Fossil SCM
Enhance the Ad-Unit processing to allow a choice of two different ad-units. A tall skinny ad-unit can be placed at the right (or left) margin on some pages in place of the banner ad-unit beneath the menu bars. Ad-Units are now configurable using CSS. <b>Note:</b> Legacy ad-unit configurations might need to adjust their CSS.
Commit
ff78d6d5ef2043d6b209fd8015dbdc14492429db
Parent
2ee18159183231b…
12 files changed
+1
+2
+2
+3
+1
+1
+36
-3
+1
+3
+57
-9
+2
-1
+10
+1
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -341,10 +341,11 @@ | ||
| 341 | 341 | Stmt q; |
| 342 | 342 | double rNow; |
| 343 | 343 | login_check_credentials(); |
| 344 | 344 | if( !g.perm.Read ){ login_needed(); return; } |
| 345 | 345 | style_header("Branches"); |
| 346 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 346 | 347 | login_anonymous_available(); |
| 347 | 348 | |
| 348 | 349 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 349 | 350 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 350 | 351 | @ <div class="brlist"><table id="branchlisttable"> |
| 351 | 352 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -341,10 +341,11 @@ | |
| 341 | Stmt q; |
| 342 | double rNow; |
| 343 | login_check_credentials(); |
| 344 | if( !g.perm.Read ){ login_needed(); return; } |
| 345 | style_header("Branches"); |
| 346 | login_anonymous_available(); |
| 347 | |
| 348 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 349 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 350 | @ <div class="brlist"><table id="branchlisttable"> |
| 351 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -341,10 +341,11 @@ | |
| 341 | Stmt q; |
| 342 | double rNow; |
| 343 | login_check_credentials(); |
| 344 | if( !g.perm.Read ){ login_needed(); return; } |
| 345 | style_header("Branches"); |
| 346 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 347 | login_anonymous_available(); |
| 348 | |
| 349 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 350 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 351 | @ <div class="brlist"><table id="branchlisttable"> |
| 352 |
+2
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -133,10 +133,11 @@ | ||
| 133 | 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | 134 | login_check_credentials(); |
| 135 | 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | 137 | style_header("File List"); |
| 138 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 138 | 139 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 139 | 140 | pathelementFunc, 0, 0); |
| 140 | 141 | url_initialize(&sURI, "dir"); |
| 141 | 142 | |
| 142 | 143 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | ||
| 555 | 556 | style_header("Folder Hierarchy"); |
| 556 | 557 | }else{ |
| 557 | 558 | showDirOnly = 0; |
| 558 | 559 | style_header("File Tree"); |
| 559 | 560 | } |
| 561 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 560 | 562 | if( P("expand")!=0 ){ |
| 561 | 563 | startExpanded = 1; |
| 562 | 564 | url_add_parameter(&sURI, "expand", "1"); |
| 563 | 565 | }else{ |
| 564 | 566 | startExpanded = 0; |
| 565 | 567 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,10 +133,11 @@ | |
| 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | login_check_credentials(); |
| 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | style_header("File List"); |
| 138 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 139 | pathelementFunc, 0, 0); |
| 140 | url_initialize(&sURI, "dir"); |
| 141 | |
| 142 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | |
| 555 | style_header("Folder Hierarchy"); |
| 556 | }else{ |
| 557 | showDirOnly = 0; |
| 558 | style_header("File Tree"); |
| 559 | } |
| 560 | if( P("expand")!=0 ){ |
| 561 | startExpanded = 1; |
| 562 | url_add_parameter(&sURI, "expand", "1"); |
| 563 | }else{ |
| 564 | startExpanded = 0; |
| 565 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,10 +133,11 @@ | |
| 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | login_check_credentials(); |
| 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | style_header("File List"); |
| 138 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 139 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 140 | pathelementFunc, 0, 0); |
| 141 | url_initialize(&sURI, "dir"); |
| 142 | |
| 143 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | |
| 556 | style_header("Folder Hierarchy"); |
| 557 | }else{ |
| 558 | showDirOnly = 0; |
| 559 | style_header("File Tree"); |
| 560 | } |
| 561 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 562 | if( P("expand")!=0 ){ |
| 563 | startExpanded = 1; |
| 564 | url_add_parameter(&sURI, "expand", "1"); |
| 565 | }else{ |
| 566 | startExpanded = 0; |
| 567 |
+2
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -133,10 +133,11 @@ | ||
| 133 | 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | 134 | login_check_credentials(); |
| 135 | 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | 137 | style_header("File List"); |
| 138 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 138 | 139 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 139 | 140 | pathelementFunc, 0, 0); |
| 140 | 141 | url_initialize(&sURI, "dir"); |
| 141 | 142 | |
| 142 | 143 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | ||
| 555 | 556 | style_header("Folder Hierarchy"); |
| 556 | 557 | }else{ |
| 557 | 558 | showDirOnly = 0; |
| 558 | 559 | style_header("File Tree"); |
| 559 | 560 | } |
| 561 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 560 | 562 | if( P("expand")!=0 ){ |
| 561 | 563 | startExpanded = 1; |
| 562 | 564 | url_add_parameter(&sURI, "expand", "1"); |
| 563 | 565 | }else{ |
| 564 | 566 | startExpanded = 0; |
| 565 | 567 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,10 +133,11 @@ | |
| 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | login_check_credentials(); |
| 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | style_header("File List"); |
| 138 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 139 | pathelementFunc, 0, 0); |
| 140 | url_initialize(&sURI, "dir"); |
| 141 | |
| 142 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | |
| 555 | style_header("Folder Hierarchy"); |
| 556 | }else{ |
| 557 | showDirOnly = 0; |
| 558 | style_header("File Tree"); |
| 559 | } |
| 560 | if( P("expand")!=0 ){ |
| 561 | startExpanded = 1; |
| 562 | url_add_parameter(&sURI, "expand", "1"); |
| 563 | }else{ |
| 564 | startExpanded = 0; |
| 565 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,10 +133,11 @@ | |
| 133 | if( strcmp(PD("type",""),"tree")==0 ){ page_tree(); return; } |
| 134 | login_check_credentials(); |
| 135 | if( !g.perm.Read ){ login_needed(); return; } |
| 136 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 137 | style_header("File List"); |
| 138 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 139 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 140 | pathelementFunc, 0, 0); |
| 141 | url_initialize(&sURI, "dir"); |
| 142 | |
| 143 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| @@ -555,10 +556,11 @@ | |
| 556 | style_header("Folder Hierarchy"); |
| 557 | }else{ |
| 558 | showDirOnly = 0; |
| 559 | style_header("File Tree"); |
| 560 | } |
| 561 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 562 | if( P("expand")!=0 ){ |
| 563 | startExpanded = 1; |
| 564 | url_add_parameter(&sURI, "expand", "1"); |
| 565 | }else{ |
| 566 | startExpanded = 0; |
| 567 |
+3
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -108,10 +108,13 @@ | ||
| 108 | 108 | ** if it does and false if it does not. |
| 109 | 109 | */ |
| 110 | 110 | int cgi_header_contains(const char *zNeedle){ |
| 111 | 111 | return strstr(blob_str(&cgiContent[0]), zNeedle)!=0; |
| 112 | 112 | } |
| 113 | +int cgi_body_contains(const char *zNeedle){ | |
| 114 | + return strstr(blob_str(&cgiContent[1]), zNeedle)!=0; | |
| 115 | +} | |
| 113 | 116 | |
| 114 | 117 | /* |
| 115 | 118 | ** Append reply content to what already exists. |
| 116 | 119 | */ |
| 117 | 120 | void cgi_append_content(const char *zData, int nAmt){ |
| 118 | 121 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -108,10 +108,13 @@ | |
| 108 | ** if it does and false if it does not. |
| 109 | */ |
| 110 | int cgi_header_contains(const char *zNeedle){ |
| 111 | return strstr(blob_str(&cgiContent[0]), zNeedle)!=0; |
| 112 | } |
| 113 | |
| 114 | /* |
| 115 | ** Append reply content to what already exists. |
| 116 | */ |
| 117 | void cgi_append_content(const char *zData, int nAmt){ |
| 118 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -108,10 +108,13 @@ | |
| 108 | ** if it does and false if it does not. |
| 109 | */ |
| 110 | int cgi_header_contains(const char *zNeedle){ |
| 111 | return strstr(blob_str(&cgiContent[0]), zNeedle)!=0; |
| 112 | } |
| 113 | int cgi_body_contains(const char *zNeedle){ |
| 114 | return strstr(blob_str(&cgiContent[1]), zNeedle)!=0; |
| 115 | } |
| 116 | |
| 117 | /* |
| 118 | ** Append reply content to what already exists. |
| 119 | */ |
| 120 | void cgi_append_content(const char *zData, int nAmt){ |
| 121 |
+1
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -500,10 +500,11 @@ | ||
| 500 | 500 | " FROM blob WHERE rid=%d", vid)); |
| 501 | 501 | Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" |
| 502 | 502 | " WHERE objid=%d AND type='ci'", vid)); |
| 503 | 503 | if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ |
| 504 | 504 | Blob title, tail; |
| 505 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 505 | 506 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 506 | 507 | style_header("%s", blob_str(&title)); |
| 507 | 508 | wiki_convert(&tail, 0, WIKI_BUTTONS); |
| 508 | 509 | }else{ |
| 509 | 510 | style_header("Documentation"); |
| 510 | 511 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -500,10 +500,11 @@ | |
| 500 | " FROM blob WHERE rid=%d", vid)); |
| 501 | Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" |
| 502 | " WHERE objid=%d AND type='ci'", vid)); |
| 503 | if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ |
| 504 | Blob title, tail; |
| 505 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 506 | style_header("%s", blob_str(&title)); |
| 507 | wiki_convert(&tail, 0, WIKI_BUTTONS); |
| 508 | }else{ |
| 509 | style_header("Documentation"); |
| 510 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -500,10 +500,11 @@ | |
| 500 | " FROM blob WHERE rid=%d", vid)); |
| 501 | Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" |
| 502 | " WHERE objid=%d AND type='ci'", vid)); |
| 503 | if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ |
| 504 | Blob title, tail; |
| 505 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 506 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 507 | style_header("%s", blob_str(&title)); |
| 508 | wiki_convert(&tail, 0, WIKI_BUTTONS); |
| 509 | }else{ |
| 510 | style_header("Documentation"); |
| 511 |
+1
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -575,10 +575,11 @@ | ||
| 575 | 575 | login_set_user_cookie(zUsername, uid, NULL); |
| 576 | 576 | redirect_to_g(); |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | style_header("Login/Logout"); |
| 580 | + style_adunit_config(ADUNIT_OFF); | |
| 580 | 581 | @ %s(zErrMsg) |
| 581 | 582 | if( zGoto && P("anon")==0 ){ |
| 582 | 583 | @ <p>A login is required for <a href="%h(zGoto)">%h(zGoto)</a>.</p> |
| 583 | 584 | } |
| 584 | 585 | form_begin(0, "%R/login"); |
| 585 | 586 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -575,10 +575,11 @@ | |
| 575 | login_set_user_cookie(zUsername, uid, NULL); |
| 576 | redirect_to_g(); |
| 577 | } |
| 578 | } |
| 579 | style_header("Login/Logout"); |
| 580 | @ %s(zErrMsg) |
| 581 | if( zGoto && P("anon")==0 ){ |
| 582 | @ <p>A login is required for <a href="%h(zGoto)">%h(zGoto)</a>.</p> |
| 583 | } |
| 584 | form_begin(0, "%R/login"); |
| 585 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -575,10 +575,11 @@ | |
| 575 | login_set_user_cookie(zUsername, uid, NULL); |
| 576 | redirect_to_g(); |
| 577 | } |
| 578 | } |
| 579 | style_header("Login/Logout"); |
| 580 | style_adunit_config(ADUNIT_OFF); |
| 581 | @ %s(zErrMsg) |
| 582 | if( zGoto && P("anon")==0 ){ |
| 583 | @ <p>A login is required for <a href="%h(zGoto)">%h(zGoto)</a>.</p> |
| 584 | } |
| 585 | form_begin(0, "%R/login"); |
| 586 |
+36
-3
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1715,13 +1715,15 @@ | ||
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | style_header("Edit Ad Unit"); |
| 1718 | 1718 | @ <form action="%s(g.zTop)/setup_adunit" method="post"><div> |
| 1719 | 1719 | login_insert_csrf_secret(); |
| 1720 | - @ <p>Edit HTML text for an ad unit that will be inserted after the | |
| 1721 | - @ menu bar and above the content of every page.</p> | |
| 1722 | - textarea_attribute("", 20, 80, "adunit", "adunit", "", 0); | |
| 1720 | + @ <b>Banner Ad-Unit:</b><br /> | |
| 1721 | + textarea_attribute("", 6, 80, "adunit", "adunit", "", 0); | |
| 1722 | + @ <br /> | |
| 1723 | + @ <b>Right-Column Ad-Unit:</b><br /> | |
| 1724 | + textarea_attribute("", 6, 80, "adunit-right", "adright", "", 0); | |
| 1723 | 1725 | @ <br /> |
| 1724 | 1726 | onoff_attribute("Omit ads to administrator", |
| 1725 | 1727 | "adunit-omit-if-admin", "oia", 0, 0); |
| 1726 | 1728 | @ <br /> |
| 1727 | 1729 | onoff_attribute("Omit ads to logged-in users", |
| @@ -1728,10 +1730,41 @@ | ||
| 1728 | 1730 | "adunit-omit-if-user", "oiu", 0, 0); |
| 1729 | 1731 | @ <br /> |
| 1730 | 1732 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 1731 | 1733 | @ <input type="submit" name="clear" value="Delete Ad-Unit" /> |
| 1732 | 1734 | @ </div></form> |
| 1735 | + @ <hr /> | |
| 1736 | + @ <b>Ad-Unit Notes:</b><ul> | |
| 1737 | + @ <li>Leave both Ad-Units blank to disable all advertising. | |
| 1738 | + @ <li>The "Banner Ad-Unit" is used for wide pages. | |
| 1739 | + @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content. | |
| 1740 | + @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages. | |
| 1741 | + @ <li>Suggested <a href="setup_editcss">CSS</a> changes: | |
| 1742 | + @ <blockquote><pre> | |
| 1743 | + @ div.adunit_banner { | |
| 1744 | + @ margin: auto; | |
| 1745 | + @ width: 100%; | |
| 1746 | + @ } | |
| 1747 | + @ div.adunit_right { | |
| 1748 | + @ float: right; | |
| 1749 | + @ } | |
| 1750 | + @ div.adunit_right_container { | |
| 1751 | + @ min-height: <i>height-of-right-column-ad-unit</i>; | |
| 1752 | + @ } | |
| 1753 | + @ </pre></blockquote> | |
| 1754 | + @ <li>For a place-holder Ad-Unit for testing, Copy/Paste the following | |
| 1755 | + @ with appropriate adjustments to "width:" and "height:". | |
| 1756 | + @ <blockquote><pre> | |
| 1757 | + @ <div style=' | |
| 1758 | + @ margin: 0 auto; | |
| 1759 | + @ width: 600px; | |
| 1760 | + @ height: 90px; | |
| 1761 | + @ border: 1px solid #f11; | |
| 1762 | + @ background-color: #fcc; | |
| 1763 | + @ '>Demo Ad</div> | |
| 1764 | + @ </pre></blockquote> | |
| 1765 | + @ </li> | |
| 1733 | 1766 | style_footer(); |
| 1734 | 1767 | db_end_transaction(0); |
| 1735 | 1768 | } |
| 1736 | 1769 | |
| 1737 | 1770 | /* |
| 1738 | 1771 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1715,13 +1715,15 @@ | |
| 1715 | } |
| 1716 | |
| 1717 | style_header("Edit Ad Unit"); |
| 1718 | @ <form action="%s(g.zTop)/setup_adunit" method="post"><div> |
| 1719 | login_insert_csrf_secret(); |
| 1720 | @ <p>Edit HTML text for an ad unit that will be inserted after the |
| 1721 | @ menu bar and above the content of every page.</p> |
| 1722 | textarea_attribute("", 20, 80, "adunit", "adunit", "", 0); |
| 1723 | @ <br /> |
| 1724 | onoff_attribute("Omit ads to administrator", |
| 1725 | "adunit-omit-if-admin", "oia", 0, 0); |
| 1726 | @ <br /> |
| 1727 | onoff_attribute("Omit ads to logged-in users", |
| @@ -1728,10 +1730,41 @@ | |
| 1728 | "adunit-omit-if-user", "oiu", 0, 0); |
| 1729 | @ <br /> |
| 1730 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 1731 | @ <input type="submit" name="clear" value="Delete Ad-Unit" /> |
| 1732 | @ </div></form> |
| 1733 | style_footer(); |
| 1734 | db_end_transaction(0); |
| 1735 | } |
| 1736 | |
| 1737 | /* |
| 1738 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1715,13 +1715,15 @@ | |
| 1715 | } |
| 1716 | |
| 1717 | style_header("Edit Ad Unit"); |
| 1718 | @ <form action="%s(g.zTop)/setup_adunit" method="post"><div> |
| 1719 | login_insert_csrf_secret(); |
| 1720 | @ <b>Banner Ad-Unit:</b><br /> |
| 1721 | textarea_attribute("", 6, 80, "adunit", "adunit", "", 0); |
| 1722 | @ <br /> |
| 1723 | @ <b>Right-Column Ad-Unit:</b><br /> |
| 1724 | textarea_attribute("", 6, 80, "adunit-right", "adright", "", 0); |
| 1725 | @ <br /> |
| 1726 | onoff_attribute("Omit ads to administrator", |
| 1727 | "adunit-omit-if-admin", "oia", 0, 0); |
| 1728 | @ <br /> |
| 1729 | onoff_attribute("Omit ads to logged-in users", |
| @@ -1728,10 +1730,41 @@ | |
| 1730 | "adunit-omit-if-user", "oiu", 0, 0); |
| 1731 | @ <br /> |
| 1732 | @ <input type="submit" name="submit" value="Apply Changes" /> |
| 1733 | @ <input type="submit" name="clear" value="Delete Ad-Unit" /> |
| 1734 | @ </div></form> |
| 1735 | @ <hr /> |
| 1736 | @ <b>Ad-Unit Notes:</b><ul> |
| 1737 | @ <li>Leave both Ad-Units blank to disable all advertising. |
| 1738 | @ <li>The "Banner Ad-Unit" is used for wide pages. |
| 1739 | @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content. |
| 1740 | @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages. |
| 1741 | @ <li>Suggested <a href="setup_editcss">CSS</a> changes: |
| 1742 | @ <blockquote><pre> |
| 1743 | @ div.adunit_banner { |
| 1744 | @ margin: auto; |
| 1745 | @ width: 100%; |
| 1746 | @ } |
| 1747 | @ div.adunit_right { |
| 1748 | @ float: right; |
| 1749 | @ } |
| 1750 | @ div.adunit_right_container { |
| 1751 | @ min-height: <i>height-of-right-column-ad-unit</i>; |
| 1752 | @ } |
| 1753 | @ </pre></blockquote> |
| 1754 | @ <li>For a place-holder Ad-Unit for testing, Copy/Paste the following |
| 1755 | @ with appropriate adjustments to "width:" and "height:". |
| 1756 | @ <blockquote><pre> |
| 1757 | @ <div style=' |
| 1758 | @ margin: 0 auto; |
| 1759 | @ width: 600px; |
| 1760 | @ height: 90px; |
| 1761 | @ border: 1px solid #f11; |
| 1762 | @ background-color: #fcc; |
| 1763 | @ '>Demo Ad</div> |
| 1764 | @ </pre></blockquote> |
| 1765 | @ </li> |
| 1766 | style_footer(); |
| 1767 | db_end_transaction(0); |
| 1768 | } |
| 1769 | |
| 1770 | /* |
| 1771 |
+1
| --- src/sitemap.c | ||
| +++ src/sitemap.c | ||
| @@ -27,10 +27,11 @@ | ||
| 27 | 27 | ** Show an incomplete list of web pages offered by the Fossil web engine. |
| 28 | 28 | */ |
| 29 | 29 | void sitemap_page(void){ |
| 30 | 30 | login_check_credentials(); |
| 31 | 31 | style_header("Site Map"); |
| 32 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 32 | 33 | @ <p> |
| 33 | 34 | @ The following links are just a few of the many web-pages available for |
| 34 | 35 | @ this Fossil repository: |
| 35 | 36 | @ </p> |
| 36 | 37 | @ |
| 37 | 38 |
| --- src/sitemap.c | |
| +++ src/sitemap.c | |
| @@ -27,10 +27,11 @@ | |
| 27 | ** Show an incomplete list of web pages offered by the Fossil web engine. |
| 28 | */ |
| 29 | void sitemap_page(void){ |
| 30 | login_check_credentials(); |
| 31 | style_header("Site Map"); |
| 32 | @ <p> |
| 33 | @ The following links are just a few of the many web-pages available for |
| 34 | @ this Fossil repository: |
| 35 | @ </p> |
| 36 | @ |
| 37 |
| --- src/sitemap.c | |
| +++ src/sitemap.c | |
| @@ -27,10 +27,11 @@ | |
| 27 | ** Show an incomplete list of web pages offered by the Fossil web engine. |
| 28 | */ |
| 29 | void sitemap_page(void){ |
| 30 | login_check_credentials(); |
| 31 | style_header("Site Map"); |
| 32 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 33 | @ <p> |
| 34 | @ The following links are just a few of the many web-pages available for |
| 35 | @ this Fossil repository: |
| 36 | @ </p> |
| 37 | @ |
| 38 |
+3
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -55,10 +55,11 @@ | ||
| 55 | 55 | |
| 56 | 56 | login_check_credentials(); |
| 57 | 57 | if( !g.perm.Read ){ login_needed(); return; } |
| 58 | 58 | brief = P("brief")!=0; |
| 59 | 59 | style_header("Repository Statistics"); |
| 60 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 60 | 61 | if( g.perm.Admin ){ |
| 61 | 62 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 62 | 63 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 63 | 64 | style_submenu_element("Web-Cache", "Web-Cache Stats", "cachestat"); |
| 64 | 65 | } |
| @@ -290,10 +291,11 @@ | ||
| 290 | 291 | int cnt; |
| 291 | 292 | login_check_credentials(); |
| 292 | 293 | if( !g.perm.Admin ){ login_needed(); return; } |
| 293 | 294 | |
| 294 | 295 | style_header("URLs and Checkouts"); |
| 296 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 295 | 297 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 296 | 298 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 297 | 299 | @ <div class="section">URLs</div> |
| 298 | 300 | @ <table border="0" width='100%%'> |
| 299 | 301 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| @@ -336,10 +338,11 @@ | ||
| 336 | 338 | Stmt q; |
| 337 | 339 | login_check_credentials(); |
| 338 | 340 | if( !g.perm.Admin ){ login_needed(); return; } |
| 339 | 341 | |
| 340 | 342 | style_header("Repository Schema"); |
| 343 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 341 | 344 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 342 | 345 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 343 | 346 | db_prepare(&q, "SELECT sql FROM %s.sqlite_master WHERE sql IS NOT NULL", |
| 344 | 347 | db_name("repository")); |
| 345 | 348 | @ <pre> |
| 346 | 349 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -55,10 +55,11 @@ | |
| 55 | |
| 56 | login_check_credentials(); |
| 57 | if( !g.perm.Read ){ login_needed(); return; } |
| 58 | brief = P("brief")!=0; |
| 59 | style_header("Repository Statistics"); |
| 60 | if( g.perm.Admin ){ |
| 61 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 62 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 63 | style_submenu_element("Web-Cache", "Web-Cache Stats", "cachestat"); |
| 64 | } |
| @@ -290,10 +291,11 @@ | |
| 290 | int cnt; |
| 291 | login_check_credentials(); |
| 292 | if( !g.perm.Admin ){ login_needed(); return; } |
| 293 | |
| 294 | style_header("URLs and Checkouts"); |
| 295 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 296 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 297 | @ <div class="section">URLs</div> |
| 298 | @ <table border="0" width='100%%'> |
| 299 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| @@ -336,10 +338,11 @@ | |
| 336 | Stmt q; |
| 337 | login_check_credentials(); |
| 338 | if( !g.perm.Admin ){ login_needed(); return; } |
| 339 | |
| 340 | style_header("Repository Schema"); |
| 341 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 342 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 343 | db_prepare(&q, "SELECT sql FROM %s.sqlite_master WHERE sql IS NOT NULL", |
| 344 | db_name("repository")); |
| 345 | @ <pre> |
| 346 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -55,10 +55,11 @@ | |
| 55 | |
| 56 | login_check_credentials(); |
| 57 | if( !g.perm.Read ){ login_needed(); return; } |
| 58 | brief = P("brief")!=0; |
| 59 | style_header("Repository Statistics"); |
| 60 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 61 | if( g.perm.Admin ){ |
| 62 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 63 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 64 | style_submenu_element("Web-Cache", "Web-Cache Stats", "cachestat"); |
| 65 | } |
| @@ -290,10 +291,11 @@ | |
| 291 | int cnt; |
| 292 | login_check_credentials(); |
| 293 | if( !g.perm.Admin ){ login_needed(); return; } |
| 294 | |
| 295 | style_header("URLs and Checkouts"); |
| 296 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 297 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 298 | style_submenu_element("Schema", "Repository Schema", "repo_schema"); |
| 299 | @ <div class="section">URLs</div> |
| 300 | @ <table border="0" width='100%%'> |
| 301 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| @@ -336,10 +338,11 @@ | |
| 338 | Stmt q; |
| 339 | login_check_credentials(); |
| 340 | if( !g.perm.Admin ){ login_needed(); return; } |
| 341 | |
| 342 | style_header("Repository Schema"); |
| 343 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 344 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 345 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 346 | db_prepare(&q, "SELECT sql FROM %s.sqlite_master WHERE sql IS NOT NULL", |
| 347 | db_name("repository")); |
| 348 | @ <pre> |
| 349 |
+57
-9
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -46,10 +46,15 @@ | ||
| 46 | 46 | /* |
| 47 | 47 | ** remember, if a sidebox was used |
| 48 | 48 | */ |
| 49 | 49 | static int sideboxUsed = 0; |
| 50 | 50 | |
| 51 | +/* | |
| 52 | +** Ad-unit styles. | |
| 53 | +*/ | |
| 54 | +static unsigned adUnitFlags = 0; | |
| 55 | + | |
| 51 | 56 | |
| 52 | 57 | /* |
| 53 | 58 | ** List of hyperlinks and forms that need to be resolved by javascript in |
| 54 | 59 | ** the footer. |
| 55 | 60 | */ |
| @@ -343,34 +348,64 @@ | ||
| 343 | 348 | @ var e = document.getElementById(x); |
| 344 | 349 | @ if(!e) throw new Error("Expecting element with ID "+x); |
| 345 | 350 | @ else return e;} |
| 346 | 351 | @ </script> |
| 347 | 352 | } |
| 353 | + | |
| 354 | +#if INTERFACE | |
| 355 | +/* Allowed parameters for style_adunit() */ | |
| 356 | +#define ADUNIT_OFF 0x0001 /* Do not allow ads on this page */ | |
| 357 | +#define ADUNIT_RIGHT_OK 0x0002 /* Right-side vertical ads ok here */ | |
| 358 | +#endif | |
| 359 | + | |
| 360 | +/* | |
| 361 | +** Various page implementations can invoke this interface to let the | |
| 362 | +** style manager know what kinds of ads are appropriate for this page. | |
| 363 | +*/ | |
| 364 | +void style_adunit_config(unsigned int mFlags){ | |
| 365 | + adUnitFlags = mFlags; | |
| 366 | +} | |
| 348 | 367 | |
| 349 | 368 | /* |
| 350 | -** Append ad unit text if appropriate. | |
| 369 | +** Return the text of an ad-unit, if one should be rendered. Return | |
| 370 | +** NULL if no ad-unit is desired. | |
| 371 | +** | |
| 372 | +** The *pAdFlag value might be set to ADUNIT_RIGHT_OK if this is | |
| 373 | +** a right-hand vertical ad. | |
| 351 | 374 | */ |
| 352 | -static void style_ad_unit(void){ | |
| 353 | - const char *zAd; | |
| 375 | +static const char *style_adunit_text(unsigned int *pAdFlag){ | |
| 376 | + const char *zAd = 0; | |
| 377 | + *pAdFlag = 0; | |
| 378 | + if( adUnitFlags & ADUNIT_OFF ) return 0; /* Disallow ads on this page */ | |
| 354 | 379 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 355 | - return; | |
| 380 | + return 0; | |
| 356 | 381 | } |
| 357 | 382 | if( !login_is_nobody() |
| 358 | 383 | && fossil_strcmp(g.zLogin,"anonymous")!=0 |
| 359 | 384 | && db_get_boolean("adunit-omit-if-user",0) |
| 360 | 385 | ){ |
| 361 | - return; | |
| 386 | + return 0; | |
| 387 | + } | |
| 388 | + if( (adUnitFlags & ADUNIT_RIGHT_OK)!=0 | |
| 389 | + && !fossil_all_whitespace(zAd = db_get("adunit-right", 0)) | |
| 390 | + && !cgi_body_contains("<table") | |
| 391 | + ){ | |
| 392 | + *pAdFlag = ADUNIT_RIGHT_OK; | |
| 393 | + return zAd; | |
| 394 | + }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){ | |
| 395 | + return zAd; | |
| 362 | 396 | } |
| 363 | - zAd = db_get("adunit", 0); | |
| 364 | - if( zAd ) cgi_append_content(zAd, -1); | |
| 397 | + return 0; | |
| 365 | 398 | } |
| 366 | 399 | |
| 367 | 400 | /* |
| 368 | 401 | ** Draw the footer at the bottom of the page. |
| 369 | 402 | */ |
| 370 | 403 | void style_footer(void){ |
| 371 | 404 | const char *zFooter; |
| 405 | + const char *zAd = 0; | |
| 406 | + unsigned int mAdFlags = 0; | |
| 372 | 407 | |
| 373 | 408 | if( !headerHasBeenGenerated ) return; |
| 374 | 409 | |
| 375 | 410 | /* Go back and put the submenu at the top of the page. We delay the |
| 376 | 411 | ** creation of the submenu until the end so that we can add elements |
| @@ -389,12 +424,25 @@ | ||
| 389 | 424 | @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a> |
| 390 | 425 | } |
| 391 | 426 | } |
| 392 | 427 | @ </div> |
| 393 | 428 | } |
| 394 | - style_ad_unit(); | |
| 395 | - @ <div class="content"> | |
| 429 | + | |
| 430 | + zAd = style_adunit_text(&mAdFlags); | |
| 431 | + if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){ | |
| 432 | + @ <div class="content adunit_right_container"> | |
| 433 | + @ <div class="adunit_right"> | |
| 434 | + cgi_append_content(zAd, -1); | |
| 435 | + @ </div> | |
| 436 | + }else{ | |
| 437 | + if( zAd ){ | |
| 438 | + @ <div class="adunit_banner"> | |
| 439 | + cgi_append_content(zAd, -1); | |
| 440 | + @ </div> | |
| 441 | + } | |
| 442 | + @ <div class="content"> | |
| 443 | + } | |
| 396 | 444 | cgi_destination(CGI_BODY); |
| 397 | 445 | |
| 398 | 446 | if( sideboxUsed ){ |
| 399 | 447 | /* Put the footer at the bottom of the page. |
| 400 | 448 | ** the additional clear/both is needed to extend the content |
| 401 | 449 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -46,10 +46,15 @@ | |
| 46 | /* |
| 47 | ** remember, if a sidebox was used |
| 48 | */ |
| 49 | static int sideboxUsed = 0; |
| 50 | |
| 51 | |
| 52 | /* |
| 53 | ** List of hyperlinks and forms that need to be resolved by javascript in |
| 54 | ** the footer. |
| 55 | */ |
| @@ -343,34 +348,64 @@ | |
| 343 | @ var e = document.getElementById(x); |
| 344 | @ if(!e) throw new Error("Expecting element with ID "+x); |
| 345 | @ else return e;} |
| 346 | @ </script> |
| 347 | } |
| 348 | |
| 349 | /* |
| 350 | ** Append ad unit text if appropriate. |
| 351 | */ |
| 352 | static void style_ad_unit(void){ |
| 353 | const char *zAd; |
| 354 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 355 | return; |
| 356 | } |
| 357 | if( !login_is_nobody() |
| 358 | && fossil_strcmp(g.zLogin,"anonymous")!=0 |
| 359 | && db_get_boolean("adunit-omit-if-user",0) |
| 360 | ){ |
| 361 | return; |
| 362 | } |
| 363 | zAd = db_get("adunit", 0); |
| 364 | if( zAd ) cgi_append_content(zAd, -1); |
| 365 | } |
| 366 | |
| 367 | /* |
| 368 | ** Draw the footer at the bottom of the page. |
| 369 | */ |
| 370 | void style_footer(void){ |
| 371 | const char *zFooter; |
| 372 | |
| 373 | if( !headerHasBeenGenerated ) return; |
| 374 | |
| 375 | /* Go back and put the submenu at the top of the page. We delay the |
| 376 | ** creation of the submenu until the end so that we can add elements |
| @@ -389,12 +424,25 @@ | |
| 389 | @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a> |
| 390 | } |
| 391 | } |
| 392 | @ </div> |
| 393 | } |
| 394 | style_ad_unit(); |
| 395 | @ <div class="content"> |
| 396 | cgi_destination(CGI_BODY); |
| 397 | |
| 398 | if( sideboxUsed ){ |
| 399 | /* Put the footer at the bottom of the page. |
| 400 | ** the additional clear/both is needed to extend the content |
| 401 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -46,10 +46,15 @@ | |
| 46 | /* |
| 47 | ** remember, if a sidebox was used |
| 48 | */ |
| 49 | static int sideboxUsed = 0; |
| 50 | |
| 51 | /* |
| 52 | ** Ad-unit styles. |
| 53 | */ |
| 54 | static unsigned adUnitFlags = 0; |
| 55 | |
| 56 | |
| 57 | /* |
| 58 | ** List of hyperlinks and forms that need to be resolved by javascript in |
| 59 | ** the footer. |
| 60 | */ |
| @@ -343,34 +348,64 @@ | |
| 348 | @ var e = document.getElementById(x); |
| 349 | @ if(!e) throw new Error("Expecting element with ID "+x); |
| 350 | @ else return e;} |
| 351 | @ </script> |
| 352 | } |
| 353 | |
| 354 | #if INTERFACE |
| 355 | /* Allowed parameters for style_adunit() */ |
| 356 | #define ADUNIT_OFF 0x0001 /* Do not allow ads on this page */ |
| 357 | #define ADUNIT_RIGHT_OK 0x0002 /* Right-side vertical ads ok here */ |
| 358 | #endif |
| 359 | |
| 360 | /* |
| 361 | ** Various page implementations can invoke this interface to let the |
| 362 | ** style manager know what kinds of ads are appropriate for this page. |
| 363 | */ |
| 364 | void style_adunit_config(unsigned int mFlags){ |
| 365 | adUnitFlags = mFlags; |
| 366 | } |
| 367 | |
| 368 | /* |
| 369 | ** Return the text of an ad-unit, if one should be rendered. Return |
| 370 | ** NULL if no ad-unit is desired. |
| 371 | ** |
| 372 | ** The *pAdFlag value might be set to ADUNIT_RIGHT_OK if this is |
| 373 | ** a right-hand vertical ad. |
| 374 | */ |
| 375 | static const char *style_adunit_text(unsigned int *pAdFlag){ |
| 376 | const char *zAd = 0; |
| 377 | *pAdFlag = 0; |
| 378 | if( adUnitFlags & ADUNIT_OFF ) return 0; /* Disallow ads on this page */ |
| 379 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 380 | return 0; |
| 381 | } |
| 382 | if( !login_is_nobody() |
| 383 | && fossil_strcmp(g.zLogin,"anonymous")!=0 |
| 384 | && db_get_boolean("adunit-omit-if-user",0) |
| 385 | ){ |
| 386 | return 0; |
| 387 | } |
| 388 | if( (adUnitFlags & ADUNIT_RIGHT_OK)!=0 |
| 389 | && !fossil_all_whitespace(zAd = db_get("adunit-right", 0)) |
| 390 | && !cgi_body_contains("<table") |
| 391 | ){ |
| 392 | *pAdFlag = ADUNIT_RIGHT_OK; |
| 393 | return zAd; |
| 394 | }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){ |
| 395 | return zAd; |
| 396 | } |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | /* |
| 401 | ** Draw the footer at the bottom of the page. |
| 402 | */ |
| 403 | void style_footer(void){ |
| 404 | const char *zFooter; |
| 405 | const char *zAd = 0; |
| 406 | unsigned int mAdFlags = 0; |
| 407 | |
| 408 | if( !headerHasBeenGenerated ) return; |
| 409 | |
| 410 | /* Go back and put the submenu at the top of the page. We delay the |
| 411 | ** creation of the submenu until the end so that we can add elements |
| @@ -389,12 +424,25 @@ | |
| 424 | @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a> |
| 425 | } |
| 426 | } |
| 427 | @ </div> |
| 428 | } |
| 429 | |
| 430 | zAd = style_adunit_text(&mAdFlags); |
| 431 | if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){ |
| 432 | @ <div class="content adunit_right_container"> |
| 433 | @ <div class="adunit_right"> |
| 434 | cgi_append_content(zAd, -1); |
| 435 | @ </div> |
| 436 | }else{ |
| 437 | if( zAd ){ |
| 438 | @ <div class="adunit_banner"> |
| 439 | cgi_append_content(zAd, -1); |
| 440 | @ </div> |
| 441 | } |
| 442 | @ <div class="content"> |
| 443 | } |
| 444 | cgi_destination(CGI_BODY); |
| 445 | |
| 446 | if( sideboxUsed ){ |
| 447 | /* Put the footer at the bottom of the page. |
| 448 | ** the additional clear/both is needed to extend the content |
| 449 |
+2
-1
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -535,11 +535,11 @@ | ||
| 535 | 535 | tag_cmd_usage: |
| 536 | 536 | usage("add|cancel|find|list ..."); |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | /* |
| 540 | -** WEBPAGE: /taglist | |
| 540 | +** WEBPAGE: taglist | |
| 541 | 541 | */ |
| 542 | 542 | void taglist_page(void){ |
| 543 | 543 | Stmt q; |
| 544 | 544 | |
| 545 | 545 | login_check_credentials(); |
| @@ -546,10 +546,11 @@ | ||
| 546 | 546 | if( !g.perm.Read ){ |
| 547 | 547 | login_needed(); |
| 548 | 548 | } |
| 549 | 549 | login_anonymous_available(); |
| 550 | 550 | style_header("Tags"); |
| 551 | + style_adunit_config(ADUNIT_RIGHT_OK); | |
| 551 | 552 | style_submenu_element("Timeline", "Timeline", "tagtimeline"); |
| 552 | 553 | @ <h2>Non-propagating tags:</h2> |
| 553 | 554 | db_prepare(&q, |
| 554 | 555 | "SELECT substr(tagname,5)" |
| 555 | 556 | " FROM tag" |
| 556 | 557 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -535,11 +535,11 @@ | |
| 535 | tag_cmd_usage: |
| 536 | usage("add|cancel|find|list ..."); |
| 537 | } |
| 538 | |
| 539 | /* |
| 540 | ** WEBPAGE: /taglist |
| 541 | */ |
| 542 | void taglist_page(void){ |
| 543 | Stmt q; |
| 544 | |
| 545 | login_check_credentials(); |
| @@ -546,10 +546,11 @@ | |
| 546 | if( !g.perm.Read ){ |
| 547 | login_needed(); |
| 548 | } |
| 549 | login_anonymous_available(); |
| 550 | style_header("Tags"); |
| 551 | style_submenu_element("Timeline", "Timeline", "tagtimeline"); |
| 552 | @ <h2>Non-propagating tags:</h2> |
| 553 | db_prepare(&q, |
| 554 | "SELECT substr(tagname,5)" |
| 555 | " FROM tag" |
| 556 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -535,11 +535,11 @@ | |
| 535 | tag_cmd_usage: |
| 536 | usage("add|cancel|find|list ..."); |
| 537 | } |
| 538 | |
| 539 | /* |
| 540 | ** WEBPAGE: taglist |
| 541 | */ |
| 542 | void taglist_page(void){ |
| 543 | Stmt q; |
| 544 | |
| 545 | login_check_credentials(); |
| @@ -546,10 +546,11 @@ | |
| 546 | if( !g.perm.Read ){ |
| 547 | login_needed(); |
| 548 | } |
| 549 | login_anonymous_available(); |
| 550 | style_header("Tags"); |
| 551 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 552 | style_submenu_element("Timeline", "Timeline", "tagtimeline"); |
| 553 | @ <h2>Non-propagating tags:</h2> |
| 554 | db_prepare(&q, |
| 555 | "SELECT substr(tagname,5)" |
| 556 | " FROM tag" |
| 557 |
+10
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -331,5 +331,15 @@ | ||
| 331 | 331 | int fossil_is_uuid(const char *zSym){ |
| 332 | 332 | return zSym |
| 333 | 333 | && (UUID_SIZE==strlen(zSym)) |
| 334 | 334 | && validate16(zSym, UUID_SIZE); |
| 335 | 335 | } |
| 336 | + | |
| 337 | +/* | |
| 338 | +** Return true if the input string is NULL or all whitespace. | |
| 339 | +** Return false if the input string contains text. | |
| 340 | +*/ | |
| 341 | +int fossil_all_whitespace(const char *z){ | |
| 342 | + if( z==0 ) return 1; | |
| 343 | + while( fossil_isspace(z[0]) ){ z++; } | |
| 344 | + return z[0]==0; | |
| 345 | +} | |
| 336 | 346 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -331,5 +331,15 @@ | |
| 331 | int fossil_is_uuid(const char *zSym){ |
| 332 | return zSym |
| 333 | && (UUID_SIZE==strlen(zSym)) |
| 334 | && validate16(zSym, UUID_SIZE); |
| 335 | } |
| 336 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -331,5 +331,15 @@ | |
| 331 | int fossil_is_uuid(const char *zSym){ |
| 332 | return zSym |
| 333 | && (UUID_SIZE==strlen(zSym)) |
| 334 | && validate16(zSym, UUID_SIZE); |
| 335 | } |
| 336 | |
| 337 | /* |
| 338 | ** Return true if the input string is NULL or all whitespace. |
| 339 | ** Return false if the input string contains text. |
| 340 | */ |
| 341 | int fossil_all_whitespace(const char *z){ |
| 342 | if( z==0 ) return 1; |
| 343 | while( fossil_isspace(z[0]) ){ z++; } |
| 344 | return z[0]==0; |
| 345 | } |
| 346 |