Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public function CreatePage()
 {
     if ($this->_context->get("logout") != "") {
         $this->_context->redirectUrl("module:Xmlnuke.Admin.ControlPanel");
     }
     parent::CreatePage();
     $mywords = $this->WordCollection();
     $this->bindParameteres();
     $this->setTitlePage($mywords->Value("CONTROLPANEL"));
     $this->setHelp($mywords->Value("CONTROLPANEL_HELP"));
     $it = $this->GetAdminGroups($this->getGroup());
     if ($it->hasNext()) {
         $sr = $it->moveNext();
         $xmlObj = new XmlnukeStringXML("<listmodules group=\"CP_" . $sr->getField("name") . "\" />");
         $this->defaultXmlnukeDocument->addXmlnukeObject($xmlObj);
         //Debug::PrintValue($sr->getField("name"));
     } else {
         throw new NotFoundException("Admin Group not found!");
     }
     $block = new XmlBlockCollection($mywords->Value("BLOCKINFO_TITLE"), BlockPosition::Center);
     $paragraph = new XmlParagraphCollection();
     $block->addXmlnukeObject($paragraph);
     $paragraph->addXmlnukeObject(new XmlnukeText($mywords->Value("INFO_USER", array($this->_context->authenticatedUser(), $this->_context->authenticatedUserId())), false, false, false, true));
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
     return $this->defaultXmlnukeDocument->generatePage();
 }
Ejemplo n.º 3
0
 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);
     // configEmail File
     $configEmailFile = new AnydatasetFilenameProcessor("_configemail");
     $fields = new CrudFieldCollection();
     $field = CrudField::FactoryMinimal("destination_id", $myWords->Value("DESTINATIONBOX"), 20, true, true);
     $field->key = true;
     $field->dataType = INPUTTYPE::UPPERASCII;
     $fields->addCrudField($field);
     $field = CrudField::FactoryMinimal("name", $myWords->Value("LABEL_NAME"), 40, true, true);
     $field->maxLength = 100;
     $fields->addCrudField($field);
     $field = CrudField::FactoryMinimal("email", $myWords->Value("LABEL_EMAIL"), 40, true, true);
     $field->maxLength = 500;
     $field->dataType = INPUTTYPE::EMAIL;
     $fields->addCrudField($field);
     $processor = new XmlnukeCrudAnydata($this->_context, $fields, $myWords->Value("TITLE"), "module:Xmlnuke.Admin.ConfigEmail", null, $configEmailFile);
     $block->addXmlnukeObject($processor);
     return $this->defaultXmlnukeDocument;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 public function Setup($xmlModuleName, $customArgs)
 {
     parent::Setup($xmlModuleName, $customArgs);
     parent::CreatePage();
     $this->url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_xmlModuleName->ToString());
     $this->user = $this->getUsersDatabase();
     $this->myWords = $this->WordCollection();
     $this->setTitlePage($this->myWords->Value("TITLE"));
     $this->setHelp($this->myWords->Value("DESCRIPTION"));
     $this->myWords = $this->WordCollection();
 }
Ejemplo n.º 7
0
 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("TITLE"), BlockPosition::Center);
     $this->addMenuItem($this->_moduleUrl, $this->myWords->Value("MENULISTPOLLS"), "");
     $this->addMenuItem("module:Xmlnuke.Admin.ManageDBConn", $this->myWords->Value("MENUMANAGEDBCONN"), "");
     // Create a NEW config file and SETUP Database
     $configfile = new AnydatasetFilenameProcessor("_poll");
     if (!FileUtil::Exists($configfile)) {
         $this->CreateSetup($block);
     } else {
         $anyconfig = new AnyDataset($configfile->FullQualifiedNameAndPath());
         $it = $anyconfig->getIterator();
         if ($it->hasNext()) {
             $sr = $it->moveNext();
             $this->_isdb = $sr->getField("dbname") != "-anydata-";
             $this->_connection = $sr->getField("dbname");
             $this->_tblanswer = $sr->getField("tbl_answer");
             $this->_tblpoll = $sr->getField("tbl_poll");
             $this->_tbllastip = $sr->getField("tbl_lastip");
         } else {
             $this->CreateSetup($block);
             $this->defaultXmlnukeDocument->addXmlnukeObject($block);
             return $this->defaultXmlnukeDocument->generatePage();
         }
         if ($this->_context->get("op") == "") {
             $this->ListPoll($block);
         } elseif ($this->_context->get("op") == "answer") {
             $polldata = explode("|", $this->_context->get("valueid"));
             $this->ListAnswers($block, $polldata[0], $polldata[1]);
         } elseif ($this->_context->get("op") == "answernav") {
             $this->ListAnswers($block, $this->_context->get("curpoll"), $this->_context->get("curlang"));
         }
     }
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
     return $this->defaultXmlnukeDocument->generatePage();
 }
Ejemplo n.º 8
0
 public function CreatePage()
 {
     parent::CreatePage();
     // Doesnt necessary get PX, because PX is protected!
     $users = $this->getUsersDatabase();
     //anydataset.SingleRow user;
     $action = strtolower($this->_action);
     $uid = $this->_context->get("valueid");
     $this->myWords = $this->WordCollection();
     $this->setTitlePage($this->myWords->Value("TITLE"));
     $this->setHelp($this->myWords->Value("DESCRIPTION"));
     $this->addMenuOption($this->myWords->Value("NEWUSER"), $this->url, null);
     $this->addMenuOption($this->myWords->Value("ADDROLE"), "module:Xmlnuke.Admin.manageusersgroups", null);
     // --------------------------------------
     // CHECK ACTION
     // --------------------------------------
     $exec = false;
     if ($action != "" && $action != "move") {
         $message = new XmlParagraphCollection();
         if ($action == "newuser") {
             if (!$users->addUser($this->_context->get("name"), $this->_context->get("login"), $this->_context->get("email"), $this->_context->get("password"))) {
                 $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("USEREXIST"), true));
             } else {
                 if ($this->isUserAdmin()) {
                     $user = $users->getUserName($this->_context->get("login"));
                     $user->setField($users->getUserTable()->admin, $this->_context->get("admin"));
                     $users->Save();
                 }
                 $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CREATED"), true));
             }
             $exec = true;
         }
         if ($action == "update") {
             $user = $users->getById($uid);
             $user->setField($users->getUserTable()->name, $this->_context->get("name"));
             $user->setField($users->getUserTable()->email, $this->_context->get("email"));
             if ($this->isUserAdmin()) {
                 $user->setField($users->getUserTable()->admin, $this->_context->get("admin"));
             }
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("UPDATE"), true));
             $exec = true;
         }
         if ($action == "changepassword") {
             $user = $users->getById($uid);
             $user->setField($users->getUserTable()->password, $users->getSHAPassword($this->_context->get("password")));
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CHANGEPASSWORD"), true));
             $exec = true;
         }
         if ($action == "delete") {
             if ($users->removeUserName($uid)) {
                 $users->Save();
                 $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("DELETE"), true));
                 $uid = "";
             } else {
                 $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ERRO"), true));
             }
             $exec = true;
         }
         if ($action == "addrole") {
             $users->addPropertyValueToUser($uid, $this->_context->get("role"), UserProperty::Role);
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ROLEADDED"), true));
             $exec = true;
         }
         if ($action == "removerole") {
             $users->removePropertyValueFromUser($uid, $this->_context->get("role"), UserProperty::Role);
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ROLEREMOVED"), true));
             $exec = true;
         }
         if ($action == "addcustomvalue") {
             $users->addPropertyValueToUser($uid, $this->_context->get("customvalue"), $this->_context->get("customfield"));
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CUSTOMFIELDUPDATED"), true));
             $exec = true;
         }
         if ($action == "removecustomvalue") {
             $users->removePropertyValueFromUser($uid, $this->_context->get("customvalue"), $this->_context->get("customfield"));
             $users->Save();
             $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CUSTOMFIELDREMOVED"), true));
             $exec = true;
         }
         if ($exec) {
             $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center);
             $block->addXmlnukeObject($message);
             $this->defaultXmlnukeDocument->addXmlnukeObject($block);
         }
     }
     // --------------------------------------
     // LIST USERS
     // --------------------------------------
     $block = new XmlBlockCollection($this->myWords->Value("USERS"), BlockPosition::Center);
     $itf = new IteratorFilter();
     if (!$this->isUserAdmin()) {
         $itf->addRelation("admin", Relation::NOT_EQUAL, "yes");
     }
     if ($this->_context->get("pesquser") != "") {
         $itf->startGroup();
         $itf->addRelationOr($users->getUserTable()->username, Relation::CONTAINS, $this->_context->get("pesquser"));
         $itf->addRelationOr($users->getUserTable()->name, Relation::CONTAINS, $this->_context->get("pesquser"));
         $itf->addRelationOr($users->getUserTable()->email, Relation::CONTAINS, $this->_context->get("pesquser"));
         $itf->endGroup();
     }
     $it = $users->getIterator($itf);
     $formpesq = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("TITLEPESQUSER"));
     $formpesq->setFormName("form-label-top");
     $textbox = new XmlInputTextBox($this->myWords->Value("PESQUSER"), "pesquser", $this->_context->get("pesquser"));
     $textbox->setDataType(INPUTTYPE::TEXT);
     $formpesq->addXmlnukeObject($textbox);
     $textbox->setRequired(true);
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("GOSEARCH"), "");
     $formpesq->addXmlnukeObject($boxButton);
     $block->addXmlnukeObject($formpesq);
     $editlist = new XmlEditList($this->_context, $this->myWords->Value("USERS"), $this->url, true, false, true, true);
     $editlist->setDataSource($it);
     $editlist->setPageSize(20, 0);
     $editlist->setEnablePage(true);
     $field = new EditListField();
     $field->fieldData = $users->getUserTable()->id;
     $editlist->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = $users->getUserTable()->username;
     $field->editlistName = $this->myWords->Value("TXT_LOGIN");
     $editlist->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = $users->getUserTable()->name;
     $field->editlistName = $this->myWords->Value("TXT_NAME");
     $editlist->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = $users->getUserTable()->email;
     $field->editlistName = $this->myWords->Value("TXT_EMAIL");
     $editlist->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = $users->getUserTable()->admin;
     $field->editlistName = $this->myWords->Value("TITADM");
     $editlist->addEditListField($field);
     $block->addXmlnukeObject($editlist);
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
     // --------------------------------------
     // EDIT AREA
     // --------------------------------------
     if ($action == "new" || $action == "newuser" || $action == "" || $action == "move" || $action == "delete") {
         $this->NewUser();
     } else {
         $this->EditUser($users, $uid);
     }
     return $this->defaultXmlnukeDocument->generatePage();
 }
Ejemplo n.º 9
0
 /**
  * Create Page Method
  *
  * @return PageXml
  */
 public function CreatePage()
 {
     parent::CreatePage();
     $this->_myWords = $this->WordCollection();
     $this->defaultXmlnukeDocument->addMenuItem("module:Xmlnuke.Admin.FileManagement", $this->_myWords->Value("FILEMANAGEMENT"), "");
     $this->_block = new XmlBlockCollection($this->_myWords->Value("FILEMANAGEMENT"), BlockPosition::Center);
     $this->setTitlePage($this->_myWords->Value("TITLE"));
     $this->setHelp($this->_myWords->Value("DESCRIPTION"));
     $this->defaultXmlnukeDocument->addXmlnukeObject($this->_block);
     //get the current folder
     $root = $this->_context->get("folder");
     $browser = new XmlFileBrowser($root, $this->_action, $this->_context);
     //SET FILEBROWSER ACESS LEVEL
     $processor = new AnydatasetFilenameProcessor("filemanagement");
     $processor->setFilenameLocation(ForceFilenameLocation::UseWhereExists);
     $anyDataSet = new AnyDataset($processor->FullQualifiedNameAndPath());
     $ignoreAdmin = false;
     $it = $anyDataSet->getIterator();
     while ($it->hasNext()) {
         $row = $it->moveNext();
         switch ($row->getField("type")) {
             case "INITIAL_DIR":
                 $initial_dir = $row->getFieldArray("value");
                 $browser->setSubFoldersPermitted($initial_dir);
                 break;
             case "VALID_FILE_NEW":
                 $file_new_list = $row->getFieldArray("value");
                 $browser->setFileNewList($file_new_list);
                 break;
             case "VALID_FILE_VIEW":
                 $file_view_list = $row->getFieldArray("value");
                 $browser->setFileViewList($file_view_list);
                 break;
             case "VALID_FILE_EDIT":
                 $file_edit_list = $row->getFieldArray("value");
                 $browser->setFileEditList($file_edit_list);
                 break;
             case "VALID_FILE_DELETE":
                 $file_delete_list = $row->getFieldArray("value");
                 $browser->setFileDeleteList($file_delete_list);
                 break;
             case "VALID_FILE_UPLOAD":
                 $file_upload_list = $row->getFieldArray("value");
                 $browser->setFileUploadList($file_upload_list);
                 break;
             case "VALID_FILE_MAX_UPLOAD":
                 $file_max_upload = $row->getField("value");
                 $browser->setFileMaxUpload($file_max_upload);
                 break;
             case "PERMISSION":
                 $browser->setFileNew($row->getField("file_new"));
                 $browser->setFileView($row->getField("file_view"));
                 $browser->setFileEdit($row->getField("file_edit"));
                 $browser->setFileDelete($row->getField("file_delete"));
                 $browser->setFileUpload($row->getField("file_upload"));
                 $browser->setFolderNew($row->getField("folder_new"));
                 $browser->setFolderView($row->getField("folder_view"));
                 $browser->setFolderEdit($row->getField("folder_edit"));
                 $browser->setFolderDelete($row->getField("folder_delete"));
                 $ignoreAdmin = $row->getField("ignore_admin") == "true";
                 break;
         }
     }
     if ($this->isUserAdmin() && !$ignoreAdmin) {
         $browser->setUserType(FileBrownserUserType::ADMIN);
     }
     $this->_block->addXmlnukeObject($browser);
     return $this->defaultXmlnukeDocument->generatePage();
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 public function CreatePage()
 {
     parent::CreatePage();
     // Doesnt necessary get PX, because PX is protected!
     $this->myWords = $this->WordCollection();
     $this->setTitlePage($this->myWords->Value("TITLE"));
     $this->setHelp($this->myWords->Value("DESCRIPTION"));
     $this->addMenuOption($this->myWords->Value("NEWLANGUAGEFILE"), "module:Xmlnuke.Admin.EditLanguage?action=new");
     $this->addMenuOption($this->myWords->Value("VIEWSHAREDFILES"), "module:Xmlnuke.Admin.EditLanguage?op=1");
     $this->addMenuOption($this->myWords->Value("VIEWPRIVATEFILES"), "module:Xmlnuke.Admin.EditLanguage");
     $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center);
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
     $op = $this->_context->get("op");
     $ed = $this->_context->get("ed");
     $langDir = new AnydatasetLangFilenameProcessor("");
     if ($op == "") {
         $filelist = FileUtil::RetrieveFilesFromFolder($langDir->PrivatePath(), $langDir->Extension());
     } else {
         $filelist = FileUtil::RetrieveFilesFromFolder($langDir->SharedPath(), $langDir->Extension());
     }
     $it = $this->getIteratorFromList($filelist, $langDir);
     if ($this->_action == "") {
         $editlist = new XmlEditList($this->_context, $this->myWords->Value("FILELIST{$op}"), "module:Xmlnuke.Admin.EditLanguage", true, false, true, false);
         $field = new EditListField();
         $field->editlistName = "#";
         $field->fieldData = "key";
         $editlist->addEditListField($field);
         $field = new EditListField();
         $field->editlistName = "Language Filename";
         $field->fieldData = "singlename";
         $editlist->addEditListField($field);
         $editlist->setDataSource($it);
         $editlist->addParameter("op", $op);
         $editlist->setEnablePage(true);
         $editlist->setPageSize(20, 0);
         $block->addXmlnukeObject($editlist);
     } elseif ($this->_action == ModuleAction::Edit || $ed == 1) {
         if ($ed == 1) {
             $file = $this->_context->get("file");
         } else {
             $file = $this->_context->get("valueid");
         }
         $langDir = new AnydatasetLangFilenameProcessor($file);
         $langDir->setFilenameLocation($op == "" ? ForceFilenameLocation::PrivatePath : ForceFilenameLocation::SharedPath);
         $anydata = new AnyDataset($langDir->FullQualifiedNameAndPath());
         $it = $anydata->getIterator();
         $sr = $it->moveNext();
         $arFields = $sr->getFieldNames();
         $i = 0;
         $CrudFieldCollection = new CrudFieldCollection();
         foreach ($arFields as $value) {
             $process = CrudField::FactoryMinimal($value, $value, 40, $i < 4, true);
             $process->key = $i == 0;
             if ($value == "LANGUAGE") {
                 $process->beforeInsertFormatter = $this;
             }
             $CrudFieldCollection->addCrudField($process);
             $i++;
         }
         $crud = new XmlnukeCrudAnydata($this->_context, $CrudFieldCollection, $this->myWords->Value("EDITLANGUAGE", $file), "module:Xmlnuke.Admin.EditLanguage", null, $langDir);
         $crud->addParameter("op", $op);
         $crud->addParameter("ed", 1);
         $crud->addParameter("file", $file);
         $block->addXmlnukeObject($crud);
     } elseif ($this->_action == ModuleAction::Create) {
         $form = new XmlFormCollection($this->_context, "module:Xmlnuke.Admin.EditLanguage", $this->myWords->Value("NEWLANGUAGEFILE"));
         $form->addXmlnukeObject(new XmlInputHidden("action", ModuleAction::CreateConfirm));
         $form->addXmlnukeObject(new XmlInputHidden("op", $op));
         $form->addXmlnukeObject(new XmlInputTextBox($this->myWords->Value("NEWFILE"), "newfile", "", 30));
         $form->addXmlnukeObject(new XmlInputMemo($this->myWords->Value("FIELDS"), "fields", "TITLE\r\nABSTRACT"));
         $form->addXmlnukeObject(XmlInputButtons::CreateSubmitButton($this->myWords->Value("TXT_SUBMIT")));
         $block->addXmlnukeObject($form);
     } elseif ($this->_action == ModuleAction::CreateConfirm) {
         $file = $this->_context->get("newfile");
         $langDir = new AnydatasetLangFilenameProcessor($file);
         $langDir->setFilenameLocation($op == "" ? ForceFilenameLocation::PrivatePath : ForceFilenameLocation::SharedPath);
         $anydata = new AnyDataset($langDir->FullQualifiedNameAndPath());
         $fields = explode("\r\n", $this->_context->get("fields"));
         $langs = $this->_context->LanguagesAvailable();
         foreach ($langs as $lang => $dummy) {
             $anydata->appendRow();
             $anydata->addField("lang", $lang);
             foreach ($fields as $field) {
                 $anydata->addField($field, "");
             }
         }
         $anydata->Save($langDir);
         $this->_context->redirectUrl("module:Xmlnuke.Admin.EditLanguage?ed=1&file={$file}");
     }
     $langfile = $this->_context->get("langfile");
     $contents = $this->_context->get("contents");
     $contents = stripslashes($contents);
     return $this->defaultXmlnukeDocument;
 }
Ejemplo n.º 12
0
 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();
 }