[geeklog-cvs] Geeklog-1.x/system/classes config.class.php, 1.16, 1.17
Dirk Haun
dhaun at qs1489.pair.com
Sun Jan 20 15:55:19 EST 2008
Update of /cvsroot/geeklog/Geeklog-1.x/system/classes
In directory qs1489.pair.com:/tmp/cvs-serv89817/system/classes
Modified Files:
config.class.php
Log Message:
Introduced a new config type 'fn:' that calls a specified function to provide contents of a dropdown at runtime, e.g. for the language and theme selection
Index: config.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/classes/config.class.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** config.class.php 19 Jan 2008 19:36:46 -0000 1.16
--- config.class.php 20 Jan 2008 20:55:17 -0000 1.17
***************
*** 523,526 ****
--- 523,544 ----
}
return $t->parse('output', 'select-element');
+ } elseif (substr($type, 0, 3) == 'fn:') {
+ $fn = 'configmanager_' . substr($type, 3);
+ if (!function_exists($fn)) {
+ return $t->finish($t->parse('output', 'text-element'));
+ }
+ $selectionArray = $fn();
+ $t->set_block('select-element', 'select-options', 'myoptions');
+ foreach ($selectionArray as $sName => $sVal) {
+ if (is_bool($sVal)) {
+ $t->set_var('opt_value', $sVal ? 'b:1' : 'b:0');
+ } else {
+ $t->set_var('opt_value', $sVal);
+ }
+ $t->set_var('opt_name', $sName);
+ $t->set_var('selected', ($val == $sVal ? 'selected="selected"' : ''));
+ $t->parse('myoptions', 'select-options', true);
+ }
+ return $t->parse('output', 'select-element');
} elseif (strpos($type, "@") === 0) {
$result = "";
More information about the geeklog-cvs
mailing list