Ejemplo n.º 1
0
 protected function actionEdit()
 {
     $selectedRole = $this->_context->get("valueid");
     $selectedSite = $this->_context->get("editsite");
     $it = $this->user->getRolesIterator($selectedSite, $selectedRole);
     $sr = $it->moveNext();
     $selectedSite = $sr->getField($this->user->getRolesTable()->Site);
     $this->_mainBlock = new XmlBlockCollection($this->myWords->Value("BLOCK_TITLE_EDIT"), BlockPosition::Center);
     $para = new XmlParagraphCollection();
     $this->url->addParam("action", ModuleAction::EditConfirm);
     $form = new XmlFormCollection($this->_context, $this->url->getUrl(), "");
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $selectedRole));
     $form->addXmlnukeObject(new XmlInputHidden("editsite", $selectedSite));
     $textbox = new XmlInputTextBox($this->myWords->Value("FORM_NAME"), "textbox_role", $selectedRole);
     $button = new XmlInputButtons();
     $button->addSubmit("OK", "");
     $form->addXmlnukeObject(new XmlInputLabelField($this->myWords->Value("FORM_FROMSITE"), $selectedSite == "_all" ? $this->myWords->Value("TEXT_ALLSITES") : $selectedSite));
     $form->addXmlnukeObject($textbox);
     $form->addXmlnukeObject($button);
     $para->addXmlnukeObject($form);
     $this->_mainBlock->addXmlnukeObject($para);
     $this->AddListLink($this->_mainBlock);
     $this->defaultXmlnukeDocument->addXmlnukeObject($this->_mainBlock);
 }
Ejemplo n.º 2
0
 /**
  * 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);
     }
 }
Ejemplo n.º 3
0
 /**
  * Form Password Info
  *
  */
 protected function formPasswordInfo()
 {
     $form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("CHANGEPASSTITLE"));
     $this->_paragraph->addXmlnukeObject($form);
     $hidden = new XmlInputHidden("action", "changepassword");
     $form->addXmlnukeObject($hidden);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSOLDPASS"), "oldpassword", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSNEWPASS"), "newpassword", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSNEWPASS2"), "newpassword2", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $button = new XmlInputButtons();
     $button->addSubmit($this->_myWords->Value("TXT_CHANGE"), "");
     $form->addXmlnukeObject($button);
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 /**
  * Show Form
  *
  */
 protected function Form()
 {
     $myWords = $this->WordCollection();
     $blockCenter = new XmlBlockCollection($myWords->Value("PAGETITLE"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockCenter);
     $paragraph = new XmlParagraphCollection();
     $blockCenter->addXmlnukeObject($paragraph);
     $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("PAGETEXT")));
     $form_target = "module:search";
     $form = new XmlFormCollection($this->_context, $form_target, $myWords->Value("CAPTION"));
     $paragraph->addXmlnukeObject($form);
     $form->setJSValidate(true);
     $textbox = new XmlInputTextBox($myWords->Value("txtSearch"), "txtSearch", $this->txtSearch, 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $checkbox = new XmlInputCheck($myWords->Value("chkAll"), "checkAll", "all");
     $checkbox->setChecked($this->_context->get("checkAll"));
     $form->addXmlnukeObject($checkbox);
     $button = new XmlInputButtons();
     $button->addSubmit($myWords->Value("SUBMIT"), "");
     $form->addXmlnukeObject($button);
 }
Ejemplo n.º 6
0
 /**
  * Show the form
  *
  */
 public function showForm()
 {
     $blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGFILL"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockcenter);
     $paragraph = new XmlParagraphCollection();
     $blockcenter->addXmlnukeObject($paragraph);
     $form = new XmlFormCollection($this->_context, "module:sendpage", $this->_myWords->Value("CAPTION"));
     $paragraph->addXmlnukeObject($form);
     $caption = new XmlInputCaption($this->_myWords->ValueArgs("INFO", array(urldecode($this->_link))));
     $form->addXmlnukeObject($caption);
     $hidden = new XmlInputHidden("action", "submit");
     $form->addXmlnukeObject($hidden);
     $hidden = new XmlInputHidden("link", $this->_link);
     $form->addXmlnukeObject($hidden);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDNAME"), "fromname", "", 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDEMAIL"), "frommail", "", 40);
     $textbox->setDataType(INPUTTYPE::EMAIL);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDTONAME"), "toname", "", 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDTOEMAIL"), "tomail", "", 40);
     $textbox->setDataType(INPUTTYPE::EMAIL);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $memo = new XmlInputMemo($this->_myWords->Value("LABEL_MESSAGE"), "custommessage", "");
     $form->addXmlnukeObject($memo);
     $form->addXmlnukeObject(new XmlInputImageValidate($this->_myWords->Value("TYPETEXTFROMIMAGE")));
     $button = new XmlInputButtons();
     $button->addSubmit($this->_myWords->Value("TXT_SUBMIT"), "");
     $form->addXmlnukeObject($button);
 }
Ejemplo n.º 7
0
 /**
  * Enter description here...
  *
  * @param string $captionSubmit
  * @param string $captionCancel
  * @param string $urlCancel
  * @return XmlInputButtons
  */
 public static function CreateSubmitCancelButton($captionSubmit, $captionCancel, $urlCancel)
 {
     $button = XmlInputButtons::CreateSubmitButton($captionSubmit);
     $button->addButton($captionCancel, "cancel", "javacript:window.location = '{$urlCancel}'");
     return $button;
 }
Ejemplo n.º 8
0
 /**
  * CreatePage is called from module processor and decide the proper output XML.
  *
  * @return DOMNode object
  */
 public function CreatePage()
 {
     $myWords = $this->WordCollection();
     $ht = array();
     $hasError = false;
     if ($this->_fromName == "") {
         $ht[$myWords->Value("FLDNAME")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_fromEmail == "") {
         $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     } else {
         if (strrpos($this->_fromEmail, "@") === false) {
             $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("FLDEMAIL") . " " . $myWords->Value("ERRORINVALID");
             $hasError = true;
         }
     }
     if ($this->_subject == "") {
         $ht[$myWords->Value("FLDSUBJECT")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_message == "") {
         $ht[$myWords->Value("FLDMESSAGE")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($hasError) {
         return $this->CreatePageArgs($myWords->Value("MSGERROR"), $ht);
     } elseif (!XmlInputImageValidate::validateText($this->_context)) {
         $document = new XmlnukeDocument($myWords->ValueArgs("TITLE", array($this->_context->get("SERVER_NAME"))), $myWords->ValueArgs("ABSTRACT", array($this->_context->get("SERVER_NAME"))));
         $blockcenter = new XmlBlockCollection($myWords->Value("MSGERROR"), BlockPosition::Center);
         $document->addXmlnukeObject($blockcenter);
         $form = new XmlFormCollection($this->_context, "module:sendemail", $myWords->Value("MSGERROR"));
         $form->addXmlnukeObject(new XmlInputCaption($myWords->Value("RETRYVALIDATE")));
         $form->addXmlnukeObject(new XmlInputHidden("toname_id", $this->_context->get("toname_id")));
         $form->addXmlnukeObject(new XmlInputHidden("name", $this->_context->get("name")));
         $form->addXmlnukeObject(new XmlInputHidden("email", $this->_context->get("email")));
         $form->addXmlnukeObject(new XmlInputHidden("subject", $this->_context->get("subject")));
         $form->addXmlnukeObject(new XmlInputHidden("message", $this->_extraMessage . $this->_context->get("message")));
         $form->addXmlnukeObject(new XmlInputHidden("redirect", $this->_context->get("redirect")));
         $form->addXmlnukeObject(new XmlInputImageValidate(""));
         $buttons = new XmlInputButtons();
         $buttons->addSubmit($myWords->Value("RETRY"), "");
         $form->addXmlnukeObject($buttons);
         $blockcenter->addXmlnukeObject($form);
         return $document->generatePage();
     } else {
         $envelope = new MailEnvelope(MailUtil::getEmailFromID($this->_toName_ID), $this->_subject, $this->_extraMessage . $this->_message);
         $envelope->setFrom(MailUtil::getEmailFromID("DEFAULT", $this->_fromName));
         $envelope->setReplyTo(\ByJG\Mail\Util::getFullEmail($this->_fromEmail, $this->_fromName));
         $envelope->setBCC($this->_fromEmail);
         $envelope->Send();
         if ($this->_redirect != "") {
             //Redirect Here!!
             //Response.End
             return $document->generatePage();
         } else {
             $ht[$myWords->Value("FLDNAME")] = $this->_fromName . " [" . $this->_fromEmail . "]";
             $ht[$myWords->Value("FLDSUBJECT")] = $this->_subject;
             $ht[$myWords->Value("FLDMESSAGE")] = $this->_message;
             return $this->CreatePageArgs($myWords->Value("MSGOK"), $ht);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  *@desc
  *@param
  *@return XmlFormCollection
  */
 protected function showCurrentRecord()
 {
     if ($this->_currentAction == self::ACTION_NEW) {
         $title = $this->_lang->Value("TITLE_NEW", $this->_header);
     } else {
         if ($this->_currentAction == self::ACTION_EDIT) {
             $title = $this->_lang->Value("TITLE_EDIT", $this->_header);
         } else {
             if ($this->_currentAction == self::ACTION_DELETE) {
                 $title = $this->_lang->Value("TITLE_DELETE", $this->_header);
             } else {
                 if ($this->_currentAction == self::ACTION_VIEW) {
                     $title = $this->_lang->Value("TITLE_VIEW", $this->_header);
                 } else {
                     $title = "";
                 }
             }
         }
     }
     //		XmlFormCollection $form
     $form = new XmlFormCollection($this->_context, $this->_module, $title);
     $form->setDecimalSeparator($this->_decimalSeparator);
     $form->setDateFormat($this->_dateFormat);
     //$form->addXmlnukeObject(new XmlInputHidden("filter", $this->_filter));
     //$form->addXmlnukeObject(new XmlInputHidden("sort", $this->_sort));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_curPage));
     $form->addXmlnukeObject(new XmlInputHidden("offset", $this->_qtdRows));
     $form->addXmlnukeObject(new XmlInputHidden("acao", $this->_currentAction . "_confirm"));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $this->_valueId));
     foreach ($this->_parameter as $key => $value) {
         $form->addXmlnukeObject(new XmlInputHidden($key, $value));
     }
     //		SingleRow $sr
     $sr = $this->getCurrentRecord();
     for ($i = 0, $fieldLength = sizeof($this->_fields); $i < $fieldLength; $i++) {
         $curValue = "";
         if ($this->_currentAction != self::ACTION_NEW) {
             $curValue = $sr->getField($this->_fields[$i]->fieldName);
             if (($this->_fields[$i]->dataType == INPUTTYPE::DATE || $this->_fields[$i]->dataType == INPUTTYPE::DATETIME) && $curValue != "") {
                 $curValue = $this->dateFromSource($curValue, $this->_fields[$i]->dataType == INPUTTYPE::DATETIME);
             } elseif ($this->_fields[$i]->dataType == INPUTTYPE::NUMBER) {
                 $curValue = str_replace(".", $this->_decimalSeparator, $curValue);
             }
             if ($this->_fields[$i]->beforeUpdateFormatter != null) {
                 $curValue = $this->_fields[$i]->beforeUpdateFormatter->Format($sr, $this->_fields[$i]->fieldName, $curValue);
             }
         } else {
             $curValue = $this->_fields[$i]->defaultValue;
         }
         $form->addXmlnukeObject($this->renderField($this->_fields[$i], $curValue));
     }
     //		XmlInputButtons $buttons
     $buttons = new XmlInputButtons();
     if ($this->_currentAction != self::ACTION_VIEW) {
         $buttons->addSubmit($this->_lang->Value("TXT_SUBMIT"), "");
     }
     $buttons->addButton($this->_lang->Value("TXT_BACK"), "", "document.location='" . str_replace("&", "&amp;", $this->redirProcessPage(true)) . "'");
     $form->addXmlnukeObject($buttons);
     return $form;
 }
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
 protected function Opcao19()
 {
     $block = new XmlBlockCollection("Exemplo 19: Media Gallery", BlockPosition::Center);
     //XmlnukeBreakLine br = new XmlnukeBreakLine();
     $para = new XmlParagraphCollection();
     $para->addXmlnukeObject(new XmlnukeText("Galeria de Imagens (album de Fotos)"));
     $gallery = new XmlnukeMediaGallery("Galeria1");
     $gallery->addImage("common/imgs/albumsample/1.jpg", "common/imgs/albumsample/t_1.jpg", "Titulo Imagem 1", "Você pode colocar um caption aqui", 60, 60);
     $gallery->addImage("common/imgs/albumsample/2.jpg", "common/imgs/albumsample/t_2.jpg", "Titulo Imagem 2", "Você pode colocar um caption aqui", 60, 60);
     $gallery->addImage("common/imgs/albumsample/3.jpg", "common/imgs/albumsample/t_3.jpg", "Titulo Imagem 3", "Você pode colocar um caption aqui", 60, 60);
     $para->addXmlnukeObject($gallery);
     $block->addXmlnukeObject($para);
     $para = new XmlParagraphCollection();
     $para->addXmlnukeObject(new XmlnukeText("Flash, Youtube e Quicktime"));
     $gallery = new XmlnukeMediaGallery();
     $gallery->addEmbed("http://www.adobe.com/products/flashplayer/include/marquee/design.swf", 792, 294, "http://images.apple.com/trailers/wb/images/terminatorsalvation_200903131052.jpg", "Titulo Flash", "Aqui vc está vendo um Flash");
     $gallery->addEmbed("http://movies.apple.com/movies/wb/terminatorsalvation/terminatorsalvation-tlr3_h.480.mov", 480, 204, "http://images.apple.com/trailers/wb/images/terminatorsalvation_200903131052.jpg", "Titulo Quicktime", "Aqui vc está vendo um Quicktime Movie");
     $gallery->addEmbed("http://www.youtube.com/watch?v=4m48GqaOz90", "", "", "http://i1.ytimg.com/vi/4m48GqaOz90/default.jpg", "Titulo Youtube", "Aqui vc está vendo um Vídeo do Youtube");
     $para->addXmlnukeObject($gallery);
     $block->addXmlnukeObject($para);
     $para = new XmlParagraphCollection();
     $para->addXmlnukeObject(new XmlnukeText("IFrame"));
     $gallery = new XmlnukeMediaGallery();
     $gallery->addIFrame($this->_url, 480, 204, "", "IFrame");
     $para->addXmlnukeObject($gallery);
     $block->addXmlnukeObject($para);
     $gallery = new XmlnukeMediaGallery("Galeria2");
     $gallery->setApi(true);
     $gallery->setVisible(false);
     $gallery->addImage("common/imgs/albumsample/4.jpg", "", "Titulo Imagem 1", "Você pode colocar um caption aqui");
     $gallery->addImage("common/imgs/albumsample/5.jpg", "", "Titulo Imagem 2", "Você pode colocar um caption aqui");
     $gallery->addImage("common/imgs/albumsample/1.jpg", "", "Titulo Imagem 3", "Você pode colocar um caption aqui");
     $block->addXmlnukeObject($gallery);
     $form = new XmlFormCollection($this->_context, "", "Abrir por JavaScript");
     $button = new XmlInputButtons();
     $button->addButton("Clique para abrir a Galeria", "kk", "open_Galeria2()");
     $form->addXmlnukeObject($button);
     $block->addXmlnukeObject($form);
     $this->_document->addXmlnukeObject($block);
 }