00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00038 function spotModuleCommand( $page_data, $moduleCommandName, $loopcontrol, $loopcontrollimit = 1000 )
00039 {
00040 if( $loopcontrol++ == $loopcontrollimit )
00041 {
00042 die( "An error occured while parsing the $moduleCommandName tags - please look at your entry. We tried parsing more than $loopcontrollimit entries - this is almost certainly an error." );
00043 return false;
00044 }
00045
00046 $len = strlen( $moduleCommandName ) + 1;
00047 $begpos = strpos( $page_data, "\\$moduleCommandName(" );
00048 if( $begpos === false )
00049 return false;
00050
00051 $endpos = strpos( $page_data, ")", $begpos + $len );
00052 if( $endpos === false )
00053 {
00054 die( "At least one of the $moduleCommandName tags was not terminated properly - please edit the entry and attempt to fix this!" );
00055 return false;
00056 }
00057
00058 $parameters = trim( substr( $page_data, $begpos + $len + 1, ( $endpos - $begpos ) - ( $len + 1 ) ) );
00059 if( $parameters == "" )
00060 $parameters = " ";
00061
00062 return $parameters;
00063 }
00064
00075 function drawCommand( $title, $description = "", $url, $extraClass = "", $target = "" )
00076 {
00077 if( $description == "" )
00078 $description = i18n( "No further description of ##0##", array($title) );
00079 if( $target != "" )
00080 $theTarget = " target=\"$target\"";
00081
00082 $link = "<a class=\"command$extraClass\" href=\"$url\" title=\"$description\"$theTarget>[";
00083 $link .= $title;
00084 $link .= "]</a>";
00085
00086 return $link;
00087 }
00088
00090 class setupPage
00091 {
00092 var $contents;
00093 var $breadcrumbs;
00094 var $commands;
00095
00099 function setupPage()
00100 {
00101 global $language;
00102
00103 $this->commands = array();
00104 $this->breadcrumbs = array();
00105
00106 $this->addBreadcrumb( i18n("Setup"), globalIDtoURL("setup") );
00107 }
00108
00115 function addBreadcrumb( $title, $url )
00116 {
00117 $this->breadcrumbs[] = array(
00118 "title" => $title,
00119 "url" => $url
00120 );
00121 }
00122
00130 function addCommand( $title, $description, $url )
00131 {
00132 $this->commands[] = array(
00133 "title" => $title,
00134 "description" => $description,
00135 "url" => $url
00136 );
00137 }
00138
00144 function render()
00145 {
00146 $renderedBreadcrumbs = "";
00147 $renderedCommands = "";
00148
00149 foreach( $this->breadcrumbs as $key => $breadcrumb )
00150 {
00151 if( $key > 0 )
00152 $renderedBreadcrumbs .= " » ";
00153 $renderedBreadcrumbs .= "<a class=\"setup-breadcrumb\" href=\"{$breadcrumb['url']}\">{$breadcrumb['title']}</a>";
00154 }
00155
00156 foreach( $this->commands as $key => $command )
00157 $renderedCommands .= " " . drawCommand( $command['title'], $command['description'], $command['url'] );
00158
00159 if( strlen( $renderedCommands ) == 0 )
00160 $renderedBreadcrumbs = "<td class=\"setup-breadcrumbs\" colspan=\"2\">$renderedBreadcrumbs</td>";
00161 else
00162 {
00163 $renderedBreadcrumbs = "<td class=\"setup-breadcrumbs\">$renderedBreadcrumbs</td>";
00164 $renderedCommands = "<td class=\"setup-commands\">$renderedCommands</td>";
00165 }
00166
00167 $renderedPage = "
00168 <table class=\"setup-container\">
00169 <tr class=\"setup-container\">
00170 $renderedBreadcrumbs
00171 $renderedCommands
00172 </tr>
00173 <tr class=\"setup-container\">
00174 <td class=\"setup-contents\" colspan=\"2\">{$this->contents}</td>
00175 </tr>
00176 </table>";
00177
00178 return $renderedPage;
00179 }
00180 }
00181
00201 function renderOptionsRow( $theOption, $mainVarName = "", $alternateTipPosition = false )
00202 {
00203 if( $mainVarName != "" )
00204 $extralayer = $mainVarName . "[" . $theOption["name"] . "]";
00205 else
00206 $extralayer = $theOption["name"];
00207
00208
00209 if( $theOption["tip"] != "" )
00210 {
00211 if( $alternateTipPosition )
00212 {
00213 $theTip = "";
00214 $theAlternateTip = "<small class=\"comment\">" . $theOption["tip"] . "</small>";
00215 }
00216 else
00217 {
00218 $theTip = "<small class=\"comment\">" . $theOption["tip"] . "</small>";
00219 $theAlternateTip = "";
00220 }
00221 }
00222
00223 if( $theOption["error"] != "" )
00224 $theError = "<small class=\"error\">" . $theOption["error"] . "</small>";
00225
00226 switch( $theOption["type"] )
00227 {
00228 case "header":
00229 return "
00230 <tr class=\"option\">
00231 <th colspan=\"2\" class=\"option\">
00232 " . $theOption["title"] . "
00233 </th>
00234 </tr>";
00235 break;
00236 case "label":
00237 return "
00238 <tr class=\"option\">
00239 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00240 <td class=\"option\"><span class=\"option_label\">{$theOption['current']}</span>$theAlternateTip</td>
00241 </tr>";
00242 break;
00243 case "text":
00244 return "
00245 <tr class=\"option\">
00246 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00247 <td class=\"option\"><input type=\"text\" style=\"width: 100%;\" class=\"option_text\" name=\"$extralayer\" value=\"{$theOption['current']}\" />$theAlternateTip</td>
00248 </tr>";
00249 break;
00250 case "password":
00251 return "
00252 <tr class=\"option\">
00253 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00254 <td class=\"option\"><input type=\"password\" style=\"width: 100%;\" class=\"option_text\" name=\"$extralayer\" value=\"{$theOption['current']}\" />$theAlternateTip</td>
00255 </tr>";
00256 break;
00257 case "file":
00258 return "
00259 <tr class=\"option\">
00260 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00261 <td class=\"option\"><input type=\"file\" style=\"width: 100%;\" class=\"option_file\" name=\"$extralayer\" />$theAlternateTip</td>
00262 </tr>";
00263 break;
00264 case "checkbox":
00265 if( $theOption["current"] == 1 )
00266 $checked = " checked";
00267 return "
00268 <tr class=\"option\">
00269 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00270 <td class=\"option\"><label><input type=\"checkbox\" class=\"option_checkbox\" name=\"$extralayer\"$checked />" . $theOption["title"] . "</label>$theAlternateTip</td>
00271 </tr>";
00272 break;
00273 case "textbox":
00274 return "
00275 <tr class=\"option\">
00276 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00277 <td class=\"option\"><textarea rows=\"4\" style=\"width: 100%;\" class=\"option_textbox\" name=\"$extralayer\">{$theOption['current']}</textarea>$theAlternateTip</td>
00278 </tr>";
00279 break;
00280 case "pagedata":
00281 global $formatting_toolbar;
00282 return "
00283 <tr class=\"option\">
00284 <td colspan=\"2\" class=\"option\">" . $theOption["title"] . "$theError $theTip$theAlternateTip</td>
00285 </tr>$formatting_toolbar
00286 <tr class=\"option\">
00287 <td colspan=\"2\" class=\"option\"><textarea id=\"edit\" rows=\"15\" style=\"width: 100%;\" class=\"option_textbox\" name=\"$extralayer\">{$theOption['current']}</textarea></td>
00288 </tr>";
00289 break;
00290 case "datetime":
00291
00292 $temp_year = date("Y", $theOption["current"]);
00293 $temp_month = date("m", $theOption["current"]);
00294 $temp_date = date("j", $theOption["current"]);
00295 $temp_hour = date("H", $theOption["current"]);
00296 $temp_minute = date("i", $theOption["current"]);
00297 $temp_second = date("s", $theOption["current"]);
00298
00299 if( is_array( $theOption["options"] ) )
00300 for ($i = $theOption["options"][0]; $i <= $theOption["options"][1]; $i++) { $allyears[] = $i; }
00301 else
00302 for ($i = date("Y") - 50; $i <= date("Y") + 50; $i++) { $allyears[] = $i; }
00303 foreach ($allyears as $key => $value) {
00304 if ($value == $temp_year) { $selected = " selected"; } else { $selected = ""; }
00305 $temp_years .= "<option value=\"$value\"$selected>$value</option>";
00306 }
00307
00308 $allmonths = array("01" => "January", "02" => "February", "03" => "March", "04" => "April", "05" => "May", "06" => "June", "07" => "July", "08" => "August", "09" => "September", "10" => "October", "11" => "November", "12" => "December");
00309 foreach ($allmonths as $key => $value) {
00310 if ($key == $temp_month) { $selected = " selected"; } else { $selected = ""; }
00311 $temp_months .= "<option value=\"$key\"$selected>$value</option>";
00312 }
00313
00314 for ($i = 1; $i <= 31; $i++) { $alldates[] = $i; }
00315 foreach ($alldates as $key => $value) {
00316 if ($value == $temp_date) { $selected = " selected"; } else { $selected = ""; }
00317 $temp_days .= "<option value=\"$value\"$selected>$value</option>";
00318 }
00319
00320 for ($i = 0; $i <= 23; $i++) { if (strlen($i) < 2) { $allhours[] = "0$i"; } else { $allhours[] = $i; } }
00321 foreach ($allhours as $key => $value) {
00322 if ($value == $temp_hour) { $selected = " selected"; } else { $selected = ""; }
00323 $temp_hours .= "<option value=\"$value\"$selected>$value</option>";
00324 }
00325
00326 for ($i = 0; $i <= 59; $i++) { if (strlen($i) < 2) { $allminutes[] = "0$i"; } else { $allminutes[] = $i; } }
00327 foreach ($allminutes as $key => $value) {
00328 if ($value == $temp_minute) { $selected = " selected"; } else { $selected = ""; }
00329 $temp_minutes .= "<option value=\"$value\"$selected>$value</option>";
00330 }
00331 foreach ($allminutes as $key => $value) {
00332 if ($value == $temp_second) { $selected = " selected"; } else { $selected = ""; }
00333 $temp_seconds .= "<option value=\"$value\"$selected>$value</option>";
00334 }
00335
00336 return "
00337 <tr class=\"option\">
00338 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00339 <td class=\"option\"><div style=\"width: 10%; overflow: hidden; display: inline-block;\" class=\"option_time_date\">
00340 " . i18n("On") . "</div><select style=\"width: 20%;\" name=\"" . $extralayer . "[day]\">$temp_days
00341 </select><select style=\"width: 40%;\" name=\"" . $extralayer . "[month]\">$temp_months
00342 </select><select style=\"width: 30%;\" name=\"" . $extralayer . "[year]\">$temp_years
00343 </select><br />
00344 <div style=\"width: 10%; overflow: hidden; display: inline-block;\">
00345 " . i18n("at") . "</div><select style=\"width: 30%;\" name=\"" . $extralayer . "[hour]\">$temp_hours
00346 </select><select style=\"width: 30%;\" name=\"" . $extralayer . "[minute]\">$temp_minutes
00347 </select><select style=\"width: 30%;\" name=\"" . $extralayer . "[second]\">$temp_seconds
00348 </select>$theAlternateTip</td>
00349 </tr>";
00350 break;
00351 case "date":
00352
00353 $temp_year = date("Y", $theOption["current"]);
00354 $temp_month = date("m", $theOption["current"]);
00355 $temp_date = date("j", $theOption["current"]);
00356
00357 if( is_array( $theOption["options"] ) )
00358 for ($i = $theOption["options"][0]; $i <= $theOption["options"][1]; $i++) { $allyears[] = $i; }
00359 else
00360 for ($i = date("Y") - 50; $i <= date("Y") + 50; $i++) { $allyears[] = $i; }
00361 foreach ($allyears as $key => $value) {
00362 if ($value == $temp_year) { $selected = " selected"; } else { $selected = ""; }
00363 $temp_years .= "<option value=\"$value\"$selected>$value</option>";
00364 }
00365
00366 $allmonths = array("01" => "January", "02" => "February", "03" => "March", "04" => "April", "05" => "May", "06" => "June", "07" => "July", "08" => "August", "09" => "September", "10" => "October", "11" => "November", "12" => "December");
00367 foreach ($allmonths as $key => $value) {
00368 if ($key == $temp_month) { $selected = " selected"; } else { $selected = ""; }
00369 $temp_months .= "<option value=\"$key\"$selected>$value</option>";
00370 }
00371
00372 for ($i = 1; $i <= 31; $i++) { $alldates[] = $i; }
00373 foreach ($alldates as $key => $value) {
00374 if ($value == $temp_date) { $selected = " selected"; } else { $selected = ""; }
00375 $temp_days .= "<option value=\"$value\"$selected>$value</option>";
00376 }
00377
00378 return "
00379 <tr class=\"option\">
00380 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00381 <td class=\"option\"><div style=\"width: 10%; overflow: hidden; display: inline-block;\" class=\"option_time_date\">
00382 " . i18n("On") . "</div><select style=\"width: 20%;\" name=\"" . $extralayer . "[day]\">$temp_days
00383 </select><select style=\"width: 40%;\" name=\"" . $extralayer . "[month]\">$temp_months
00384 </select><select style=\"width: 30%;\" name=\"" . $extralayer . "[year]\">$temp_years
00385 </select>$theAlternateTip</td>
00386 </tr>";
00387 break;
00388 case "time":
00389
00390 $temp_hour = date("H", $theOption["current"]);
00391 $temp_minute = date("i", $theOption["current"]);
00392 $temp_second = date("s", $theOption["current"]);
00393
00394 for ($i = 0; $i <= 23; $i++) { if (strlen($i) < 2) { $allhours[] = "0$i"; } else { $allhours[] = $i; } }
00395 foreach ($allhours as $key => $value) {
00396 if ($value == $temp_hour) { $selected = " selected"; } else { $selected = ""; }
00397 $temp_hours .= "<option value=\"$value\"$selected>$value</option>";
00398 }
00399
00400 for ($i = 0; $i <= 59; $i++) { if (strlen($i) < 2) { $allminutes[] = "0$i"; } else { $allminutes[] = $i; } }
00401 foreach ($allminutes as $key => $value) {
00402 if ($value == $temp_minute) { $selected = " selected"; } else { $selected = ""; }
00403 $temp_minutes .= "<option value=\"$value\"$selected>$value</option>";
00404 }
00405 foreach ($allminutes as $key => $value) {
00406 if ($value == $temp_second) { $selected = " selected"; } else { $selected = ""; }
00407 $temp_seconds .= "<option value=\"$value\"$selected>$value</option>";
00408 }
00409
00410 return "
00411 <tr class=\"option\">
00412 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00413 <td class=\"option\">
00414 <div style=\"width: 10%; overflow: hidden; display: inline-block;\">
00415 " . i18n("at") . "</div><select style=\"width: 30%;\" name=\"" . $extralayer . "[hour]\">$temp_hours
00416 </select><select style=\"width: 30%;\" name=\"" . $extralayer . "[minute]\">$temp_minutes
00417 </select>$theAlternateTip</td>
00418 </tr>";
00419 break;
00420 case "radio":
00421 if( is_array( $theOption["options"] ) )
00422 {
00423 $temp_content = "
00424 <tr class=\"option\">
00425 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00426 <td class=\"option\">";
00427 foreach( $theOption["options"] as $key => $value )
00428 {
00429 $default = "";
00430 if( $key == $theOption["current"] )
00431 $default = " checked";
00432
00433 $temp_content .= "
00434 <label><input type=\"radio\" name=\"$extralayer\" value=\"$key\"$default>{$value['title']}</label>" . parse_page_data($value['description']);
00435 }
00436 $temp_content .= "
00437 $theAlternateTip</td>
00438 </tr>";
00439 }
00440 else
00441 {
00442 $temp_content .= "<tr class=\"option\"><td class=\"option\" colspan=\"2\">" . i18n( "Error - The options argument is missing from the select option named "##0##"", array( $theOption["title"] ) ) . "</td></tr>";
00443 }
00444 return $temp_content;
00445 break;
00446 case "select":
00447 if( is_array( $theOption["options"] ) )
00448 {
00449 $temp_content = "
00450 <tr class=\"option\">
00451 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00452 <td class=\"option\"><select style=\"width: 100%;\" class=\"option_select\" name=\"$extralayer\">";
00453 foreach( $theOption["options"] as $key => $value )
00454 {
00455 $default = "";
00456 if( $key == $theOption["current"] )
00457 $default = " selected";
00458
00459 $temp_content .= "
00460 <option value=\"$key\"$default>$value</option>";
00461 }
00462 $temp_content .= "
00463 </select>$theAlternateTip</td>
00464 </tr>";
00465 }
00466 else
00467 {
00468 $temp_content .= "<tr class=\"option\"><td class=\"option\" colspan=\"2\">" . i18n( "Error - The options argument is missing from the select option named "##0##"", array( $theOption["title"] ) ) . "</td></tr>";
00469 }
00470 return $temp_content;
00471 break;
00472 case "multicheck":
00473 if( is_array( $theOption["options"] ) )
00474 {
00475 $temp_content = "
00476 <tr class=\"option\">
00477 <td class=\"option\">" . $theOption["title"] . "$theError $theTip</td>
00478 <td class=\"option\">";
00479 foreach( $theOption["options"] as $key => $value )
00480 {
00481 $extralayer .= "[" . $key . "]";
00482
00483 $default = "";
00484 if( $theOption["current"][$key] == 1 )
00485 $default = " checked";
00486
00487 $temp_content .= "
00488 <label><input type=\"checkbox\" name=\"$extralayer\" value=\"$key\"$default>{$value['title']}</label><small class=\"comment\">" . parse_page_data($value['description']) . "</small>";
00489 }
00490 $temp_content .= "
00491 $theAlternateTip</td>
00492 </tr>";
00493 }
00494 else
00495 $temp_content .= "<tr class=\"option\"><td class=\"option\" colspan=\"2\">" . i18n( "Error - The options argument is missing from the multicheck option named "##0##"", array( $theOption["title"] ) ) . "</td></tr>";
00496 return $temp_content;
00497 break;
00498 default:
00499 return "<tr class=\"option\"><td class=\"option\" colspan=\"2\">" . i18n("Error - this option has no type, or the type was not recognised!") . "</td></tr>";
00500 break;
00501 }
00502 }
00503
00505 class optionsPanel
00506 {
00507 var $saveTitle;
00508 var $revertTitle;
00509 var $showHeader = true;
00510 var $alternateTipPosition = false;
00511
00512 var $submitted = false;
00513
00515 var $mainVarName;
00516 var $options;
00517 var $submits;
00518
00519 function optionsPanel( $mainVarName, $alternateTipPosition = false )
00520 {
00521 $this->mainVarName = $mainVarName;
00522 $this->saveTitle = i18n("Save options");
00523 $this->revertTitle = i18n("Revert to saved");
00524 $this->alternateTipPosition = $alternateTipPosition;
00525
00526 if( $_POST["saveOptions"] )
00527 $this->submitted = key($_POST["saveOptions"]);
00528 }
00529
00530 function addOption( $title, $tip, $current, $name, $type, $options = "" )
00531 {
00532 $this->options[$name] = array(
00533 "title" => $title,
00534 "tip" => $tip,
00535 "current" => $current,
00536 "name" => $name,
00537 "type" => $type,
00538 "options" => $options
00539 );
00540
00541 if( $type == "checkbox" )
00542 {
00543 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) )
00544 $this->options[$name]["current"] = $_POST[$this->mainVarName][$name] ? 1 : 0;
00545 else if( is_array( $_POST ) && array_key_exists( "saveOptions", $_POST ) )
00546 $this->options[$name]["current"] = $_POST[$name] ? 1 : 0;
00547 }
00548 else if( $type == "datetime" )
00549 {
00550 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) && array_key_exists( $name, $_POST[$this->mainVarName] ) )
00551 $this->options[$name]["current"] = mktime($_POST[$this->mainVarName][$name]["hour"], $_POST[$this->mainVarName][$name]["minute"], $_POST[$this->mainVarName][$name]["second"], $_POST[$this->mainVarName][$name]["month"], $_POST[$this->mainVarName][$name]["day"], $_POST[$this->mainVarName][$name]["year"]);
00552 else if( is_array( $_POST ) && array_key_exists( $name, $_POST ) )
00553 $this->options[$name]["current"] = mktime($_POST[$name]["hour"], $_POST[$name]["minute"], $_POST[$name]["second"], $_POST[$name]["month"], $_POST[$name]["day"], $_POST[$name]["year"]);
00554 }
00555 else if( $type == "time" )
00556 {
00557 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) && array_key_exists( $name, $_POST[$this->mainVarName] ) )
00558 $this->options[$name]["current"] = mktime($_POST[$this->mainVarName][$name]["hour"], $_POST[$this->mainVarName][$name]["minute"], 0, 0, 0, 0);
00559 else if( is_array( $_POST ) && array_key_exists( $name, $_POST ) )
00560 $this->options[$name]["current"] = mktime($_POST[$name]["hour"], $_POST[$name]["minute"], 0, 0, 0, 0);
00561 }
00562 else if( $type == "date" )
00563 {
00564 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) && array_key_exists( $name, $_POST[$this->mainVarName] ) )
00565 $this->options[$name]["current"] = mktime(0, 0, 0, $_POST[$this->mainVarName][$name]["month"], $_POST[$this->mainVarName][$name]["day"], $_POST[$this->mainVarName][$name]["year"]);
00566 else if( is_array( $_POST ) && array_key_exists( $name, $_POST ) )
00567 $this->options[$name]["current"] = mktime(0, 0, 0, $_POST[$name]["month"], $_POST[$name]["day"], $_POST[$name]["year"]);
00568 }
00569 else if( $type == "multicheck" )
00570 {
00571 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) )
00572 {
00573 foreach( $this->options[$name]["options"] as $key => $value )
00574 {
00575 if( is_array( $_POST[$this->mainVarName][$name] ) )
00576 $this->options[$name]["current"][$key] = array_key_exists( $key, $_POST[$this->mainVarName][$name] ) ? 1 : 0;
00577 else
00578 $this->options[$name]["current"][$key] = 0;
00579 }
00580 }
00581 else if( is_array( $_POST ) && array_key_exists( "saveOptions", $_POST ) )
00582 {
00583 foreach( $this->options[$name]["options"] as $key => $value )
00584 {
00585 if( is_array( $_POST[$name] ) )
00586 $this->options[$name]["current"][$key] = array_key_exists( $key, $_POST[$name] ) ? 1 : 0;
00587 else
00588 $this->options[$name]["current"][$key] = 0;
00589 }
00590 }
00591 }
00592 else
00593 {
00594 if( $this->mainVarName != "" && is_array( $_POST[$this->mainVarName] ) && array_key_exists( $name, $_POST[$this->mainVarName] ) )
00595 $this->options[$name]["current"] = stripslashes($_POST[$this->mainVarName][$name]);
00596 else if( is_array( $_POST ) && array_key_exists( $name, $_POST ) )
00597 $this->options[$name]["current"] = stripslashes($_POST[$name]);
00598 }
00599 }
00600
00601 function addHeader( $title, $name )
00602 {
00603 $this->options[$name] = array(
00604 "title" => $title,
00605 "type" => "header",
00606 );
00607 }
00608
00609 function addCommand( $title, $name )
00610 {
00611 $this->submits[$name] = $title;
00612 }
00613
00614 function getValue( $optionName )
00615 {
00616 return $this->options[$optionName]["current"];
00617 }
00618
00619 function render()
00620 {
00621
00622 $rendered_panel = "
00623 <table class=\"options\">";
00624
00625 if( $this->showHeader )
00626 $rendered_panel .= "
00627 <tr class=\"options\">
00628 <th class=\"options\">" . i18n("Option") . "</th>
00629 <th class=\"options\">" . i18n("Value") . "</th>
00630 </tr>";
00631
00632 foreach( $this->options as $key => $value )
00633 $rendered_panel .= renderOptionsRow( $value, $this->mainVarName, $this->alternateTipPosition );
00634
00635 if( is_array( $this->submits ) )
00636 foreach( $this->submits as $key => $value )
00637 $submits .= "<input type=\"submit\" class=\"options_save\" name=\"saveOptions[$key]\" value=\"$value\" />";
00638
00639 $rendered_panel .= "
00640 <tr class=\"options\">
00641 <td width=\"50%\" class=\"options-bottomleft\"><input type=\"submit\" class=\"options_save\" name=\"saveOptions[default]\" value=\"" . $this->saveTitle . "\" />$submits</td>
00642 <td width=\"50%\" class=\"options-bottomright\"><input type=\"reset\" class=\"options_reset\" value=\"" . $this->revertTitle . "\" /></td>
00643 </tr>
00644 </table>";
00645 return $rendered_panel;
00646 }
00647 }
00648
00656 function globalID_setup( $splitID )
00657 {
00658 $pageID = null;
00659
00660 if( $splitID[0] == "setup" )
00661 {
00662 switch( $splitID[1] )
00663 {
00664 case null:
00665 $pageID = "3";
00666 break;
00667 case "users":
00668 $pageID = "4";
00669 if( array_key_exists( 2, $splitID ) )
00670 $_REQUEST["action"] = $splitID[2];
00671 if( array_key_exists( 3, $splitID ) )
00672 $_REQUEST["username"] = $splitID[3];
00673 break;
00674 case "pagesetup":
00675 global $theAction, $deleteID;
00676 $pageID = "5";
00677 if( array_key_exists( 2, $splitID ) )
00678 $theAction = $splitID[2];
00679 if( array_key_exists( 3, $splitID ) )
00680 $deleteID = $splitID[3];
00681 break;
00682 case "editpage":
00683 if( array_key_exists( 2, $splitID ) && array_key_exists( 3, $splitID ) )
00684 {
00685 global $editFrontpage, $theEditID, $theEditTitle, $theEditLanguage;
00686 $pageID = "6";
00687 $theEditLanguage = $splitID[2];
00688 if( is_numeric( $splitID[3] ) )
00689 {
00690 if( (int)$splitID[3] == 0 )
00691 $editFrontpage = true;
00692 else
00693 $theEditID = $splitID[3];
00694 }
00695 else
00696 $theEditTitle = $splitID[3];
00697 }
00698 else
00699 $pageID = "5";
00700 break;
00701 case "menusetup":
00702 global $theAction, $theMenuID, $deleteComfirm;
00703 $pageID = "7";
00704 if( $splitID[2] == "assign" && array_key_exists( 3, $splitID ) )
00705 {
00706 $theAction = "assign";
00707 $theMenuID = $splitID[3];
00708 }
00709 else if( $splitID[2] == "delete" && array_key_exists( 3, $splitID ) )
00710 {
00711 $theAction = "delete";
00712 $theMenuID = $splitID[3];
00713 if( $splitID[4] == "confirm" )
00714 $deleteComfirm = true;
00715 }
00716 break;
00717 case "editmenu":
00718 global $menuEditLanguage, $menuEditID, $menuEditTitle;
00719 if( array_key_exists( 2, $splitID ) && array_key_exists( 3, $splitID ) )
00720 {
00721 $pageID = "8";
00722 $menuEditLanguage = $splitID[2];
00723 $menuEditID = $splitID[3];
00724 }
00725 else if( array_key_exists( 2, $splitID ) )
00726 {
00727 $pageID = "8";
00728 $menuEditTitle = $splitID[2];
00729 }
00730 else
00731 $pageID = "7";
00732 break;
00733 case "themesetup":
00734 global $setupAction, $setupAction, $themeDelete;
00735 $pageID = "9";
00736 if( $splitID[2] == "options" )
00737 $setupAction = "options";
00738 else if( $splitID[2] == "delete" && array_key_exists( 3, $splitID ) )
00739 $setupAction = "delete";
00740 $themeDelete = $splitID[3];
00741 break;
00742 case "filesetup":
00743 global $theAction, $deleteFile, $renameFrom;
00744 $pageID = "11";
00745 if( $splitID[2] == "upload" )
00746 $theAction = "upload";
00747 else if( $splitID[2] == "uploadcomplete" )
00748 $theAction = "uploadcomplete";
00749 else if( $splitID[2] == "delete" && array_key_exists( 3, $splitID ) )
00750 {
00751 $theAction = "delete";
00752 $deleteFile = $splitID[3];
00753 }
00754 else if( $splitID[2] == "confirm_delete" && array_key_exists( 3, $splitID ) )
00755 {
00756 $theAction = "confirm_delete";
00757 $deleteFile = $splitID[3];
00758 }
00759 else if( $splitID[2] == "rename" && array_key_exists( 3, $splitID ) )
00760 {
00761 $theAction = "rename";
00762 $renameFrom = $splitID[3];
00763 }
00764 break;
00765 case "modulesetup":
00766 global $theModule, $theModuleSection, $theModuleSubsection, $theModuleAction;
00767 $pageID = "12";
00768 if( array_key_exists( 2, $splitID ) )
00769 $theModule = $splitID[2];
00770
00773 if( array_key_exists( 3, $splitID ) )
00774 $theModuleSection = $splitID[3];
00775 if( array_key_exists( 4, $splitID ) )
00776 $theModuleSubsection = $splitID[4];
00777 if( array_key_exists( 5, $splitID ) )
00778 $theModuleAction = $splitID[5];
00779
00780 break;
00781 case "help":
00782 $pageID = "14";
00783 break;
00784 case "requestpassword":
00785 global $username;
00786 $pageID = "15";
00787 $username = $splitID[2];
00788 break;
00789 case "options":
00790 $pageID = "16";
00791 break;
00792 default:
00793
00794 }
00795 $_REQUEST["page_id"] = ($pageID != null) ? $pageID : $_REQUEST["page_id"];
00796 }
00797
00798 return $pageID;
00799 }
00800
00801 $modules_globalID[] = "globalID_setup";
00802 ?>