Roxen.git / server / modules / graphics / gbutton.pike

version» Context lines:

Roxen.git/server/modules/graphics/gbutton.pike:20:   // icon-data -- inline icon data   // align -- left|center|right text alignment   // align-icon -- left|center-before|center-after|right icon alignment   // valign-icon -- above|middle|below icon vertical alignment   // >Button text</gbutton>   //   // Alignment restriction: when text alignment is either left or right, icons   // must also be aligned left or right.       - constant cvs_version = "$Id: gbutton.pike,v 1.124 2010/04/27 13:36:56 grubba Exp $"; + constant cvs_version = "$Id$";   constant thread_safe = 1;      #include <module.h>   inherit "module";      roxen.ImageCache button_cache;   int do_ext;      constant module_type = MODULE_TAG;   constant module_name = "Graphics: GButton";
Roxen.git/server/modules/graphics/gbutton.pike:217: Inside #if defined(manual)
     <attr name='minutes' value='number'><p>   Add this number of minutes to the time this entry is valid.</p>   </attr>      <attr name='seconds' value='number'><p>   Add this number of seconds to the time this entry is valid.</p>   </attr>";   #endif    + // Cached copy of conf->query("compat_level"). This setting is defined + // to require a module reload to take effect so we only query it when + // the module instance is created. + float compat_level = (float) my_configuration()->query("compat_level"); +    function TIMER( function f )   {   #if 0    return lambda(mixed ... args) {    int h = gethrtime();    mixed res;    werror("Drawing ... ");    res = f( @args );    werror(" %.1fms\n", (gethrtime()-h)/1000000.0 );    return res;
Roxen.git/server/modules/graphics/gbutton.pike:345: Inside #if constant(Sitebuilder)
   tmp = roxen.load_layers(args->border_image, id, opts);    Sitebuilder.sb_end_use_imagecache(args, id);    } else   #endif    {    tmp = roxen.load_layers(args->border_image, id, opts);    }       if (mappingp(tmp)) {    if (tmp->error != 401) -  report_debug("GButton: Failed to load frame image: %O (error: %O)\n", +  RXML.parse_error("Failed to load frame image: %O (error: %O)\n",    args->border_image, tmp->error);    return tmp;    }    set_image( tmp );    }          // otherwise load default images    if ( !frame && !background && !mask )    {
Roxen.git/server/modules/graphics/gbutton.pike:831:   }      class ButtonFrame {    inherit RXML.Frame;       array mk_url(RequestID id)    {   // int t = gethrtime();    string fi = (args["frame-image"] ||    id->misc->defines["gbutton-frame-image"]); -  if( fi ) +  if( fi ) { +  // Reject empty file paths for sufficiently high compat_level +  if (fi == "" && compat_level >= 5.2) +  RXML.parse_error("Empty frame-image attribute not allowed."); +     fi = Roxen.fix_relative( fi, id ); -  +  }    m_delete(args, "frame-image");       // Harmonize some attribute names to RXML standards...    args->icon_src = args["icon-src"] || args->icon_src;    args->icon_data = args["icon-data"] || args->icon_data;    args->align_icon = args["align-icon"] || args->align_icon;    args->valign_icon = args["valign-icon"] || args->valign_icon;    m_delete(args, "icon-src");    m_delete(args, "icon-data");    m_delete(args, "align-icon");    -  +  if (args->icon_src == "" && compat_level >= 5.2) +  RXML.parse_error("Empty icon-src attribute not allowed."); +     mapping new_args =    ([    "pagebg" :parse_color(args->pagebgcolor ||    id->misc->defines->theme_bgcolor ||    id->misc->defines->bgcolor ||    args->bgcolor ||    "#eeeeee"), // _page_ bg color    "bg" : parse_color(args->bgcolor ||    id->misc->defines->theme_bgcolor ||    id->misc->defines->bgcolor ||
Roxen.git/server/modules/graphics/gbutton.pike:996:    // first image will lack sizes).    img_attrs->width = size->xsize;    img_attrs->height = size->ysize;    }       result = Roxen.make_tag("img", img_attrs, !args->noxml);       // Make button clickable if not dimmed    if(args->href && !new_args->dim)    { -  mapping a_attrs = ([ "href" : args->href, -  "onfocus" : "this.blur();" ]); +  mapping a_attrs = ([ "href" : args->href ]);       foreach(indices(args), string arg)    if(has_value("/target/onmousedown/onmouseup/onclick/ondblclick/"    "onmouseout/onmouseover/onkeypress/onkeyup/"    "onkeydown/style/class/id/accesskey/",    "/" + lower_case(arg) + "/"))    a_attrs[arg] = args[arg];       result = Roxen.make_container("a", a_attrs, result);    }       return 0;    }    }   }