6503 lines
233 KiB
PHP
6503 lines
233 KiB
PHP
<?php
|
|
// File name: form.inc.php
|
|
// Description: PHP classes to display form tables
|
|
// Date: 2004-10-01
|
|
// Author: imacat <imacat@pristine.com.tw>
|
|
// Copyright: Copyright (C) 2004-2013 Pristine Communications
|
|
|
|
// Set the include path
|
|
if (!defined("INCPATH_SET")) {
|
|
require_once dirname(__FILE__) . "/incpath.inc.php";
|
|
}
|
|
// Referenced subroutines
|
|
require_once "monica/a2html.inc.php";
|
|
require_once "monica/addget.inc.php";
|
|
require_once "monica/callform.inc.php";
|
|
require_once "monica/chkpriv.inc.php";
|
|
require_once "monica/commtext.inc.php";
|
|
require_once "monica/country.inc.php";
|
|
require_once "monica/echoform.inc.php";
|
|
require_once "monica/encrypt.inc.php";
|
|
require_once "monica/formfunc.inc.php";
|
|
require_once "monica/geoip.inc.php";
|
|
require_once "monica/getlang.inc.php";
|
|
require_once "monica/gettext.inc.php";
|
|
require_once "monica/htmlchar.inc.php";
|
|
require_once "monica/https.inc.php";
|
|
require_once "monica/links.inc.php";
|
|
require_once "monica/lninfo.inc.php";
|
|
require_once "monica/login.inc.php";
|
|
require_once "monica/markabbr.inc.php";
|
|
require_once "monica/pagefunc.inc.php";
|
|
require_once "monica/pic.inc.php";
|
|
require_once "monica/requri.inc.php";
|
|
require_once "monica/sql.inc.php";
|
|
require_once "monica/upload.inc.php";
|
|
require_once "monica/username.inc.php";
|
|
require_once "monica/usrconst.inc.php";
|
|
require_once "monica/zh2py.inc.php";
|
|
|
|
// Settings
|
|
define("FORM_RADIO_ONELINE", true);
|
|
|
|
// BaseForm: Display a form
|
|
class BaseForm
|
|
{
|
|
// Public-accessible attributes
|
|
public $title = null;
|
|
|
|
protected $_status = null;
|
|
protected $_type = null;
|
|
protected $_type_to_pass = null;
|
|
protected $_valid_types = null;
|
|
protected $_step = null;
|
|
protected $_req = null;
|
|
protected $_table = null;
|
|
|
|
protected $_form = null;
|
|
protected $_cur = null;
|
|
protected $_sn = null;
|
|
protected $_https = null;
|
|
protected $_isupload = false;
|
|
protected $_prefmsg = array();
|
|
protected $_nodelete = false;
|
|
protected $_deltext = "Delete it";
|
|
protected $_delprompt = "Are you sure you want to delete it? It cannot be recovered.";
|
|
protected $_mark = null;
|
|
protected $_markcols = null;
|
|
protected $_markmsg = null;
|
|
protected $_show_form = true;
|
|
protected $_show_table = true;
|
|
protected $_hidcols = null;
|
|
protected $_header_buttons = null;
|
|
protected $_footer_buttons = null;
|
|
protected $_summary = true;
|
|
protected $_class = "defform";
|
|
protected $_onsubmit = null;
|
|
protected $_colspan = 1;
|
|
protected $_defsize = 40;
|
|
protected $_procurl = REQUEST_FILE;
|
|
protected $_cols = array();
|
|
protected $_auto_referer2 = true;
|
|
|
|
protected $_is_called_form = false;
|
|
protected $_caller = null;
|
|
protected $_cformid = null;
|
|
|
|
protected $_preview = false;
|
|
protected $_prevmsg = null;
|
|
|
|
// Attributes to be always automatically generated
|
|
protected $_mlcols = array();
|
|
protected $_maxlens = array();
|
|
protected $_is_first_form = false;
|
|
protected $_referer2 = null;
|
|
protected $_hostport = null;
|
|
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
$this->_status = $status;
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
// The form type
|
|
if (array_key_exists("type", $args)) {
|
|
$this->_type = $args["type"];
|
|
} else {
|
|
$this->_type = form_type();
|
|
}
|
|
// The form type to pass to the handler
|
|
if (array_key_exists("type_to_pass", $args)) {
|
|
$this->_type_to_pass = $args["type_to_pass"];
|
|
} else {
|
|
$this->_type_to_pass = $this->_type;
|
|
}
|
|
// The allowed form types
|
|
if (array_key_exists("valid_types", $args)) {
|
|
$this->_valid_types = $args["valid_types"];
|
|
} else {
|
|
$this->_valid_types = array("new", "cur", "del");
|
|
}
|
|
// Check if the form type is valid
|
|
if (!in_array($this->_type, $this->_valid_types)) {
|
|
trigger_error("unknown form type: \"" . $this->_type . "\"", E_USER_ERROR);
|
|
}
|
|
// The form step
|
|
if (array_key_exists("step", $args)) {
|
|
$this->_step = $args["step"];
|
|
}
|
|
// The request ID.
|
|
if (array_key_exists("req", $args)) {
|
|
$this->_req = $args["req"];
|
|
}
|
|
// The manuplating table
|
|
if (array_key_exists("table", $args)) {
|
|
$this->_table = $args["table"];
|
|
} elseif (defined("THIS_TABLE")) {
|
|
$this->_table = THIS_TABLE;
|
|
}
|
|
// The submitted form
|
|
if (array_key_exists("form", $args)) {
|
|
$this->_form =& $args["form"];
|
|
} else {
|
|
$this->_form =& retrieve_form();
|
|
}
|
|
// The current record
|
|
if (array_key_exists("current", $args)) {
|
|
$this->_cur =& $args["current"];
|
|
} elseif (array_key_exists("CURRENT", $GLOBALS)) {
|
|
$this->_cur =& $GLOBALS["CURRENT"];
|
|
}
|
|
if (!is_null($this->_cur) && array_key_exists("sn", $this->_cur)) {
|
|
$this->_sn = $this->_cur["sn"];
|
|
}
|
|
// If we should process with HTTPS/SSL
|
|
$this->_https = $this->https($args);
|
|
if (is_null($this->_https)) {
|
|
$this->_https = false;
|
|
}
|
|
// If the form contains file uploads (multipart/form-data)
|
|
if (array_key_exists("isupload", $args) && $this->_type != "del") {
|
|
$this->_isupload = $args["isupload"];
|
|
}
|
|
// The deletion text
|
|
if (array_key_exists("deltext", $args)) {
|
|
$this->_deltext = $args["deltext"];
|
|
} else {
|
|
$this->_deltext = C_("Delete it");
|
|
}
|
|
// The deletion confirmation prompt
|
|
if (array_key_exists("delprompt", $args)) {
|
|
$this->_delprompt = $args["delprompt"];
|
|
} else {
|
|
$this->_delprompt = C_("Are you sure you want to delete it? It cannot be recovered.");
|
|
}
|
|
// If this record can be deleted
|
|
if (array_key_exists("nodelete", $args)) {
|
|
$this->_nodelete = $args["nodelete"];
|
|
}
|
|
// The prefix message to display before the form
|
|
if (array_key_exists("prefmsg", $args)) {
|
|
$this->_prefmsg = array_merge($this->_prefmsg, $args["prefmsg"]);
|
|
}
|
|
// The mark
|
|
if (array_key_exists("mark", $args)) {
|
|
$this->_mark = $args["mark"];
|
|
} else {
|
|
$this->_mark = C_("<span class=\"mark\">*</span>");
|
|
}
|
|
// The columns to mark
|
|
if (array_key_exists("markcols", $args)) {
|
|
$this->_markcols = $args["markcols"];
|
|
}
|
|
// The prompt message for the marked columns
|
|
if (array_key_exists("markmsg", $args)) {
|
|
$this->_markmsg = $args["markmsg"];
|
|
}
|
|
// The hidden columns
|
|
if (array_key_exists("hidcols", $args)) {
|
|
$this->_hidcols = $args["hidcols"];
|
|
}
|
|
// The buttons to show before and after the form
|
|
if (array_key_exists("header_buttons", $args)) {
|
|
$this->_header_buttons = $args["header_buttons"];
|
|
}
|
|
if (array_key_exists("footer_buttons", $args)) {
|
|
$this->_footer_buttons = $args["footer_buttons"];
|
|
}
|
|
// If we should show the form
|
|
if (array_key_exists("show_form", $args)) {
|
|
$this->_show_form = $args["show_form"];
|
|
}
|
|
// If we should show the table
|
|
if (array_key_exists("show_table", $args)) {
|
|
$this->_show_table = $args["show_table"];
|
|
}
|
|
// The table summary
|
|
if (array_key_exists("summary", $args)) {
|
|
$this->_summary = $args["summary"];
|
|
} else {
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$this->_summary = C_("This table provides you a form to add a new data record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$this->_summary = C_("This table provides you a form to update a current data record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$this->_summary = C_("This table provides you a form to delete a data record.");
|
|
break;
|
|
}
|
|
}
|
|
// The form class
|
|
if (array_key_exists("class", $args)) {
|
|
$this->_class = $args["class"];
|
|
}
|
|
// The onsubmit javascript form checker
|
|
if (array_key_exists("onsubmit", $args)) {
|
|
$this->_onsubmit = $args["onsubmit"];
|
|
}
|
|
// The colspan for each normal <td> cell
|
|
if (array_key_exists("colspan", $args)) {
|
|
$this->_colspan = $args["colspan"];
|
|
}
|
|
// The default input box size
|
|
if (array_key_exists("defsize", $args)) {
|
|
$this->_defsize = $args["defsize"];
|
|
}
|
|
// The process URL.
|
|
if (array_key_exists("procurl", $args)) {
|
|
$this->_procurl = $args["procurl"];
|
|
} elseif ($this->_https) {
|
|
if (defined("VIRTUAL_HOST") && !VIRTUAL_HOST) {
|
|
$this->_procurl = "https://" . https_host() . REQUEST_PATH;
|
|
} else {
|
|
$this->_procurl = "https://" . https_host() . "/" . PACKAGE . REQUEST_PATH;
|
|
}
|
|
} else {
|
|
$this->_procurl = REQUEST_FILE;
|
|
}
|
|
// The columns to display
|
|
if (array_key_exists("cols", $args)) {
|
|
$this->_cols = $args["cols"];
|
|
} elseif (!is_null($this->_table)) {
|
|
$this->_cols = sql_cols($this->_table);
|
|
}
|
|
// Should we automatically keep our HTTP_REFERER
|
|
if (array_key_exists("auto_referer2", $args)) {
|
|
$this->_auto_referer2 = $args["auto_referer2"];
|
|
}
|
|
// The title
|
|
if (array_key_exists("title", $args)) {
|
|
$this->title = $args["title"];
|
|
} else {
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$this->title = C_("Add a New Data Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$this->title = C_("Update a Current Data Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$this->title = C_("Delete a Data Record");
|
|
break;
|
|
}
|
|
}
|
|
// The preview link
|
|
if (array_key_exists("preview", $args)) {
|
|
$this->_preview = $args["preview"];
|
|
}
|
|
if ($this->_preview) {
|
|
if (array_key_exists("prevmsg", $args)) {
|
|
$this->_prevmsg = $args["prevmsg"];
|
|
} else {
|
|
$this->_prevmsg = C_("Preview it.");
|
|
}
|
|
}
|
|
// The caller form and form ID.
|
|
$CURFORM =& curform();
|
|
if ( array_key_exists("caller", $args)
|
|
&& array_key_exists("cformid", $args)) {
|
|
$this->_is_called_form = true;
|
|
$this->_caller = $args["caller"];
|
|
$this->_cformid = $args["cformid"];
|
|
} elseif ( array_key_exists("caller", $CURFORM)
|
|
&& array_key_exists("cformid", $CURFORM)) {
|
|
$this->_is_called_form = true;
|
|
$this->_caller = $CURFORM["caller"];
|
|
$this->_cformid = $CURFORM["cformid"];
|
|
}
|
|
|
|
// Initialize the first form
|
|
if (count($this->_form) == 0) {
|
|
$this->_is_first_form = true;
|
|
if (!is_null($this->_cur)) {
|
|
// ...with the current item
|
|
$this->_form = $this->_cur;
|
|
}
|
|
}
|
|
if (!is_null($this->_table)) {
|
|
$this->_mlcols = sql_cols_ml($this->_table);
|
|
$this->_maxlens = sql_col_lens($this->_table);
|
|
}
|
|
|
|
// Check the columns to display
|
|
foreach ($this->_cols as $col) {
|
|
if (!method_exists($this, "_html_col_$col")) {
|
|
trigger_error("Called an undefined form column \"$col\"", E_USER_ERROR);
|
|
}
|
|
}
|
|
|
|
// Set the referer2 (the place to return when we finished the form)
|
|
if ($this->_is_called_form) {
|
|
// Referer specified
|
|
$CALLINGFORM =& retrieve_form($this->_cformid);
|
|
if (array_key_exists("referer2", $CALLINGFORM)) {
|
|
$this->_referer2 = $CALLINGFORM["referer2"];
|
|
}
|
|
// First form
|
|
} elseif ($this->_is_first_form) {
|
|
// Referer specified
|
|
if (array_key_exists("referer", $CURFORM)) {
|
|
$this->_referer2 = $CURFORM["referer"];
|
|
// Keep the source referer
|
|
} elseif ( $this->_auto_referer2
|
|
&& array_key_exists("HTTP_REFERER", $_SERVER)
|
|
&& substr($_SERVER["HTTP_REFERER"], 0, strlen(REQUEST_HOSTPORT)+1) == REQUEST_HOSTPORT . "/") {
|
|
$this->_referer2 = $_SERVER["HTTP_REFERER"];
|
|
}
|
|
// A subsequent form
|
|
} else {
|
|
// Maintain the previous referer2
|
|
if (array_key_exists("referer2", $this->_form)) {
|
|
$this->_referer2 = $this->_form["referer2"];
|
|
}
|
|
}
|
|
// Remove statid from referer2
|
|
if (!is_null($this->_referer2)) {
|
|
$this->_referer2 = rem_get_arg($this->_referer2, "statid");
|
|
}
|
|
|
|
// The prefix of where to return after form is processed
|
|
// No need to have it if we have a proper referer2 to return to
|
|
if (is_null($this->_referer2) && $this->_https) {
|
|
$this->_hostport = REQUEST_HOSTPORT;
|
|
}
|
|
}
|
|
|
|
// html: Display the HTML form table
|
|
function html()
|
|
{
|
|
// Display the form header
|
|
$this->_html_form_header();
|
|
// Display the table header
|
|
$this->_html_table_header();
|
|
// Display each column
|
|
foreach ($this->_cols as $col) {
|
|
call_user_func(array(&$this, "_html_col_$col"));
|
|
}
|
|
// Display the table footer
|
|
$this->_html_table_footer();
|
|
// Display the form footer
|
|
$this->_html_form_footer();
|
|
return;
|
|
}
|
|
|
|
// https: If we should process with HTTPS/SSL
|
|
function https($args = null)
|
|
{
|
|
// Checked before
|
|
if (!is_null($this->_https)) {
|
|
return $this->_https;
|
|
}
|
|
// Already in HTTPS
|
|
if (is_https()) {
|
|
$this->_https = false;
|
|
return $this->_https;
|
|
}
|
|
// HTTPS specified
|
|
if ( !is_null($args)
|
|
&& array_key_exists("https", $args)
|
|
&& !is_null($args["https"])) {
|
|
$this->_https = $args["https"];
|
|
settype($this->_https, "boolean");
|
|
return $this->_https;
|
|
}
|
|
// Specified in the current form
|
|
$FORM =& curform();
|
|
if (array_key_exists("https", $FORM) && $FORM["https"]) {
|
|
$this->_https = true;
|
|
return $this->_https;
|
|
}
|
|
// Specified in the GET or POST arguments
|
|
$FORM =& get_or_post();
|
|
if (array_key_exists("https", $FORM) && $FORM["https"]) {
|
|
$this->_https = true;
|
|
return $this->_https;
|
|
}
|
|
// Unable to decide it
|
|
return null;
|
|
}
|
|
|
|
/////////////////////////
|
|
// Methods below are private. Do not call them directly.
|
|
/////////////////////////
|
|
/////////////////////////
|
|
// Basic form elements
|
|
/////////////////////////
|
|
// _html_form_header: Display the form header
|
|
function _html_form_header()
|
|
{
|
|
// Don't show the form
|
|
if (!$this->_show_form) {
|
|
?><div<?php
|
|
if (!is_null($this->_class)) {
|
|
?> class="<?php echo h($this->_class); ?>"<?php
|
|
} ?>>
|
|
<?php
|
|
// Display the prefix message
|
|
$this->_html_prefix_message();
|
|
// Display the preview link
|
|
$this->_html_preview_link();
|
|
// Display the prompt for the marked columns
|
|
$this->_html_mark_prompt();
|
|
return;
|
|
}
|
|
|
|
// The meta form information
|
|
$meta = new _Form_MetaCols();
|
|
$meta->add("hidden", "lang", getlang());
|
|
$meta->add("hidden", "charset", getlang(LN_CHARSET));
|
|
if (!is_null($this->_type_to_pass)) {
|
|
$meta->add("hidden", "form", $this->_type_to_pass);
|
|
}
|
|
if (!is_null($this->_step)) {
|
|
$meta->add("hidden", "step", $this->_step);
|
|
}
|
|
if (!is_null($this->_sn)) {
|
|
$meta->add("hidden", "sn", $this->_sn);
|
|
}
|
|
if (!is_null($this->_req)) {
|
|
$meta->add("hidden", "req", $this->_req);
|
|
}
|
|
if ($this->_is_called_form) {
|
|
$meta->add("hidden", "caller", $this->_caller);
|
|
$meta->add("hidden", "cformid", $this->_cformid);
|
|
}
|
|
if ($this->_https) {
|
|
$meta->add("hidden", "https", 1);
|
|
$meta->add("hidden", "referer", REQUEST_HOSTPATH);
|
|
$meta->add("hidden", session_name(), session_id());
|
|
}
|
|
if (!is_null($this->_referer2)) {
|
|
$meta->add("hidden", "referer2", $this->_referer2);
|
|
} elseif (!is_null($this->_hostport)) {
|
|
$meta->add("hidden", "hostport", $this->_hostport);
|
|
}
|
|
if (!is_null($this->_hidcols)) {
|
|
for ($i = 0; $i < count($this->_hidcols); $i++) {
|
|
$meta->add("hidden", $this->_hidcols[$i]["name"], $this->_hidcols[$i]["value"]);
|
|
}
|
|
}
|
|
|
|
// The submit buttons
|
|
if (!is_null($this->_header_buttons)) {
|
|
foreach ($this->_header_buttons as $button) {
|
|
$meta->add("submit", $button["name"], $button["value"]);
|
|
}
|
|
// Apply the default submit buttons
|
|
} else {
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$meta->add("submit", null, C_("Preview"));
|
|
$meta->add("submit", "confirm", C_("Confirm and submit"));
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$meta->add("submit", null, C_("Preview"));
|
|
$meta->add("submit", "confirm", C_("Confirm and submit"));
|
|
if (!$this->_nodelete) {
|
|
$meta->add("submit", "del", $this->_deltext);
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Output the form header
|
|
?><form<?php
|
|
if (!is_null($this->_class)) {
|
|
?> class="<?php echo h($this->_class); ?>"<?php
|
|
} ?> action="<?php echo h($this->_procurl); ?>" method="post"
|
|
accept-charset="<!--monica:charset-->"<?php
|
|
if ($this->_isupload) {
|
|
?> enctype="multipart/form-data"<?php
|
|
}
|
|
if (!is_null($this->_onsubmit)) {
|
|
?> onsubmit="<?php echo h($this->_onsubmit); ?>"<?php
|
|
} ?>>
|
|
<?php
|
|
// Display the prefix message
|
|
$this->_html_prefix_message();
|
|
// Display the preview link
|
|
$this->_html_preview_link();
|
|
// Display the prompt for the marked columns
|
|
$this->_html_mark_prompt();
|
|
?><div>
|
|
<?php
|
|
// Output the meta form information
|
|
$meta->out();
|
|
return;
|
|
}
|
|
|
|
// _html_prefix_message: Display the prefix message
|
|
function _html_prefix_message()
|
|
{
|
|
// Show each prefix message
|
|
foreach ($this->_prefmsg as $msg) {
|
|
?><p class="prefmsg"><?php echo h_abbr($msg); ?></p>
|
|
|
|
<?php
|
|
}
|
|
return;
|
|
}
|
|
|
|
// _html_preview_link: Display the link for the preview
|
|
function _html_preview_link()
|
|
{
|
|
// Bounce when preview is not available for this form
|
|
if (!$this->_preview) {
|
|
return;
|
|
}
|
|
// No preview on following forms that cannot be previewed
|
|
if (!$this->_is_first_form) {
|
|
if ( is_null($this->_status)
|
|
|| !array_key_exists("preview", $this->_status)
|
|
|| !$this->_status["preview"]) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
$cols = array();
|
|
$cols[] = "form=preview";
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
// No preview for the first blank form
|
|
if ($this->_is_first_form) {
|
|
return;
|
|
} else {
|
|
$cols[] = "sn=" . urlencode($this->_form["formid"]);
|
|
}
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// Make a suspended form and get the form ID.
|
|
if ($this->_is_first_form) {
|
|
$cols[] = "sn=" . urlencode($this->_sn);
|
|
$cols[] = "source=db";
|
|
} else {
|
|
$cols[] = "sn=" . urlencode($this->_form["formid"]);
|
|
}
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
// No preview for the deletion form
|
|
return;
|
|
break;
|
|
}
|
|
$url = REQUEST_FILE . "?" . implode("&", $cols);
|
|
|
|
?><p><a href="<?php echo h($url); ?>"><?php
|
|
echo h($this->_prevmsg); ?></a></p>
|
|
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_mark_prompt: Display the prompt for the marked columns
|
|
function _html_mark_prompt()
|
|
{
|
|
// Bounce when there is no prompt message or no mark to use
|
|
if (is_null($this->_markmsg) || is_null($this->_mark)) {
|
|
return;
|
|
}
|
|
?><p><?php printf(h($this->_markmsg), $this->_mark); ?></p>
|
|
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_table_header: Display the table header
|
|
function _html_table_header()
|
|
{
|
|
// Don't show the table
|
|
if (!$this->_show_table) {
|
|
return;
|
|
}
|
|
// No table header for the mass deletion form
|
|
if ($this->_type == "massdel") {
|
|
return;
|
|
}
|
|
// Output the table header
|
|
?><table summary="<?php echo h($this->_summary); ?>">
|
|
<colgroup><col /><?php
|
|
if ($this->_type == "cur") {
|
|
?><col /><?php
|
|
}
|
|
for ($i = 0; $i < $this->_colspan; $i++) {
|
|
?><col /><?php
|
|
} ?></colgroup>
|
|
<tbody>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_table_footer: Display the table footer
|
|
function _html_table_footer()
|
|
{
|
|
// Don't show the table
|
|
if (!$this->_show_table) {
|
|
return;
|
|
}
|
|
// No table footer for the mass deletion form
|
|
if ($this->_type == "massdel") {
|
|
return;
|
|
}
|
|
// Output the table footer
|
|
?></tbody>
|
|
</table>
|
|
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_form_footer: Display the form footer
|
|
function _html_form_footer()
|
|
{
|
|
// Don't show the form
|
|
if (!$this->_show_form) {
|
|
// Display additional feedback information at the end
|
|
$this->_html_feedback();
|
|
?></div>
|
|
|
|
<?php
|
|
return;
|
|
}
|
|
// The meta form information
|
|
$meta = new _Form_MetaCols();
|
|
// The submit buttons
|
|
if (!is_null($this->_footer_buttons)) {
|
|
foreach ($this->_footer_buttons as $button) {
|
|
$meta->add("submit", $button["name"], $button["value"]);
|
|
}
|
|
// Apply the default submit buttons
|
|
} else {
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$meta->add("submit", null, C_("Preview"));
|
|
$meta->add("submit", "confirm", C_("Confirm and submit"));
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$meta->add("submit", null, C_("Preview"));
|
|
$meta->add("submit", "confirm", C_("Confirm and submit"));
|
|
if (!$this->_nodelete) {
|
|
$meta->add("submit", "del", $this->_deltext);
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
// A form to delete a list of item
|
|
case "massdel":
|
|
$meta->add("submit", "confirm", C_("Delete"));
|
|
$meta->add("submit", "cancel", C_("Cancel"));
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Output the deletion confirmation prompt
|
|
if (!is_null($this->_delprompt)) {
|
|
switch ($this->_type) {
|
|
// A form to delete a current item
|
|
case "del":
|
|
// A form to delete a list of item
|
|
case "massdel":
|
|
?><p><?php echo h($this->_delprompt); ?></p>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
// Output the meta form information
|
|
$meta->out();
|
|
// Display additional feedback information at the end
|
|
$this->_html_feedback();
|
|
// Output the form footer
|
|
?></div>
|
|
</form>
|
|
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_feedback: Display additional feedback information at the end
|
|
// This is initially empty. Membership system quitting needs it.
|
|
function _html_feedback()
|
|
{
|
|
return;
|
|
}
|
|
|
|
/////////////////////////
|
|
// Column templates
|
|
/////////////////////////
|
|
// _html_coltmpl_ro: Display a read-only normal column
|
|
function _html_coltmpl_ro($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_textarea: Display a read-only textarea column
|
|
function _html_coltmpl_ro_textarea($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_textarea($col);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_bool: Display a read-only boolean column
|
|
function _html_coltmpl_ro_bool($col, $label, $true, $false, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
$text = $this->_cur[$col]? $true: $false;
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($text);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_user: Display a read-only user column
|
|
function _html_coltmpl_ro_user($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(username($this->_cur[$col]));
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_date: Display a read-only date column
|
|
function _html_coltmpl_ro_date($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
// We work with Unix epoch time
|
|
$date = $this->_cur[$col];
|
|
if (is_null($date)) {
|
|
$date = t_none();
|
|
} else {
|
|
$date = is_int($date)? $date: strtotime($date);
|
|
$date = date("Y-m-d", $date);
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($date);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_datetime: Display a read-only date-time column
|
|
function _html_coltmpl_ro_datetime($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
// We work with Unix epoch time
|
|
$date = $this->_cur[$col];
|
|
if (is_null($date)) {
|
|
$date = t_none();
|
|
} else {
|
|
// ISO date-time with miniseconds cannot be read by strtotime()
|
|
if (preg_match("/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).(\d+)$/", $date, $m)) {
|
|
$date = strtotime($m[1]);
|
|
$nsec = ("0.".$m[2])*1000000;
|
|
// Unix epoch with miniseconds cannot be read by strtotime()
|
|
} elseif (preg_match("/^(\d+).(\d+)$/", $date, $m)) {
|
|
$date = $m[1];
|
|
$nsec = ("0.".$m[2])*1000000;
|
|
} else {
|
|
$date = is_int($date)? $date: strtotime($date);
|
|
$nsec = null;
|
|
}
|
|
$date = date("Y-m-d H:i:s", $date);
|
|
if (!is_null($nsec)) {
|
|
$date .= ".$nsec";
|
|
}
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($date);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_lang: Display a read-only language column
|
|
function _html_coltmpl_ro_lang($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
$lang = !is_null($this->_cur[$col])?
|
|
ln($this->_cur[$col], LN_DESC_CURLC): t_none();
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($lang);
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_ct: Display a read-only country column
|
|
function _html_coltmpl_ro_ct($col, $label, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(ctname($this->_cur[$col]));
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_title: Display a read-only column with a title function
|
|
function _html_coltmpl_ro_title($col, $label, $titlefunc, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col]));
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_ro_radio: Display a read-only column with a option list
|
|
function _html_coltmpl_ro_radio($col, $label, $opts, $prompt = null)
|
|
{
|
|
if (is_null($this->_cur)) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $found = false; $i < count($opts); $i++) {
|
|
if ($this->_cur[$col] == $opts[$i]["val"]) {
|
|
$found = true;
|
|
echo h_abbr($opts[$i]["title"]);
|
|
break;
|
|
}
|
|
}
|
|
if (!$found) {
|
|
echo h_abbr(t_na());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_loop_pic: Display an instance of a list of pictures
|
|
function _html_coltmpl_loop_pic($i)
|
|
{
|
|
// Obtain the picture deposit
|
|
$PICS =& pic_deposit();
|
|
$setpic = C_("Set the picture");
|
|
$delpic = C_("Delete this picture");
|
|
$col = "pic$i";
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$newalt = C_("Picture preview");
|
|
$rows_new = 1;
|
|
if ( !is_null($this->_form($col . "pic"))
|
|
&& pic_exists($this->_form($col . "pic"))) {
|
|
$rows_new = 2;
|
|
}
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($rows_new != 1) {
|
|
?> rowspan="<?php echo h($rows_new); ?>"<?php
|
|
} ?> scope="row"><label for="set<?php echo h($col); ?>"><?php
|
|
$this->_mark($col . "pic"); echo h_abbr(sprintf(C_("Picture #%d:"), $i + 1)); ?></label></th>
|
|
<?php
|
|
if (is_null($this->_form($col . "pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php echo h_abbr(t_none()); ?><input
|
|
id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} elseif (!pic_exists($this->_form($col . "pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php echo h_abbr(t_na()); ?><input
|
|
id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan(); ?>><input type="hidden" name="<?php echo h($col); ?>pic"<?php
|
|
$this->_val_text($col . "pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form($col . "pic")];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" /><input
|
|
id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delpic); ?>" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><label for="<?php echo h($col); ?>cap"><?php
|
|
$this->_mark($col . "cap"); echo h_abbr(C_("Caption:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>cap" class="text" type="text" name="<?php echo h($col); ?>cap" size="40"<?php
|
|
$this->_val_text($col . "cap", "piccap"); ?> /></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$origalt = C_("Original picture preview");
|
|
$newalt = C_("New picture preview");
|
|
$rows_new = 1;
|
|
if ( !is_null($this->_form($col . "pic"))
|
|
&& pic_exists($this->_form($col . "pic"))) {
|
|
$rows_new = 2;
|
|
}
|
|
$rows_cur = 1;
|
|
if ( array_key_exists($col . "pic", $this->_cur)
|
|
&& !is_null($this->_cur[$col . "pic"])) {
|
|
$rows_cur = 2;
|
|
}
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($rows_new + $rows_cur != 1) {
|
|
?> rowspan="<?php echo h($rows_new + $rows_cur); ?>"<?php
|
|
} ?> scope="row"><label for="set<?php echo h($col); ?>"><?php
|
|
$this->_mark($col . "pic"); echo h_abbr(sprintf(C_("Picture #%d:"), $i + 1)); ?></label></th>
|
|
<th class="oldnew"<?php
|
|
if ($rows_cur != 1) {
|
|
?> rowspan="<?php echo h($rows_cur); ?>"<?php
|
|
} ?> scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (is_null($this->_cur[$col . "pic"])) {
|
|
echo h_abbr(t_none());
|
|
} elseif ($this->_cur[$col . "pic"] === false) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
$pic =& $PICS[$this->_cur[$col . "pic"]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
echo " ";
|
|
}
|
|
?></td>
|
|
<?php
|
|
if ( array_key_exists($col . "pic", $this->_cur)
|
|
&& !is_null($this->_cur[$col . "pic"])) {
|
|
?></tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php
|
|
$this->_mark($col . "cap"); echo h_abbr(C_("Caption:")); ?></th>
|
|
<td<?php $this->_colspan(-1); ?>><?php
|
|
$this->_cval_text($col . "cap"); ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<tr>
|
|
<th class="oldnew"<?php
|
|
if ($rows_new != 1) {
|
|
?> rowspan="<?php echo h($rows_new); ?>"<?php
|
|
} ?> scope="row"><label for="set<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
if (is_null($this->_form($col . "pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?><input
|
|
id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" />
|
|
</td>
|
|
<?php
|
|
} elseif (!pic_exists($this->_form($col . "pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_na()); ?><input
|
|
id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" />
|
|
</td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan(); ?>><input type="hidden" name="<?php echo h($col); ?>pic"<?php
|
|
$this->_val_text($col . "pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form($col . "pic")];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input id="set<?php echo h($col); ?>" type="submit" name="set<?php echo h($col); ?>" value="<?php echo h($setpic); ?>" /><input
|
|
id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delpic); ?>" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><label for="<?php echo h($col); ?>cap"><?php
|
|
$this->_mark($col . "cap"); echo h_abbr(C_("Caption:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>cap" class="text" type="text" name="<?php echo h($col); ?>cap" size="40"<?php
|
|
$this->_val_text($col . "cap", "piccap"); ?> /></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
$origalt = C_("Picture preview");
|
|
$rows_cur = 2;
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($rows_cur != 1) {
|
|
?> rowspan="<?php echo h($rows_cur); ?>"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col . "pic"); echo h_abbr(sprintf(C_("Picture #%d:"), $i)); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (is_null($this->_cur[$col . "pic"])) {
|
|
echo h_abbr(t_none());
|
|
} elseif ($this->_cur[$col . "pic"] === false) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
$pic =& $PICS[$this->_cur[$col . "pic"]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
echo " ";
|
|
?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php
|
|
$this->_mark($col . "cap"); echo h_abbr(C_("Caption:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col . "cap");
|
|
}
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_act_bool: Display a action boolean column
|
|
function _html_coltmpl_act_bool($col, $text, $prompt = null)
|
|
{
|
|
?><tr>
|
|
<td<?php $this->_colspan_full();
|
|
?>><input id="<?php echo h($col); ?>" type="checkbox" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_check($col); ?> />
|
|
<label for="<?php echo h($col); ?>"><?php echo h_abbr($text); ?></label>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
return;
|
|
}
|
|
|
|
// _html_coltmpl_text: Display a text column
|
|
function _html_coltmpl_text($col, $label, $prompt = null, $size = null)
|
|
{
|
|
if (is_null($size)) {
|
|
$size = $this->_defsize;
|
|
$class = " class=\"text\"";
|
|
} else {
|
|
$class = "";
|
|
}
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col . "_$lndbdef"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_text_null: The nullable text column
|
|
function _html_coltmpl_text_null($col, $label, $nullcol, $nulllabel, $prompt = null, $size = null)
|
|
{
|
|
if (is_null($size)) {
|
|
$size = $this->_defsize;
|
|
$class = " class=\"textnull\"";
|
|
} else {
|
|
$class = "";
|
|
}
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
if ($this->_is_first_form) {
|
|
$this->_form[$nullcol] = is_null($this->_form($col))?
|
|
"true": "false";
|
|
}
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($this->_cur[$col])? h($this->_cur[$col]):
|
|
h($nulllabel); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($this->_cur[$col])? h($this->_cur[$col]):
|
|
h($nulllabel); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_textarea: Display a textarea column
|
|
function _html_coltmpl_textarea($col, $label, $default, $prompt = null, $rows = 10, $cols = null)
|
|
{
|
|
if (is_null($cols)) {
|
|
$cols = $this->_defsize;
|
|
}
|
|
$id = ($col == "body"? "fbody": $col);
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><textarea id="<?php echo h($id); ?>" name="<?php echo h($col); ?>" cols="<?php echo h($cols); ?>" rows="<?php echo h($rows); ?>"
|
|
onfocus="if (this.value == "<?php echo h($default); ?>") this.value = "";"><?php
|
|
$this->_val_textarea($col, $default); ?></textarea><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_textarea($col . "_$lndbdef"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_textarea($col); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($id); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($id); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><textarea id="<?php echo h($id); ?>" name="<?php echo h($col); ?>" cols="<?php echo h($cols); ?>" rows="<?php echo h($rows); ?>"
|
|
onfocus="if (this.value == "<?php echo h($default); ?>") this.value = "";"><?php
|
|
$this->_val_textarea($col, $default); ?></textarea><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_textarea($col); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_textarea_hideshow: Display a textarea column that can taggle shown/hidden of the current content
|
|
function _html_coltmpl_textarea_hideshow($col, $label, $default, $prompt = null, $rows = 10, $cols = null)
|
|
{
|
|
if (is_null($cols)) {
|
|
$cols = $this->_defsize;
|
|
}
|
|
$id = ($col == "body"? "fbody": $col);
|
|
$hide = C_("Hide");
|
|
$show = C_("Show");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><textarea id="<?php echo h($id); ?>" name="<?php echo h($col); ?>" cols="<?php echo h($cols); ?>" rows="<?php echo h($rows); ?>"
|
|
onfocus="if (this.value == "<?php echo h($default); ?>") this.value = "";"><?php
|
|
$this->_val_textarea($col, $default); ?></textarea><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
if ( !array_key_exists($col . "hidden", $this->_form)
|
|
|| $this->_form[$col . "hidden"] != "no") {
|
|
$this->_form[$col . "hidden"] = "yes";
|
|
}
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
if ( !array_key_exists($col . "defhidden", $this->_form)
|
|
|| $this->_form[$col . "defhidden"] != "no") {
|
|
$this->_form[$col . "defhidden"] = "yes";
|
|
}
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($id); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><input
|
|
type="hidden" name="<?php echo h($col); ?>defhidden"<?php
|
|
$this->_val_text($col . "defhidden"); ?> /><?php
|
|
if ($this->_form[$col . "defhidden"] == "yes") {
|
|
?><input
|
|
id="show<?php echo h($col); ?>def" type="submit" name="show<?php echo h($col); ?>def" value="<?php echo h($show); ?>" /><?php
|
|
} else {
|
|
?><input
|
|
id="hide<?php echo h($col); ?>def" type="submit" name="hide<?php echo h($col); ?>def" value="<?php echo h($hide); ?>" /><br />
|
|
<?php
|
|
$this->_cval_textarea($col . "_$lndbdef");
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><input
|
|
type="hidden" name="<?php echo h($col); ?>hidden"<?php
|
|
$this->_val_text($col . "hidden"); ?> /><?php
|
|
if ($this->_form[$col . "hidden"] == "yes") {
|
|
?><input
|
|
id="show<?php echo h($col); ?>" type="submit" name="show<?php echo h($col); ?>" value="<?php echo h($show); ?>" /><?php
|
|
} else {
|
|
?><input
|
|
id="hide<?php echo h($col); ?>" type="submit" name="hide<?php echo h($col); ?>" value="<?php echo h($hide); ?>" /><br />
|
|
<?php
|
|
$this->_cval_textarea($col);
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($id); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($id); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><textarea id="<?php echo h($id); ?>" name="<?php echo h($col); ?>" cols="<?php echo h($cols); ?>" rows="<?php echo h($rows); ?>"
|
|
onfocus="if (this.value == "<?php echo h($default); ?>") this.value = "";"><?php
|
|
$this->_val_textarea($col, $default); ?></textarea><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if ( array_key_exists("show$col", $this->_form)
|
|
&& !array_key_exists("hide$col", $this->_form)) {
|
|
?><input
|
|
id="hide<?php echo h($col); ?>" type="submit" name="hide<?php echo h($col); ?>" value="<?php echo h($hide); ?>" /><br />
|
|
<?php
|
|
$this->_cval_textarea($col);
|
|
} else {
|
|
?><input
|
|
id="show<?php echo h($col); ?>" type="submit" name="show<?php echo h($col); ?>" value="<?php echo h($show); ?>" /><?php
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_bool: Display a boolean column
|
|
function _html_coltmpl_bool($col, $label, $true, $false, $text, $prompt = null)
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="checkbox" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_check($col); ?> />
|
|
<label for="<?php echo h($col); ?>"><?php echo h_abbr($text); ?></label>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr($this->_cur[$col]? $true: $false); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="checkbox" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_check($col); ?> />
|
|
<label for="<?php echo h($col); ?>"><?php echo h_abbr($text); ?></label>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr($this->_cur[$col]? $true: $false); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_call: The call selection column
|
|
function _html_coltmpl_call($col, $label, $titlefunc, $prompt = null)
|
|
{
|
|
// "" means not selected yet
|
|
if ( array_key_exists($col, $this->_form)
|
|
&& $this->_form[$col] == "") {
|
|
unset($this->_form[$col]);
|
|
}
|
|
$choose = C_("Choose");
|
|
$delete = C_("Delete");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="sel<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><label for="sel<?php echo h($col); ?>"><?php echo h(call_user_func($titlefunc, $this->_form($col))); ?></label>
|
|
<?php
|
|
if (!is_null($this->_form($col))) {
|
|
?> <input id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delete); ?>" /><input
|
|
id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
} else {
|
|
?> <input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
}
|
|
?> <input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="sel<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="sel<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><label for="sel<?php echo h($col); ?>"><?php echo h(call_user_func($titlefunc, $this->_form($col))); ?></label>
|
|
<?php
|
|
if (!is_null($this->_form($col))) {
|
|
?> <input id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delete); ?>" /><input
|
|
id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
} else {
|
|
?> <input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
}
|
|
?> <input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_call_null: The nullable call selection column
|
|
function _html_coltmpl_call_null($col, $label, $nullcol, $nulllabel, $titlefunc, $prompt = null)
|
|
{
|
|
// "" means not selected yet
|
|
if ( array_key_exists($col, $this->_form)
|
|
&& $this->_form[$col] == "") {
|
|
unset($this->_form[$col]);
|
|
}
|
|
$choose = C_("Choose");
|
|
$delete = C_("Delete");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="sel<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<label for="not<?php echo h($nullcol); ?>"><?php echo h(call_user_func($titlefunc, $this->_form($col))); ?></label>
|
|
<?php
|
|
if (!is_null($this->_form($col))) {
|
|
?> <input id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delete); ?>" /><input
|
|
id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
} else {
|
|
?> <input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
}
|
|
?> <input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
if ($this->_is_first_form) {
|
|
$this->_form[$nullcol] = is_null($this->_form($col))?
|
|
"true": "false";
|
|
}
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="sel<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($this->_cur[$col])?
|
|
h(call_user_func($titlefunc, $this->_cur[$col])):
|
|
h($nulllabel); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="sel<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<label for="not<?php echo h($nullcol); ?>"><?php echo h(call_user_func($titlefunc, $this->_form($col))); ?></label>
|
|
<?php
|
|
if (!is_null($this->_form($col))) {
|
|
?> <input id="del<?php echo h($col); ?>" type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delete); ?>" /><input
|
|
id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
} else {
|
|
?> <input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
}
|
|
?> <input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($this->_cur[$col])?
|
|
h(call_user_func($titlefunc, $this->_cur[$col])):
|
|
h($nulllabel); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_call_recent: The recently-used call selection column
|
|
function _html_coltmpl_call_recent($col, $label, $optfunc, $titlefunc, $prompt = null)
|
|
{
|
|
// "" means not selected yet
|
|
if ( array_key_exists($col, $this->_form)
|
|
&& $this->_form[$col] == "") {
|
|
unset($this->_form[$col]);
|
|
}
|
|
$choose = C_("Choose");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><select id="<?php echo h($col); ?>" name="<?php echo h($col); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_table, $this->_form($col));
|
|
?> </select>
|
|
<input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
if ($this->_is_first_form) {
|
|
$this->_form[$col . "userecent"] = "true";
|
|
}
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><select id="<?php echo h($col); ?>" name="<?php echo h($col); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_table, $this->_form($col));
|
|
?> </select>
|
|
<input id="sel<?php echo h($col); ?>" type="submit" name="sel<?php echo h($col); ?>" value="<?php echo h($choose); ?>" />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_select: The selection column
|
|
function _html_coltmpl_select($col, $label, $optfunc, $titlefunc, $prompt = null)
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><select id="<?php echo h($col); ?>" name="<?php echo h($col); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_form($col));
|
|
?> </select>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><select id="<?php echo h($col); ?>" name="<?php echo h($col); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_form($col));
|
|
?> </select>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(call_user_func($titlefunc, $this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_select_multi: The multiple selection column
|
|
function _html_coltmpl_select_multi($col, $label, $optfunc, $prompt = null)
|
|
{
|
|
// Find the last used category index, and append 3 blank selections
|
|
for ($i = 0; array_key_exists("$col$i", $this->_form); $i++) { }
|
|
for ($i--; $i >= 0 && $this->_form["$col$i"] == ""; $i--) { };
|
|
$count = $i + 3;
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>0"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); $i <= $count; $i++) {
|
|
ob_start();
|
|
?> <li><select id="<?php echo h($col . $i); ?>" name="<?php echo h($col . $i); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_form("$col$i"));
|
|
?> </select>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
$htmls = array();
|
|
if (count($items) > 0) {
|
|
$htmls[] = "<ul>\n" . implode("", $items) . " </ul>\n";
|
|
}
|
|
if (!is_null($prompt)) {
|
|
$htmls[] = "<p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
if (count($htmls) > 0) {
|
|
echo implode(" ", $htmls) . " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>0"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); array_key_exists("$col$i", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["$col$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>0"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); $i <= $count; $i++) {
|
|
ob_start();
|
|
?> <li><select id="<?php echo h($col . $i); ?>" name="<?php echo h($col . $i); ?>">
|
|
<?php echo call_user_func($optfunc, $this->_form("$col$i"));
|
|
?> </select>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
$htmls = array();
|
|
if (count($items) > 0) {
|
|
$htmls[] = "<ul>\n" . implode("", $items) . " </ul>\n";
|
|
}
|
|
if (!is_null($prompt)) {
|
|
$htmls[] = "<p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
if (count($htmls) > 0) {
|
|
echo implode(" ", $htmls) . " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); array_key_exists("$col$i", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["$col$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_radio: The radio column
|
|
function _html_coltmpl_radio($col, $label, $opts, $prompt = null, $oneline = false)
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$coldef = $col . (array_key_exists("id", $opts[0])?
|
|
$opts[0]["id"]: $opts[0]["val"]);
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($coldef); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); $i < count($opts); $i++) {
|
|
$val = $opts[$i]["val"];
|
|
$title = $opts[$i]["title"];
|
|
$id = $col . (array_key_exists("id", $opts[$i])?
|
|
$opts[$i]["id"]: $opts[$i]["val"]);
|
|
ob_start();
|
|
?> <li><input id="<?php echo h($id); ?>" type="radio" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_radio($col, $val); ?> />
|
|
<label for="<?php echo h($id); ?>"><?php echo h_abbr($title); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
$htmls = array();
|
|
if (count($items) > 0) {
|
|
$htmls[] = "<ul" . ($oneline? " class=\"oneline\"": "")
|
|
. ">\n" . implode("", $items) . " </ul>\n ";
|
|
}
|
|
if (!is_null($prompt)) {
|
|
$htmls[] = "<p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
if (count($htmls) > 0) {
|
|
echo implode(" ", $htmls) . " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$coldef = $col . (array_key_exists("id", $opts[0])?
|
|
$opts[0]["id"]: $opts[0]["val"]);
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($coldef); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $found = false; $i < count($opts); $i++) {
|
|
if ($this->_cur[$col] == $opts[$i]["val"]) {
|
|
$found = true;
|
|
echo h_abbr($opts[$i]["title"]);
|
|
break;
|
|
}
|
|
}
|
|
if (!$found) {
|
|
echo h_abbr(t_na());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($coldef); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); $i < count($opts); $i++) {
|
|
$val = $opts[$i]["val"];
|
|
$title = $opts[$i]["title"];
|
|
$id = $col . (array_key_exists("id", $opts[$i])?
|
|
$opts[$i]["id"]: $opts[$i]["val"]);
|
|
ob_start();
|
|
?> <li><input id="<?php echo h($id); ?>" type="radio" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_radio($col, $val); ?> />
|
|
<label for="<?php echo h($id); ?>"><?php echo h_abbr($title); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
$htmls = array();
|
|
if (count($items) > 0) {
|
|
$htmls[] = "<ul" . ($oneline? " class=\"oneline\"": "")
|
|
. ">\n" . implode("", $items) . " </ul>\n ";
|
|
}
|
|
if (!is_null($prompt)) {
|
|
$htmls[] = "<p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
if (count($htmls) > 0) {
|
|
echo implode(" ", $htmls) . " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $found = false; $i < count($opts); $i++) {
|
|
if ($this->_cur[$col] == $opts[$i]["val"]) {
|
|
$found = true;
|
|
echo h_abbr($opts[$i]["title"]);
|
|
break;
|
|
}
|
|
}
|
|
if (!$found) {
|
|
echo h_abbr(t_na());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_file: Display a file-upload column
|
|
function _html_coltmpl_file($col, $label, $prompt = null, $size = null)
|
|
{
|
|
// Obtain the files deposit
|
|
$FILES =& file_deposit();
|
|
if (is_null($size)) {
|
|
$size = $this->_defsize;
|
|
$class = " class=\"text\"";
|
|
} else {
|
|
$class = "";
|
|
}
|
|
$delfile = C_("Delete this file");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$newrowspan = 2;
|
|
if ( !is_null($this->_form($col))
|
|
&& savefile_exists($this->_form($col))) {
|
|
$newrowspan += 2;
|
|
$newfile =& $FILES[$this->_form($col)];
|
|
if (array_key_exists("name", $newfile)) {
|
|
$newrowspan++;
|
|
}
|
|
}
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($newrowspan != 1) {
|
|
?> rowspan="<?php echo h($newrowspan); ?>"<?php
|
|
} ?> scope="row"><label for="up<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
if (is_null($this->_form($col))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?></td>
|
|
<?php
|
|
} elseif (!savefile_exists($this->_form($col))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_na()); ?></td>
|
|
<?php
|
|
} else {
|
|
if (array_key_exists("name", $newfile)) {
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("File name:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($newfile["name"]); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?><tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("MIME file type:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($newfile["type"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("File size:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h_abbr(report_size($newfile["size"])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td<?php $this->_colspan();
|
|
?>><input type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delfile); ?>" /></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<tr>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (array_key_exists($col, $this->_form) && !is_null($this->_form[$col])) {
|
|
?><input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> /><?php
|
|
} ?><input
|
|
id="up<?php echo h($col); ?>"<?php echo $class; ?> type="file" name="up<?php echo h($col); ?>" size="<?php echo h($size); ?>" /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
$rowspan = 0;
|
|
// A multi-lingual column that is not in the default language
|
|
if (in_array($col, $this->_mlcols) && getlang() != DEFAULT_LANG) {
|
|
$srcrowspan = 1;
|
|
$coldef = $col . "_" . $lndbdef;
|
|
if (!is_null($this->_cur[$coldef])) {
|
|
$srcrowspan += 1;
|
|
$curfiledef =& $FILES[$this->_cur[$coldef]];
|
|
if (array_key_exists("name", $curfiledef)) {
|
|
$srcrowspan++;
|
|
}
|
|
}
|
|
$rowspan += $srcrowspan;
|
|
}
|
|
$currowspan = 1;
|
|
if (!is_null($this->_cur[$col])) {
|
|
$currowspan += 1;
|
|
$curfile =& $FILES[$this->_cur[$col]];
|
|
if (array_key_exists("name", $curfile)) {
|
|
$currowspan++;
|
|
}
|
|
}
|
|
$rowspan += $currowspan;
|
|
$newrowspan = 2;
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$coldef])) {
|
|
$newrowspan--;
|
|
}
|
|
if ( !is_null($this->_form($col))
|
|
&& savefile_exists($this->_form($col))) {
|
|
$newrowspan += 2;
|
|
$newfile =& $FILES[$this->_form($col)];
|
|
if (array_key_exists("name", $newfile)) {
|
|
$newrowspan++;
|
|
}
|
|
}
|
|
$rowspan += $newrowspan;
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($rowspan != 1) {
|
|
?> rowspan="<?php echo h($rowspan); ?>"<?php
|
|
} ?> scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
if (in_array($col, $this->_mlcols) && getlang() != DEFAULT_LANG) {
|
|
?> <th class="oldnew"<?php
|
|
if ($srcrowspan != 1) {
|
|
?> rowspan="<?php echo h($srcrowspan); ?>"<?php
|
|
} ?> scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<?php
|
|
if (is_null($this->_cur[$coldef])) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
} else {
|
|
if (array_key_exists("name", $curfiledef)) {
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("File name:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfiledef["name"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("MIME file type:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfiledef["type"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("File size:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h_abbr(report_size($curfiledef["size"])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
}
|
|
?> <th class="oldnew"<?php
|
|
if ($currowspan != 1) {
|
|
?> rowspan="<?php echo h($currowspan); ?>"<?php
|
|
} ?> scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<?php
|
|
if (is_null($this->_cur[$col])) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
if (array_key_exists("name", $curfile)) {
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("File name:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfile["name"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("MIME file type:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfile["type"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("File size:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h_abbr(report_size($curfile["size"])); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?><tr>
|
|
<th class="oldnew"<?php
|
|
if ($newrowspan != 1) {
|
|
?> rowspan="<?php echo h($newrowspan); ?>"<?php
|
|
} ?> scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$coldef])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please upload it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
if (is_null($this->_form($col))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?></td>
|
|
<?php
|
|
} elseif (!savefile_exists($this->_form($col))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_na()); ?></td>
|
|
<?php
|
|
} else {
|
|
if (array_key_exists("name", $newfile)) {
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("File name:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($newfile["name"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("MIME file type:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($newfile["type"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("File size:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h_abbr(report_size($newfile["size"])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td<?php $this->_colspan();
|
|
?>><input type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delfile); ?>" /></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<tr>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (array_key_exists($col, $this->_form) && !is_null($this->_form[$col])) {
|
|
?><input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> /><?php
|
|
} ?><input
|
|
id="up<?php echo h($col); ?>"<?php echo $class; ?> type="file" name="up<?php echo h($col); ?>" size="<?php echo h($size); ?>" /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
$currowspan = 1;
|
|
if (!is_null($this->_cur[$col])) {
|
|
$currowspan += 1;
|
|
$curfile =& $FILES[$this->_cur[$col]];
|
|
if (array_key_exists("name", $curfile)) {
|
|
$currowspan++;
|
|
}
|
|
}
|
|
?><tr>
|
|
<th class="th"<?php
|
|
if ($currowspan != 1) {
|
|
?> rowspan="<?php echo h($currowspan); ?>"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<?php
|
|
if (is_null($this->_cur[$col])) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
if (array_key_exists("name", $curfile)) {
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("File name:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfile["name"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="thfile" scope="row"><?php echo h_abbr(C_("MIME file type:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h($curfile["type"]); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="thfile" scope="row"><?php echo h_abbr(C_("File size:")); ?></th>
|
|
<td<?php $this->_colspan(-1);
|
|
?>><?php echo h_abbr(report_size($curfile["size"])); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_date: Display a date column
|
|
function _html_coltmpl_date($col, $label, $prompt = null, $size = 10)
|
|
{
|
|
// Set the default date to today
|
|
if ($this->_is_first_form && $this->_type == "new") {
|
|
$this->_form[$col] = date("Y-m-d");
|
|
}
|
|
// We work with Unix epoch time
|
|
if (!is_null($this->_cur) && array_key_exists($col, $this->_cur)) {
|
|
$date = $this->_cur[$col];
|
|
if (is_null($date)) {
|
|
$date = t_none();
|
|
} else {
|
|
$date = is_int($date)? $date: strtotime($date);
|
|
$date = date("Y-m-d", $date);
|
|
}
|
|
$cur = $date;
|
|
}
|
|
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_date($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
$curdef = $this->_cur[$col . "_$lndbdef"];
|
|
if (is_null($curdef)) {
|
|
$curdef = t_none();
|
|
} else {
|
|
$curdef = is_int($curdef)? $curdef: strtotime($curdef);
|
|
$curdef = date("Y-m-d", $curdef);
|
|
}
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($curdef); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($cur); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_date($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($cur); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_date_null: Display a nullable date column
|
|
function _html_coltmpl_date_null($col, $label, $nullcol, $nulllabel, $prompt = null, $size = 10)
|
|
{
|
|
// Set the default date to today
|
|
if ($this->_is_first_form && $this->_type == "new") {
|
|
$this->_form[$col] = date("Y-m-d");
|
|
}
|
|
// We work with Unix epoch time
|
|
if (!is_null($this->_cur) && array_key_exists($col, $this->_cur)) {
|
|
$date = $this->_cur[$col];
|
|
if (is_null($date)) {
|
|
$date = t_none();
|
|
} else {
|
|
$date = is_int($date)? $date: strtotime($date);
|
|
$date = date("Y-m-d", $date);
|
|
}
|
|
$cur = $date;
|
|
}
|
|
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_date($col, $col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
if ($this->_is_first_form) {
|
|
$this->_form[$nullcol] = is_null($this->_form($col))?
|
|
"true": "false";
|
|
}
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($cur)? h($cur): h($nulllabel); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul>
|
|
<li><input id="not<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "false"); ?> />
|
|
<input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_date($col, $col); ?> />
|
|
</li>
|
|
<li><input id="<?php echo h($nullcol); ?>" type="radio" name="<?php echo h($nullcol); ?>"<?php
|
|
$this->_val_radio($nullcol, "true"); ?> />
|
|
<label for="<?php echo h($nullcol); ?>"><?php echo h($nulllabel); ?></label>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
?> <p class="prompt"><?php echo h_abbr($prompt); ?></p>
|
|
<?php
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo !is_null($cur)? h($cur): h($nulllabel); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_datetime: Display a date-time column
|
|
function _html_coltmpl_datetime($col, $label, $prompt = null, $size = 26)
|
|
{
|
|
// Set the default date to today
|
|
if ($this->_is_first_form && $this->_type == "new") {
|
|
$this->_form[$col] = date("Y-m-d h:i:s");
|
|
}
|
|
// We work with Unix epoch time
|
|
if (!is_null($this->_cur) && array_key_exists($col, $this->_cur)) {
|
|
$date = $this->_cur[$col];
|
|
if (is_null($date)) {
|
|
$date = t_none();
|
|
} elseif (is_int($date)) {
|
|
$date = date("Y-m-d h:i:s", $date);
|
|
} elseif (is_float($date)) {
|
|
$dec = $date - floor($date);
|
|
$date = floor($date);
|
|
settype($date, "integer");
|
|
$date = date("Y-m-d h:i:s", $date);
|
|
if ($dec > 0) {
|
|
$date .= substr($dec, 1);
|
|
}
|
|
}
|
|
$cur = $date;
|
|
}
|
|
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
$curdef = $this->_cur[$col . "_$lndbdef"];
|
|
if (is_null($curdef)) {
|
|
$curdef = t_none();
|
|
} else {
|
|
$curdef = is_int($curdef)? $curdef: strtotime($curdef);
|
|
$curdef = date("Y-m-d", $curdef);
|
|
}
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($curdef); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($cur); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($cur); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_url: Display a URL. column
|
|
function _html_coltmpl_url($col, $label, $prompt = null, $size = null)
|
|
{
|
|
// Set the default URL. to "http://"
|
|
if ($this->_is_first_form) {
|
|
if ($this->_type == "new") {
|
|
$this->_form[$col] = "http://";
|
|
} elseif ($this->_type == "cur" && is_null($this->_form($col))) {
|
|
$this->_form[$col] = "http://";
|
|
}
|
|
}
|
|
if (is_null($size)) {
|
|
$size = $this->_defsize;
|
|
$class = " class=\"text\"";
|
|
} else {
|
|
$class = "";
|
|
}
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col . "_$lndbdef"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>"<?php echo $class; ?> type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text($col); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_amount: Display an amount column
|
|
function _html_coltmpl_amount($col, $label, $prompt = null, $size = 16)
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
?><tr>
|
|
<?php
|
|
// A uni-lingual column, or a multi-lingual column but in the
|
|
// default language
|
|
if (!in_array($col, $this->_mlcols) || getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language
|
|
} else {
|
|
?> <th class="th" rowspan="3" scope="row"><label for="<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(locale_amount($this->_cur[$col . "_$lndbdef"])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(locale_amount($this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
// A multi-lingual column that is not in the default language,
|
|
// and the content for the default language is not available
|
|
if ( in_array($col, $this->_mlcols)
|
|
&& getlang() != DEFAULT_LANG
|
|
&& is_null($this->_cur[$col . "_$lndbdef"])) {
|
|
?> <td id="<?php echo h($col); ?>"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please set it from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan();
|
|
?>><input id="<?php echo h($col); ?>" type="text" name="<?php echo h($col); ?>" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_text($col, $col); ?> /><?php
|
|
if (!is_null($prompt)) {
|
|
echo "\n <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n ";
|
|
} ?></td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(locale_amount($this->_cur[$col])); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_coltmpl_pic_simple: Display a simple picture upload column
|
|
function _html_coltmpl_pic_simple($col, $label, $prompt = null, $size = null)
|
|
{
|
|
if (is_null($size)) {
|
|
$size = $this->_defsize;
|
|
$class = " class=\"text\"";
|
|
} else {
|
|
$class = "";
|
|
}
|
|
$delpic = C_("Delete this picture");
|
|
// Obtain the picture deposit
|
|
$PICS =& pic_deposit();
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$newalt = C_("Picture preview");
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="up<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (!is_null($this->_form($col))) {
|
|
?><input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
<?php $pic =& $PICS[$this->_form($col)];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delpic); ?>" /><br />
|
|
<?php
|
|
} else {
|
|
echo h_abbr(t_none()) . "<br />\n ";
|
|
}
|
|
?><input id="up<?php echo h($col); ?>"<?php echo $class; ?> type="file" name="up<?php echo h($col); ?>" size="<?php echo h($size); ?>" />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
echo " <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$origalt = C_("Original picture preview");
|
|
$newalt = C_("New picture preview");
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="up<?php echo h($col); ?>"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (!is_null($this->_cur[$col])) {
|
|
$pic =& $PICS[$this->_cur[$col]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
echo " ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="up<?php echo h($col); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (!is_null($this->_form($col))) {
|
|
?><input type="hidden" name="<?php echo h($col); ?>"<?php
|
|
$this->_val_text($col); ?> />
|
|
<?php $pic =& $PICS[$this->_form($col)];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input type="submit" name="del<?php echo h($col); ?>" value="<?php echo h($delpic); ?>" /><br />
|
|
<?php
|
|
} else {
|
|
echo h_abbr(t_none()) . "<br />\n ";
|
|
}
|
|
?><input id="up<?php echo h($col); ?>"<?php echo $class; ?> type="file" name="up<?php echo h($col); ?>" size="<?php echo h($size); ?>" />
|
|
<?php
|
|
if (!is_null($prompt)) {
|
|
echo " <p class=\"prompt\">" . h_abbr($prompt) . "</p>\n";
|
|
}
|
|
?> </td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
$origalt = C_("Picture preview");
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark($col); echo h_abbr($label); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (!is_null($this->_cur[$col])) {
|
|
$pic =& $PICS[$this->_cur[$col]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
echo " ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
/////////////////////////
|
|
// Columns, sorted alphabetically
|
|
/////////////////////////
|
|
// _html_col_addr: The address
|
|
function _html_col_addr()
|
|
{
|
|
$this->_html_coltmpl_textarea("addr", C_("Address:"),
|
|
C_("Fill in your address here."), null, 3);
|
|
}
|
|
|
|
// _html_col_att: The attachment
|
|
function _html_col_att()
|
|
{
|
|
$this->_html_coltmpl_file("att", C_("Attachment:"));
|
|
if ( in_array("attdsc", sql_cols_nl($this->_table))
|
|
&& !is_null($this->_form("att"))
|
|
&& savefile_exists($this->_form("att"))) {
|
|
$this->_html_coltmpl_text("attdsc", C_("Attachment description:"));
|
|
}
|
|
}
|
|
|
|
// _html_col_bi_address: The address set: country, address
|
|
function _html_col_bi_address()
|
|
{
|
|
if (getlang(LN_COUNTRY_FIRST)) {
|
|
$this->_html_col_country();
|
|
$this->_html_col_addr();
|
|
} else {
|
|
$this->_html_col_addr();
|
|
$this->_html_col_country();
|
|
}
|
|
}
|
|
|
|
// _html_col_body: The content body
|
|
function _html_col_body()
|
|
{
|
|
$this->_html_coltmpl_textarea("body", C_("Content:"),
|
|
C_("Fill in the content here."));
|
|
}
|
|
|
|
// _html_col_city: The city
|
|
function _html_col_city()
|
|
{
|
|
$this->_html_coltmpl_text("city", C_("City:"));
|
|
}
|
|
|
|
// _html_col_content: The content body
|
|
function _html_col_content()
|
|
{
|
|
$this->_html_coltmpl_textarea("content", C_("Content:"),
|
|
C_("Fill in the content here."));
|
|
}
|
|
|
|
// _html_col_country: The country
|
|
function _html_col_country()
|
|
{
|
|
// Set the default country to the client country
|
|
if ($this->_type == "new" && !array_key_exists("country", $this->_form)) {
|
|
$this->_form["country"] = geoiplookup();
|
|
}
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="country"><?php
|
|
$this->_mark("country"); echo h_abbr(C_("Country:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><select id="country" name="country">
|
|
<?php echo country_options($this->_form("country"));
|
|
?> </select></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="country"><?php
|
|
$this->_mark("country"); echo h_abbr(C_("Country:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(ctname($this->_cur["country"])); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="country"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><select id="country" name="country">
|
|
<?php echo country_options($this->_form("country"));
|
|
?> </select></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("country"); echo h_abbr(C_("Country:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(ctname($this->_cur["country"])); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_created: The creation time
|
|
function _html_col_created()
|
|
{
|
|
$this->_html_coltmpl_ro_datetime("created", C_("Created:"));
|
|
}
|
|
|
|
// _html_col_createdby: The creator
|
|
function _html_col_createdby()
|
|
{
|
|
$this->_html_coltmpl_ro_user("createdby", C_("Created by:"));
|
|
}
|
|
|
|
// _html_col_ct: The country
|
|
function _html_col_ct()
|
|
{
|
|
$this->_html_coltmpl_ro_ct("ct", C_("Country:"));
|
|
}
|
|
|
|
// _html_col_date: The date
|
|
function _html_col_date()
|
|
{
|
|
$this->_html_coltmpl_date("date", C_("Date:"));
|
|
}
|
|
|
|
// _html_col_disabled: Disabled?
|
|
function _html_col_disabled()
|
|
{
|
|
$this->_html_coltmpl_bool("disabled", C_("Disabled?"),
|
|
C_("Disabled"), C_("Enabled"), C_("Disable it."));
|
|
}
|
|
|
|
// _html_col_dsc: The description
|
|
function _html_col_dsc()
|
|
{
|
|
$this->_html_coltmpl_textarea("dsc", C_("Description:"),
|
|
C_("Fill in the description here."), null, 5);
|
|
}
|
|
|
|
// _html_col_email: The e-mail
|
|
function _html_col_email()
|
|
{
|
|
$this->_html_coltmpl_text("email", C_("E-mail:"));
|
|
}
|
|
|
|
// _html_col_fax: The facsimile number
|
|
function _html_col_fax()
|
|
{
|
|
$this->_html_coltmpl_text("fax", C_("Fax:"));
|
|
}
|
|
|
|
// _html_col_grp: The group
|
|
function _html_col_grp()
|
|
{
|
|
$this->_html_coltmpl_call("grp", C_("Group:"), "groupdsc");
|
|
}
|
|
|
|
// _html_col_hid: Hide?
|
|
function _html_col_hid()
|
|
{
|
|
$this->_html_coltmpl_bool("hid", C_("Hide?"),
|
|
C_("Hide it"), C_("Show it"), C_("Hide it currently."));
|
|
}
|
|
|
|
// _html_col_host: The host
|
|
function _html_col_host()
|
|
{
|
|
$this->_html_coltmpl_ro("host", C_("Host:"));
|
|
}
|
|
|
|
// _html_col_html: HTML?
|
|
function _html_col_html()
|
|
{
|
|
$this->_html_coltmpl_bool("html", C_("HTML?"),
|
|
C_("HTML"), C_("Plain text"), C_("The submitted content is HTML."));
|
|
}
|
|
|
|
// _html_col_id: The ID.
|
|
function _html_col_id()
|
|
{
|
|
$this->_html_coltmpl_text("id", C_("ID.:"));
|
|
}
|
|
|
|
// _html_col_intro: The introduction
|
|
function _html_col_intro()
|
|
{
|
|
$this->_html_coltmpl_textarea("intro", C_("Introduction:"),
|
|
C_("Fill in the introduction here."));
|
|
}
|
|
|
|
// _html_col_ip: The IP
|
|
function _html_col_ip()
|
|
{
|
|
$this->_html_coltmpl_ro("ip", C_("IP:"));
|
|
}
|
|
|
|
// _html_col_kw: The keywords
|
|
function _html_col_kw()
|
|
{
|
|
$this->_html_coltmpl_text("kw", C_("Keywords:"));
|
|
}
|
|
|
|
// _html_col_lang: The language
|
|
function _html_col_lang()
|
|
{
|
|
$this->_html_coltmpl_ro_lang("lang", C_("Language:"));
|
|
}
|
|
|
|
// _html_col_massdel: The list of items for mass deletion
|
|
function _html_col_massdel()
|
|
{
|
|
?><ol>
|
|
<?php
|
|
for ($i = 0; array_key_exists("sn$i", $this->_cur); $i++) {
|
|
?><li><?php if (is_null($this->_cur["sn$i" . "title"])) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
echo h($this->_cur["sn$i" . "title"]);
|
|
} ?><input
|
|
type="hidden" name="sn<?php echo h($i); ?>"<?php
|
|
$this->_val_text("sn$i"); ?> /></li>
|
|
<?php
|
|
}
|
|
?></ol>
|
|
<?php
|
|
}
|
|
|
|
// _html_col_name: The name
|
|
function _html_col_name()
|
|
{
|
|
$this->_html_coltmpl_text("name", C_("Name:"));
|
|
}
|
|
|
|
// _html_col_ord: The order
|
|
function _html_col_ord()
|
|
{
|
|
// Set the default order to the half of the maximum
|
|
if ($this->_is_first_form && $this->_type == "new" && is_null($this->_form("ord"))) {
|
|
$this->_form["ord"] = pow(10, $this->_maxlens["ord"]) / 2;
|
|
}
|
|
$this->_html_coltmpl_text("ord", C_("Order:"), null, $this->_maxlens["ord"]);
|
|
}
|
|
|
|
// _html_col_org: The organization
|
|
function _html_col_org()
|
|
{
|
|
$this->_html_coltmpl_text("org", C_("Organization:"));
|
|
}
|
|
|
|
// _html_col_parent: The parent category
|
|
function _html_col_parent()
|
|
{
|
|
$this->_html_coltmpl_call_null("parent", C_("Parent category:"),
|
|
"topmost", C_("At the very top"), $this->_table . "_title");
|
|
}
|
|
|
|
// _html_col_passwd: The password
|
|
function _html_col_passwd()
|
|
{
|
|
$size = $this->_defsize;
|
|
$dummy = str_repeat("*", 16);
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="passwd"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Password:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
// There is a previously-saved password
|
|
if (!is_null($this->_form("passid"))) {
|
|
?><input type="hidden" name="passid"<?php
|
|
$this->_val_text("passid"); ?> />
|
|
<input id="passwd" class="text" type="password" name="passwd" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar($dummy, "passwd"); ?> />
|
|
<?php
|
|
} else {
|
|
?><input id="passwd" class="text" type="password" name="passwd" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar(null, "passwd"); ?> /><?php
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" scope="row"><label for="passwd2"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Confirm password:")); ?></label></th>
|
|
<td><?php
|
|
// There is a previously-saved password
|
|
if (!is_null($this->_form("passid2"))) {
|
|
?><input type="hidden" name="passid2"<?php
|
|
$this->_val_text("passid2"); ?> />
|
|
<input id="passwd2" class="text" type="password" name="passwd2" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar($dummy, "passwd"); ?> />
|
|
<?php
|
|
} else {
|
|
?><input id="passwd2" class="text" type="password" name="passwd2" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar(null, "passwd"); ?> /><?php
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th colspan="2" scope="row"><label for="passwd"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Password:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
// There is a previously-saved password
|
|
if (!is_null($this->_form("passid"))) {
|
|
?><input type="hidden" name="passid"<?php
|
|
$this->_val_text("passid"); ?> />
|
|
<input id="passwd" class="text" type="password" name="passwd" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar($dummy, "passwd"); ?> />
|
|
<?php
|
|
} else {
|
|
?><input id="passwd" class="text" type="password" name="passwd" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar(null, "passwd"); ?> /><?php
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="2" scope="row"><label for="passwd2"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Confirm password:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
// There is a previously-saved password
|
|
if (!is_null($this->_form("passid2"))) {
|
|
?><input type="hidden" name="passid2"<?php
|
|
$this->_val_text("passid2"); ?> />
|
|
<input id="passwd2" class="text" type="password" name="passwd2" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar($dummy, "passwd"); ?> />
|
|
<?php
|
|
} else {
|
|
?><input id="passwd2" class="text" type="password" name="passwd2" size="<?php echo h($size); ?>"<?php
|
|
$this->_val_scalar(null, "passwd"); ?> />
|
|
<?php
|
|
}
|
|
?> <p class="prompt"><?php echo h(C_("(Leave them blank if you don't plan to change your password.)")); ?></p>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Password:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($dummy); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_path: The path
|
|
function _html_col_path()
|
|
{
|
|
// Set the default path to "/"
|
|
if ($this->_is_first_form && $this->_type == "new") {
|
|
$this->_form["path"] = "/";
|
|
}
|
|
$this->_html_coltmpl_text("path", C_("Page path:"));
|
|
}
|
|
|
|
// _html_col_pdf: The PDF file
|
|
function _html_col_pdf()
|
|
{
|
|
$this->_html_coltmpl_file("pdf", C_("PDF. file:"));
|
|
}
|
|
|
|
// _html_col_pic: The picture
|
|
function _html_col_pic()
|
|
{
|
|
global $PIC_VALID_POS;
|
|
// Obtain the picture deposit
|
|
$PICS =& pic_deposit();
|
|
$setpic = C_("Set the picture");
|
|
$delpic = C_("Delete this picture");
|
|
$picposid_default = "picpos" . strtolower(PIC_POS_DEFAULT);
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$newalt = C_("Picture preview");
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="setpic"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Picture:")); ?></label></th>
|
|
<?php
|
|
if (is_null($this->_form("pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?><input
|
|
id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} elseif (!pic_exists($this->_form("pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_na()); ?><input
|
|
id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan(); ?>><input type="hidden" name="pic"<?php
|
|
$this->_val_text("pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form("pic")];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /><input
|
|
id="delpic" type="submit" name="delpic" value="<?php echo h($delpic); ?>" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" scope="row"><label for="piccap"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. caption:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="piccap" class="text" type="text" name="piccap" size="40"<?php
|
|
$this->_val_text("piccap", "piccap"); ?> /></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" scope="row"><label for="<?php echo h($picposid_default); ?>"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. position:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul class="oneline">
|
|
<?php
|
|
for ($i = 0, $items = array(); $i < count($PIC_VALID_POS); $i++) {
|
|
$pos = $PIC_VALID_POS[$i];
|
|
$id = "picpos" . strtolower($pos);
|
|
$label = picpos_label($pos);
|
|
$default = ($pos == PIC_POS_DEFAULT);
|
|
ob_start();
|
|
?> <li><input id="<?php echo h($id); ?>" type="radio" name="picpos"<?php
|
|
$this->_val_radio("picpos", $pos, $default); ?> />
|
|
<label for="<?php echo h($id); ?>"><?php echo h($label); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo implode("", $items);
|
|
?> </ul>
|
|
</td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$origalt = C_("Original picture preview");
|
|
$newalt = C_("New picture preview");
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="setpic"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Picture:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (is_null($this->_cur["pic"])) {
|
|
echo h_abbr(t_none());
|
|
} elseif ($this->_cur["pic"] === false) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
$pic =& $PICS[$this->_cur["pic"]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
echo " ";
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="setpic"><?php echo h(C_("New:")); ?></label></th>
|
|
<?php
|
|
if (!pic_exists($this->_cur["pic"]) && getlang() != DEFAULT_LANG) {
|
|
?> <td id="setpic"<?php $this->_colspan(); ?>><?php
|
|
echo h(sprintf(C_("Please upload a new picture from %s."),
|
|
ln(DEFAULT_LANG, LN_DESC_CURLC))); ?></td>
|
|
<?php
|
|
} elseif (is_null($this->_form("pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_none()); ?><input
|
|
id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} elseif (!pic_exists($this->_form("pic"))) {
|
|
?> <td<?php $this->_colspan(); ?>><?php
|
|
echo h_abbr(t_na()); ?><input
|
|
id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /></td>
|
|
<?php
|
|
} else {
|
|
?> <td<?php $this->_colspan(); ?>><input type="hidden" name="pic"<?php
|
|
$this->_val_text("pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form("pic")];
|
|
echopic($pic, $newalt, $pic["ratio"]);
|
|
?> <input id="setpic" type="submit" name="setpic" value="<?php echo h($setpic); ?>" /><input
|
|
id="delpic" type="submit" name="delpic" value="<?php echo h($delpic); ?>" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
// Default language
|
|
if (getlang() == DEFAULT_LANG) {
|
|
?> <th class="th" rowspan="2" scope="row"><label for="piccap"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. caption:")); ?></label></th>
|
|
<?php
|
|
} else {
|
|
?> <th class="th" rowspan="3" scope="row"><label for="piccap"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. caption:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Source:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("piccap_" . ln(DEFAULT_LANG, LN_DATABASE)); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
}
|
|
?> <th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("piccap"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="piccap"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="piccap" class="text" type="text" name="piccap" size="40"<?php
|
|
$this->_val_text("piccap", "piccap"); ?> /></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="<?php echo h($picposid_default); ?>"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. position:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (!array_key_exists("picpos", $this->_cur) || is_null($this->_cur["picpos"])) {
|
|
echo h_abbr(t_notset());
|
|
} else {
|
|
echo h(picpos_label($this->_cur["picpos"]));
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="<?php echo h($picposid_default); ?>"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><ul class="oneline">
|
|
<?php
|
|
for ($i = 0, $items = array(); $i < count($PIC_VALID_POS); $i++) {
|
|
$pos = $PIC_VALID_POS[$i];
|
|
$id = "picpos" . strtolower($pos);
|
|
$label = picpos_label($pos);
|
|
$default = ($pos == PIC_POS_DEFAULT);
|
|
ob_start();
|
|
?> <li><input id="<?php echo h($id); ?>" type="radio" name="picpos"<?php
|
|
$this->_val_radio("picpos", $pos, $default); ?> />
|
|
<label for="<?php echo h($id); ?>"><?php echo h($label); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo implode("", $items);
|
|
?> </ul>
|
|
</td>
|
|
<?php
|
|
}
|
|
?></tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
$origalt = C_("Picture preview");
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Picture:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (is_null($this->_cur["pic"])) {
|
|
echo h_abbr(t_none());
|
|
} elseif ($this->_cur["pic"] === false) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
$pic =& $PICS[$this->_cur["pic"]];
|
|
echopic($pic, $origalt, $pic["ratio"]);
|
|
?> </td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. caption:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("piccap"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Pic. position:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h(picpos_label($this->_cur["picpos"]));
|
|
}
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_pinyin: The pinyin
|
|
function _html_col_pinyin()
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="pinyin0"><?php
|
|
$this->_mark("pinyin"); echo h_abbr(C_("Pinyin:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if ( !array_key_exists("chinese", $this->_form)
|
|
|| $this->_form["chinese"] == "") {
|
|
echo h(C_("Please fill in the Chinese first."));
|
|
} else {
|
|
$pinyins = zh2pys($this->_form["chinese"]);
|
|
for ($i = 0, $items = array(); $i < count($pinyins); $i++) {
|
|
ob_start();
|
|
?> <li><input id="pinyin<?php echo h($i); ?>" type="radio" name="pinyin"<?php
|
|
$this->_val_radio("pinyin", $pinyins[$i]); ?> />
|
|
<label for="pinyin<?php echo h($i); ?>"><?php
|
|
echo h($pinyins[$i]); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="pinyin0"><?php
|
|
$this->_mark("pinyin"); echo h_abbr(C_("Pinyin:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("pinyin"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="pinyin0"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if ( !array_key_exists("chinese", $this->_form)
|
|
|| $this->_form["chinese"] == "") {
|
|
echo h(C_("Please fill in the Chinese first."));
|
|
} else {
|
|
$pinyins = zh2pys($this->_form["chinese"]);
|
|
for ($i = 0, $items = array(); $i < count($pinyins); $i++) {
|
|
ob_start();
|
|
?> <li><input id="pinyin<?php echo h($i); ?>" type="radio" name="pinyin"<?php
|
|
$this->_val_radio("pinyin", $pinyins[$i]); ?> />
|
|
<label for="pinyin<?php echo h($i); ?>"><?php
|
|
echo h($pinyins[$i]); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("pinyin"); echo h_abbr(C_("Pinyin:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("pinyin"); ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_scats: The subcategories
|
|
function _html_col_scats()
|
|
{
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark("scats"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Subcategory:", "Subcategories:", $this->_cur["scatcount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["scatcount"]; $i++) {
|
|
$items[] = sprintf(" <li><a href=\"%1\$s?form=cur&sn=%2\$d\">%3\$s</a>\n"
|
|
. " (<a href=\"%4\$s\"><samp>%4\$s</samp></a>)</li>\n",
|
|
h($this->_procurl), h($this->_cur["scat$i" . "sn"]),
|
|
h($this->_cur["scat$i" . "title"]),
|
|
h($this->_cur["scat$i" . "url"]));
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
// _html_col_script: The script
|
|
function _html_col_script()
|
|
{
|
|
$this->_html_coltmpl_text("script", C_("Script:"));
|
|
}
|
|
|
|
// _html_col_sn: The serial number
|
|
function _html_col_sn()
|
|
{
|
|
$this->_html_coltmpl_ro("sn", C_("S/N:"));
|
|
}
|
|
|
|
// _html_col_street: The street
|
|
function _html_col_street()
|
|
{
|
|
$this->_html_coltmpl_text("street", C_("Street:"));
|
|
}
|
|
|
|
// _html_col_subject: The subject
|
|
function _html_col_subject()
|
|
{
|
|
$this->_html_coltmpl_text("subject", C_("Subject:"));
|
|
}
|
|
|
|
// _html_col_tel: The telephone number
|
|
function _html_col_tel()
|
|
{
|
|
$this->_html_coltmpl_text("tel", C_("Telephone:"));
|
|
}
|
|
|
|
// _html_col_tel: The cellular telephone number
|
|
function _html_col_telc()
|
|
{
|
|
$this->_html_coltmpl_text("telc", C_("Tel. (cell.):"));
|
|
}
|
|
|
|
// _html_col_tel: The telephone number at home
|
|
function _html_col_telh()
|
|
{
|
|
$this->_html_coltmpl_text("telh", C_("Tel. (home):"));
|
|
}
|
|
|
|
// _html_col_tel: The telephone number at the office
|
|
function _html_col_telo()
|
|
{
|
|
$this->_html_coltmpl_text("telo", C_("Tel. (office):"));
|
|
}
|
|
|
|
// _html_col_title: The title
|
|
function _html_col_title()
|
|
{
|
|
$this->_html_coltmpl_text("title", C_("Title:"));
|
|
}
|
|
|
|
// _html_col_tri_address: The address set: country, city, street
|
|
function _html_col_tri_address()
|
|
{
|
|
if (getlang(LN_COUNTRY_FIRST)) {
|
|
$this->_html_col_country();
|
|
$this->_html_col_city();
|
|
$this->_html_col_street();
|
|
} else {
|
|
$this->_html_col_street();
|
|
$this->_html_col_city();
|
|
$this->_html_col_country();
|
|
}
|
|
}
|
|
|
|
// _html_col_value: The preference value
|
|
function _html_col_value()
|
|
{
|
|
$this->_html_coltmpl_text("value", C_("Value:"));
|
|
}
|
|
|
|
// _html_col_visits: The visit count
|
|
function _html_col_visits()
|
|
{
|
|
$this->_html_coltmpl_ro("visits", C_("Visits:"));
|
|
}
|
|
|
|
// _html_col_visited: The last-visited time
|
|
function _html_col_visited()
|
|
{
|
|
$this->_html_coltmpl_ro_datetime("visited", C_("Visited:"));
|
|
}
|
|
|
|
// _html_col_updated: The The last-update time
|
|
function _html_col_updated()
|
|
{
|
|
$this->_html_coltmpl_ro_datetime("updated", C_("Updated:"));
|
|
}
|
|
|
|
// _html_col_updatedby: The last maintainer
|
|
function _html_col_updatedby()
|
|
{
|
|
$this->_html_coltmpl_ro_user("updatedby", C_("Updated by:"));
|
|
}
|
|
|
|
// _html_col_url: The URL.
|
|
function _html_col_url()
|
|
{
|
|
$this->_html_coltmpl_url("url", C_("URL.:"));
|
|
}
|
|
|
|
// _html_col_zip: The zip code
|
|
function _html_col_zip()
|
|
{
|
|
$this->_html_coltmpl_text("zip", C_("Zip code:"), null, 5);
|
|
}
|
|
|
|
|
|
/////////////////////////
|
|
// Private utility methods. Do not call them directly.
|
|
/////////////////////////
|
|
// _cval_text: Output a current text value
|
|
function _cval_text($col)
|
|
{
|
|
echo is_null($this->_cur[$col])? h_abbr(t_none()):
|
|
h($this->_cur[$col]);
|
|
}
|
|
|
|
// _cval_textarea: Output a current textarea value
|
|
function _cval_textarea($col)
|
|
{
|
|
echo is_null($this->_cur[$col])? h_abbr(t_none()):
|
|
a2html($this->_cur[$col]);
|
|
}
|
|
|
|
// _val_text: Output a value
|
|
function _val_text($col, $maxcol = null)
|
|
{
|
|
if (!is_null($maxcol)) {
|
|
echo " maxlength=\"" . h($this->_maxlens[$maxcol]) . "\"";
|
|
}
|
|
if (array_key_exists($col, $this->_form)) {
|
|
echo " value=\"" . h($this->_form[$col]) . "\"";
|
|
} else {
|
|
echo " value=\"\"";
|
|
}
|
|
}
|
|
|
|
// _val_scalar: Output a scalar value
|
|
function _val_scalar($val, $maxcol = null)
|
|
{
|
|
if (!is_null($maxcol)) {
|
|
echo " maxlength=\"" . h($this->_maxlens[$maxcol]) . "\"";
|
|
}
|
|
if (!is_null($val)) {
|
|
echo " value=\"" . h($val) . "\"";
|
|
} else {
|
|
echo " value=\"\"";
|
|
}
|
|
}
|
|
|
|
// _val_date: Output a date value
|
|
function _val_date($col, $maxcol = null)
|
|
{
|
|
if (!is_null($maxcol)) {
|
|
echo " maxlength=\"" . h($this->_maxlens[$maxcol]) . "\"";
|
|
}
|
|
if (array_key_exists($col, $this->_form)) {
|
|
$val = $this->_form[$col];
|
|
if (is_numeric($val)) {
|
|
$val = date("Y-m-d", $val);
|
|
}
|
|
echo " value=\"" . h($val) . "\"";
|
|
} else {
|
|
echo " value=\"\"";
|
|
}
|
|
}
|
|
|
|
// _val_textarea: Output a value as a textarea content
|
|
function _val_textarea($col, $default)
|
|
{
|
|
echo array_key_exists($col, $this->_form) && $this->_form[$col] != ""?
|
|
h($this->_form[$col]): h($default);
|
|
}
|
|
|
|
// _val_check: Output a value as a checkbox check value
|
|
function _val_check($col)
|
|
{
|
|
if (array_key_exists($col, $this->_form) && $this->_form[$col]) {
|
|
echo " checked=\"checked\"";
|
|
}
|
|
}
|
|
|
|
// _val_radio: Output a value as a radio check value
|
|
function _val_radio($col, $valhere, $is_default = false)
|
|
{
|
|
// Value set, checked when same value
|
|
if (array_key_exists($col, $this->_form)) {
|
|
echo " value=\"" . h($valhere) . "\"";
|
|
if ($this->_form[$col] == $valhere) {
|
|
echo " checked=\"checked\"";
|
|
}
|
|
// Value not set, checked when default
|
|
} else {
|
|
echo " value=\"" . h($valhere) . "\"";
|
|
if ($is_default) {
|
|
echo " checked=\"checked\"";
|
|
}
|
|
}
|
|
}
|
|
|
|
// _form: Return a specific form value, or null if not exists
|
|
function _form($col)
|
|
{
|
|
if (array_key_exists($col, $this->_form)) {
|
|
return $this->_form[$col];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// _colspan: Output the colspan phrase
|
|
function _colspan($addcols = 0)
|
|
{
|
|
$colspan = $this->_colspan + $addcols;
|
|
// Only output for many columns
|
|
if ($colspan > 1) {
|
|
?> colspan="<?php echo h($colspan); ?>"<?php
|
|
}
|
|
return;
|
|
}
|
|
|
|
// _colspan_full: Output the colspan phrase spanning the whole table
|
|
function _colspan_full($addcols = 0)
|
|
{
|
|
$colspan = $this->_colspan + $addcols;
|
|
$colspan += ($this->_type == "cur")? 2: 1;
|
|
// Only output for many columns
|
|
if ($colspan > 1) {
|
|
?> colspan="<?php echo h($colspan); ?>"<?php
|
|
}
|
|
return;
|
|
}
|
|
|
|
// _mark: Output the column mark
|
|
function _mark($col)
|
|
{
|
|
// Bounce if no columns to check or no mark to use
|
|
if (is_null($this->_markcols) || is_null($this->_mark)) {
|
|
return;
|
|
}
|
|
if (in_array($col, $this->_markcols)) {
|
|
echo $this->_mark;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// _delcolcount: Obtain the number of items of a column for the deletion form
|
|
function _delcolcount($col)
|
|
{
|
|
// None-deletion form -- return 0 since the number of items is unknown
|
|
if ($this->_type != "del") {
|
|
return 0;
|
|
}
|
|
// Deletion form -- return the number of items
|
|
return $this->_cur[$col . "count"];
|
|
}
|
|
}
|
|
|
|
// _Form_MetaCols: Manage and output the meta form information
|
|
class _Form_MetaCols
|
|
{
|
|
protected $_cols = array();
|
|
|
|
// add: Add a column
|
|
function add($type, $name, $value)
|
|
{
|
|
$this->_cols[] = array(
|
|
"type" => $type,
|
|
"name" => $name,
|
|
"value" => $value,
|
|
);
|
|
return;
|
|
}
|
|
|
|
// out: Output the columns
|
|
function out()
|
|
{
|
|
// Bounce for nothing
|
|
if (count($this->_cols) == 0) {
|
|
return;
|
|
}
|
|
$cols = $this->_cols;
|
|
// Output the first column
|
|
$col = array_shift($cols);
|
|
?><input <?php echo $this->_out_attrs($col); ?> /><?php
|
|
// Output the rest columns
|
|
foreach ($cols as $col) {
|
|
?><input
|
|
<?php echo $this->_out_attrs($col); ?> /><?php
|
|
}
|
|
// Output a new line
|
|
echo "\n";
|
|
return;
|
|
}
|
|
|
|
// _out_attrs: Output the attributes
|
|
function _out_attrs($col)
|
|
{
|
|
$attrs = array();
|
|
$attrs[] = "type=\"" . h($col["type"]) . "\"";
|
|
if (!is_null($col["name"])) {
|
|
$attrs[] = "name=\"" . h($col["name"]) . "\"";
|
|
}
|
|
if (!is_null($col["name"]) && $col["name"] == "charset") {
|
|
$attrs[] = "value=\"<!--monica:charset-->\"";
|
|
} else {
|
|
$attrs[] = "value=\"" . h($col["value"]) . "\"";
|
|
}
|
|
return join(" ", $attrs);
|
|
}
|
|
}
|
|
|
|
// UserForm: Display a user form
|
|
class UserForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "users";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this user account");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new user account.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to update a current user account.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a user account.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("id", "passwd", "name",
|
|
"disabled", "supgroup");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "id", "passwd", "name",
|
|
"disabled", "supgroup",
|
|
"admin", "lang", "visits", "visited", "ip", "host", "ct",
|
|
"fails",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New User Account");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Update a Current User Account");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a User Account");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("https", $args)) {
|
|
$args["https"] = ($args["type"] != "del");
|
|
}
|
|
parent::__construct($status, $args);
|
|
$this->_maxlens["passwd"] = 100;
|
|
if ( $args["type"] == "cur" && !is_su()
|
|
&& ($this->_cur["su"] || $this->_sn == get_login_sn())) {
|
|
$this->_nodelete = true;
|
|
if ($this->_cur["su"]) {
|
|
$this->_prefmsg[] = C_("This is a super-user. You can only change parts of her infomation.");
|
|
}
|
|
}
|
|
if ($this->_type == "cur") {
|
|
if (array_key_exists("datacount", $this->_cur) && $this->_cur["datacount"] > 0) {
|
|
$this->_nodelete = true;
|
|
$this->_prefmsg[] = dngettext(COMMONDOMAIN,
|
|
"This user has a datum. It cannot be deleted. To delete the user, its datum must first be deleted.",
|
|
"This user has data. It cannot be deleted. To delete the user, all of its data must first be deleted.",
|
|
$this->_cur["datacount"]);
|
|
}
|
|
}
|
|
// Set all the available belonging groups list
|
|
$this->_set_supgroup_list();
|
|
}
|
|
|
|
// _set_supgroup_list: Set all the available belonging groups list
|
|
function _set_supgroup_list()
|
|
{
|
|
// Get the list of checked groups
|
|
$checked = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_form); $i++) {
|
|
if (array_key_exists("supgroup$i", $this->_form)) {
|
|
$checked[] = $this->_form["supgroup$i" . "sn"];
|
|
}
|
|
}
|
|
|
|
// Remove the old groups list
|
|
foreach (array_keys($this->_form) as $col) {
|
|
if (substr($col, 0, 8) == "supgroup") {
|
|
unset($this->_form[$col]);
|
|
}
|
|
}
|
|
|
|
// Get the list of all groups
|
|
if (count($GLOBALS["ALL_LINGUAS"]) > 1) {
|
|
$lndb = getlang(LN_DATABASE);
|
|
if (getlang() == DEFAULT_LANG) {
|
|
$title = sql_strcat("id", "' ('", "dsc_$lndb", "')'");
|
|
} else {
|
|
$lndbdef = ln(DEFAULT_LANG, LN_DATABASE);
|
|
$title = sql_strcat("id", "' ('",
|
|
"COALESCE(dsc_$lndb, dsc_$lndbdef)", "')'");
|
|
}
|
|
} else {
|
|
$title = sql_strcat("id", "' ('", "dsc", "')'");
|
|
}
|
|
$select = "SELECT sn AS sn, $title AS title FROM groups"
|
|
. " WHERE id!='" . sql_esctext(SU_GROUP) . "'"
|
|
. " AND id!='" . sql_esctext(ADMIN_GROUP) . "'"
|
|
. " AND id!='" . sql_esctext(ALLUSERS_GROUP) . "'"
|
|
. " ORDER BY id;\n";
|
|
$result = sql_query($select);
|
|
$count = sql_num_rows($result);
|
|
for ($i = 0; $i < $count; $i++) {
|
|
$row = sql_fetch_assoc($result);
|
|
// Set it
|
|
$this->_form["supgroup$i" . "sn"] = $row["sn"];
|
|
$this->_form["supgroup$i" . "title"] = $row["title"];
|
|
if (in_array($row["sn"], $checked)) {
|
|
$this->_form["supgroup$i"] = true;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// _html_col_admin: Is the user an administrator?
|
|
function _html_col_admin()
|
|
{
|
|
$this->_html_coltmpl_ro_bool("admin", C_("Administrator?"),
|
|
C_("Administrator"), C_("Non-administrator"));
|
|
}
|
|
|
|
// _html_col_disabled: Disabled?
|
|
function _html_col_disabled()
|
|
{
|
|
// Read-only for a non-super-user editing herself or a super-user
|
|
if ( $this->_type == "cur" && !is_su()
|
|
&& ($this->_cur["su"] || $this->_sn == get_login_sn())) {
|
|
$this->_html_coltmpl_ro_bool("disabled", C_("Disabled?"),
|
|
C_("Disabled"), C_("Enabled"));
|
|
} else {
|
|
$this->_html_coltmpl_bool("disabled", C_("Disabled?"),
|
|
C_("Disabled"), C_("Enabled"), C_("Disable this user account."));
|
|
}
|
|
}
|
|
|
|
// _html_col_id: The user ID.
|
|
function _html_col_id()
|
|
{
|
|
// Read-only for a non-super-user editing a super-user
|
|
if ($this->_type == "cur" && !is_su() && $this->_cur["su"]) {
|
|
$this->_html_coltmpl_ro("id", C_("User ID.:"));
|
|
} else {
|
|
$this->_html_coltmpl_text("id", C_("User ID.:"));
|
|
}
|
|
}
|
|
|
|
// _html_col_lang: The preferred language
|
|
function _html_col_lang()
|
|
{
|
|
$this->_html_coltmpl_ro_lang("lang", C_("Pref. language:"));
|
|
}
|
|
|
|
// _html_col_name: The user name
|
|
function _html_col_name()
|
|
{
|
|
$this->_html_coltmpl_text("name", C_("Full name:"));
|
|
}
|
|
|
|
// _html_col_passwd: The password
|
|
function _html_col_passwd()
|
|
{
|
|
// Read-only for a non-super-user editing a super-user
|
|
if ($this->_type == "cur" && !is_su() && $this->_cur["su"]) {
|
|
$dummy = str_repeat("*", $this->_maxlens["passwd"]);
|
|
?><tr>
|
|
<th colspan="2" scope="row"><?php echo h(C_("Password:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
echo h($dummy); ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
parent::_html_col_passwd();
|
|
}
|
|
}
|
|
|
|
// _html_col_supgroup: Its belonging groups
|
|
function _html_col_supgroup()
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="supgroup0"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("supgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("supgroup$i"); ?> />
|
|
<label for="supgroup<?php echo h($i); ?>"><?php
|
|
echo h($this->_form["supgroup$i" . "title"]); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
// Only super users can set the super-user group
|
|
if (!is_null(su_group_sn())) {
|
|
ob_start();
|
|
if (is_su()) {
|
|
?> <li><input id="su" type="checkbox" name="su"<?php
|
|
$this->_val_check("su"); ?> />
|
|
<?php
|
|
echo " " . group_opt_label(su_group_sn(), "su") . "\n </li>\n";
|
|
} else {
|
|
?> <li><input type="checkbox" disabled="disabled" />
|
|
<?php
|
|
echo " " . group_opt_label(su_group_sn()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
// Attach the all-users group in any case
|
|
if (!is_null(groupsn(ALLUSERS_GROUP))) {
|
|
ob_start();
|
|
?> <li><input type="checkbox" checked="checked" disabled="disabled" />
|
|
<?php
|
|
echo " " . group_opt_label(groupsn(ALLUSERS_GROUP)) . "\n </li>\n";
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// Read-only for a non-super-user editing herself
|
|
if (!is_su() && $this->_sn == get_login_sn()) {
|
|
?><tr>
|
|
<th colspan="2" scope="row"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if ($this->_cur["su"]) {
|
|
$items[] = " <li>" . group_opt_label(su_group_sn()) . "</li>\n";
|
|
}
|
|
if (!is_null(groupsn(ALLUSERS_GROUP))) {
|
|
$items[] = " <li>" . group_opt_label(groupsn(ALLUSERS_GROUP)) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="supgroup0"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if ($this->_cur["su"]) {
|
|
$items[] = " <li>" . group_opt_label(su_group_sn()) . "</li>\n";
|
|
}
|
|
if (!is_null(groupsn(ALLUSERS_GROUP))) {
|
|
$items[] = " <li>" . group_opt_label(groupsn(ALLUSERS_GROUP)) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="supgroup0"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("supgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("supgroup$i"); ?> />
|
|
<label for="supgroup<?php echo h($i); ?>"><?php
|
|
echo h($this->_form["supgroup$i" . "title"]); ?></label>
|
|
</li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
// Only super users can set the super-user group
|
|
if (!is_null(su_group_sn())) {
|
|
ob_start();
|
|
if (is_su()) {
|
|
?> <li><input id="su" type="checkbox" name="su"<?php
|
|
$this->_val_check("su"); ?> />
|
|
<?php
|
|
echo " " . group_opt_label(su_group_sn(), "su") . "\n </li>\n";
|
|
} else {
|
|
?> <li><input type="checkbox"<?php
|
|
if ($this->_cur["su"]) {
|
|
?> checked="checked"<?php
|
|
} ?> disabled="disabled" />
|
|
<?php
|
|
echo " " . group_opt_label(su_group_sn()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
// Attach the all-users group in any case
|
|
if (!is_null(groupsn(ALLUSERS_GROUP))) {
|
|
ob_start();
|
|
?> <li><input type="checkbox" checked="checked" disabled="disabled" />
|
|
<?php
|
|
echo " " . group_opt_label(groupsn(ALLUSERS_GROUP)) . "\n </li>\n";
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if ($this->_cur["su"]) {
|
|
$items[] = " <li>" . group_opt_label(su_group_sn()) . "</li>\n";
|
|
}
|
|
if (!is_null(groupsn(ALLUSERS_GROUP))) {
|
|
$items[] = " <li>" . group_opt_label(groupsn(ALLUSERS_GROUP)) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_fails: The fail login counter
|
|
function _html_col_fails()
|
|
{
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
// Nothing for a new form
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$locked = false;
|
|
if ( defined("MAX_FAIL_LOGINS")
|
|
&& MAX_FAIL_LOGINS !== false
|
|
&& $this->_form("fails") >= MAX_FAIL_LOGINS) {
|
|
$locked = true;
|
|
}
|
|
if (!$locked) {
|
|
?><tr>
|
|
<th class="th" colspan="2" scope="row"><?php
|
|
$this->_mark("fails"); echo h_abbr(C_("Fail logins:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("fails"); ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="failsreset"><?php
|
|
$this->_mark("fails"); echo h_abbr(C_("Fail logins:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("fails");
|
|
echo h(C_("(Locked)")); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="failsreset"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><input id="failsreset" type="checkbox" name="failsreset"<?php
|
|
$this->_val_check("failsreset"); ?> />
|
|
<label for="failsreset"><?php echo h(C_("Reset the counter and activate the account")); ?></label></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
$locked = false;
|
|
if ( defined("MAX_FAIL_LOGINS")
|
|
&& MAX_FAIL_LOGINS !== false
|
|
&& $this->_form("fails") >= MAX_FAIL_LOGINS) {
|
|
$locked = true;
|
|
}
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("fails"); echo h_abbr(C_("Fail logins:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("fails");
|
|
if ($locked) {
|
|
echo h(C_("(Locked)"));
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// GroupForm: Display a group form
|
|
class GroupForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "groups";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this group");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new group.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to update a current group.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a group.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("id", "dsc",
|
|
"subuser", "subgroup", "supgroup");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "id", "dsc",
|
|
"subuser", "subgroup", "supgroup",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Group");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Update a Current Group");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Group");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
if ($this->_type == "cur" && !is_su() && $this->_cur["sn"] == su_group_sn()) {
|
|
$this->_nodelete = true;
|
|
$this->_prefmsg[] = C_("This is a super-user group. You can only change parts of its infomation.");
|
|
}
|
|
}
|
|
|
|
// _html_col_id: The group ID.
|
|
function _html_col_id()
|
|
{
|
|
// Read-only for a non-super-user editing a super-user group
|
|
if ($this->_type == "cur" && !is_su() && $this->_sn == su_group_sn()) {
|
|
$this->_html_coltmpl_ro("id", C_("Group ID.:"));
|
|
} else {
|
|
$this->_html_coltmpl_text("id", C_("Group ID.:"));
|
|
}
|
|
}
|
|
|
|
// _html_col_dsc: The description
|
|
function _html_col_dsc()
|
|
{
|
|
$this->_html_coltmpl_text("dsc", C_("Description:"));
|
|
}
|
|
|
|
// _html_col_subuser: The child users
|
|
function _html_col_subuser()
|
|
{
|
|
$submit = C_("Add a user");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="selsubuser"><?php
|
|
$this->_mark("subuser"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"User member:", "User members:", 0)); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("subuser$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = user_opt_label($this->_form("subuser$i" . "sn"), "subuser$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="subuser<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subuser$i" . "sn"); ?> />
|
|
<input id="subuser<?php echo h($i); ?>" type="checkbox" name="subuser<?php echo h($i); ?>"<?php
|
|
$this->_val_check("subuser$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="subuser<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subuser$i" . "sn"); ?> />
|
|
<input id="subuser<?php echo h($i); ?>" type="checkbox" name="subuser<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsubuser" type="submit" name="selsubuser" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// Read-only for a non-super-user editing a super-user group
|
|
if (!is_su() && $this->_sn == su_group_sn()) {
|
|
?><tr>
|
|
<th colspan="2" scope="row"><?php
|
|
$this->_mark("subuser"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"User member:", "User members:", $this->_cur["subusercount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subusercount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subuser$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
} else {
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="selsubuser"><?php
|
|
$this->_mark("subuser"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"User member:", "User members:", 0)); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subusercount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subuser$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="selsubuser"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("subuser$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = user_opt_label($this->_form("subuser$i" . "sn"), "subuser$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="subuser<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subuser$i" . "sn"); ?> />
|
|
<input id="subuser<?php echo h($i); ?>" type="checkbox" name="subuser<?php echo h($i); ?>"<?php
|
|
$this->_val_check("subuser$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="subuser<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subuser$i" . "sn"); ?> />
|
|
<input id="subuser<?php echo h($i); ?>" type="checkbox" name="subuser<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsubuser" type="submit" name="selsubuser" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php echo
|
|
$this->_mark("subuser"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"User member:", "User members:", $this->_cur["subusercount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subusercount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subuser$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_subgroup: The child groups
|
|
function _html_col_subgroup()
|
|
{
|
|
$submit = C_("Add a group");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="selsubgroup"><?php
|
|
$this->_mark("subgroup"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Group member:", "Group members:", 0)); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("subgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = group_opt_label($this->_form("subgroup$i" . "sn"), "subgroup$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="subgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subgroup$i" . "sn"); ?> />
|
|
<input id="subgroup<?php echo h($i); ?>" type="checkbox" name="subgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("subgroup$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="subgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subgroup$i" . "sn"); ?> />
|
|
<input id="subgroup<?php echo h($i); ?>" type="checkbox" name="subgroup<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsubgroup" type="submit" name="selsubgroup" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// Read-only for a non-super-user editing a super-user group
|
|
if (!is_su() && $this->_sn == su_group_sn()) {
|
|
?><tr>
|
|
<th colspan="2" scope="row"><?php
|
|
$this->_mark("subgroup"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Group member:", "Group members:", $this->_cur["subgroupcount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subgroupcount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="selsubgroup"><?php
|
|
$this->_mark("subgroup"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Group member:", "Group members:", 0)); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subgroupcount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="selsubgroup"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("subgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = group_opt_label($this->_form("subgroup$i" . "sn"), "subgroup$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="subgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subgroup$i" . "sn"); ?> />
|
|
<input id="subgroup<?php echo h($i); ?>" type="checkbox" name="subgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("subgroup$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="subgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("subgroup$i" . "sn"); ?> />
|
|
<input id="subgroup<?php echo h($i); ?>" type="checkbox" name="subgroup<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsubgroup" type="submit" name="selsubgroup" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("subgroup"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Group member:", "Group members:", $this->_cur["subgroupcount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["subgroupcount"]; $i++) {
|
|
$items[] = " <li>" . h($this->_cur["subgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_supgroup: Its belonging groups
|
|
function _html_col_supgroup()
|
|
{
|
|
$submit = C_("Add a group");
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="selsupgroup"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("supgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = group_opt_label($this->_form("supgroup$i" . "sn"), "supgroup$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("supgroup$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsupgroup" type="submit" name="selsupgroup" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// Read-only for a non-super-user editing a super-user group
|
|
if (!is_su() && $this->_sn == su_group_sn()) {
|
|
?><tr>
|
|
<th class="th" colspan="2" scope="row"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="selsupgroup"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="selsupgroup"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
for ($i = 0, $items = array(); !is_null($this->_form("supgroup$i" . "sn")); $i++) {
|
|
ob_start();
|
|
$label = group_opt_label($this->_form("supgroup$i" . "sn"), "supgroup$i");
|
|
if (!is_null($label)) {
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>"<?php
|
|
$this->_val_check("supgroup$i"); ?> />
|
|
<?php
|
|
echo " $label\n </li>\n";
|
|
} else {
|
|
?> <li><input type="hidden" name="supgroup<?php echo h($i); ?>sn"<?php
|
|
$this->_val_text("supgroup$i" . "sn"); ?> />
|
|
<input id="supgroup<?php echo h($i); ?>" type="checkbox" name="supgroup<?php echo h($i); ?>" disabled="disabled" />
|
|
<?php
|
|
echo " " . h_abbr(t_na()) . "\n </li>\n";
|
|
}
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
}
|
|
ob_start();
|
|
?> <li><input id="selsupgroup" type="submit" name="selsupgroup" value="<?php echo h($submit); ?>" /></li>
|
|
<?php
|
|
$items[] = ob_get_contents();
|
|
ob_end_clean();
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
break;
|
|
|
|
// A form to delete a current item
|
|
case "del":
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("supgroup"); echo h_abbr(C_("Belonging to:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; array_key_exists("supgroup$i" . "sn", $this->_cur); $i++) {
|
|
$items[] = " <li>" . h($this->_cur["supgroup$i" . "title"]) . "</li>\n";
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// UserMembershipForm: Display a user membership form
|
|
class UserMembershipForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "usermem";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this membership record");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new membership record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to change a current membership record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a membership record.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("grp", "member");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "grp", "member",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New User Membership Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Change a Current User Membership Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a User Membership Record");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_member: The member
|
|
function _html_col_member()
|
|
{
|
|
$this->_html_coltmpl_call("member", C_("Member:"), "username");
|
|
}
|
|
}
|
|
|
|
// GroupMembershipForm: Display a group membership form
|
|
class GroupMembershipForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "groupmem";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this membership record");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new membership record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to change a current membership record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a membership record.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("grp", "member");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "grp", "member",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Group Membership Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Change a Current Group Membership Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Group Membership Record");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_member: The member
|
|
function _html_col_member()
|
|
{
|
|
$this->_html_coltmpl_call("member", C_("Member:"), "groupdsc");
|
|
}
|
|
}
|
|
|
|
// UserPreferenceForm: Display a user preference form
|
|
class UserPreferenceForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "userpref";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this user preference");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new user preference.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to modify a current user preference.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a user preference.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("usr", "domain", "name", "value");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "usr", "domain", "name", "value",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New User Preference");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Modify a Current User Preference");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a User Preference");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_usr: The user
|
|
function _html_col_usr()
|
|
{
|
|
$this->_html_coltmpl_call_null("usr", C_("User:"),
|
|
"everyone", C_("Everyone"), "username");
|
|
}
|
|
|
|
// _html_col_domain: The domain
|
|
function _html_col_domain()
|
|
{
|
|
$this->_html_coltmpl_text_null("domain", C_("Domain:"),
|
|
"everywhere", C_("Everywhere"));
|
|
}
|
|
}
|
|
|
|
// ScriptPrivilegeForm: Display a script privilege form
|
|
class ScriptPrivilegeForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "scptpriv";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this script privilege record");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new script privilege record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to change a current script privilege record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a script privilege record.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("script", "grp");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "script", "grp",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Script Privilege Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Change a Current Script Privilege Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Script Privilege Record");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_grp: The group
|
|
function _html_col_grp()
|
|
{
|
|
$this->_html_coltmpl_call("grp", C_("Privilege:"), "groupdsc");
|
|
}
|
|
}
|
|
|
|
// UserRequestForm: Display a user request form
|
|
class UserRequestForm extends BaseForm
|
|
{
|
|
protected $_types = array();
|
|
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "userreq";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this user request");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new user request.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to update a current user request.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a user request.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("type", "usr", "args", "expire");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "type", "usr", "args", "expire",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New User Request");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Update a Current User Request");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a User Request");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
$this->_types = array(
|
|
array(
|
|
"val" => "join",
|
|
"title" => C_("Join"),
|
|
),
|
|
array(
|
|
"val" => "chgeml",
|
|
"title" => C_("Change e-mail"),
|
|
),
|
|
array(
|
|
"val" => "rstpwd",
|
|
"title" => C_("Reset password"),
|
|
),
|
|
);
|
|
}
|
|
|
|
// _html_col_expire: The expiration time
|
|
function _html_col_expire()
|
|
{
|
|
$this->_html_coltmpl_datetime("expire", C_("Expiration:"));
|
|
}
|
|
|
|
// _html_col_type: The type
|
|
function _html_col_type()
|
|
{
|
|
$this->_html_coltmpl_radio("type", C_("Type:"), $this->_types);
|
|
}
|
|
|
|
// _html_col_usr: The user
|
|
function _html_col_usr()
|
|
{
|
|
$this->_html_coltmpl_call_null("usr", C_("User:"),
|
|
"anonymous", C_("Anonymous"), "username");
|
|
}
|
|
|
|
// _html_col_args: The arguments
|
|
function _html_col_args()
|
|
{
|
|
$this->_html_coltmpl_textarea("args", C_("Arguments:"),
|
|
C_("Please fill in the request arguments list here."), null, 3);
|
|
}
|
|
}
|
|
|
|
// BaseCategoryForm: Display a base category form
|
|
class BaseCategoryForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this category");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new category.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to edit a current category.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a category.");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
$this->_maxlens["ord"] = 2;
|
|
if ($this->_type == "cur") {
|
|
if (array_key_exists("scatcount", $this->_cur) && $this->_cur["scatcount"] > 0) {
|
|
$this->_nodelete = true;
|
|
$this->_prefmsg[] = dngettext(COMMONDOMAIN,
|
|
"This category has a subcategory. It cannot be deleted. To delete the category, its subcategory must first be deleted.",
|
|
"This category has subcategories. It cannot be deleted. To delete the category, all of its subcategories must first be deleted.",
|
|
$this->_cur["scatcount"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// _html_col_id: The ID.
|
|
function _html_col_id()
|
|
{
|
|
$this->_html_coltmpl_text("id", C_("ID.:"), null, 8);
|
|
}
|
|
|
|
// _html_col_hid: Hide?
|
|
function _html_col_hid()
|
|
{
|
|
$this->_html_coltmpl_bool("hid", C_("Hide?"),
|
|
C_("Hide this category"), C_("Show this category"), C_("Hide this category currently."));
|
|
}
|
|
}
|
|
|
|
// BaseCategorizationForm: Display a base categorization record form
|
|
class BaseCategorizationForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this categorization record");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new categorization record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to change a current categorization record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a categorization record.");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
}
|
|
|
|
// LinkCategoryForm: Display a link category form
|
|
class LinkCategoryForm extends BaseCategoryForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "linkcat";
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("parent", "id", "ord",
|
|
"title", "kw", "hid");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "parent", "id", "ord",
|
|
"title", "kw", "hid",
|
|
"scats", "links",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Link Category");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Edit a Current Link Category");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Link Category");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
$this->_maxlens["ord"] = 2;
|
|
if ($this->_type == "cur") {
|
|
if (array_key_exists("linkcount", $this->_cur) && $this->_cur["linkcount"] > 0) {
|
|
$this->_nodelete = true;
|
|
$this->_prefmsg[] = dngettext(COMMONDOMAIN,
|
|
"This category has a link. It cannot be deleted. To delete the category, its link must first be deleted.",
|
|
"This category has links. It cannot be deleted. To delete the category, all of its links must first be deleted.",
|
|
$this->_cur["linkcount"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// _html_col_links: The links
|
|
function _html_col_links()
|
|
{
|
|
?><tr>
|
|
<th<?php
|
|
if ($this->_type != "cur") {
|
|
?> class="th"<?php
|
|
}
|
|
if ($this->_type == "cur") {
|
|
?> colspan="2"<?php
|
|
} ?> scope="row"><?php
|
|
$this->_mark("links"); echo h_abbr(dngettext(COMMONDOMAIN,
|
|
"Link:", "Links:", $this->_cur["linkcount"])); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$items = array();
|
|
for ($i = 0; $i < $this->_cur["linkcount"]; $i++) {
|
|
$items[] = sprintf(" <li><a href=\"%1\$s\">%2\$s</a>\n"
|
|
. " (<a href=\"%3\$s\"><samp>%3\$s</samp></a>)\n"
|
|
. " </li>\n",
|
|
h("links.php?form=cur&sn=" . $this->_cur["link$i" . "sn"]),
|
|
h($this->_cur["link$i" . "title"]),
|
|
h($this->_cur["link$i" . "url"]));
|
|
}
|
|
if (count($items) > 0) {
|
|
echo "<ul>\n" . implode("", $items) . " </ul>\n ";
|
|
} else {
|
|
echo h_abbr(t_none());
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
// LinkForm: Display a related link form
|
|
class LinkForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "links";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this related link");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new related link.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to edit a current related link.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a related link.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("title", "url", "dsc", "hid", "cats");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "title", "url", "dsc", "hid", "cats",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Related Link");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Edit a Current Related Link");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Related Link");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_hid: Hide?
|
|
function _html_col_hid()
|
|
{
|
|
$this->_html_coltmpl_bool("hid", C_("Hide?"),
|
|
C_("Hide this link"), C_("Show this page"), C_("Hide this related link currently."));
|
|
}
|
|
|
|
// _html_col_cats: The categories
|
|
function _html_col_cats()
|
|
{
|
|
$this->_html_coltmpl_select_multi("cat",
|
|
dngettext(COMMONDOMAIN, "Category:", "Categories:", $this->_delcolcount("cat")),
|
|
"linkcat_options");
|
|
}
|
|
}
|
|
|
|
// LinkCategorizationForm: Display a link categorization record form
|
|
class LinkCategorizationForm extends BaseCategorizationForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "linkcatz";
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("cat", "link");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "cat", "link",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Link Categorization Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Change a Current Link Categorization Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Link Categorization Record");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_cat: The category
|
|
function _html_col_cat()
|
|
{
|
|
$this->_html_coltmpl_select("cat", C_("Category:"),
|
|
"linkcat_options", "linkcat_title");
|
|
}
|
|
|
|
// _html_col_link: The link
|
|
function _html_col_link()
|
|
{
|
|
$this->_html_coltmpl_call("link", C_("Link:"), "link_title");
|
|
}
|
|
}
|
|
|
|
// PageForm: Display a page form
|
|
class PageForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "pages";
|
|
}
|
|
if (!array_key_exists("isupload", $args)) {
|
|
$args["isupload"] = true;
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this page");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to write a new page.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to edit a current page.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a page.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("path", "ord", "title",
|
|
"body", "kw", "pic", "html", "hid");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "path", "ord", "title",
|
|
"body", "kw", "pic", "html", "hid",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Write a New Page");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Edit a Current Page");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Page");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("preview", $args)) {
|
|
$args["preview"] = true;
|
|
}
|
|
if ($args["preview"] && !array_key_exists("prevmsg", $args)) {
|
|
$args["prevmsg"] = C_("Preview this page.");
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_hid: Hide?
|
|
function _html_col_hid()
|
|
{
|
|
$this->_html_coltmpl_bool("hid", C_("Hide?"),
|
|
C_("Hide this page"), C_("Show this page"), C_("Hide this page currently."));
|
|
}
|
|
}
|
|
|
|
// NewsForm: Display a news form
|
|
class NewsForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "news";
|
|
}
|
|
if (!array_key_exists("isupload", $args)) {
|
|
$args["isupload"] = true;
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this news article");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to write a new news article.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to edit a current news article.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a news article.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("date", "title",
|
|
"body", "kw", "pic", "html", "hid");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "date", "ord", "title",
|
|
"body", "kw", "pic", "html", "hid",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Write a New News Article");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Edit a Current News Article");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a News Article");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("preview", $args)) {
|
|
$args["preview"] = true;
|
|
}
|
|
if ($args["preview"] && !array_key_exists("prevmsg", $args)) {
|
|
$args["prevmsg"] = C_("Preview this news article.");
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_ord: The order
|
|
function _html_col_ord()
|
|
{
|
|
$this->_html_coltmpl_ro("ord", C_("Order:"));
|
|
}
|
|
|
|
// _html_col_hid: Hide?
|
|
function _html_col_hid()
|
|
{
|
|
$this->_html_coltmpl_bool("hid", C_("Hide?"),
|
|
C_("Hide this news article"), C_("Show this news article"), C_("Hide this news article currently."));
|
|
}
|
|
}
|
|
|
|
// CountryForm: Display a country form
|
|
class CountryForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("table", $args)) {
|
|
$args["table"] = "country";
|
|
}
|
|
if (!array_key_exists("deltext", $args)) {
|
|
$args["deltext"] = C_("Delete this country record");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new country record.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to edit a current country record.");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["summary"] = C_("This table provides you a form to delete a country record.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["cols"] = array("id", "name", "special");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["cols"] = array("sn", "id", "name", "special",
|
|
"created", "createdby", "updated", "updatedby");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Add a New Country Record");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Edit a Current Country Record");
|
|
break;
|
|
// A form to delete a current item
|
|
case "del":
|
|
$args["title"] = C_("Delete a Country Record");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_id: The ID.
|
|
function _html_col_id()
|
|
{
|
|
$this->_html_coltmpl_text("id", C_("ID.:"), null, 2);
|
|
}
|
|
|
|
// _html_col_special: Special record?
|
|
function _html_col_special()
|
|
{
|
|
$this->_html_coltmpl_bool("special", C_("Special?"),
|
|
C_("A special record"), C_("A normal country"), C_("This is a special record."));
|
|
}
|
|
}
|
|
|
|
// PictureForm: Display a picture form
|
|
class PictureForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = form_type();
|
|
}
|
|
if (!array_key_exists("valid_types", $args)) {
|
|
$args["valid_types"] = array("new", "cur");
|
|
}
|
|
if (!array_key_exists("isupload", $args)) {
|
|
$args["isupload"] = true;
|
|
}
|
|
if (!array_key_exists("nodelete", $args)) {
|
|
$args["nodelete"] = true;
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["summary"] = C_("This table provides you a form to add a new picture.");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["summary"] = C_("This table provides you a form to modify a current picture.");
|
|
break;
|
|
}
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
$args["cols"] = array("pic", "ratio", "uppic");
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
switch ($args["type"]) {
|
|
// A form to create a new item
|
|
case "new":
|
|
$args["title"] = C_("Upload a New Picture");
|
|
break;
|
|
// A form to edit a current item
|
|
case "cur":
|
|
$args["title"] = C_("Modify a Current Picture");
|
|
break;
|
|
}
|
|
}
|
|
parent::__construct($status, $args);
|
|
$this->_maxlens["ratio"] = 4;
|
|
}
|
|
|
|
// _html_col_pic: The picture preview
|
|
function _html_col_pic()
|
|
{
|
|
// Obtain the picture deposit
|
|
$PICS =& pic_deposit();
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
// No display if the picture is not submitted yet
|
|
if (is_null($this->_form("pic"))) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th class="th" scope="row"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Picture:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if (is_null($this->_form("pic"))) {
|
|
echo h_abbr(t_notset());
|
|
} elseif (!pic_exists($this->_form("pic"))) {
|
|
?><input type="hidden" name="pic"<?php
|
|
$this->_val_text("pic"); ?> /><?php
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
?><input type="hidden" name="pic"<?php
|
|
$this->_val_text("pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form("pic")];
|
|
$alt = C_("Picture preview");
|
|
echopic($pic, $alt, $this->_form("ratio"));
|
|
echo " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><?php
|
|
$this->_mark("pic"); echo h_abbr(C_("Picture:")); ?></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if ( is_null($this->_cur["pic"])
|
|
|| !pic_exists($this->_cur["pic"])) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
$pic =& $PICS[$this->_cur["pic"]];
|
|
echopic($pic, C_("Original picture preview"), $pic["ratio"]);
|
|
echo " ";
|
|
} ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("New:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
if ( is_null($this->_form("pic"))
|
|
|| !pic_exists($this->_form("pic"))) {
|
|
echo h_abbr(t_na());
|
|
} else {
|
|
?><input type="hidden" name="pic"<?php
|
|
$this->_val_text("pic"); ?> />
|
|
<?php $pic =& $PICS[$this->_form("pic")];
|
|
echopic($pic, C_("New picture preview"),
|
|
$this->_form("ratio"));
|
|
echo " ";
|
|
} ?></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_ratio: The ratio
|
|
function _html_col_ratio()
|
|
{
|
|
// Obtain the picture deposit
|
|
$PICS =& pic_deposit();
|
|
// Set the proper numeric ratio display format
|
|
if (!is_null($this->_form("ratio"))) {
|
|
if (is_numeric($this->_form["ratio"])) {
|
|
$this->_form["ratio_input"] = number_format($this->_form["ratio"], 2);
|
|
} else {
|
|
$this->_form["ratio_input"] = $this->_form["ratio"];
|
|
}
|
|
}
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
// No display if the picture is not submitted yet
|
|
if ( is_null($this->_form("pic"))
|
|
&& is_null($this->_form("ratio"))) {
|
|
return;
|
|
}
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="ratio"><?php
|
|
$this->_mark("ratio"); echo h_abbr(C_("Ratio:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="ratio" type="text" name="ratio" size="5"<?php
|
|
$this->_val_text("ratio_input", "ratio"); ?> /></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" rowspan="2" scope="row"><label for="ratio"><?php
|
|
$this->_mark("ratio"); echo h_abbr(C_("Ratio:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><?php echo h(C_("Original:")); ?></th>
|
|
<td<?php $this->_colspan(); ?>><?php
|
|
$this->_cval_text("ratio_input"); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="oldnew" scope="row"><label for="ratio"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="ratio" type="text" name="ratio" size="5"<?php
|
|
$this->_val_text("ratio_input", "ratio"); ?> /></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
|
|
// _html_col_uppic: The picture file to be submitted
|
|
function _html_col_uppic()
|
|
{
|
|
$class = " class=\"text\"";
|
|
switch ($this->_type) {
|
|
// A form to create a new item
|
|
case "new":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="uppic"><?php
|
|
$this->_mark("uppic"); echo h_abbr(C_("Upload:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="uppic"<?php echo $class; ?> type="file" name="uppic" size="40" /></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
|
|
// A form to edit a current item
|
|
case "cur":
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="uppic"><?php echo h(C_("Upload:")); ?></label></th>
|
|
<th class="oldnew" scope="row"><label for="uppic"><?php echo h(C_("New:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="uppic"<?php echo $class; ?> type="file" name="uppic" size="40" /></td>
|
|
</tr>
|
|
<?php
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// LogInForm: Display a log in form
|
|
class LogInForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
// This is always a new form
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = "new";
|
|
}
|
|
if (!array_key_exists("type_to_pass", $args)) {
|
|
$args["type_to_pass"] = null;
|
|
}
|
|
if (!array_key_exists("valid_types", $args)) {
|
|
$args["valid_types"] = array("new");
|
|
}
|
|
if (!array_key_exists("summary", $args)) {
|
|
$args["summary"] = C_("This table provides you a form to log in.");
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
$args["cols"] = array("id", "passwd", "remember");
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
$args["title"] = C_("Identify Yourself");
|
|
}
|
|
if (!array_key_exists("https", $args)) {
|
|
$args["https"] = true;
|
|
}
|
|
if (!array_key_exists("prefmsg", $args)) {
|
|
$args["prefmsg"] = array();
|
|
}
|
|
if (defined("NOLOGIN") && NOLOGIN) {
|
|
$args["prefmsg"][] = C_("Log-in is temporarily closed for maintainance now. Please come again later. Sorry for the inconvienence.");
|
|
}
|
|
if (!array_key_exists("header_buttons", $args)) {
|
|
$args["header_buttons"] = array();
|
|
}
|
|
if (!array_key_exists("footer_buttons", $args)) {
|
|
$args["footer_buttons"] = array(
|
|
array(
|
|
"name" => null,
|
|
"value" => C_("Log in"),
|
|
),
|
|
);
|
|
}
|
|
if (!array_key_exists("auto_referer2", $args)) {
|
|
$args["auto_referer2"] = false;
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_id: The user ID.
|
|
function _html_col_id()
|
|
{
|
|
if ($this->_is_first_form) {
|
|
// Set the remember me value
|
|
if (array_key_exists(REMEMBER_COOKIE, $_COOKIE)) {
|
|
$id = decrypt($_COOKIE[REMEMBER_COOKIE]);
|
|
if (!is_null($id)) {
|
|
$this->_form["id"] = $id;
|
|
}
|
|
}
|
|
}
|
|
$this->_html_coltmpl_text("id", C_("User ID.:"), null, 20);
|
|
}
|
|
|
|
// _html_col_passwd: The password
|
|
function _html_col_passwd()
|
|
{
|
|
?><tr>
|
|
<th class="th" scope="row"><label for="passwd"><?php
|
|
$this->_mark("passwd"); echo h_abbr(C_("Password:")); ?></label></th>
|
|
<td<?php $this->_colspan();
|
|
?>><input id="passwd" type="password" name="passwd" size="20"<?php
|
|
$this->_val_scalar(null, "passwd"); ?> /></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
// _html_col_remember: Remember me?
|
|
function _html_col_remember()
|
|
{
|
|
if ($this->_is_first_form) {
|
|
// Set the remember me value
|
|
if (array_key_exists(REMEMBER_COOKIE, $_COOKIE)) {
|
|
$this->_form["remember"] = true;
|
|
}
|
|
}
|
|
$this->_html_coltmpl_act_bool("remember", C_("Remember me."));
|
|
}
|
|
}
|
|
|
|
// RebuildForm: Display a rebuild form
|
|
class RebuildForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
// This is always a rebuild form
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = "new";
|
|
}
|
|
if (!array_key_exists("type_to_pass", $args)) {
|
|
$args["type_to_pass"] = null;
|
|
}
|
|
if (!array_key_exists("valid_types", $args)) {
|
|
$args["valid_types"] = array("new");
|
|
}
|
|
if (!array_key_exists("cols", $args)) {
|
|
$args["cols"] = array("type");
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
$args["title"] = C_("Rebuild the Pages");
|
|
}
|
|
if (!array_key_exists("header_buttons", $args)) {
|
|
$args["header_buttons"] = array();
|
|
}
|
|
if (!array_key_exists("footer_buttons", $args)) {
|
|
$args["footer_buttons"] = array(
|
|
array(
|
|
"name" => "confirm",
|
|
"value" => C_("Confirm"),
|
|
),
|
|
array(
|
|
"name" => "cancel",
|
|
"value" => C_("Cancel"),
|
|
),
|
|
);
|
|
}
|
|
if (!array_key_exists("auto_referer2", $args)) {
|
|
$args["auto_referer2"] = false;
|
|
}
|
|
parent::__construct($status, $args);
|
|
}
|
|
|
|
// _html_col_type: The page type
|
|
function _html_col_type()
|
|
{
|
|
$this->_html_coltmpl_select("type", C_("Type:"),
|
|
"rebuildtype_options", null);
|
|
}
|
|
}
|
|
|
|
// LogOutForm: Display a log out form
|
|
class LogOutForm extends BaseForm
|
|
{
|
|
// __construct: Initialize the form
|
|
function __construct($status = null, $args = null)
|
|
{
|
|
if (is_null($args)) {
|
|
$args = array();
|
|
}
|
|
// This is always a rebuild form
|
|
if (!array_key_exists("type", $args)) {
|
|
$args["type"] = "new";
|
|
}
|
|
if (!array_key_exists("type_to_pass", $args)) {
|
|
$args["type_to_pass"] = null;
|
|
}
|
|
if (!array_key_exists("valid_types", $args)) {
|
|
$args["valid_types"] = array("new");
|
|
}
|
|
if (!array_key_exists("title", $args)) {
|
|
$args["title"] = C_("Log Out");
|
|
}
|
|
if (!array_key_exists("header_buttons", $args)) {
|
|
$args["header_buttons"] = array();
|
|
}
|
|
if (!array_key_exists("footer_buttons", $args)) {
|
|
$args["footer_buttons"] = array(
|
|
array(
|
|
"name" => "confirm",
|
|
"value" => C_("Log out"),
|
|
),
|
|
array(
|
|
"name" => "cancel",
|
|
"value" => C_("Cancel"),
|
|
),
|
|
);
|
|
}
|
|
if (!array_key_exists("show_table", $args)) {
|
|
$args["show_table"] = false;
|
|
}
|
|
if (!array_key_exists("prefmsg", $args)) {
|
|
$args["prefmsg"] = array();
|
|
}
|
|
$args["prefmsg"][] = C_("Are you sure you want to log out?");
|
|
parent::__construct($status, $args);
|
|
}
|
|
}
|
|
|
|
?>
|