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.
70
2001/03/
28
09
:
50
:
08
kuntri
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
71
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 = "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:598:
// 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); } class ButtonFrame { inherit RXML.Frame; array mk_url(RequestID id) { string fi = (args["frame-image"] ||
Roxen.git/server/modules/graphics/gbutton.pike:700:
Roxen.add_cache_callback( id, get_cache_callback( fn, new_args->stat ) ); } new_args->quant = args->quant || 128; foreach(glob("*-*", indices(args)), string n) new_args[n] = args[n]; string img_src = query_absolute_internal_location(id) + button_cache->store( ({ new_args, content }), id);
+
if(query("ext"))
+
img_src += "." + (new_args->format || "gif");
+
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);