"); output_notl("`b%s`b", $info[0], true); rawoutput(" | |
"); output_notl("`i%s`i", $info[0], true); $i++; }elseif($info[1]=="invisible"){ // Don't show }else{ if (isset($row[$key])) $returnvalues[$key] = $row[$key]; rawoutput(" | |
"); output_notl("%s", $info[0],true); rawoutput(" | ");
$i++;
}
switch ($info[1]){
case "title":
case "note":
case "invisible":
break;
case "theme":
// A generic way of allowing a theme to be selected.
$skins = array();
$handle = @opendir("templates");
// Template directory open failed
if (!$handle) {
output("None available");
break;
}
while (false != ($file = @readdir($handle))) {
if (strpos($file,".htm") > 0) {
array_push($skins, $file);
}
}
// No templates installed!
if (count($skins) == 0) {
output("None available");
break;
}
natcasesort($skins); //sort them in natural order
rawoutput("");
break;
case "location":
// A generic way of allowing the location to be specified for
// things which only want to be in one place. There are other
// things which would be good to do as well of course, such
// as making sure to handle village name changes in the module
// that cares about this or what not, but this at least gives
// some support.
$vloc = array();
$vname = getsetting("villagename", LOCATION_FIELDS);
$vloc[$vname]="village";
$vloc['all'] = 1;
$vloc = modulehook("validlocation", $vloc);
unset($vloc['all']);
reset($vloc);
rawoutput("");
break;
case "checkpretrans":
$pretrans = 1;
// FALLTHROUGH
case "checklist":
reset($info);
list($k,$v)=each($info);
list($k,$v)=each($info);
$select="";
while (list($k,$v)=each($info)){
$optval = $v;
list($k,$v)=each($info);
$optdis = $v;
if (!$pretrans) $optdis = translate_inline($optdis);
if (is_array($row[$key])){
if ($row[$key][$optval]) {
$checked=true;
}else{
$checked=false;
}
}else{
//any other ways to represent this?
debug("You must pass an array as the value when using a checklist.");
$checked=false;
}
$select.=" ".("$optdis")." "; } rawoutput($select); break; case "radiopretrans": $pretrans = 1; // FALLTHROUGH case "radio": reset($info); list($k,$v)=each($info); list($k,$v)=each($info); $select=""; while (list($k,$v)=each($info)){ $optval = $v; list($k,$v)=each($info); $optdis = $v; if (!$pretrans) $optdis = translate_inline($optdis); $select.=(" ".("$optdis")." "); } rawoutput($select); break; case "dayrange": $start = strtotime(date("Y-m-d", strtotime("now"))); $end = strtotime($info[2]); $step = $info[3]; // we should really try to avoid an infinite loop here if // they define a time string which equates to 0 :/ $cur = $row[$key]; rawoutput(""); break; case "range": $min = (int)$info[2]; $max = (int)$info[3]; $step = (int)(isset($info[4])?$info[4]:false); if ($step == 0) $step = 1; rawoutput(""); break; case "floatrange": $min = round((float)$info[2],2); $max = round((float)$info[3],2); $step = round((float)$info[4],2); if ($step==0) $step=1; rawoutput("", true); break; case "bitfieldpretrans": $pretrans = 1; // FALLTHROUGH case "bitfield": //format: //DisplayName,bitfield,disablemask,(highbit,display)+ //1-26-03 added disablemask so this field type can be used // on bitfields other than superuser. reset($info); list($k,$v)=each($info); list($k,$v)=each($info); list($k,$disablemask)=each($info); rawoutput("", true); while (list($k,$v)=each($info)){ rawoutput(" "); list($k,$v)=each($info); if (!$pretrans) $v = translate_inline($v); output_notl("%s`n",$v,true); } break; case "datelength": // However, there was a bug with your translation code wiping // the key name for the actual form. It's now fixed. // ok, I see that, but 24 hours and 1 day are the same // aren't they? $vals = array( "1 hour", "2 hours", "3 hours", "4 hours", "5 hours", "6 hours", "8 hours", "10 hours", "12 hours", "16 hours", "18 hours", "24 hours", "1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "1 week", "2 weeks", "3 weeks", "4 weeks", "1 month", "2 months", "3 months", "4 months", "6 months", "9 months", "12 months", "1 year" ); tlschema("showform"); while (list($k,$v)=each($vals)){ $vals[$k]=translate($v); rawoutput(tlbutton_pop()); } tlschema(); reset($vals); rawoutput(""); break; case "enumpretrans": $pretrans = 1; // FALLTHROUGH case "enum": reset($info); list($k,$v)=each($info); list($k,$v)=each($info); $select=""; $select.=(""; rawoutput($select); break; case "password": if (array_key_exists($key, $row)) $out = $row[$key]; else $out = ""; rawoutput(""); break; case "bool": tlschema("showform"); $yes = translate_inline("Yes"); $no = translate_inline("No"); tlschema(); rawoutput("", true); break; case "hidden": if(isset($row[$key])) rawoutput("".HTMLEntities($row[$key], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))); break; case "viewonly": unset($returnvalues[$key]); if (isset($row[$key])) output_notl(dump_item($row[$key]),true); break; case "textarearesizeable": $resize=true; //FALLTHROUGH case "textarea": $cols = 0; if (isset($info[2])) $cols = $info[2]; if (!$cols) $cols = 70; $text = ""; if (isset($row[$key])) { $text = $row[$key]; } if (isset($resize) && $resize) { rawoutput(""); rawoutput(""); rawoutput(""); } else { rawoutput(""); } break; case "int": if (array_key_exists($key, $row)) $out = $row[$key]; else $out = 0; rawoutput(""); break; case "float": rawoutput(""); break; case "string": $len = 50; $minlen = 50; if (isset($info[2])) $len = (int)$info[2]; if ($len < $minlen) $minlen = $len; if ($len > $minlen) $minlen = $len/2; if ($minlen > 70) $minlen = 70; if (array_key_exists($key, $row)) $val = $row[$key]; else $val = ""; rawoutput(""); break; default: if (array_key_exists($info[1],$extensions)){ $func=$extensions[$info[1]]; if (array_key_exists($key, $row)) $val = $row[$key]; else $val = ""; call_user_func($func, $keyout, $val, $info); }else{ if (array_key_exists($key, $row)) $val = $row[$key]; else $val = ""; rawoutput(""); } } rawoutput(" |