Roxen.git
/
server
/
modules
/
graphics
/
gbutton.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/graphics/gbutton.pike:18:
// 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.
82
2001/
03
/
30
17
:
12
:
49
kuntri
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
83
2001/
04/
03
07
:
29
:
40
per
Exp $";
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"; constant module_doc = "Provides the <tt><gbutton></tt> tag that is used to draw graphical " "buttons."; void create() { defvar("ext", Variable.Flag(0, VAR_MORE,
Roxen.git/server/modules/graphics/gbutton.pike:188:
Inside #if 0
res = f( @args ); werror(" %.1fms\n", (gethrtime()-h)/1000000.0 ); return res; }; #endif return f; } void start() { button_cache = roxen.ImageCache("gbutton", TIMER(draw_button));
+
do_ext = query("ext");
} string status() { array s=button_cache->status(); return sprintf("<b>Images in cache:</b> %d images<br />\n" "<b>Cache size:</b> %s", s[0], Roxen.sizetostring(s[1])); } mapping(string:function) query_action_buttons() {
Roxen.git/server/modules/graphics/gbutton.pike:688:
// the png images are generated without alpha. if (args->format == "png") return ({ Image.Layer(([ "fill":args->pagebg, ])) }) + button_layers; else return button_layers; // } } mapping find_internal(string f, RequestID id) {
-
if(strlen(f)>4
&&
query("
ext
")
&&
f
[-4]
==
'.'
)
//
Remove
.
ext
-
f
=
f[
.
.strlen(f)-5];
-
return button_cache->http_file_answer(f, id);
+
//
It's
not enough to
+
// 1. Only do this check when the
ext
flag
is set, old URLs might
+
// live in caches
+
//
+
// 2. Check str
[-4]
for
'.'
,
consider .jpeg .tiff etc.
+
//
+
// However,
.
is not a valid character in the ID, so just cutting at
+
//
the
first
one
works
.
+
return button_cache->http_file_answer(
(
f
/".")[0]
, id
);
} mapping __stat_cache = ([ ]); int get_file_stat( string f, RequestID id ) { if( __stat_cache[ f ] ) return __stat_cache[ f ]; call_out( m_delete, 10, __stat_cache, f ); return __stat_cache[ f ] = (id->conf->stat_file( f,id )
Roxen.git/server/modules/graphics/gbutton.pike:785:
// Roxen.add_cache_stat_callback( id, fn, new_args->stat ); string fn; // werror("mkurl took %dµs\n", gethrtime()-t ); // t = gethrtime(); string img_src = query_absolute_internal_location(id) + button_cache->store( ({ new_args, content }), id);
-
if(
query("
ext
"
)
)
+
if(
do_
ext)
img_src += "." + (new_args->format || "gif"); // werror("argcache->store took %dµs\n", gethrtime()-t ); return ({ img_src, new_args }); } } class TagGButtonURL { inherit RXML.Tag; constant name = "gbutton-url";