示例#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;
 }
示例#2
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;
 }
示例#3
0
文件: Download.php 项目: byjg/xmlnuke
 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;
 }
示例#4
0
 /**
  * Enter description here...
  *
  * @param XmlBlockCollection $block
  * @param string $pollname
  */
 protected function ListAnswers($block, $pollname, $lang)
 {
     $yesno = array("Y" => $this->myWords->Value("YES"), "N" => $this->myWords->Value("NO"));
     $processfields = new CrudFieldCollection();
     $field = CrudField::FactoryMinimal("name", $this->myWords->Value("POLLNAME"), 15, true, true);
     $field->key = true;
     $field->editable = $this->_context->get("acao") == XmlnukeCrudBase::ACTION_NEW_CONFIRM;
     $field->defaultValue = $pollname;
     $processfields->addCrudField($field);
     $field = CrudField::FactoryMinimal("lang", $this->myWords->Value("POLLLANG"), 5, true, true);
     $field->key = true;
     $field->editable = $this->_context->get("acao") == XmlnukeCrudBase::ACTION_NEW_CONFIRM;
     $field->fieldXmlInput = XmlInputObjectType::SELECTLIST;
     $field->arraySelectList = $this->_context->LanguagesAvailable();
     $field->defaultValue = $lang;
     $processfields->addCrudField($field);
     $field = CrudField::FactoryMinimal("code", $this->myWords->Value("ANSWERCODE"), 3, true, true);
     $field->key = true;
     $field->dataType = INPUTTYPE::NUMBER;
     $processfields->addCrudField($field);
     $field = CrudField::FactoryMinimal("short", $this->myWords->Value("SHORTTEXT"), 10, true, true);
     $processfields->addCrudField($field);
     $field = CrudField::FactoryMinimal("answer", $this->myWords->Value("ANSWERTEXT"), 50, true, true);
     $processfields->addCrudField($field);
     $field = CrudField::FactoryMinimal("votes", $this->myWords->Value("ANSWERVOTES"), 3, true, true);
     $field->editable = false;
     $field->defaultValue = 0;
     $field->dataType = INPUTTYPE::NUMBER;
     $processfields->addCrudField($field);
     if ($this->_isdb) {
         $crud = new XmlnukeCrudDB($this->_context, $processfields, $this->myWords->Value("AVAILABLEANSWER", $pollname), $this->_moduleUrl, null, $this->_tblanswer, $this->_connection);
         $crud->setFilter("name = '" . $pollname . "' and lang='" . $lang . "'");
     } else {
         $anydatafile = new AnydatasetFilenameProcessor("poll_" . $pollname . "_" . $lang);
         $crud = new XmlnukeCrudAnydata($this->_context, $processfields, $this->myWords->Value("AVAILABLEANSWER", $pollname), $this->_moduleUrl, null, $anydatafile);
     }
     $crud->addParameter("op", "answernav");
     $crud->addParameter("curpoll", $pollname);
     $crud->addParameter("curlang", $lang);
     $block->addXmlnukeObject($crud);
 }
示例#5
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;
 }