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.
79
2001/03/
28
09
:
49
:
29
kuntri
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
80
2001/03/
30
11
:
14
:
36
jhs
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; roxen.ImageCache button_cache; 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,
+
"Append format to generated images",
+
"Append the image format (.gif, .png, "
+
".jpg, etc) to the generated images. "
+
"This is not necessary, but might seem "
+
"nicer, especially to people who try "
+
"to mirror your site."));
+
}
+
mapping tagdocumentation() { Stdio.File file=Stdio.File(); if(!file->open(__FILE__,"r")) return 0; string doc=compile_string("#define manual\n"+file->read())->gbuttonattr; string imagecache=button_cache->documentation(); return ([ "gbutton":#"<desc cont='cont'><p><short> Creates graphical buttons.</short></p>
Roxen.git/server/modules/graphics/gbutton.pike:669:
// this version totally destroys the alpha channel of the image, // but that's sort of the intention. The reason is that // 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); } 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 );
Roxen.git/server/modules/graphics/gbutton.pike:766:
// if( new_args->stat && (fn = id->conf->real_file( fi, id ) ) ) // 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"))
+
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"; constant flags = RXML.FLAG_DONT_REPORT_ERRORS; RXML.Type content_type = RXML.t_text(RXML.PXml);