/** * Generates control's HTML element. * @return Html * <span id="ns" class="ui-stepper"> <input type="text" name="ns_textbox" size="2" autocomplete="off" class="ui-stepper-textbox" /> <button type="submit" name="ns_button_1" class="ui-stepper-plus">+</button> <button type="submit" name="ns_button_2" class="ui-stepper-minus">-</button> </span> */ public function getControl() { $control = parent::getControl(); $updown = Html::el('span')->class('ui-stepper')->add($control)->add(Html::el('input')->type('button')->class('ui-stepper-plus'))->add(Html::el('button')->class('ui-stepper-minus')); //$control->class = 'numericUpDown'; return $updown; }
public function setup_validations() { if ($this->required === true) { $this->validations[] = "checked"; } parent::setup_validations(); }
public function addToField(\Foundation\Form\Field $field) { $this->setupPki(); $element = parent::addToField($field); $filter = new \Foundation\Form\Filter\Encrypt($element, $this->_pki); $element->addFilter($filter); return $element; }
public function setSpecificParameters(&$params) { parent::setSpecificParameters($params); if ($preview = self::getParameter($params, 'preview')) { $this->_preview = $preview; if ($previewClass = self::getParameter($params, 'previewClass')) { $this->_previewClass = $previewClass; } } }
public function render($attributes = array()) { $this->setAttributes($attributes); $dateFormat = ''; $format = $this->format ?: 'Y-m-d'; for ($i = 0; $i < strlen($format); ++$i) { switch ($format[$i]) { case 'd': $dateFormat .= 'dd'; break; case 'j': $dateFormat .= 'd'; break; case 'D': $dateFormat .= 'D'; break; case 'l': $dateFormat .= 'DD'; break; case 'z': $dateFormat .= 'o'; break; case 'F': $dateFormat .= 'MM'; break; case 'M': $dateFormat .= 'M'; break; case 'm': $dateFormat .= 'mm'; break; case 'n': $dateFormat .= 'm'; break; case 'Y': $dateFormat .= 'yy'; break; case 'y': $dateFormat .= 'y'; break; default: $dateFormat .= $format[$i]; } } $this->dataDateFormat = $dateFormat; $this->dataChangeMonth = $this->change_month; $this->dataChangeYear = $this->change_year; if ($this->value instanceof \DateTime) { $this->value = $this->value->format($format); } return parent::render(); }
/** * Check the format of the submitted value * * @param Form $form The form the input is associated with * * @return boolean true if the submitted value is a correct email, else false */ public function check(&$form = null) { if (parent::check($form)) { if (!empty($this->compare) && $form) { if ($form->getData($this->compare) != $this->value) { $form->error($this->errorAt, Lang::get("form.email-comparison")); return false; } } return true; } else { return false; } }
public function render($attributes = array()) { if (!$this->boolean_value) { return parent::render($attributes); } // Here we use a javascript to switch the hidden value. $this->setAttributes($attributes); ob_start(); $fieldId = $this->generateSerialId(); ?> <input id="<?php echo $fieldId; ?> " type="hidden" name="<?php echo $this->name; ?> " value="<?php echo $this->checked ? '1' : '0'; ?> "/> <input <?php echo " data-hidden-id=\"{$fieldId}\" "; echo $this->renderAttributes(); echo $this->checked ? 'checked' : ''; ?> onclick=" var el = document.getElementById('<?php echo $fieldId; ?> '); el.value = el.value != '1' ? '1' : '0'; $(el).triggerHandler('change'); "/><?php $html = ob_get_contents(); ob_end_clean(); return $html; }
/** * Check the submitted value * * @param Form $form The form to apply the errors on in case of check failure * * @return bool the check status */ public function check(&$form = null) { // First check the global input validators if (!parent::check($form)) { return false; } if ($this->value != "") { // Check the format of the given date $tmp = date_parse_from_format($this->format, $this->value); if (empty($tmp)) { $form->error($this->errorAt, Lang::get('form.date-format')); return false; } // Check the date is valid if (!checkdate($tmp['month'], $tmp['day'], $tmp['year'])) { $form->error($this->errorAt, Lang::get('form.invalid-date')); return false; } } return true; }
public function render($attributes = array()) { $serial = $this->getSerialId(); $this->setId($serial); ob_start(); /* <style> .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } </style> select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); } */ ?> <script> jQuery(function() { jQuery( "#<?php echo $serial; ?> " ).autocomplete({ source: "<?php echo $this->source; ?> ", minLength: <?php echo $this->min_length; ?> }); }); </script> <?php $script = ob_get_contents(); ob_end_clean(); return parent::render($attributes) . $script; }
/** * Generates control's HTML element. * @return Html */ public function getControl() { $control = parent::getControl(); $control->class = 'datepicker'; return $control; }
if (count($alternativeTemplates) > 1 && $aclf->checkAccessToFunction("CHANGE_TEMPLATE")) { $sel = new SelectOneInputFixed($lang->get("change_template", "Change Template"), "sitepage", "SPM_ID", $alternativeTemplates, $cond); $propPanel->add($sel); $propPanel->add(new NonDisplayedValue("sitemap", "SPM_ID", $cond, $sel->value, "NUMBER")); } else { $propPanel->add(new Label("lbl", $lang->get("ptempl", "Page Template"), "standard")); $propPanel->add(new Label("lbl", getSPMLink($spm), "standard")); } $propPanel->add(new Label("lbl", $lang->get("spm_cluster"), "standard")); $propPanel->add(new Label("lbl", $cltname, "standard")); $propPanel->add(new Label("lbl", $lang->get("cli"), "standard")); $propPanel->add(new Label("lbl", $clnname, "standard")); $parentMenuID = getDBCell("sitemap", "PARENT_ID", "MENU_ID = " . $menuID); if ($auth->checkAccessToFunction("SITEPAGE_PROPS")) { //$propPanel->add(new MenuDropdown($lang->get("sp_parmenu"), "sitemap", "PARENT_ID", $cond, "type:dropdown", "MANDATORY")); $oname = new TextInput($lang->get("name"), "sitemap", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("PARENT_ID = {$parentMenuID}"); $propPanel->add($oname); } if ($auth->checkAccessToFunction("POSITION")) { $propPanel->add(new SitemapPosition($lang->get("position"), "sitemap", "POSITION", $cond, $menuID, $parentMenuID)); $propPanel->add(new MenuDropdown($lang->get("par_page", "Parent Page"), "sitemap", "PARENT_ID", $cond)); } if ($auth->checkAccessToFunction("C_ACTIVE")) { $propPanel->add(new CheckboxInput($lang->get("active"), "sitemap", "IS_DISPLAYED", $cond, "1", "0")); $propPanel->add(new CheckboxInput($lang->get("restricted_page", "Restricted page", "Page requires login by the user."), 'sitepage', 'PASSWORD_PROTECTED', "SPID = {$spid}")); } if ($auth->checkAccessToFunction("C_CACHE") && $c["renderstatichtml"]) { $propPanel->add(new CheckboxInput($lang->get("cached"), "sitemap", "IS_CACHED", $cond, "1", "0")); } if ($auth->checkAccessToFunction("LOCK_MENU") && $type == 1) {
if ($errors == "") { $topText = $lang->get("objlaunch_success", "The object was successfully launched."); } } if ($action == $lang->get("new_content") && $aclf->checkAccessToFunction("NEW_OBJECT")) { $handled = true; if (!isset($go) || $go == "0") $go = "insert"; if ($go == "insert") $page_action = "INSERT"; $form = new stdEDForm($lang->get("o_new"), "i_edit.gif"); $cond = $form->setPK("content", "CID"); $oname = new TextInput($lang->get("o_name"), "content", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("CATEGORY_ID = $pnode"); $form->add($oname); $form->add(new SelectOneInput($lang->get("type"), "content", "MODULE_ID", "modules", "MODULE_NAME", "MODULE_ID", "MODULE_TYPE_ID=1", "1", "type:dropdown", "MANDATORY")); $form->add(new SelectMultiple2Input($lang->get("variations"), "content_variations", "VARIATION_ID", "1", "variations", "NAME", "VARIATION_ID", "DELETED=0")); $form->add(new SelectOneInput($lang->get("metatemplate"), "content", "MT_ID", "meta_templates", "NAME", "MT_ID", "INTERNAL=0 AND VERSION=0", "1", "type:dropdown", "MANDATORY")); $form->add(new TextInput($lang->get("description"), "content", "DESCRIPTION", $cond, "type:textarea, width:300,size:3", "")); $form->add(new TextInput($lang->get("keywords"), "content", "KEYWORDS", $cond, "type:textarea, width:300,size:3", "")); $form->add(new Hidden("action", "newobject")); $form->add(new NonDisplayedValueOnInsert("content", "CATEGORY_ID", $cond, $pnode, "NUMBER")); $form->add(new NonDisplayedValueOnInsert("content", "CREATED", $cond, "", "TIMESTAMP")); $form->add(new NonDisplayedValue("content", "LAST_MODIFIER", $cond, $auth->user, "TEXT")); $form->add(new NonDisplayedValue("content", "LAST_MOD_DATE", $cond, "", "TIMESTAMP")); $form->add(new NonDisplayedValueOnInsert("content", "DELETED", $cond, 0, "NUMBER")); $form->add(new Hidden("action", $lang->get("new_content"))); $form->forbidDelete(true);
$menuPanel->add(new SubTitle("st", $lang->get("sp_menuprops"), 3)); $menuPanel->add(new Cell('clc', '', 3, 600,10)); $menuPanel->add(new TextInput($lang->get("sp_menuname"), "sitepage_names", "NAME", "VARIATION_ID = $variation AND SPID = $spid", "type:text,size:128,width:300", "")); $menuPanel->add(new TextInput($lang->get("sp_menudescription", "Page Description (for sitemap...)"), "sitepage_names","HELP", "VARIATION_ID = $variation AND SPID = $spid", "type:textarea,size:5,width:400", "")); $menuPanel->add(new Label('lbl', $lang->get('url', 'URL'), 'standard',1)); $uri = getPageURL($menuID, $variation); if (file_exists($c["livepath"].$uri)) { $menuPanel->add(new Label('lbl', '<a href="'.$c["host"].$c["livedocroot"].$uri.'" target="_blank">'.$c["host"].$c["livedocroot"].$uri.'</a>', 'standardlight',2)); } else { $menuPanel->add(new Label('lbl', $c["host"].$c["livedocroot"].$uri, 'standardlight',2)); } if ($aclf->checkAccessToFunction("DIRECT_URL")) { $menuPanel->add(new Cell('clc', '', 3, 600,10)); $menuPanel->add(new SubTitle("st", $lang->get("sp_menudirecttitle", "Define optional Path on server for direct access"), 3)); $menuPanel->add(new Cell('clc', '', 3, 600,10)); $durl = new TextInput($lang->get("sp_menudirect", "Direct url on Live Server"), "sitepage_names", "DIRECT_URL", "VARIATION_ID=$variation AND VERSION=0 AND SPID = " . $spid, "type:text,size:64;width:300", "UNIQUE"); $durl->setFilter("VERSION=0"); $menuPanel->add($durl); } if ($mpProp) { $menuPanel->add(new Hidden("acstate", "pproperties")); } $menuPanel->add(new Hidden("oid", $spid)); $menuPanel->add(new Hidden("view", $view)); $menuPanel->add(new Hidden("processing", "yes")); $menueditbar = new FormButtons(true, true); $menuPanel->add($menueditbar); ?>
public function __construct() { parent::__construct('date'); }
} } } } // doing a trick, to prevent an error display on name-input-field when linking. if ($selected != "0") { $cluster_node_NAME = " "; } // we are starting and are creating a new instance or selecting an existing one. $slcluster = true; $form = new csForm($lang->get("sp_configure"), ""); $form->add(new Hidden("action", "editobject")); $form->add(new Hidden("goon", "UPDATE")); $form->addToTopText($lang->get("sp_confdesc") . "<br>"); $form->add(new Label("lbl", $lang->get("sp_link"), "standard", 2)); $form->add(new CLSelector($lang->get("cli"), "sitepage", "CLNID", "SPID = {$spid}", $clt, $params = "", $check = "")); $form->add(new Cell("clc", "standard", 1, 150)); $form->add(new ButtonInCell("selected", $lang->get("commit"), "standard", "SUBMIT")); $form->add(new Cell("clc", "border", 2, 500)); $form->add(new Label("lbl", $lang->get("sp_clnew"), "standard", 2)); $oname = new TextInput($lang->get("cli"), "cluster_node", "NAME", 1, "type:text,size:32,width:200", "MANDATORY&UNIQUE"); $oname->setFilter("CLT_ID = {$clt}"); $form->add($oname); $form->add(new Cell("clc", "standard", 1, 150)); $form->add(new ButtonInCell("create", $lang->get("commit"), "standard", "SUBMIT")); // add some variations now... $vari = createDBCArray("sitepage_variations", "VARIATION_ID", "SPM_ID = {$spm}"); for ($i = 0; $i < count($vari); $i++) { $form->add(new Hidden("cluster_variations_VARIATION_ID_" . $vari[$i], "1")); } // check end
/** * Adds single-line text input control used for sensitive input such as passwords. * @param string control name * @param string label * @param int width of the control * @param int maximum number of characters the user may enter * @return TextInput */ public function addPassword($name, $label, $cols = NULL, $maxLength = NULL) { $control = new TextInput($label, $cols, $maxLength); $control->setPasswordMode(TRUE); $this->addComponent($control, $name); return $control; }
public function render($attributes = array()) { $html = parent::render($attributes); return $html; }
$auth = new auth("CALENDAR_CREATE"); $page = new Page("Edit Calendars"); $selch = new SelectMenu($lang->get("channel_select", "Select Channel"), "chsel", "channels", "NAME", "CHID", "1"); $filter = new Filter("channel_categories", "CH_CAT_ID"); $filter->addRule($lang->get("cat_name", "Category"), "NAME", "NAME"); $filter->setAdditionalCondition(" CHID=" . $selch->selected . " AND CHID <> 0"); $filter->type_name = $lang->get("category", "Category"); $filter->icon = "li_categories.gif"; $filtermenu = new Filtermenu("", $filter); include $c["path"] . "modules/channels/menu.inc.php"; if (strtoupper(value("deletion")) == "DELETE" && strtoupper(value("commit")) == "YES") { deleteChannelCategory(value("oid", "NUMERIC")); } if ($oid == 0) { $addtext = ""; } else { $addtext = ": " . getDBCell("channel_categories", "NAME", "CH_CAT_ID = " . $oid); } if ($selch->selected != "0" && $selch->selected != "-1" && $selch->selected != 0) { $form = new stdEDForm($lang->get("category") . $addtext); $cond = $form->setExPK("channel_categories", "CH_CAT_ID"); $nameInput = new TextInput($lang->get("name"), "channel_categories", "NAME", $cond, "type:text,width:300,size:64", "MANDATORY&UNIQUE"); $nameInput->setFilter("CHID = " . $selch->selected); $form->add($nameInput); $form->add(new SitepageSelector($lang->get("outputpage", "Output Page", 'Page where the articles will be rendered to.'), 'channel_categories', 'PAGE_ID', $cond)); $form->add(new NonDisplayedValueOnInsert("channel_categories", "CHID", $cond, $selch->selected, "NUMBER")); $page->add($form); } $page->addMenu($selch); $page->addMenu($filtermenu); $page->draw();
$filter->addRule($lang->get("cat_name", "Category"), "NAME", "NAME"); $filter->setAdditionalCondition(" CALID=" . $selcal->selected . " AND CALID <> 0"); $filter->type_name = $lang->get("category", "Category"); $filtermenu = new Filtermenu("", $filter); $filtermenu->addMenuEntry($lang->get("calendars_edit", "Edit Calendar"), "edit.php", "", "CALENDAR_EDIT"); $filtermenu->addMenuEntry($lang->get("calendars_define", "Define Calendars"), "calendars.php", "", "CALENDAR_CREATE"); $filtermenu->addMenuEntry($lang->get("calendars_cat_define", "Define Categories"), "categories.php", "", "CALENDAR_CREATE"); $deleteHandler = new ActionHandler("DELETE"); $deleteHandler->addDbAction("DELETE FROM pgn_cal_calendars WHERE CATID = {$oid}"); $deleteHandler->addDbAction("DELETE FROM pgn_cal_categories WHERE CATID = {$oid}"); if ($oid == 0) { $addtext = ""; } else { $addtext = ": " . getDBCell("pgn_cal_categories", "NAME", "CATID = " . $oid); } if ($selcal->selected != "0" && $selcal->selected != "-1") { $form = new stdEDForm($lang->get("category") . $addtext); $cond = $form->setExPK("pgn_cal_categories", "CATID"); $nameInput = new TextInput($lang->get("name"), "pgn_cal_categories", "NAME", $cond, "type:text,width:300,size:64", "MANDATORY&UNIQUE"); $nameInput->setFilter("CALID = " . $selcal->selected); $form->add($nameInput); $form->add(new TextInput($lang->get("description"), "pgn_cal_categories", "DESCRIPTION", $cond, "type:textarea,width:300,size:3", "")); $form->add(new TextInput($lang->get("color", "Color"), "pgn_cal_categories", "COLOR", $cond, "type:color,param:form1", "")); $form->add(new NonDisplayedValueOnInsert("pgn_cal_categories", "CALID", $cond, $selcal->selected, "NUMBER")); $form->registerActionHandler($deleteHandler); $page->add($form); } $page->addMenu($selcal); $page->addMenu($filtermenu); $page->draw(); echo $errors;
$form->add(new Hidden("crvar", $variation)); $handled = true; } } if (! $handled) { $form = new PanelForm($lang->get("edit_content", "Edit Content"). ": " . $name, '', 'con'); if ($aclf->checkAccessToFunction("EDIT_OBJECT")) { $editpanel = new Panel($lang->get("edit_content")); $buttonbar = new ButtonBar("variations"); $buttonbar->selectBoxDescr = true; $buttonbar->setVariationSelector(createNameValueArrayEx("variations", "NAME", "VARIATION_ID", "1"), $variation); $editpanel->add($buttonbar); $editpanel->add(new Subtitle("st", $lang->get("title"))); $oname = new TextInput($lang->get("o_name"), "content", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("CATEGORY_ID = $category_id"); $editpanel->add($oname); $editpanel->add(new TextInput($lang->get('access_key', 'Access Key', 'Key-Value with which you can access this content from the editor by typing [key].'), 'content', 'ACCESSKEY', $cond, "type:text,width:100,size:16",'UNIQUE')); $editpanel->backto = $c["docroot"] . "modules/content/objectbrowser.php?sid=$sid&resetfilter=1&pnode=$category_id"; // Edit $editpanel->add(new Subtitle("st", $lang->get("edit_content"))); includePGNSource ($content_MODULE_ID); $ref = createPGNRef($content_MODULE_ID, $fkid); if ($ref != "") { $ref->edit($editpanel); } else { $editpanel->add(new Label("std", $lang->get("error_init", "Could not initialize the content"), "standardlight")); }
public function render($name, $value = null, array $attrs = array()) { if ($value instanceof \DateTime) { $value = $value->format($this->format); } return parent::render($name, $value, $attrs); }
/** * draw the form for creating new items. * May be overwritten if standard Display should not be used! */ function draw_new() { global $db, $lang, $go, $oid, $newitem, $errors, $page_action; $newitem = value("newitem"); $oid = value("oid", "NUMERIC"); $go = value("go", "NOSPACES"); //needed for uniqueness checks. $page_action = "INSERT"; $go = "UPDATE"; $container = new Container(4); $container->add(new Label("lbl", $lang->get("selectobject"), "informationheader", 3)); $container->add(new Cell("clc", "cwhite", 1, 20,10)); $container->add(new Cell("clc", "cwhite", 1, 150,10)); $container->add(new Cell("clc", "cwhite", 1, 350,10)); // what data should be displayed // check if item is selected. $stdStyle = "standardlight"; if ($this->state == creating && $newitem == "0") { $errors .= "-MANDATORY"; $stdStyle = "error"; $container->add(new Label("lbl", $lang->get("selectone"), "error", 3)); } $sql = "SELECT " . $this->new_pkname . ", " . $this->new_name . ", " . $this->new_description . " FROM " . $this->new_table . " ORDER BY " . $this->new_name; $query = new query($db, $sql); while ($query->getrow()) { $pk = $query->field($this->new_pkname); $checked = false; if (value("newitem", "NUMERIC") == $pk) $checked = true; $container->add(new Radio("newitem", $pk, $stdStyle, $checked)); $container->add(new Label("name", $query->field($this->new_name), "standard", 2)); $container->add(new Cell("clc", "standard", 1)); $container->add(new Label("desc", $query->field($this->new_description), "description", 2)); } $nameinput = new TextInput($lang->get("name"), $this->item_table, $this->item_name, "1", "type:text,size:32,width:200", "UNIQUE&MANDATORY"); $nameinput->setFilter($this->item_parentKeyName . " = $oid"); $positioninput = new TextInput($lang->get("position"), $this->item_table, "POSITION", "1", "type:text,size:3,width:30", "MANDATORY", "NUMBER"); if ($this->state == "creating") { $nameinput->check(); $positioninput->check(); } $container->add(new Cell("cll", "standard", 3, 10, 10)); $container->add(new Cell("cll", $nameinput->std_style, 1, 10, 1)); $container->add($nameinput); $container->add(new Cell("cll", $positioninput->std_style, 1, 10, 1)); $container->add($positioninput); // drawing. echo drawSpacer(1,1)."</td><td>".drawSpacer(1,1)."</td></tr>"; // cleanup the shit. echo "<tr><td colspan=\"2\"><br>"; echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">'; $container->draw(); echo '</table>'; echo '</td></tr>'; echo '<tr><td colspan="2" align="right">'; echo '<br/>'; $resetbutton = new Button("reset", $lang->get("reset"), "navelement", "reset"); $resetbutton->draw(); echo drawSpacer(50,1); $backbutton = new Button("back", $lang->get("back"), "navelement", "submit"); $backbutton->draw(); echo ' '; $submitbutton = new Button("neu", $lang->get("create"), "navelement", "submit"); $submitbutton->draw(); retain("oid", $oid); retain("action", "editobject"); }
if ($errors != "") { $form->addToTopText($lang->get("saveerror")); } else { $form->addToTopText($lang->get("savesuccess")); } } $clusterPanel = new Panel($lang->get("ed_content")); $clusterPanel->backto = $c["docroot"]."modules/cluster/clusterbrowser.php?sid=$sid&oid=$clnid&view=1"; $propPanel = new Panel($lang->get("cl_properties")); $metaPanel = new Panel($lang->get("ed_meta")); if ($view == $pos_clusterPanel && count($variations) > 0 && ($aclf->checkAccessToFunction("EDIT_CL_CONTENT"))) { require_once $c["path"] . "modules/common/panel_cluster.inc.php"; } else if ($view == $pos_objectProp && $aclf->checkAccessToFunction("CL_PROPS")) { $mynode = getVar("cluster"); $cond = "CLNID = $clnid"; $oname = new TextInput($lang->get("cl_name"), "cluster_node", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("CLT_ID = $mynode"); $propPanel->add(new Hidden("view", $view)); $propPanel->add(new Hidden("processing", "yes")); $propPanel->add($oname); $propPanel->add(new SelectMultiple2Input($lang->get("variations"), "cluster_variations", "VARIATION_ID", $cond . " AND DELETED=0", "variations", "NAME", "VARIATION_ID", "DELETED=0")); $propPanel->add(new Hidden("action", "objectprop")); $propPanel->add(new FormButtons(true, true)); $handler = new ActionHandler("UPDATE"); $handler->addFncAction("syncClusterVariations"); $propPanel->registerActionHandler($handler); } else if ($view == $pos_metaPanel && ($aclf->checkAccessToFunction("ED_CL_META_DATA"))) { require_once $c["path"] . "modules/common/panel_meta.inc.php"; }
$oid = value("oid", "NUMERIC"); $deleteobject = value("deleteobject"); $forward = ""; // processing page actions if ($action != "0") { if ($action == $lang->get("new_folder") && $auth->checkAccessToFunction("NEW_FOLDER")) { if (value("go") == "0") $go = "insert"; if ($go == "insert") $page_action = "INSERT"; $form = new stdEDForm($lang->get("r_newfolder"), "i_newfolder.gif"); $cond = $form->setPK("categories", "CATEGORY_ID"); $catname = new TextInput($lang->get("r_foldername"), "categories", "CATEGORY_NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $catname->setFilter("PARENT_CATEGORY_ID = $pnode"); $form->add($catname); $form->add(new Hidden("action", $lang->get("new_folder"))); $form->add(new Hidden("pnode", $pnode)); $form->add(new NonDisplayedValueOnInsert("categories", "PARENT_CATEGORY_ID", $cond, $pnode, "NUMBER")); $form->add(new NonDisplayedValueOnInsert("categories", "DELETED", $cond, 0, "NUMBER")); $form->forbidDelete(true); $page->add($form); $handled = true; $forward = doc(); } else if ($action == $lang->get("del_folder") && $auth->checkAccessToFunction("DELETE_FOLDER") && $pnode != "0") { if (!isset($go)) $go = "start"; $delhandler = new ActionHandler("deletefolder");
public function render($attributes = array()) { $this->setAttributes($attributes); $dateFormat = ''; $timeFormat = ''; $cursor =& $dateFormat; $format = $this->format ?: 'Y-m-d H:i:s'; $this->dataAmpm = false; for ($i = 0; $i < strlen($format); ++$i) { switch ($format[$i]) { case 'd': $cursor =& $dateFormat; $cursor .= 'dd'; break; case 'j': $cursor =& $dateFormat; $cursor .= 'd'; break; case 'D': $cursor =& $dateFormat; $cursor .= 'D'; break; case 'l': $cursor =& $dateFormat; $cursor .= 'DD'; break; case 'z': $cursor =& $dateFormat; $cursor .= 'o'; break; case 'F': $cursor =& $dateFormat; $cursor .= 'MM'; break; case 'M': $cursor =& $dateFormat; $cursor .= 'M'; break; case 'm': $cursor =& $dateFormat; $cursor .= 'mm'; break; case 'n': $cursor =& $dateFormat; $cursor .= 'm'; break; case 'Y': $cursor =& $dateFormat; $cursor .= 'yy'; break; case 'y': $cursor =& $dateFormat; $cursor .= 'y'; break; case 'a': $cursor =& $timeFormat; $cursor .= 'tt'; break; case 'A': $cursor =& $timeFormat; $cursor .= 'TT'; break; case 'g': $cursor =& $timeFormat; $cursor .= 'h'; $this->dataAmpm = true; break; case 'h': $cursor =& $timeFormat; $cursor .= 'hh'; $this->dataAmpm = true; break; case 'G': $cursor =& $timeFormat; $cursor .= 'h'; break; case 'H': $cursor =& $timeFormat; $cursor .= 'hh'; break; case 'i': $cursor =& $timeFormat; $cursor .= 'mm'; break; case 's': $cursor =& $timeFormat; $cursor .= 'ss'; break; default: $cursor .= $format[$i]; } } $this->dataDateFormat = $dateFormat; $this->dataTimeFormat = $timeFormat; if ($this->value instanceof \DateTime) { $this->value = $this->value->format($format); } return parent::render(); }
$query = new query($db, $sql); $query->free(); $action = "editobject"; $go = "CREATE"; $processing = "no"; $page_state = "start"; } if ($action == "newpage" && $aclf->checkAccessToFunction("ADD_SITEPAGE")) { if ($go == "insert") $page_action = "INSERT"; $mid = initValueEx("mid", "mid", "0"); $form = new stdEDForm($lang->get("sp_newpage"), "i_edit.gif"); $cond = $form->setPK("sitemap", "MENU_ID"); $form->add(new IconSelectInput($lang->get("tmpl_name", "Select a template"), "sitemap", "SPM_ID", "sitepage_master", "NAME", "SPM_ID", "DESCRIPTION", $c["spmthumbdocroot"], "THUMBNAIL", "DELETED=0 AND VERSION=0", $cond, "type:dropdown", "MANDATORY")); $oname = new TextInput($lang->get("stname", "Select a name to identify this page in the sitemap"), "sitemap", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("PARENT_ID = $mid"); $form->add($oname); $form->add(new SitemapPosition($lang->get("pos_in_menu"), "sitemap", "POSITION", $cond, 0, $mid)); $form->add(new Label("lbl", $lang->get("cr_content", "Create Content for this page?"), "standard")); $form->add(new Checkbox("createpage", "1", "standard", true)); $form->add(new ActionField("newpage")); $form->add(new NonDisplayedValueOnInsert("sitemap", "PARENT_ID", $cond, $mid, "NUMBER")); $form->add(new NonDisplayedValueOnInsert("sitemap", "DELETED", $cond, 0, "NUMBER")); $form->add(new NonDisplayedValueOnInsert("sitemap", "IS_DISPLAYED", $cond, 1, "NUMBER")); $form->forbidDelete(true); $form->forbidUpdate(true); $handler = new ActionHandler("INSERT"); $handler->addFncAction("createMenuEntry"); $handler->addFncAction("createContentPage");
function addPassword($name, $label = NULL, $cols = NULL, $maxLength = NULL) { $control = new TextInput($label, $cols, $maxLength); $control->setPasswordMode(TRUE); return $this[$name] = $control; }
/** * Adds single-line text input control used for sensitive input such as passwords. * @param string control name * @param string label * @param int width of the control * @param int maximum number of characters the user may enter * @return TextInput */ public function addPassword($name, $label = NULL, $cols = NULL, $maxLength = NULL) { $control = new TextInput($label, $cols, $maxLength); $control->setType('password'); return $this[$name] = $control; }
function draw_edit($id) { global $lang, $oid; $oid = value("oid", "NUMERIC"); $cond = $this->item_pkname . " = $id"; $myCLTIName = new TextInput($lang->get("name"), $this->item_table, $this->item_name, $cond, "type:text,size:32,width:200", "UNIQUE&MANDATORY"); $myCLTIName->setFilter("CLT_ID = " . value("oid", "NUMERIC")); $this->add($myCLTIName); // dispatching, what type of clti we are working with. $cltitypeId = getDBCell($this->item_table, "CLTITYPE_ID", $cond); $fkId = getDBCell($this->item_table, "FKID", $cond); switch ($cltitypeId) { case 1: // static content $this->add(new Cell("clc", "standard", 2,1,5)); $this->add(new Label("lbl", $lang->get("ci_select", "Please select a content to link it into the cluster-template"), "standard", 2)); $this->add(new Cell("clc", "standard", 2,1,5)); $this->add(new LibrarySelect("cluster_template_items", "FKID", $cond)); $this->add(new Cell("clc", "standard", 2,1,5)); break; case 2: // dynamic content if ($fkId == 0) $this->add(new SelectOneInput($lang->get("type"), "cluster_template_items", "FKID", "modules", "MODULE_NAME", "MODULE_ID", "MODULE_TYPE_ID=1", $cond, "type:dropdown", "MANDATORY")); $this->add(new TextInput($lang->get("clt_mincard"), "cluster_template_items", "MINCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new TextInput($lang->get("clt_maxcard"), "cluster_template_items", "MAXCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new CheckboxInput($lang->get("clt_exclusive", "Developer Content", "If box is checked, this content can only be edited by developers."), "cluster_template_items", "EXCLUSIVE", $cond, 1, 0)); if ($fkId != 0 || $this->ready) { if ($this->ready && $fkId =="0") $fkId = value($this->item_table . "_FKID", "NUMERIC"); $classname = getDBCell("modules", "CLASS", "MODULE_ID = ".$fkId); $ref = new $classname(0, $id); $ref->_editConfig($this); } break; case 3: // static cluster // $this->searchbox = new CLTISelector($this->item_table, "FKID", $cond); $this->add(new Cell("clc", "standard", 2,1,5)); $this->add(new Label("lbl", $lang->get("cl_select", "Please select a cluster to link it into the cluster-template"), "standard", 2)); $this->add(new Cell("clc", "standard", 2,1,5)); $container = new Container(2); $this->add(new WZSelectCluster("sel_object",600,2)); //$this->add($container); break; case 4: //dynamic cluster if ($fkId == 0) $this->add(new CLTSelector($lang->get("type"), "cluster_template_items", "FKID", $cond, $oid, "", "MANDATORY")); $this->add(new TextInput($lang->get("clt_mincard"), "cluster_template_items", "MINCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new TextInput($lang->get("clt_maxcard"), "cluster_template_items", "MAXCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new CheckboxInput($lang->get("clt_exclusive", "Developer Content", "If box is checked, this content can only be edited by developers."), "cluster_template_items", "EXCLUSIVE", $cond, 1, 0)); break; case 5: // library if ($fkId == 0) $this->add(new SelectOneInput($lang->get("type"), "cluster_template_items", "FKID", "modules", "MODULE_NAME", "MODULE_ID", "1", $cond, "type:dropdown", "MANDATORY")); $this->add(new TextInput($lang->get("clt_mincard"), "cluster_template_items", "MINCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new TextInput($lang->get("clt_maxcard"), "cluster_template_items", "MAXCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new CheckboxInput($lang->get("clt_exclusive", "Developer Content", "If box is checked, this content can only be edited by developers."), "cluster_template_items", "EXCLUSIVE", $cond, 1, 0)); break; case 6: // compound if ($fkId == 0) $this->add(new CLTSelector($lang->get("type"), "cluster_template_items", "FKID", $cond, $oid, "", "", "NUMBER", true)); $this->add(new TextInput($lang->get("clt_mincard"), "cluster_template_items", "MINCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new TextInput($lang->get("clt_maxcard"), "cluster_template_items", "MAXCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new CheckboxInput($lang->get("clt_exclusive", "Developer Content", "If box is checked, this content can only be edited by developers."), "cluster_template_items", "EXCLUSIVE", $cond, 1, 0)); break; case 7: // compound group $this->add(new SelectOneInput($lang->get("cp_group", "Compound Group"), "cluster_template_items", "FKID", "compound_groups", "NAME", "CGID", "1", $cond, "type:dropdown", "MANDATORY")); break; case 8: // channel $this->add(new TextInput($lang->get("clt_mincard"), "cluster_template_items", "MINCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new TextInput($lang->get("clt_maxcard"), "cluster_template_items", "MAXCARD", $cond, "type:text,size:3,width:40", "MANDATORY", "NUMBER")); $this->add(new CheckboxInput($lang->get("clt_exclusive", "Developer Content", "If box is checked, this content can only be edited by developers."), "cluster_template_items", "EXCLUSIVE", $cond, 1, 0)); $this->add(new NonDisplayedValue("cluster_template_items", "FKID", $cond, "1", "NUMBER")); break; } $this->add(new Hidden("editing", $id)); }