/** * Add EditList to site * * @param XmlBlockCollection $this->_mainBlock * @param string $site * @param AnyDataset $dataset */ protected function AddEditListToSite($block, $site, $dataset) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("editsite", $site); $editList = new XmlEditList($this->_context, $this->myWords->Value("EDITLIST_TITLE", $site), $this->url->getUrl(), true, false, true, true); $editList->setDataSource($dataset->getIterator()); $listField = new EditListField(); $listField->editlistName = ""; $listField->fieldData = "role"; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_ROLES"); $listField->fieldData = $this->user->getRolesTable()->Role; $editList->addEditListField($listField); $listField = new EditListField(); $listField->editlistName = $this->myWords->Value("EDITLIST_SITES"); $listField->fieldData = $this->user->getRolesTable()->Site; $editList->addEditListField($listField); $para->addXmlnukeObject($editList); }
/** *@desc Build URL link based on xmlnuke model. *@desc Note: target must be the follow values: *@desc - site if URLTYPE is equal to ENGINE or ADMIN *@desc - module is URLTYPE is equal to MODULE *@desc - Full URL (without protocol) if any other. *@return string */ public function getUrl() { if ($this->_urltype == URLTYPE::ENGINE || $this->_urltype == URLTYPE::ADMINENGINE) { $url = $this->_urltype; } else { $url = $this->_target; if ($this->_urltype == URLTYPE::MODULE || $this->_urltype == URLTYPE::JAVASCRIPT || $this->_urltype == URLTYPE::ADMIN) { if (strpos($this->_target, $this->_urltype) === false) { $url = $this->_urltype . $url; } } } $separator = strpos($this->_target, "?") === false ? '?' : "&"; $count = 0; foreach ($this->_parameters as $param => $value) { if ($count > 0) { $separator = '&'; } $count++; $url .= $separator . $param . '=' . XmlnukeManageUrl::encodeParam($value); } //return $url; return str_replace('&', '&', $url); }
protected function redirProcessPage($full) { $url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_module); $url->addParam("acao", self::ACTION_MSG); $url->addParam(self::PARAM_MSG, $this->_currentAction); //$url->addParam("filter", $this->_filter); //$url->addParam("sort", $this->_sort); $url->addParam("curpage", $this->_curPage); $url->addParam("offset", $this->_qtdRows); foreach ($this->_parameter as $key => $value) { $url->addParam($key, $value); } //if ($full) //{ return $url->getUrlFull(); //} //else //{ // return $url->getUrl(); //} }
/** * Update Info * * @param String $usernamevalid * @param String $id */ protected function updateInfo($usernamevalid, $id) { $this->_context->MakeLogin($usernamevalid, $id); $url = XmlnukeManageUrl::decodeParam($this->_urlReturn); $this->_context->redirectUrl($url); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return function */ public function generateObject($current) { if ($this->_readonly) { $deliLeft = strlen($this->_readOnlyDeli) != 0 ? $this->_readOnlyDeli[0] : ""; $deliRight = strlen($this->_readOnlyDeli) != 0 ? $this->_readOnlyDeli[1] : ""; // XmlInputLabelField $ic; if ($this->_inputextboxtype == InputTextBoxType::TEXT) { $ic = new XmlInputLabelField($this->_caption, $deliLeft . $this->_value . $deliRight); } else { $ic = new XmlInputLabelField($this->_caption, $deliLeft . "**********" . $deliRight); } $ic->generateObject($current); // XmlInputHidden $ih $ih = new XmlInputHidden($this->_name, $this->_value); $ih->generateObject($current); } else { if ($this->_inputextboxtype == InputTextBoxType::TEXT) { $nodeWorking = XmlUtil::CreateChild($current, "textbox", ""); } else { $nodeWorking = XmlUtil::CreateChild($current, "password", ""); } if (intval($this->_maxlength) != 0) { XmlUtil::AddAttribute($nodeWorking, "maxlength", $this->_maxlength); } XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); XmlUtil::AddAttribute($nodeWorking, "value", $this->_value); XmlUtil::AddAttribute($nodeWorking, "size", $this->_size); if ($this->_autosuggestUrl != "") { $url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_autosuggestUrl); $urlStr = $url->getUrlFull(); if (strpos($urlStr, "?") === false) { $urlStr .= "?"; } else { $urlStr .= "&"; } XmlUtil::AddAttribute($nodeWorking, "autosuggesturl", str_replace("&", "&", $urlStr)); XmlUtil::AddAttribute($nodeWorking, "autosuggestparamreq", $this->_autosuggestParamReq); if ($this->_autosuggestCallback) { XmlUtil::AddAttribute($nodeWorking, "autosuggestcallback", $this->_autosuggestCallback); } XmlUtil::AddAttribute($nodeWorking, "autosuggest_array", $this->_autosuggestJsonArray); XmlUtil::AddAttribute($nodeWorking, "autosuggest_objid", $this->_autosuggestJsonObjKey); XmlUtil::AddAttribute($nodeWorking, "autosuggest_objvalue", $this->_autosuggestJsonObjValue); XmlUtil::AddAttribute($nodeWorking, "autosuggest_objinfo", $this->_autosuggestJsonObjInfo); } if ($this->getMask() == "") { if ($this->getDataType() == INPUTTYPE::DATE) { $this->setMask("99/99/9999"); } elseif ($this->getDataType() == INPUTTYPE::DATETIME) { $this->setMask("99/99/9999 99:99:99"); } } if ($this->getMask() != "") { XmlUtil::AddAttribute($nodeWorking, "mask", $this->_maskText); } if ($this->_disableAutoComplete) { XmlUtil::AddAttribute($nodeWorking, "autocomplete", "off"); } parent::generateObject($nodeWorking); } }
/** * */ function processModule() { $context = Context::getInstance(); //IModule $module = null; $moduleName = $context->getModule(); if ($moduleName == "") { // Experimental... Not finished... $moduleName = $context->getVirtualCommand(); if ($moduleName == 'admin') { $moduleName = 'Xmlnuke.Admin.ControlPanel'; } } $firstError = null; $debug = $context->getDebugStatus(); // Try load modules // Catch errors from permissions and so on. $writeResult = $this->getProcessResult(); try { $module = ModuleFactory::GetModule($moduleName); $engine = $this->createXmlnukeEngine(); $writeResult->SearchAndReplace($engine->TransformDocumentFromModule($module)); } catch (ModuleNotFoundException $ex) { $module = ModuleFactory::GetModule('Xmlnuke.HandleException', array('TYPE' => 'NOTFOUND', 'MESSAGE' => 'The module "' . $moduleName . '" was not found.', 'OBJECT' => $moduleName)); $engine = $this->createXmlnukeEngine(); $writeResult->SearchAndReplace($engine->TransformDocumentFromModule($module)); } catch (NotAuthenticatedException $ex) { $s = XmlnukeManageUrl::encodeParam($_SERVER["REQUEST_URI"]); $url = $context->bindModuleUrl($context->get("xmlnuke.LOGINMODULE")) . "&ReturnUrl=" . $s; // Do not leave empty spaces at begin or end of modules // Não deixe espaços em branco no início ou fim dos módulos $context->redirectUrl($url); } }
/** * Action Upload * */ protected function actionUpload() { $blockCenter = new XmlBlockCollection($this->_myWords->Value("UPLOAD"), BlockPosition::Center); $this->_document->addXmlnukeObject($blockCenter); $paragraph = new XmlParagraphCollection(); $blockCenter->addXmlnukeObject($paragraph); switch ($this->_action) { case 'add': $fileProcessor = new UploadFilenameProcessor('*.*'); $fileProcessor->setFilenameLocation(ForceFilenameLocation::DefinePath, "diretorio/subdir/"); $result = $this->_context->processUpload($fileProcessor, false, 'form_file'); $paragraph->addXmlnukeObject(new XmlnukeText("Arquivo " . $result[0] . " enviado com sucesso ao servidor!")); break; default: $paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DESCUPLOADTEXT2"))); $url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_url); $url->addParam('op', '6'); $url->addParam('action', 'add'); $form = new XmlFormCollection($this->_context, $url->getUrl(), $this->_myWords->Value("MAKEUPLOAD")); $paragraph = new XmlParagraphCollection(); $blockCenter->addXmlnukeObject($paragraph); $paragraph->addXmlnukeObject($form); $fileField = new XmlInputFile($this->_myWords->Value("FILE"), 'form_file'); $form->addXmlnukeObject($fileField); $button = new XmlInputButtons(); $button->addSubmit($this->_myWords->Value("ADD"), ""); $form->addXmlnukeObject($button); break; } }