/** * syncronize variations with entered data to the database. * The configuration for this function must be set manually. * I.E. there must be the $oid-Variable set and there must(!) * be also the global vars content_variations_VARIATION_ID_XX * and content_MODULE_ID * set which are automatically set by the SelectMultiple2Input. */ function syncVariations() { global $db, $oid, $content_MODULE_ID; $module = value("content_MODULE_ID", "NUMERIC"); if ($module == "0") { $module = $content_MODULE_ID; } includePGNSource($module); //delete all variations first. $del = "UPDATE content_variations SET DELETED=1 WHERE CID = {$oid}"; $query = new query($db, $del); // get list of variations $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0"); for ($i = 0; $i < count($variations); $i++) { $id = $variations[$i][1]; if (value("content_variations_VARIATION_ID_" . $id) != "0") { // create or restore variation // check, if variations already exists and is set to deleted. $sql = "SELECT COUNT(CID) AS ANZ FROM content_variations WHERE CID = {$oid} AND VARIATION_ID = {$id}"; $query = new query($db, $sql); $query->getrow(); $amount = $query->field("ANZ"); if ($amount > 0) { $sql = "UPDATE content_variations SET DELETED=0 WHERE CID = {$oid} AND VARIATION_ID = {$id}"; } else { $fk = nextGUID(); $sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( {$oid}, {$id}, {$fk}, 0)"; $PGNRef = createPGNRef($module, $fk); $PGNRef->sync(); } $query = new query($db, $sql); } } }
/** * Creates the input fields for editing text * @param integer &$form link to the form the input-fields are to be created in */ function edit(&$form) { global $lang; $groups = createNameValueArray("groups", "GROUP_NAME", "GROUP_ID", "1 ORDER BY GROUP_NAME ASC"); $groups[0][0] = $lang->get("all"); $groups[0][1] = "0"; $condition = "FKID = $this->fkid"; $form->add(new SelectOneInputFixed($lang->get("auth_group", "Authentification"), "pgn_auth", "GROUP_ID", $groups, $condition, "type:dropdown,width:200", "")); }
/** * writes HTML for the Selector */ function draw_selector() { global $lang, $statsinfo; $values = createNameValueArray($this->table, $this->namecol, $this->valuecol, $this->cond); echo "<tr><td>"; echo "<table width=\"185\" cellpadding=\"3\" cellspacing=\"3\" class=\"sidebar_menubox\"><tr><td>"; echo "<table width='100%' cellpadding='3' cellspacing='0' border='0'>"; echo "<tr>"; $dropdown = new Dropdown($this->identifier, $values, 'standardwhite', $this->selected, 100, 1); $dropdown->draw(); echo "</td><td>"; $lbi = new ButtonInline("changetop", $lang->get('change', 'Change'), 'navelement', 'submit', '', 'f'.$this->identifier); echo $lbi->draw(); echo '<input type="hidden" name="changetop" value="">'; echo "</td></tr>"; echo "</tr></table>"; echo "</td></tr></table>"; echo "</td></tr>"; }
/** * Standard constructor * @param string optional to manually set resource_type */ function STSelectResource($restype = "") { global $lang; if ($restype == "") { $this->restype = $_SESSION["resource_type"]; } else { $this->restype = $restype; $_SESSION["resource_type"] = $restype; } if ($this->restype == "CLUSTER") { $this->add(new WZSelectCluster("guid")); $this->explanation = $lang->get("expl_sel_cluster", "After selecting a cluster-template, a list with clusters will appear, where you can select one."); } else { if ($this->restype == "CLUSTERTEMPLATE") { $this->explanation = $lang->get("expl_sel_clt", "Please Select a cluster-template."); $clts = array(); createCLTTree($clts); $this->add(new WZSelect("guid", $lang->get("sel_clt", "Select Cluster-Template"), $clts)); } else { if ($this->restype == "PAGETEMPLATE") { $spms = createNameValueArray("sitepage_master", "NAME", "SPM_ID", "DELETED=0 AND VERSION=0"); $this->add(new WZSelect("guid", $lang->get("sel_ptml", "Select Page-Template"), $spms)); $this->explanation = $lang->get("expl_sel_spm", "Please select a page-template."); } else { if ($this->restype == "CHANNEL") { $channels = createNameValueArray("channels", "NAME", "CHID"); $this->add(new WZSelect("guid", $lang->get("sel_ch", "Select Channel"), $channels)); $this->explanation = $lang->get("expl_sel_ch", "Please select a channel."); } else { if ($this->restype == "CHANNELCATEGORY") { $channels = getChannelDropDownValues(); $this->add(new WZSelect("guid", $lang->get("sel_ch", "Select Channel"), $channels)); $this->explanation = $lang->get("expl_sel_ch", "Please select a channel."); } } } } } }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string name of the table, you want to join to the input-value. * @param string name of the column, you want to use as diplay in dropdown for value. * @param string name of the column, you want to retrieve the values from for the table and column. * foreign key to table->column. * @param string $foreign_data_identifier where-condition in SQL-Clause for selections of input-values. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string allowed is type:DROPDOWN|SELECT as paramter for choosing a dropdown or selectbox. For select * you may also use size:XX for number of rows. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Unique will not make sense in most cases! * @param string $datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function SelectOneInput($label, $table, $column, $foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier = "1", $row_identifier = "1", $param = "type:dropdown", $check = "MANDATORY", $datatype = "NUMBER") { $chktmp = $check; DBO::DBO($label, $table, $column, $row_identifier, $param, $datatype, $chktmp); if (!$this->mandatory) { $values = createNameValueArray($foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier); } else { $values = createNameValueArrayEx($foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier); } switch ($this->type): case "DROPDOWN": $this->v_wuiobject = new Dropdown($this->name, $values, $this->std_style, $this->value, $this->width); break; case "SELECT": $this->v_wuiobject = new Select($this->name, $values, "", $this->value, $this->size, $this->std_style, $this->width); break; endswitch; }
<? /********************************************************************** * @module Application **********************************************************************/ require_once "../../config.inc.php"; $auth = new auth("Administrator"); $page = new page("Designs"); require_once "menudef.inc.php"; $form = new SettingsForm($lang->get("designs", "Website Designs")); $ar = createNameValueArray('sitemap', 'NAME', 'MENU_ID'); $designclasses = getDCFileList('designs'); $form->addRadioSetting($lang->get('sel_design', 'Select Design'), 'CDS/MENU', $designclasses); $mclass = reg_load('CDS/MENU'); if ((value("set0", "", "") != $mclass) && (value("set0", "", "") != "")) $mclass = value("set0"); if ($mclass != "") { $form->addHeadline($lang->get('adjust/desugb', 'Adjust Design')); $ref = createDCRef($c["basepath"]."designs/".$mclass); $ref->editConfiguration(&$form); $form->add(new Spacer(2)); } $page->add($form); $page->draw(); $db->close(); ?>
/** * Standard constructor * @param string name of the table, the data is to be stored * @param string name of the column, the data is to be stored * @param string Where-Condition to select the record that is to be updated. * @param integer ID of the content-type, i.e. plugin. */ function CISelector($table, $column, $row_identifier, $type = 0) { $this->table = $table; $this->column = $column; $this->cond = $row_identifier; $this->type = $type; $this->fk = getDBCell($table, $column, $row_identifier); global $lang, $folder, $plugin, $searchin, $pattern, $db, $specialID; // $plugin = value("plugin"); $searchin = value("searchin"); $pattern = value("pattern"); // $specialID = value("specialID"); // $folder = value("folder"); $this->add(new Label("lbl1", $lang->get("sr_selectci"), "informationheader", 2)); //$this->add(new Label("lbl", "<b>".$lang->get("selectedobject")."</b>", "informationheader")); //if ($this->fk !=0) { // $this->idlabel = new Label("lbl0", getDBCell("content", "NAME", "CID = ".$this->fk), "informationheader"); //} else { // $this->idlabel = new Label("lbl0", $lang->get("empty"), "informationheader"); //} //$this->add(&$this->idlabel); $this->add(new Label("lbl2", $lang->get("folder"), "standard")); $this->add(new Label("lbl3", $lang->get("contenttype"), "standard")); // folder dropdown. $folders[0][0] = ">"; $folders[0][1] = 0; createFolders($folders, ">", 0); $plugins = createNameValueArray("modules", "MODULE_NAME", "MODULE_ID", "1"); $this->add(new Dropdown("folder", $folders, "standard", $folder, 220, 1)); if ($this->type == 0) { $this->add(new Dropdown("plugin", $plugins, "standard", $plugin, 250, 1)); } else { $type_name = getDBCell("modules", "MODULE_NAME", "MODULE_ID = $type"); $this->add(new Label("lbl", $type_name, "standardlight", 1)); } $searchins[0][0] = $lang->get("searchin"); $searchins[0][1] = 0; $searchins[1][0] = $lang->get("name"); $searchins[1][1] = 1; $searchins[2][0] = $lang->get("keywords"); $searchins[2][1] = 2; $searchins[3][0] = $lang->get("description"); $searchins[3][1] = 3; $this->add(new Dropdown("searchin", $searchins, "standard", $searchin, 220, 1)); $this->add(new Input("pattern", $pattern, "standard", 32, "", 250)); $this->add(new Cell("clc", "standard", 1, 250)); $this->add(new ButtonInCell("search", $lang->get("search"), "standard", "SUBMIT")); global $search; $search = value("search"); if ($search != "0") { // prepare search-pattern. $ppattern = strtoupper($pattern); $ppattern = ereg_replace(" ", "%", $ppattern); $ppattern = ereg_replace("\*", "%", $ppattern); if (!isset($plugin)) $plugin = $this->type; $this->search("/", $folder, $plugin, $searchin, $ppattern); $this->add(new Label("lbl4", $lang->get("searchresults"), "standard")); $this->add(new Dropdown("CIDRES_" . $specialID, $this->results, "standard", $CID, 250, 1)); } }
/** * returns a 2d NAme-Value- array with all instances a cluster-template has. * the result is stored by array[counter][0] = title, array[counter][1] = clnid * Note that entry counter=0 has always Please select and Value -1! * @param integer Cluster-Node-Id of the cluster you want to get all brothers from * @returns array NAME-Value-array. */ function getClusterBrothers($clnid) { $clt = getDBCell("cluster_node", "CLT_ID", "CLNID = $clnid"); return createNameValueArray("cluster_node", "NAME", "CLNID", "CLT_ID = $clt ORDER BY NAME ASC"); }
$clnid = "-1"; } td($style); echo $lang->get("sel_clt"); tde(); tr(); $clts = array(); createCLTTree($clts); $sb = new Dropdown("clt", $clts, $style, $clt, $width); $sb->params = 'onChange="if (this.value != \'-1\') document.ifoform.submit();"'; $sb->draw(); tr(); td($style); echo drawSpacer(5); echo '<script language="JavaScript">'; echo ' parent.document.getElementById("' . $callback . '").value = "' . $clnid . '";'; echo '</script>'; tde(); if ($clt != "-1" && $clt != "0" && $clt != "") { $clusters = createNameValueArray("cluster_node", "NAME", "CLNID", "CLT_ID = {$clt} AND VERSION=0 AND DELETED=0"); tr(); td($style); echo $lang->get("sel_cluster", "Select Cluster") . " (" . (count($clusters) - 1) . ")"; tde(); tr(); $sb2 = new Dropdown("clnid", $clusters, $style, $clnid, $width); $sb2->params = 'onChange="' . drawIfoSave($callback, "clnid") . '"'; $sb2->draw(); } retain("width", $width + 50); drawIFOFooter();
/** * standard constructor */ function ACLEditor($acl, $title = "") { global $lang; Container::Container(3); $this->acl = $acl; $this->title = $title; $id = $acl->guid; // load the data of the field. global $page_state, $page_action; if ($page_state == "processing") { $acl->inherit = value("acl_inherit" . $id); // because the config is not displayed in inherit mode, this is necessarry to load the data! if ($acl->inherit != value("checkednow")) { $page_state = "start"; } else { $acl->owner = value("acl_owner" . $id); } } // prepare the form.... $clc = new Cell("clc", "embedded", 1, 195, 1); $this->add($clc); $this->add($clc); $this->add($clc); $this->add(new Subtitle("title", $lang->get("acl_title", "Setting permissions for "). "<b> $title</b>", 3)); $this->add(new CheckboxTxt("acl_inherit" . $id, 1, $lang->get("acl_inherit", "Inherit permissions from parent"), "standard", $acl->inherit, 3)); $this->add(new Hidden("checkednow", $acl->inherit)); if ($acl->inherit) { $this->add(new Label("lbl", $lang->get("acl_inherit_note", "Note: When the box is checked, there is no other configuration available!"), "standardlight", 3)); $this->add(new Subtitle("title", $lang->get("acl_info", "Inherited Access from parent"), 3)); $this->add(new ACLInfo($acl)); } else { $this->add(new Subtitle("title", $lang->get("alc_owner", "Set owner"), 3)); $groups = createNameValueArrayEx("groups", "GROUP_NAME", "GROUP_ID", "1"); $this->add(new Label("lbl", $lang->get("acl_owner", "Owner"), "standard", 1)); $this->add(new Select("acl_owner" . $id, $groups, "standard", $acl->owner, 1, "", 250, 2)); $this->add(new Subtitle("title", $lang->get("acl_access", "Edit permissions in groups on "). "<b> $title</b>", 3)); // Create Comboeditor. $groups = createNameValueArray("groups", "GROUP_NAME", "GROUP_ID", "1"); $roles = createNameValueArray("roles", "ROLE_NAME", "ROLE_ID", "1"); $headlines = array ( "head1" => $lang->get("acl_groups", "Select Group to add"), "head1_selected" => $lang->get("acl_groupedit", "Select group to edit roles"), "head2_selected" => $lang->get("acl_role", "Select roles for group") ); $pk = array ( array ( "GUID", $id, "NUMBER" ) ); $comboeditor = new CombinationEditor($groups, $roles, $headlines, "acl_relations", $pk, "ACCESSOR_GUID", "NUMBER", "ROLE_ID", "NUMBER"); $this->add($comboeditor); } $acl->syncEx(); }
/** * syncronize variations with entered data to the database. * The configuration for this function must be set manually. * I.E. there must be the $oid-Variable set and there must(!) * be also the global vars cluster_variations_VARIATION_ID_XX * set which are automatically set by the SelectMultiple2Input. * and the cluster variable must be pushed. */ function syncClusterVariations() { global $db, $oid, $auth; $clt = getVar("cluster"); //delete all variations first. $del = "UPDATE cluster_variations SET DELETED=1 WHERE CLNID = {$oid}"; $query = new query($db, $del); // get list of variations $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0"); for ($i = 0; $i < count($variations); $i++) { $id = $variations[$i][1]; if (value("cluster_variations_VARIATION_ID_" . $id) != "0") { // create or restore variation // check, if variations already exists and is set to deleted. $sql = "SELECT COUNT(CLNID) AS ANZ FROM cluster_variations WHERE CLNID = {$oid} AND VARIATION_ID = {$id}"; $query = new query($db, $sql); $query->getrow(); $amount = $query->field("ANZ"); if ($amount > 0) { $sql = "UPDATE cluster_variations SET DELETED=0 WHERE CLNID = {$oid} AND VARIATION_ID = {$id}"; } else { $fk = nextGUID(); $sql = "INSERT INTO cluster_variations (CLNID, VARIATION_ID, CLID, DELETED,CREATED_AT, CREATE_USER ) VALUES ( {$oid}, {$id}, {$fk}, 0, NOW()+0, '" . $auth->userName . "')"; } $query = new query($db, $sql); } } }
/** * syncronize variations with entered data to the database. * The configuration for this function must be set manually. * I.E. there must be the $oid-Variable set and there must(!) * be also the global vars sitepage_variations_VARIATION_ID_XX * set which are automatically set by the SelectMultiple2Input. */ function syncSPMVariations() { global $db, $oid; //delete all variations first. $del = "DELETE FROM sitepage_variations WHERE SPM_ID = {$oid}"; $query = new query($db, $del); // get list of variations $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0"); for ($i = 0; $i < count($variations); $i++) { $id = $variations[$i][1]; if (value("sitepage_variations_VARIATION_ID_" . $id) != "0") { $sql = "INSERT INTO sitepage_variations (SPM_ID, VARIATION_ID) VALUES ( {$oid}, {$id})"; $query = new query($db, $sql); } } }
if ($oid == 0) { $addtext = ""; } else { $addtext = ": " . getDBCell("users", "USER_NAME", "USER_ID = " . $oid); } $form = new stdEDForm($lang->get("userperm_head", "Edit user permissions"). $addtext, "i_myprofile.gif"); $cond = $form->setPK("users", "USER_ID"); if ($oid != "") { $form->headerlink = crHeaderLink($lang->get("user_general", "Edit general user data"), "modules/user/user_general.php?sid=$sid&oid=$oid&go=update"); } // User Permissions $groups = createNameValueArray("groups", "GROUP_NAME", "GROUP_ID", "1"); $roles = createNameValueArray("roles", "ROLE_NAME", "ROLE_ID", "1"); $headlines = array ( "head1" => $lang->get("acl_groups", "Select Group to add"), "head1_selected" => $lang->get("acl_groupedit", "Select group to edit roles"), "head2_selected" => $lang->get("acl_role", "Select roles for group") ); $pk = array ( array ( "USER_ID", $oid, "NUMBER" ) ); $form->add(new CombinationEditor($groups, $roles, $headlines, "user_permissions", $pk, "GROUP_ID", "NUMBER", "ROLE_ID", "NUMBER", 3, "standard")); $form->forbidDelete(true);
<? if ((value("changevariation") != "0" && value("changevariation") != "") || (value("changetranslation") != "0" && value("changetranslation") != "")) $page_state = ""; $switchbar = new ButtonBar("swbar"); if ($mpProp) { $allowedVariations = createDBCArray("sitepage_variations", "VARIATION_ID", "SPM_ID = $spm"); $commatext = implode(", ", $allowedVariations); $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0 AND VARIATION_ID IN ($commatext)"); } $switchbar->setVariationSelector($variations, $variation); if ($mpProp) { $backup = $spid; $spid = $menuID; } // synchronize.... because new feature if (countRows("sitepage_names", "SPID", "SPID = $spid AND VARIATION_ID = $variation") < 1) { $sql = "INSERT INTO sitepage_names (SPID, VARIATION_ID) VALUES ($spid, $variation)"; $query = new query($db, $sql); $query->free(); } $menuPanel->add($switchbar);