/** * Form Roles Info * */ protected function formRolesInfo() { $form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("OTHERTITLE")); $this->_paragraph->addXmlnukeObject($form); $easyList = new XmlEasyList(EasyListType::SELECTLIST, "", $this->_myWords->Value("OTHERROLE"), $this->_users->returnUserProperty($this->_context->authenticatedUserId(), UserProperty::Role)); $form->addXmlnukeObject($easyList); }
public function CreatePage() { parent::CreatePage(); // Doesnt necessary get PX, because PX is protected! $myWords = $this->WordCollection(); $forceReset = false; // Get parameters to define type of edit $catId = $this->_context->get("ci"); $type = $this->_context->get("t"); if ($type == "") { if ($this->_action == XmlnukeCrudBase::ACTION_VIEW) { $type = "FILE"; $catId = $this->_context->get("valueid"); $catIdAr = explode("|", $catId); $catId = $catIdAr[1]; $forceReset = true; } else { $type = "CATEGORY"; } } $block = new XmlBlockCollection($myWords->Value("TITLE"), BlockPosition::Center); $this->setTitlePage($myWords->Value("TITLE")); $this->setHelp($myWords->Value("DESCRIPTION")); $this->defaultXmlnukeDocument->addXmlnukeObject($block); // Download File $downloadFile = new AnydatasetFilenameProcessor("_download"); $fields = new CrudFieldCollection(); // Create Process Page Fields $field = CrudField::FactoryMinimal("TYPE", $myWords->Value("FORMTYPE"), 20, false, true); $field->key = true; $field->editable = false; $field->dataType = INPUTTYPE::UPPERASCII; $field->defaultValue = $type; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("cat_id", $myWords->Value("FORMCATEGORY"), 20, true, true); $field->key = $type == "CATEGORY"; $field->editable = $type == "CATEGORY"; $field->defaultValue = $catId; $fields->addCrudField($field); if ($type == "FILE") { $field = CrudField::FactoryMinimal("file_id", $myWords->Value("FORMFILE"), 20, true, true); $field->key = $type == "FILE"; $fields->addCrudField($field); } $field = CrudField::FactoryMinimal("name", $myWords->Value("LABEL_NAME"), 20, true, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("description", $myWords->Value("FORMDESCRIPTION"), 40, true, true); $field->maxLength = 500; $fields->addCrudField($field); $langs = $this->_context->LanguagesAvailable(); foreach ($langs as $key => $desc) { $field = CrudField::FactoryMinimal("name_" . $key, $myWords->Value("LABEL_NAME") . $desc, 20, false, false); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("description_" . $key, $myWords->Value("FORMDESCRIPTION") . $desc, 40, false, false); $field->maxLength = 500; $fields->addCrudField($field); } if ($type == "FILE") { $field = CrudField::FactoryMinimal("url", $myWords->Value("FORMURL"), 40, true, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("seemore", $myWords->Value("FORMSEEMORE"), 40, false, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("emailto", $myWords->Value("FORMEMAILTO"), 40, false, true); $field->maxLength = 50; $field->dataType = INPUTTYPE::EMAIL; $fields->addCrudField($field); } // Write custom message if ($this->_action == XmlnukeCrudBase::ACTION_LIST || $this->_action == XmlnukeCrudBase::ACTION_MSG || $forceReset) { $p = new XmlParagraphCollection(); if ($type == "CATEGORY") { $p->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTE_CATEGORY"))); } else { $href = new XmlAnchorCollection("module:Xmlnuke.Admin.download"); $href->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTE_FILE", $catId))); $p->addXmlnukeObject($href); } $block->addXmlnukeObject($p); } // Show Process Page State $itf = new IteratorFilter(); $itf->addRelation("TYPE", Relation::EQUAL, $type); if ($type == "FILE") { $itf->addRelation("cat_id", Relation::EQUAL, $catId); } $processor = new XmlnukeCrudAnydata($this->_context, $fields, $myWords->Value("TITLE_" . $type, $catId), "module:Xmlnuke.Admin.download", null, $downloadFile, $itf); if ($forceReset) { $processor->forceCurrentAction(XmlnukeCrudBase::ACTION_LIST); } if ($type == "FILE") { $processor->addParameter("t", $type); $processor->addParameter("ci", $catId); } $block->addXmlnukeObject($processor); return $this->defaultXmlnukeDocument; }
public function CreatePage() { parent::CreatePage(); $onlyGroup = $this->_context->get("onlygroup") != ""; $urlXml = "module:Xmlnuke.Admin.ManageXML"; $urlGrp = "module:Xmlnuke.Admin.ManageGroup"; $this->myWords = $this->WordCollection(); $this->setTitlePage($this->myWords->Value("TITLE")); $this->setHelp($this->myWords->Value("DESCRIPTION")); if (!$onlyGroup) { $this->addMenuOption($this->myWords->Value("EDITALLXML"), $urlXml . "?id=_all"); $this->addMenuOption($this->myWords->Value("NEWXML"), $urlXml); } $this->addMenuOption($this->myWords->Value("NEWGROUP"), $urlGrp); // Open Index File $indexFile = new XMLFilenameProcessor("index"); //XmlDocument $index = $this->_context->getXMLDataBase()->getDocument($indexFile->FullQualifiedName(), null); $groupList = XmlUtil::SelectNodes($index->documentElement, "group"); $table = new XmlTableCollection(); foreach ($groupList as $node) { $groupText = XmlUtil::SelectSingleNode($node, "title")->nodeValue; $groupId = XmlUtil::SelectSingleNode($node, "id")->nodeValue; $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlGrp . "?id=" . $groupId, ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT"), true, false, false)); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlGrp . "?id=" . $groupId . "&action=delete", ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE"), true, false, false)); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($groupText, true, false, false)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); if (!$onlyGroup) { $fileList = XmlUtil::SelectNodes($index->documentElement, "group[id='" . $groupId . "']/page"); foreach ($fileList as $nodeFile) { $fileText = XmlUtil::SelectSingleNode($nodeFile, "title")->nodeValue; $fileId = XmlUtil::SelectSingleNode($nodeFile, "id")->nodeValue; $fileAbstract = XmlUtil::SelectSingleNode($nodeFile, "summary")->nodeValue; $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlXml . "?id=" . $fileId, ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT"))); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlXml . "?id=" . $fileId . "&action=delete", ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE"))); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($fileText)); $col->addXmlnukeObject(new XmlnukeBreakLine()); $col->addXmlnukeObject(new XmlnukeText($fileAbstract, false, true, false)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); } } } $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center); $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject($table); $block->addXmlnukeObject($paragraph); $this->defaultXmlnukeDocument->addXmlnukeObject($block); return $this->defaultXmlnukeDocument->generatePage(); }
/** * Create and show the list of Xsl Templates * * @param String $caption * @param XmlParagraphCollection $paragraph * @param Array $filelist * @param Array $xslUsed * @param XSLFilenameProcessor $xsl */ private function generateList($caption, $paragraph, $filelist, $xslUsed, $xsl) { $paragraph->addXmlnukeObject(new XmlnukeText($caption, true)); $listCollection = new XmlListCollection(XmlListType::UnorderedList); $paragraph->addXmlnukeObject($listCollection); foreach ($filelist as $file) { $xslname = FileUtil::ExtractFileName($file); $xslname = $xsl->removeLanguage($xslname); if (!in_array($xslname, $xslUsed)) { $objectList = new XmlnukeSpanCollection(); $listCollection->addXmlnukeObject($objectList); $xslUsed[] = $xslname; if ($xslname == "index") { $anchor = new XmlAnchorCollection("engine:xmlnuke?xml=index&xsl=index"); $anchor->addXmlnukeObject(new XmlnukeText($xslname, true)); $objectList->addXmlnukeObject($anchor); } else { $anchor = new XmlAnchorCollection("module:Xmlnuke.XSLTheme?xsl=" . $xslname); $anchor->addXmlnukeObject(new XmlnukeText($xslname, true)); $objectList->addXmlnukeObject($anchor); } } } }
protected function actionSave() { $this->_mainBlock = new XmlBlockCollection($this->myWords->Value("BLOCK_TITLE_NEW"), BlockPosition::Center); $para = new XmlParagraphCollection(); $newRole = strtoupper($this->_context->get("textbox_role")); try { $this->user->addRolePublic($this->_context->get("select_sites"), $newRole); $para->addXmlnukeObject(new XmlnukeText($this->myWords->Value("MSG_CREATE"), true)); } catch (Exception $ex) { $para->addXmlnukeObject(new XmlnukeText($this->myWords->Value("MSG_ALREADYEXISTS"), true)); } $this->_mainBlock->addXmlnukeObject($para); $this->AddListLink($this->_mainBlock); $this->defaultXmlnukeDocument->addXmlnukeObject($this->_mainBlock); }
public function CreatePage() { parent::CreatePage(); // Doesnt necessary get PX, because PX is protected! $myWords = $this->WordCollection(); $block = new XmlBlockCollection($myWords->Value("TITLE"), BlockPosition::Center); $this->setTitlePage($myWords->Value("TITLE")); $this->setHelp($myWords->Value("DESCRIPTION")); $this->defaultXmlnukeDocument->addXmlnukeObject($block); // configSearch File $configSearchFile = new AnydatasetFilenameProcessor("_configsearch"); $fields = new CrudFieldCollection(); $field = CrudField::FactoryMinimal("alias", $myWords->Value("NODEALIAS"), 20, true, true); $field->key = true; $field->dataType = INPUTTYPE::UPPERASCII; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("nodetitle", $myWords->Value("NODETITLE"), 20, true, true); $field->maxLength = 500; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("nodeabstract", $myWords->Value("NODEABSTRACT"), 20, true, true); $field->maxLength = 500; $fields->addCrudField($field); $processor = new XmlnukeCrudAnydata($this->_context, $fields, $myWords->Value("TITLE"), "module:Xmlnuke.Admin.configsearch", null, $configSearchFile); $block->addXmlnukeObject($processor); $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTE"))); $block->addXmlnukeObject($p); return $this->defaultXmlnukeDocument; }
/** * Enter description here... * * @param XmlBlockCollection $block */ protected function CreateSetup($block) { if ($this->_action == ModuleAction::CreateConfirm) { $p = new XmlParagraphCollection(); if ($this->_context->get("type") != "-anydata-") { try { $tblpoll = $this->_context->get("tbl_poll"); $tblanswer = $this->_context->get("tbl_answer"); $tbllastip = $this->_context->get("tbl_lastip"); $suffix = $this->_context->get("tablesuffix"); $dbdata = new DBDataset($this->_context->get("type")); $results = array(); $results[] = $this->CreateTable($dbdata, "create table {$tblpoll}", "create table {$tblpoll} (name varchar(15), lang char(5), question varchar(150), multiple char(1), showresults char(1), active char(1)) {$suffix}"); $results[] = $this->CreateTable($dbdata, "create table {$tblanswer}", "create table {$tblanswer} (name varchar(15), lang char(5), code int, short varchar(10), answer varchar(50), votes int) {$suffix}"); //$results[] = $this->CreateTable($dbdata, "create table $tbllastip", "create table $tbllastip (name varchar(15), ip varchar(15)) $suffix"); $results[] = $this->CreateTable($dbdata, "add primary key poll", "alter table {$tblpoll} add constraint pk_poll primary key (name, lang);"); $results[] = $this->CreateTable($dbdata, "add primary key answer", "alter table {$tblanswer} add constraint pk_answer primary key (name, lang, code)"); //$results[] = $this->CreateTable($dbdata, "add primary key lastip", "alter table $tbllastip add constraint pk_lastip primary key (name, ip)"); $results[] = $this->CreateTable($dbdata, "add check poll 1", "alter table {$tblpoll} add constraint ck_poll_multiple check (multiple in ('Y', 'N'))"); $results[] = $this->CreateTable($dbdata, "add check poll 2", "alter table {$tblpoll} add constraint ck_poll_showresults check (showresults in ('Y', 'N'))"); $results[] = $this->CreateTable($dbdata, "add check poll 3", "alter table {$tblpoll} add constraint ck_poll_active check (active in ('Y', 'N'))"); $results[] = $this->CreateTable($dbdata, "add foreign key answer", "alter table {$tblanswer} add constraint pk_answer_poll foreign key (name) references {$tblpoll}(name)"); //$results[] = $this->CreateTable($dbdata, "add foreign key lastip", "alter table $tbllastip add constraint pk_lastip_poll foreign key (name) references $tblpoll(name)"); $block->addXmlnukeObject(new XmlEasyList(EasyListType::UNORDEREDLIST, "", $this->myWords->Value("RESULTSQL"), $results)); $poll = new AnydatasetFilenameProcessor("_poll"); $anypoll = new AnyDataset($poll); $anypoll->appendRow(); $anypoll->addField("dbname", $this->_context->get("type")); $anypoll->addField("tbl_poll", $tblpoll); $anypoll->addField("tbl_answer", $tblanswer); $anypoll->addField("tbl_lastip", $tbllastip); $anypoll->Save(); } catch (Exception $ex) { $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOTERROR", $ex->getMessage()))); } } else { $poll = new AnydatasetFilenameProcessor("_poll"); $anypoll = new AnyDataset($poll); $anypoll->appendRow(); $anypoll->addField("dbname", "-anydata-"); $anypoll->Save(); } $p->addXmlnukeObject(new XmlnukeBreakLine()); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CONFIGCREATED"), true)); $block->addXmlnukeObject($p); } else { $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("FIRSTTIMEMESSAGE"))); $block->addXmlnukeObject($p); $form = new XmlFormCollection($this->_context, $this->_moduleUrl, $this->myWords->Value("CREATESETUP")); $form->addXmlnukeObject(new XmlInputHidden("action", ModuleAction::CreateConfirm)); $db = array("-anydata-" => $this->myWords->Value("NOTUSEDB")); $anydatafile = new AnydatasetFilenameProcessor("_db"); $anydata = new AnyDataset($anydatafile->FullQualifiedNameAndPath()); $it = $anydata->getIterator(); while ($it->hasNext()) { $sr = $it->moveNext(); $db[$sr->getField("dbname")] = $sr->getField("dbname"); } $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "type", $this->myWords->Value("FORMCONN"), $db)); $inputGroup = new XmlInputGroup($this->_context, "tabledetail", true); $inputGroup->setVisible(false); $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_POLL"), "tbl_poll", "xmlnuke_poll", 20); $text->setRequired(true); $inputGroup->addXmlnukeObject($text); $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_ANSWER"), "tbl_answer", "xmlnuke_answer", 20); $text->setRequired(true); $inputGroup->addXmlnukeObject($text); $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_LASTIP"), "tbl_lastip", "xmlnuke_lastip", 20); $text->setRequired(true); $inputGroup->addXmlnukeObject($text); $text = new XmlInputTextBox($this->myWords->Value("TABLE_SUFFIX"), "tablesuffix", "TYPE INNODB", 30); $text->setRequired(true); $inputGroup->addXmlnukeObject($text); $form->addXmlnukeObject($inputGroup); $buttons = new XmlInputButtons(); $buttons->addSubmit($this->myWords->Value("CREATESETUPBTN")); $form->addXmlnukeObject($buttons); $block->addXmlnukeObject($form); $javascript = "\n\t\t\t\t// ByJG \n\t\t\t\tfn_addEvent('type', 'change', enableFields);\n\t\t\t\tfunction enableFields(e) {\n\t\t \t\tobj = document.getElementById('type');\n\t\t \t\tshowHide_tabledetail(obj.selectedIndex != 0);\n\t\t\t\t}\n\t\t\t\t"; $this->defaultXmlnukeDocument->addJavaScriptSource($javascript, true); } }
public function EditUser($users, $uid) { $user = $users->getById($uid); $block = new XmlBlockCollection($this->myWords->Value("EDITUSER") . $user->getField($users->getUserTable()->username), BlockPosition::Center); if (!$this->isUserAdmin() && $user->getField($users->getUserTable()->admin) == "yes") { $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CANNOTEDITADMIN"))); $block->addXmlnukeObject($p); $this->defaultXmlnukeDocument->addXmlnukeObject($block); return; } $tabview = new XmlnukeTabView(); $block->addXmlnukeObject($tabview); // ------------------------------------------------------------------- // EDITAR USUÁRIO $form = new XmlFormCollection($this->_context, $this->url, ""); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "update")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_LOGIN"), "login", $user->getField($users->getUserTable()->username)); $textbox->setDataType(INPUTTYPE::TEXT); $textbox->setRequired(true); $textbox->setReadOnly(true); $form->addXmlnukeObject($textbox); $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_NAME"), "name", $user->getField($users->getUserTable()->name)); $textbox->setDataType(INPUTTYPE::TEXT); $textbox->setRequired(true); $form->addXmlnukeObject($textbox); $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_EMAIL"), "email", $user->getField($users->getUserTable()->email)); $textbox->setDataType(INPUTTYPE::EMAIL); $textbox->setRequired(true); $form->addXmlnukeObject($textbox); $textbox = new XmlInputLabelField($this->myWords->Value("LABEL_PASSWORD"), $this->myWords->Value("FORMPASSWORDNOTVIEW")); $form->addXmlnukeObject($textbox); $check = new XmlInputCheck($this->myWords->Value("FORMADMINISTRADOR"), "admin", "yes"); $check->setChecked($user->getField($users->getUserTable()->admin)); $check->setReadOnly(!$this->isUserAdmin()); $form->addXmlnukeObject($check); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("TXT_UPDATE"), ""); $form->addXmlnukeObject($boxButton); $tabview->addTabItem($this->myWords->Value("TABEDITUSER"), $form); // ------------------------------------------------------------------- // ALTERAR SENHA $form = new XmlFormCollection($this->_context, $this->url, ""); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "changepassword")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); $textbox = new XmlInputTextBox($this->myWords->Value("FORMNEWPASSWORD"), "password", ""); $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD); $textbox->setDataType(INPUTTYPE::TEXT); $textbox->setRequired(true); $form->addXmlnukeObject($textbox); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("TXT_CHANGE"), ""); $form->addXmlnukeObject($boxButton); $tabview->addTabItem($this->myWords->Value("TABCHANGEPASSWD"), $form); // ------------------------------------------------------------------- // REMOVER USUARIO $form = new XmlFormCollection($this->_context, $this->url, ""); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "delete")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("BUTTONREMOVE"), ""); $form->addXmlnukeObject($boxButton); $tabview->addTabItem($this->myWords->Value("TABREMOVEUSER"), $form); // ------------------------------------------------------------------- // REMOVER PAPEL DO USUARIO $para = new XmlParagraphCollection(); $form = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("FORMEDITROLES")); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "removerole")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); $userroles = $users->returnUserProperty($uid, UserProperty::Role); $userroles = is_null($userroles) ? array() : $userroles; $roles = array(); foreach ($userroles as $i) { $roles[$i] = $i; } $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "role", $this->myWords->Value("FORMUSERROLES"), $roles)); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("TXT_REMOVE"), ""); $form->addXmlnukeObject($boxButton); $para->addXmlnukeObject($form); // ------------------------------------------------------------------- // ADICIONAR PAPEL AO USUARIO $form = new XmlFormCollection($this->_context, $this->url, ""); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "addrole")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); // $textbox = new XmlInputTextBox($this->myWords->Value("FORMROLES"), "role", "", 10); // $textbox->setInputTextBoxType(InputTextBoxType::TEXT); // $textbox->setDataType(INPUTTYPE::TEXT); // $textbox->setRequired(true); // $form->addXmlnukeObject($textbox); // $form->addXmlnukeObject(new XmlInputLabelField("DEFAULT ROLES", "EDITOR")); // $form->addXmlnukeObject(new XmlInputLabelField("", "DESIGNER")); // $form->addXmlnukeObject(new XmlInputLabelField("", "MANAGER")); $roleData = $this->getAllRoles($users); $selectRole = new XmlEasyList(EasyListType::SELECTLIST, "role", $this->myWords->Value("FORMROLES"), $roleData); $form->addXmlnukeObject($selectRole); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("TXT_ADD"), ""); $form->addXmlnukeObject($boxButton); $para->addXmlnukeObject($form); $tabview->addTabItem($this->myWords->Value("TABMANROLE"), $para, $this->_action == "addrole" || $this->_action == "removerole"); //------------------------------------------------------------------------ // CUSTOM FIELDS //------------------------------------------------------------------------ $block2 = new XmlnukeSpanCollection(); $table = new XmlTableCollection(); $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ACTION"), true)); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GRIDFIELD"), true)); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GRIDVALUE"), true)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); $fields = $user->getFieldNames(); $fieldsLength = count($fields); foreach ($fields as $fldValue => $fldName) { $values = $user->getFieldArray($fldName); foreach ($values as $value) { $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); if ($fldName != $users->getUserTable()->name && $fldName != $users->getUserTable()->username && $fldName != $users->getUserTable()->email && $fldName != $users->getUserTable()->password && $fldName != $users->getUserTable()->created && $fldName != $users->getUserTable()->admin && $fldName != $users->getUserTable()->id) { $href = new XmlAnchorCollection("module:Xmlnuke.Admin.ManageUsers?action=removecustomvalue&customfield=" . $fldName . "&valueid=" . $uid . "&customvalue=" . urlencode($value), ""); $href->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_REMOVE"))); $col->addXmlnukeObject($href); } else { $col->addXmlnukeObject(new XmlnukeText("---")); } $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($fldName)); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($value)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); } } $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject($table); $block2->addXmlnukeObject($paragraph); $table = new XmlTableCollection(); $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $form = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("GRIDVALUE")); $form->setJSValidate(true); $form->addXmlnukeObject(new XmlInputHidden("action", "addcustomvalue")); $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage"))); $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid)); $textbox = new XmlInputTextBox($this->myWords->Value("FORMFIELD"), "customfield", "", 20); $textbox->setInputTextBoxType(InputTextBoxType::TEXT); $textbox->setDataType(INPUTTYPE::TEXT); $textbox->setRequired(true); $form->addXmlnukeObject($textbox); $textbox = new XmlInputTextBox($this->myWords->Value("FORMVALUE"), "customvalue", "", 40); $textbox->setInputTextBoxType(InputTextBoxType::TEXT); $textbox->setDataType(INPUTTYPE::TEXT); $textbox->setRequired(true); $form->addXmlnukeObject($textbox); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("TXT_ADD"), ""); $form->addXmlnukeObject($boxButton); $col->addXmlnukeObject($form); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject($table); $block2->addXmlnukeObject($paragraph); $tabview->addTabItem($this->myWords->Value("TABCUSTOMVALUE"), $block2, $this->_action == "addcustomvalue" || $this->_action == "removecustomvalue"); $this->defaultXmlnukeDocument->addXmlnukeObject($block); }
/** * Enter description here... * * @param XmlnukeDocument $xmlnukeDoc */ protected function Find() { $myWords = $this->WordCollection(); $xmlnukeDB = $this->_context->getXMLDataBase(); $arr = $xmlnukeDB->searchDocuments($this->txtSearch, $this->_context->get("checkAll") != ""); $blockCenter = new XmlBlockCollection($myWords->Value("BLOCKRESULT"), BlockPosition::Center); $this->_document->addXmlnukeObject($blockCenter); if ($arr == null) { $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTFOUND"))); $blockCenter->addXmlnukeObject($paragraph); } else { $nodeTitleList = array("/meta/title"); $nodeAbstractList = array("/meta/abstract"); $configSearchFile = new AnydatasetFilenameProcessor("_configsearch"); $configSearch = new AnyDataset($configSearchFile->FullQualifiedNameAndPath()); $iterator = $configSearch->getIterator(); while ($iterator->hasNext()) { $singleRow = $iterator->moveNext(); $nodeTitleList[] = $sr->getField("nodetitle"); $nodeAbstractList[] = $sr->getField("nodeabstract"); } foreach ($arr as $s) { $singleName = FilenameProcessor::StripLanguageInfo($s); try { $file = new XMLFilenameProcessor($singleName); $docResult = $this->_context->getXMLDataBase()->getDocument($file->FullQualifiedName(), null); $nodeResult = $this->getNode($nodeTitleList, $docResult); $titulo = $nodeResult == null ? $myWords->Value("NOTITLE") : $nodeResult->nodeValue; $nodeResult = $this->getNode($nodeAbstractList, $docResult); $abstr = $nodeResult == null ? "" : $nodeResult->nodeValue; $paragraph = new XmlParagraphCollection(); $blockCenter->addXmlnukeObject($paragraph); $href = new XmlAnchorCollection("engine:xmlnuke?xml={$singleName}", ""); $href->addXmlnukeObject(new XmlnukeText($titulo)); $paragraph->addXmlnukeObject($href); $paragraph->addXmlnukeObject(new XmlnukeText(" [")); $href = new XmlAnchorCollection("engine:xmlnuke?xml={$singleName}&xsl=rawxml", ""); $href->addXmlnukeObject(new XmlnukeText($myWords->Value("VIEWXML"))); $paragraph->addXmlnukeObject($href); $paragraph->addXmlnukeObject(new XmlnukeText("]")); $paragraph->addXmlnukeObject(new XmlnukeBreakLine()); $paragraph->addXmlnukeObject(new XmlnukeText($abstr)); } catch (Exception $e) { $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject(new XmlnukeText($s . " (" . $myWords->Value("NOTITLE") . ")")); $blockCenter->addXmlnukeObject($paragraph); } } $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("DOCFOUND", sizeof($arr)))); $blockCenter->addXmlnukeObject($paragraph); } }
/** *@desc Contains specific instructions to generate all XML informations-> This method is processed only one time-> Usually is the last method processed-> *@param DOMNode $current \DOMNode where the XML will be created-> *@return void */ public function generateObject($current) { // Improve Security $wrongway = !$this->_edit && ($this->_currentAction == self::ACTION_EDIT || $this->_currentAction == self::ACTION_EDIT_CONFIRM); $wrongway = $wrongway || !$this->_new && ($this->_currentAction == self::ACTION_NEW || $this->_currentAction == self::ACTION_NEW_CONFIRM); $wrongway = $wrongway || !$this->_delete && ($this->_currentAction == self::ACTION_DELETE || $this->_currentAction == self::ACTION_DELETE_CONFIRM); if ($wrongway) { $message = $this->_lang->Value("MSG_DONT_HAVEGRANT"); $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlnukeText($message, true, true, false)); $p->generateObject($current); return; } // Checkings! if ($this->_context->get(self::PARAM_CANCEL) != "") { $this->listAllRecords()->generateObject($current); } else { if (strpos($this->_currentAction, "_confirm") !== false) { try { $validateResult = $this->updateRecord(); } catch (Exception $ex) { $nvc = array($ex->getMessage()); //XmlParagraphCollection $p $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlEasyList(EasyListType::UNORDEREDLIST, "Error", $this->_lang->Value("ERR_FOUND"), $nvc, "")); //XmlAnchorCollection $a $a = new XmlAnchorCollection("javascript:history.go(-1)", ""); $a->addXmlnukeObject(new XmlnukeText($this->_lang->Value("TXT_GOBACK"))); $p->addXmlnukeObject($a); $validateResult = $p; } if (is_null($validateResult)) { $this->_context->redirectUrl($this->redirProcessPage(false)); } else { $validateResult->generateObject($current); if ($this->_currentAction != XmlnukeCrudBase::ACTION_NEW_CONFIRM) { $this->showCurrentRecord()->generateObject($current); } } } else { if ($this->_currentAction == self::ACTION_MSG) { $this->showResultMessage()->generateObject($current); $this->listAllRecords()->generateObject($current); } else { if ($this->_currentAction == self::ACTION_NEW || $this->_currentAction == self::ACTION_VIEW || $this->_currentAction == self::ACTION_EDIT || $this->_currentAction == self::ACTION_DELETE) { $this->showCurrentRecord()->generateObject($current); } else { $this->listAllRecords()->generateObject($current); } } } } }
public function CreatePage() { parent::CreatePage(); $myWords = $this->WordCollection(); $this->setHelp($myWords->Value("DESCRIPTION")); //this.addMenuOption("OK", "module:Xmlnuke.Admin.ManageGroup?action=aqui"); $this->setTitlePage($myWords->Value("TITLE")); //this.addMenuOption("Click here to ERASE ALL cache.", "module:Xmlnuke.Admin.CustomConfig?action=erase"); //this.addMenuOption("Click here to LIST cache.", "module:Xmlnuke.Admin.CustomConfig?action=list"); $action = strtolower($this->_action); $block = new XmlBlockCollection($myWords->Value("WORKINGAREA"), BlockPosition::Center); /* XmlNode paragraph; XmlNode form; XmlNode boxButton; */ if ($action == "update") { $nv = array(); $nv["xmlnuke.SMTPSERVER"] = $this->_context->get("smtpserver"); $nv["xmlnuke.LANGUAGESAVAILABLE"] = $this->createLanguageString(); $nv["xmlnuke.SHOWCOMPLETEERRORMESSAGES"] = $this->_context->get("showcompleterrormessages"); $nv["xmlnuke.LOGINMODULE"] = $this->_context->get("loginmodule"); $nv["xmlnuke.USERSDATABASE"] = $this->_context->get("usersdatabase"); $nv["xmlnuke.USERSCLASS"] = $this->_context->get("usersclass"); $nv["xmlnuke.DEBUG"] = $this->_context->get("txtdebug"); $nv["xmlnuke.DETECTMOBILE"] = $this->_context->get("txtdetectmobile"); $nv["xmlnuke.CAPTCHACHALLENGE"] = $this->_context->get("captchachallenge"); $nv["xmlnuke.CAPTCHALETTERS"] = $this->_context->get("captchaletters"); $nv["xmlnuke.ENABLEPARAMPROCESSOR"] = $this->_context->get("enableparamprocessor"); $nv["xmlnuke.USEFULLPARAMETER"] = $this->_context->get("usefullparameter"); $nv["xmlnuke.PHPLIBDIR"] = $this->_context->get("phplibdir"); # PHP SPECIFIC $this->_context->updateCustomConfig($nv); $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("UPDATED"), true)); $block->addXmlnukeObject($paragraph); } $form = new XmlFormCollection($this->_context, "module:Xmlnuke.Admin.CustomConfig", $myWords->Value("FORMTITLE")); $form->setJSValidate(true); $form->setFormName("form"); $truefalse = array("" => "Use Default", "true" => "True", "false" => "False"); $form->addXmlnukeObject(new XmlInputHidden("action", "update")); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.ROOTDIR", $this->_context->get("xmlnuke.ROOTDIR"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.USEABSOLUTEPATHSROOTDIR", $this->_context->get("xmlnuke.USEABSOLUTEPATHSROOTDIR"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.URLMODULE", $this->_context->get("xmlnuke.URLMODULE"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.URLXMLNUKEADMIN", $this->_context->get("xmlnuke.URLXMLNUKEADMIN"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.URLXMLNUKEENGINE", $this->_context->get("xmlnuke.URLXMLNUKEENGINE"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.DEFAULTPAGE", $this->_context->get("xmlnuke.DEFAULTPAGE"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.XSLCACHE", $this->_context->get("xmlnuke.XSLCACHE"))); $form->addXmlnukeObject(new XmlInputTextBox("xmlnuke.SMTPSERVER", "smtpserver", $this->_context->get("xmlnuke.SMTPSERVER"), 30)); $this->generateLanguageInput($form); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "showcompleterrormessages", "xmlnuke.SHOWCOMPLETEERRORMESSAGES", $truefalse, $this->getStringBool($this->_context->get("xmlnuke.SHOWCOMPLETEERRORMESSAGES")))); $form->addXmlnukeObject(new XmlInputTextBox("xmlnuke.LOGINMODULE", "loginmodule", $this->_context->get("xmlnuke.LOGINMODULE"), 30)); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "usersdatabase", "xmlnuke.USERSDATABASE", $this->getStringConnectionsArray(), $this->_context->get("xmlnuke.USERSDATABASE"))); $form->addXmlnukeObject(new XmlInputTextBox("xmlnuke.USERSCLASS", "usersclass", $this->_context->get("xmlnuke.USERSCLASS"), 30)); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "txtdetectmobile", "xmlnuke.DETECTMOBILE", $truefalse, $this->getStringBool($this->_context->get("xmlnuke.DETECTMOBILE")))); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "txtdebug", "xmlnuke.DEBUG", $truefalse, $this->getStringBool($this->_context->get("xmlnuke.DEBUG")))); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "captchachallenge", "xmlnuke.CAPTCHACHALLENGE", array("easy" => "Easy", "hard" => "Hard"), $this->_context->get("xmlnuke.CAPTCHACHALLENGE"))); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "captchaletters", "xmlnuke.CAPTCHALETTERS", array("5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10"), $this->_context->get("xmlnuke.CAPTCHALETTERS"))); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "enableparamprocessor", "xmlnuke.ENABLEPARAMPROCESSOR", $truefalse, $this->getStringBool($this->_context->get("xmlnuke.ENABLEPARAMPROCESSOR")))); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "usefullparameter", "xmlnuke.USEFULLPARAMETER", $truefalse, $this->getStringBool($this->_context->get("xmlnuke.USEFULLPARAMETER")))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.CACHESTORAGEMETHOD", $this->_context->get("xmlnuke.CACHESTORAGEMETHOD"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.XMLSTORAGEMETHOD", $this->_context->get("xmlnuke.XMLSTORAGEMETHOD"))); $form->addXmlnukeObject(new XmlInputLabelField("xmlnuke.XMLNUKEDATA", $this->_context->get("xmlnuke.XMLNUKEDATA"))); $form->addXmlnukeObject(new XmlInputTextBox("xmlnuke.PHPLIBDIR", "phplibdir", $this->_context->get("xmlnuke.PHPLIBDIR"), 30)); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($myWords->Value("TXT_SAVE")); $form->addXmlnukeObject($boxButton); $block->addXmlnukeObject($form); $this->defaultXmlnukeDocument->addXmlnukeObject($block); return $this->defaultXmlnukeDocument; }
/** *@param string $strHelp *@return void *@desc */ protected function setHelp($strHelp) { $this->_help->addXmlnukeObject(new XmlnukeText($strHelp)); }
public function CreatePage() { parent::CreatePage(); $this->myWords = $this->WordCollection(); $this->setTitlePage($this->myWords->Value("TITLE")); $this->setHelp($this->myWords->Value("DESCRIPTION")); $block = new XmlBlockCollection($this->myWords->Value("BLOCK_TITLE"), BlockPosition::Center); $anydatafile = new AnydatasetFilenameProcessor("_db"); if ($this->_action != "test") { $processfields = new CrudFieldCollection(); $field = new CrudField(); $field->fieldName = "dbname"; $field->editable = true; $field->key = true; $field->visibleInList = true; $field->dataType = INPUTTYPE::TEXT; $field->fieldXmlInput = XmlInputObjectType::TEXTBOX; $field->fieldCaption = $this->myWords->Value("DBNAME"); $field->size = 20; $field->maxLength = 20; $field->required = true; $field->newColumn = true; $processfields->addCrudField($field); $field = new CrudField(); $field->fieldName = "dbtype"; $field->editable = true; $field->key = false; $field->visibleInList = true; $field->dataType = INPUTTYPE::TEXT; $field->fieldXmlInput = XmlInputObjectType::SELECTLIST; $field->fieldCaption = $this->myWords->Value("DBTYPE"); $field->size = 15; $field->maxLength = 15; $field->required = true; $field->arraySelectList = array("dsn" => "dsn (use it)", "literal" => "PDO Literal connection string", "dblib" => "FreeTDS / Microsoft SQL Server / Sybase", "firebird" => "Firebird/Interbase 6", "informix" => "IBM Informix Dynamic Server", "mysql" => "MySQL 3.x/4.x/5.x", "oci" => "Oracle Call Interface", "odbc" => "ODBC v3 (IBM DB2, unixODBC and win32 ODBC)", "pgsql" => "PostgreSQL", "sqlite" => "SQL Lite"); $field->defaultValue = "dsn"; $field->newColumn = true; $processfields->addCrudField($field); $field = new CrudField(); $field->fieldName = "dbconnectionstring"; $field->editable = true; $field->key = false; $field->visibleInList = true; $field->dataType = INPUTTYPE::TEXT; $field->fieldXmlInput = XmlInputObjectType::TEXTBOX; $field->fieldCaption = $this->myWords->Value("DBCONNECTIONSTRING"); $field->size = 50; $field->maxLength = 200; $field->required = true; $field->defaultValue = "adodriver://*****:*****@server/datasource?persist"; $field->newColumn = true; $processfields->addCrudField($field); $buttons = new CustomButtons(); $buttons->action = "test"; $buttons->alternateText = $this->myWords->Value("TESTALTERNATETEXT"); $buttons->enabled = true; $buttons->icon = "common/editlist/ic_selecionar.gif"; $buttons->message = $this->myWords->Value("TESTMESSAGETEXT"); $buttons->multiple = MultipleSelectType::ONLYONE; $crud = new XmlnukeCrudAnydata($this->_context, $processfields, $this->myWords->Value("AVAILABLELANGUAGES"), "module:Xmlnuke.Admin.ManageDBConn", array($buttons), $anydatafile); $block->addXmlnukeObject($crud); $p = new XmlParagraphCollection(); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("NOTE"), true)); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("PHPNOTE"))); $block->addXmlnukeObject($p); } else { $p = new XmlParagraphCollection(); $db = $this->_context->get("valueid"); if ($db == "") { $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ERRORDBEMPTY"))); } else { try { $dbdataset = new DBDataset($db); $dbdataset->TestConnection(); $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("SEEMSOK"))); } catch (Exception $ex) { $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOTERROR", $ex->getMessage()))); } } $block->addXmlnukeObject($p); $p = new XmlParagraphCollection(); $href = new XmlAnchorCollection("module:Xmlnuke.Admin.ManageDBConn"); $href->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOBACK"))); $p->addXmlnukeObject($href); $block->addXmlnukeObject($p); } $this->defaultXmlnukeDocument->addXmlnukeObject($block); return $this->defaultXmlnukeDocument->generatePage(); }
protected function Opcao20() { $block = new XmlBlockCollection("Exemplo 20: Portlets", BlockPosition::Center); //XmlnukeBreakLine br = new XmlnukeBreakLine(); $para = new XmlParagraphCollection(); $para->addXmlnukeObject(new XmlnukeText("Esse exemplo mostra como criar um componente de ordenação interativa com o uso de Portlets através da classe de abstração XmlInputSortable")); $block->addXmlnukeObject($para); $form = new XmlFormCollection($this->_context, "", "Portlet Example"); // Portlet One $sortable = new XmlInputSortableList("Teste", "meunome", array("col1", "col2")); $sortable->setConnectKey("ligacao"); $sortable->setFullSize(true); $sortable->addSortableItem("", new XmlnukeText("Coluna 1"), SortableListItemState::Disabled, "col1"); $sortable->addPortlet("1", "Titulo 1", new XmlnukeText("Teste 1"), "col1"); $sortable->addPortlet("2", "Titulo 2", new XmlnukeText("Teste 2"), "col1"); $sortable->addPortlet("3", "Titulo 3", new XmlnukeText("Teste 3"), "col1"); $sortable->addSortableItem("", new XmlnukeText("Coluna 2"), SortableListItemState::Disabled, "col2"); $sortable->addPortlet("4", "Titulo 4", new XmlnukeText("Teste 4"), "col2"); $sortable->addPortlet("5", "Titulo 5", new XmlnukeText("Teste 5"), "col2"); $form->addXmlnukeObject($sortable); // Portlet Two $sortable = new XmlInputSortableList("Teste2", "meunome2"); $sortable->setConnectKey("ligacao"); $sortable->setFullSize(true); $sortable->addSortableItem("", new XmlnukeText("Outra Coluna"), SortableListItemState::Disabled); $sortable->addPortlet("6", "Titulo 6", new XmlnukeText("Teste 6")); $sortable->addPortlet("7", "Titulo 7", new XmlnukeText("Teste 7")); $form->addXmlnukeObject($sortable); $block->addXmlnukeObject($form); $this->_document->addXmlnukeObject($block); }