Fossil

Check-in [7d79460479]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not attempt to use the Right-Column Ad-Unit if the content contains a <table> element.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ad-unit-enhancement
Files: files | file ages | folders
SHA1: 7d794604794c025a863dd4e92d12000bd5aac3be
User & Date: drh 2015-01-21 21:19:00.582
Context
2015-01-21
21:33
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. check-in: ff78d6d5ef user: drh tags: trunk
21:19
Do not attempt to use the Right-Column Ad-Unit if the content contains a &lt;table&gt; element. Closed-Leaf check-in: 7d79460479 user: drh tags: ad-unit-enhancement
18:55
Enhance the ad-unit processing to allow for tall right-side column ads as an alternative to banner ads. check-in: 4bc5b6cf9b user: drh tags: ad-unit-enhancement
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cgi.c.
106
107
108
109
110
111
112



113
114
115
116
117
118
119
/*
** Check to see if the header contains the zNeedle string.  Return true
** if it does and false if it does not.
*/
int cgi_header_contains(const char *zNeedle){
  return strstr(blob_str(&cgiContent[0]), zNeedle)!=0;
}




/*
** Append reply content to what already exists.
*/
void cgi_append_content(const char *zData, int nAmt){
  blob_append(pContent, zData, nAmt);
}







>
>
>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
** Check to see if the header contains the zNeedle string.  Return true
** if it does and false if it does not.
*/
int cgi_header_contains(const char *zNeedle){
  return strstr(blob_str(&cgiContent[0]), zNeedle)!=0;
}
int cgi_body_contains(const char *zNeedle){
  return strstr(blob_str(&cgiContent[1]), zNeedle)!=0;
}

/*
** Append reply content to what already exists.
*/
void cgi_append_content(const char *zData, int nAmt){
  blob_append(pContent, zData, nAmt);
}
Changes to src/style.c.
383
384
385
386
387
388
389

390
391
392
393
394
395
396
   && fossil_strcmp(g.zLogin,"anonymous")!=0
   && db_get_boolean("adunit-omit-if-user",0)
  ){
    return 0;
  }
  if( (adUnitFlags & ADUNIT_RIGHT_OK)!=0
   && !fossil_all_whitespace(zAd = db_get("adunit-right", 0))

  ){
    *pAdFlag = ADUNIT_RIGHT_OK;
    return zAd;
  }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
    return zAd;
  }
  return 0;







>







383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
   && fossil_strcmp(g.zLogin,"anonymous")!=0
   && db_get_boolean("adunit-omit-if-user",0)
  ){
    return 0;
  }
  if( (adUnitFlags & ADUNIT_RIGHT_OK)!=0
   && !fossil_all_whitespace(zAd = db_get("adunit-right", 0))
   && !cgi_body_contains("<table")
  ){
    *pAdFlag = ADUNIT_RIGHT_OK;
    return zAd;
  }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
    return zAd;
  }
  return 0;
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
        @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
      }
    }
    @ </div>
  }

  zAd = style_adunit_text(&mAdFlags);
  if( mAdFlags & ADUNIT_RIGHT_OK ){
    @ <div class="content adunit_right_container">
    @ <div class="adunit_right">
    cgi_append_content(zAd, -1);
    @ </div>
  }else{
    if( zAd ){
      @ <div class="adunit_banner">







|







424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
        @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
      }
    }
    @ </div>
  }

  zAd = style_adunit_text(&mAdFlags);
  if( (mAdFlags & ADUNIT_RIGHT_OK)!=0  ){
    @ <div class="content adunit_right_container">
    @ <div class="adunit_right">
    cgi_append_content(zAd, -1);
    @ </div>
  }else{
    if( zAd ){
      @ <div class="adunit_banner">