Beispiel #1
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;
 }
Beispiel #2
0
 /**
  *@desc
  *@param
  *@return IXmlnukeDocumentObject
  */
 protected function listAllRecords()
 {
     //		XmlEditList $editList
     $editList = new XmlEditList($this->_context, $this->_header, $this->_module, false, false, false, false);
     $editList->setDataSource($this->getAllRecords());
     $editList->setPageSize($this->_qtdRows, $this->_curPage);
     $editList->setEnablePage(true);
     //$editList->addParameter("filter", $this->_filter);
     //$editList->addParameter("sort", $this->_sort);
     foreach ($this->_parameter as $key => $value) {
         $editList->addParameter($key, $value);
     }
     if ($this->_new) {
         $cb = new CustomButtons();
         $cb->action = self::ACTION_NEW;
         $cb->alternateText = $this->_lang->Value("TXT_NEW");
         $cb->icon = "common/editlist/ic_novo.gif";
         $cb->enabled = true;
         $cb->multiple = MultipleSelectType::NONE;
         $editList->setCustomButton($cb);
     }
     if ($this->_view) {
         $cb = new CustomButtons();
         $cb->action = self::ACTION_VIEW;
         $cb->alternateText = $this->_lang->Value("TXT_VIEW");
         $cb->icon = "common/editlist/ic_detalhes.gif";
         $cb->enabled = true;
         $cb->multiple = MultipleSelectType::ONLYONE;
         $editList->setCustomButton($cb);
     }
     if ($this->_edit) {
         $cb = new CustomButtons();
         $cb->action = self::ACTION_EDIT;
         $cb->alternateText = $this->_lang->Value("TXT_EDIT");
         $cb->icon = "common/editlist/ic_editar.gif";
         $cb->enabled = true;
         $cb->multiple = MultipleSelectType::ONLYONE;
         $editList->setCustomButton($cb);
     }
     if ($this->_delete) {
         $cb = new CustomButtons();
         $cb->action = self::ACTION_DELETE;
         $cb->alternateText = $this->_lang->Value("TXT_DELETE");
         $cb->icon = "common/editlist/ic_excluir.gif";
         $cb->enabled = true;
         $cb->multiple = MultipleSelectType::ONLYONE;
         $editList->setCustomButton($cb);
     }
     if ($this->_buttons != null) {
         for ($i = 0, $buttonsLength = sizeof($this->_buttons); $i < $buttonsLength; $i++) {
             //				CustomButtons $cb;
             if ($this->_buttons[$i]->action != "" || $this->_buttons[$i]->url != "") {
                 $cb = new CustomButtons();
                 $cb->action = $this->_buttons[$i]->action;
                 $cb->alternateText = $this->_buttons[$i]->alternateText;
                 $cb->icon = $this->_buttons[$i]->icon;
                 $cb->url = $this->_buttons[$i]->url;
                 $cb->enabled = true;
                 $cb->multiple = $this->_buttons[$i]->multiple;
                 $editList->setCustomButton($cb);
             }
         }
     }
     $fldKey = "";
     for ($i = 0, $current = 0; $i < sizeof($this->_keyIndex); $i++, $current++) {
         $fldKey .= ($fldKey != "" ? "|" : "") . $this->_fields[$this->_keyIndex[$i]]->fieldName;
     }
     $field = new EditListField();
     $field->fieldData = $fldKey;
     $field->editlistName = "#";
     $field->formatter = new CrudPKFormatter();
     $field->fieldType = EditListFieldType::FORMATTER;
     $editList->addEditListField($field);
     for ($i = 0, $fieldLength = sizeof($this->_fields); $i < $fieldLength; $i++, $current++) {
         if ($this->_fields[$i]->visibleInList) {
             $field = new EditListField();
             $field->fieldData = $this->_fields[$i]->fieldName;
             $field->editlistName = $this->_fields[$i]->fieldCaption;
             if ($this->_fields[$i]->fieldXmlInput == XmlInputObjectType::SELECTLIST) {
                 $field->fieldType = EditListFieldType::LOOKUP;
                 $field->arrayLookup = $this->_fields[$i]->arraySelectList;
             } elseif ($this->_fields[$i]->fieldXmlInput == XmlInputObjectType::DUALLIST) {
                 $field->fieldType = EditListFieldType::FORMATTER;
                 $field->formatter = new CrudDualListFormatter($this->_fields[$i]->arraySelectList);
             } else {
                 $field->fieldType = EditListFieldType::TEXT;
             }
             $field->newColumn = $this->_fields[$i]->newColumn;
             if (!is_null($this->_fields[$i]->viewFormatter)) {
                 $field->formatter = $this->_fields[$i]->viewFormatter;
                 $field->fieldType = EditListFieldType::FORMATTER;
             }
             $field = $this->editListFieldCustomize($field, $this->_fields[$i]);
             $editList->addEditListField($field);
         }
     }
     return $editList;
 }
Beispiel #3
0
 /**
  * EditList
  *
  */
 protected function actionEditList()
 {
     $blockCenter = new XmlBlockCollection($this->_myWords->Value("EDITLIST"), BlockPosition::Center);
     $breakLine = new XmlnukeBreakLine();
     $firstParagraph = new XmlParagraphCollection();
     $firstParagraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DESCEDITLISTTEXT")));
     $firstParagraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DESCEDITLISTTEXT2"), true, false, false));
     $firstParagraph->addXmlnukeObject($breakLine);
     $guestbookFile = new AnydatasetFilenameProcessor("guestbook");
     $guestbook = new AnyDataset($guestbookFile->FullQualifiedNameAndPath());
     $iterator = $guestbook->getIterator();
     $thirdParagraph = new XmlParagraphCollection();
     $editList = new XmlEditList($this->_context, $this->_myWords->Value("CONTENTBOOK"), $this->_url);
     $editList->setDataSource($iterator);
     $editList->addParameter("op", "3");
     $field = new EditListField();
     $field->fieldData = "frommail";
     $editList->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = "fromname";
     $field->editlistName = $this->_myWords->Value("TXT_NAME");
     $editList->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = "frommail";
     $field->editlistName = $this->_myWords->Value("TXT_EMAIL");
     $editList->addEditListField($field);
     $field = new EditListField();
     $field->fieldData = "message";
     $field->editlistName = $this->_myWords->Value("MESSAGE");
     $editList->addEditListField($field);
     $customButton = new CustomButtons();
     $customButton->action = "acaocustomizada";
     $customButton->enabled = true;
     $customButton->alternateText = "Texto alternativo da ação";
     $url = new XmlnukeManageUrl(URLTYPE::MODULE, "Xmlnuke.Sample");
     $url->addParam("op", 3);
     $customButton->url = $url->getUrlFull();
     $customButton->icon = "common/editlist/ic_custom.gif";
     $editList->setCustomButton($customButton);
     $editList->setPageSize(3, 0);
     $editList->setEnablePage(true);
     $thirdParagraph->addXmlnukeObject($editList);
     $secondParagraph = new XmlParagraphCollection();
     $secondParagraph->addXmlnukeObject(new XmlnukeText("Ação selecionada: ", true, false, false));
     $secondParagraph->addXmlnukeObject(new XmlnukeText($this->_action));
     $secondParagraph->addXmlnukeObject($breakLine);
     $secondParagraph->addXmlnukeObject(new XmlnukeText("Valor selecionado: ", true, false, false));
     $secondParagraph->addXmlnukeObject(new XmlnukeText($this->_context->get("valueid")));
     $blockCenter->addXmlnukeObject($firstParagraph);
     $blockCenter->addXmlnukeObject($thirdParagraph);
     if ($this->_action != "") {
         $blockCenter->addXmlnukeObject($secondParagraph);
     }
     $this->_document->addXmlnukeObject($blockCenter);
 }