Branch: Tag:

2004-05-22

2004-05-22 19:52:24 by Stephen R. van den Berg <srb@cuci.nl>

Sync with webserver -r1.294

Rev: server/modules/graphics/graphic_text.pike:1.298

1:   // This is a ChiliMoon module. Copyright © 1996 - 2001, Roxen IS.   //    - constant cvs_version="$Id: graphic_text.pike,v 1.297 2002/11/17 17:55:44 mani Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.298 2004/05/22 19:52:24 _cvs_stephen Exp $";      #include <module.h>   inherit "module";
37:    TYPE_FLAG|VAR_MORE|VAR_NOT_CFIF,    "Append the image format (.gif, .png, .jpg, etc) to the generated "    "images. This is not necessary, but might seem nicer."); +  defvar("honor_supports", 1, "Honor supports", +  TYPE_FLAG|VAR_MORE, +  "Normally javascript tags generated by the 'magic' attribute are not " +  "sent to clients that don't support javascript image objects. " +  "This check can be disabled to always output those javascript tags.");   }      TAGDOCUMENTATION;
562:      private roxen.ImageCache image_cache;   private string compat_level; + private int honor_supports;      string status() {    array s=image_cache->status();
584:    roxen.dump( "etc/modules/GText.pmod" );    if(query("colorparse")) module_dependencies(conf, ({ "wiretap" }) );    compat_level = conf->query("compat_level"); +  honor_supports = query("honor_supports");   }      private constant nbsp = Roxen.iso88591["&nbsp;"];
1056:       if(!arg->border) arg->border="0";    +  int no_draw = !id->misc->generate_images;    if(arg->split)    {    string res="",split=arg->split;
1066:    foreach(c/split-({""}), string word)    {    string fn = image_cache->store( ({ p, word }),id ); -  mapping size = image_cache->metadata( fn, id, 1 ); +  mapping size = image_cache->metadata( fn, id, no_draw);    if(setalt) arg->alt=word;    arg->src=query_absolute_internal_location(id)+fn+ext;    if( size )
1084:    }       string num = image_cache->store( ({ p, c }), id ); -  mapping size = image_cache->metadata( num, id, 1 ); +  mapping size = image_cache->metadata( num, id, no_draw );    if(!arg->alt) arg->alt=replace(c,"\"","'");       arg->src=query_absolute_internal_location(id)+num+ext;
1114:    }       string sn = "gtext" + id->root_id->misc->gtext_mi++; -  if(!id->supports->js_image_object) { +  RXML_CONTEXT->set_root_id_misc("gtext_mi", id->root_id->misc->gtext_mi); +  +  if(honor_supports && !id->supports->js_image_object) {    return (!input)?    ("<a"+ea+"href=\""+url+"\">"+Roxen.make_tag("img",arg+(["name":sn]),xml)+"</a>"):    Roxen.make_tag("input",arg+(["type":"image"]),xml);