Пример #1
0
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Dec 20, 2005
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opAdd()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty, $__MODULE__, $__TEMPLATES__;
     parent::opAdd();
     $sysMenuDao =& new SiteMenuDAO();
     $data_menu = $sysMenuDao->getMenuArr();
     $form->addElement('header', null, $__Lang__['langMenuHeader']);
     $menu_array = array("0" => $__Lang__['langGeneralNone']);
     $menu_all = $menu_array + $data_menu;
     if ($_REQUEST['Action'] == 'Update') {
         $this->opUpdate();
     }
     $form->addElement('select', 'PID', $__Lang__['langMenuCategory'] . $__Lang__['langGeneralName'] . ' : ', $menu_all);
     $form->addElement('text', 'Title', $__Lang__['langMenu'] . $__Lang__['langGeneralName'] . ' : ');
     $form->addElement('text', 'URL', $__Lang__['langMenu'] . $__Lang__['langGeneralURL'] . ' : ');
     $form->addElement('select', 'SiteModule', $__Lang__['langMenu'] . $__Lang__['langSiteModule'] . ' : ', $__MODULE__);
     $form->addElement('select', 'SiteTemplate', $__Lang__['langMenu'] . $__Lang__['langSiteTemplate'] . ' : ', $__TEMPLATES__);
     $form->addElement('checkbox', 'CopyTemplate', null, $__Lang__['langSiteCopyTemplate']);
     $form->setDefaults(array("CopyTemplate" => 1));
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->addRule('PID', 'Please enter a username.', 'required');
     $form->addRule('Title', 'Please enter a password.', 'required');
     if ($form->validate()) {
         $record["PID"] = $form->exportValue('PID');
         $record["Title"] = $form->exportValue('Title');
         $record["URL"] = $form->exportValue('URL');
         $record["Module"] = $form->exportValue('SiteModule');
         $record["Template"] = $form->exportValue('SiteTemplate');
         $record = $record + $this->_DAO->baseField();
         $dbAppObj = $FlushPHPObj->loadApp("DBApp");
         if ($_POST['ID'] && $_POST['Action'] == 'Update') {
             $this->_DAO->opUpdate(SITE_MENU_TABLE, $record, " SiteMenuID = " . $_POST['ID']);
             $form->setElementError('Title', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
             $form->freeze();
             if ($form->exportValue('CopyTemplate') == 1) {
                 $this->_copyTemplate($record["Template"], $_POST['ID']);
             }
             echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
         } else {
             if ($dbAppObj->checkExists(SITE_MENU_TABLE, " Title='" . $record["Title"] . "' ")) {
                 $form->setElementError('Title', $__Lang__['langSameRecordExist']);
             } else {
                 $menu_id = $this->_DAO->opAdd(SITE_MENU_TABLE, $record);
                 $form->setElementError('Title', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
                 $form->freeze();
                 if ($form->exportValue('CopyTemplate') == 1) {
                     $this->_copyTemplate($record["Template"], $menu_id);
                 }
                 echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
             }
         }
     }
     $smarty->assign("Main", $form->toHTML());
 }
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 16, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opUpdate()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty;
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langGeneralUpdate'] . " " . $__Lang__['langBaseInfo']);
     $form->addElement('text', 'SiteName', $__Lang__['langSite'] . $__Lang__['langGeneralName'] . ' : ', array('size' => 40));
     $form->addElement('text', 'SiteKeyword', $__Lang__['langSite'] . $__Lang__['langKeyword'] . ' : ', array('size' => 40));
     $form->addElement('textarea', 'SiteCopyright', $__Lang__['langSite'] . $__Lang__['langSiteCopyRight'] . ' : ', array('rows' => 8, 'cols' => 40));
     $site_logo_group[] =& HTML_QuickForm::createElement('file', 'Pic', $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ');
     if ($site_logo = $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_LOGO'])) {
         $swf_image_obj = $FlushPHPObj->loadUtility("ViewImgSwf");
         $site_logo_group[] =& HTML_QuickForm::createElement('static', '_SiteLogo', NULL, $swf_image_obj->displayIt($site_logo, NULL, NULL, NULL, HTML_IMAGES_DIR));
         $site_logo_group[] =& HTML_QuickForm::createElement('checkbox', 'del_site_logo', NULL, $__Lang__['langGeneralCancel'] . $__Lang__['langSiteLogo']);
         $site_logo_group[] =& HTML_QuickForm::createElement('hidden', 'old_site_logo', $site_logo);
     }
     $form->addGroup($site_logo_group, NULL, $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ', "    ");
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->setDefaults(array('SiteName' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_NAME']), 'SiteKeyword' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_KEYWORD']), 'SiteCopyright' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_COPYRIGHT'])));
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'Step', 'Step3');
     $form->addRule('SiteName', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langGeneralName'], 'required');
     $form->addRule('SiteKeyword', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langKeyword'], 'required');
     if ($form->validate()) {
         $record["VarName"] = $__SITE_VAR__['SITE_NAME'];
         $record["VarValue"] = $form->exportValue('SiteName');
         $record = $record + $this->_DAO->baseField();
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_KEYWORD'];
         $record["VarValue"] = $form->exportValue('SiteKeyword');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_COPYRIGHT'];
         $record["VarValue"] = $form->exportValue('SiteCopyright');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         if ($_FILES['Pic']['name'] != "") {
             $file_upload_obj = $FlushPHPObj->loadApp("FileUploadHandle");
             $StrPic = $file_upload_obj->uploadMedia(HTML_IMAGES_DIR);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = $StrPic;
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         if ($_POST['del_site_logo'] == 1 && ($old_site_logo = $_POST['old_site_logo'])) {
             unlink(HTML_IMAGES_DIR . $old_site_logo);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = '';
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
     }
     $smarty->assign("Main", $form->toHTML());
 }
Пример #3
0
 /**
  * Add user
  *
  * @author  John.meng (цот╤РШ)
  * @since   version 1.0 - 2005-12-14 22:27:14
  * @param   string  
  *
  */
 function opAdd()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty;
     parent::opAdd();
     if ($_REQUEST['Action'] == 'Update') {
         $this->opUpdate();
     }
     $form->addElement('header', null, $__Lang__['langUserAddHeader']);
     $form->addElement('text', 'user_name', $__Lang__['langMenuUser'] . $__Lang__['langGeneralName'] . ' : ');
     $form->addElement('password', 'user_passwd', $__Lang__['langMenuUser'] . $__Lang__['langGeneralPassword'] . ' : ');
     $form->addElement('password', 'user_passwd2', $__Lang__['langGeneralConfirm'] . $__Lang__['langGeneralPassword'] . ' : ');
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('submit', 'btnSubmit', $__Lang__['langGeneralSubmit']);
     $form->addRule('user_name', 'Please enter a username.', 'required');
     $form->addRule('user_passwd', 'Please enter a password.', 'required');
     $form->addRule('user_passwd2', 'Please enter a confirm password.', 'required');
     $form->addRule(array('user_passwd2', 'user_passwd'), 'The passwords do not match', 'compare');
     if ($form->validate()) {
         $record["UserName"] = $form->exportValue('user_name');
         $record["Passwd"] = md5($form->exportValue('user_passwd'));
         $record["AddIP"] = $AddIPObj->getTrueIP();
         $record["CreateTime"] = time();
         $dbAppObj = $FlushPHPObj->loadApp("DBApp");
         if ($_POST['ID'] && $_POST['Action'] == 'Update') {
             $thisDAO =& new UserDAO();
             $thisDAO->opUpdate(USERS_TABLE, $record, " UsersID = " . $_POST['ID']);
             $form->setElementError('user_name', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
             $form->freeze();
         } else {
             if ($dbAppObj->checkExists(USERS_TABLE, " UserName='******' ")) {
                 $form->setElementError('user_name', $__Lang__['langUserNameExist']);
             } else {
                 $userDAO = new UserDAO();
                 $userDAO->addUser($record);
                 $form->setElementError('user_name', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
                 $form->freeze();
             }
         }
         $form->removeElement('btnSubmit');
     }
     $smarty->assign("Main", $form->toHTML());
 }
Пример #4
0
 /**
  *
  *
  * @author  John.meng (цот╤РШ)
  * @since   version - 2005-12-26 21:02:50
  * @param   string  
  *
  */
 function opGroupUser()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty;
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langUserGroup'] . $__Lang__['langMenuUser'] . $__Lang__['langGeneralList']);
     $thisDAO = new GroupDAO();
     $all_group = $thisDAO->getAllGroup();
     $userDAO = new UserDAO();
     $from_arr = $userDAO->getNotGroupUsers();
     $tmp =& $form->addElement('multiChooser', 'users', 'Select ' . $__Lang__['langUserGroup'] . $__Lang__['langMenuUser'], array("All Users", "Group Users"), $from_arr, array());
     $tmp->addOptionPicker("From Group", $all_group);
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('submit', 'btnSubmit', $__Lang__['langGeneralSubmit']);
     if ($form->validate()) {
         $record["AddIP"] = $AddIPObj->getTrueIP();
         $record["CreateTime"] = time();
         $record["GroupsID"] = $_POST['usersPICKER'];
         $users_arr = explode(';', $_POST['users']);
         array_pop($users_arr);
         $thisDAO =& new GroupDAO();
         $user_arr = $thisDAO->autoUpdateInsertDel(UGROUPS_TABLE, $record, 'UsersID', implode(',', $users_arr), 'GroupsID', $_POST['usersPICKER']);
     }
     $smarty->assign("Main", $form->toHTML());
 }
Пример #5
0
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 6, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opStep3()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty, $__MODULE__, $__TEMPLATES__;
     include_once PEAR_DIR . "HTML/Table.php";
     include_once MODULE_DIR . "Site/DAO/SiteMenuDAO.class.php";
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langSite'] . $__Lang__['langWizard'] . $__Lang__['langStep'] . " 3 ");
     $sysMenuDao = new SiteMenuDAO();
     $data_menu = $sysMenuDao->getMenuAllArr();
     $tableAttrs = array("class" => "grid_sub_table", 'cellspacing' => "0");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     //		$table->setAutoFill("n/a");
     $cell_x = 0;
     $data_menu = array(NULL => NULL) + $data_menu;
     foreach ($data_menu as $key => $value) {
         $table->addRow(array($value['Title'], $__MODULE__[$value['Module']], $__TEMPLATES__[$value['Template']], $value['URL'], " <table><tr><td><a href='####' onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Update&ID=" . $key . "' , 450, 450)\" ><img src='" . THEMES_DIR . "images/edit.gif' border='0'><br />" . $__Lang__['langGeneralUpdate'] . "</a></td><td><a href='####' onclick=\"confirm ( '" . $__Lang__['langGeneralCancelConfirm'] . "')?popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Cancel&ID=" . $key . "' , 20, 20):'';\"><img src='" . THEMES_DIR . "images/delete.gif' border='0'><br />" . $__Lang__['langGeneralCancel'] . "</a></td></tr></table>"));
         $cell_x++;
     }
     $altRow = array("class" => "grid_table_tr_alternate");
     $table->altRowAttributes(1, null, $altRow);
     $hrAttrs = array("class" => "grid_sub_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $table->setHeaderContents(0, 0, $__Lang__['langMenu']);
     $table->setHeaderContents(0, 1, $__Lang__['langSiteModule']);
     $table->setHeaderContents(0, 2, $__Lang__['langSiteTemplate']);
     $table->setHeaderContents(0, 3, $__Lang__['langGeneralURL']);
     $table->setHeaderContents(0, 4, $__Lang__['langGeneralOperation']);
     $form->addElement('static', NULL, NULL, $table->toHtml());
     $step_nav[] =& HTML_QuickForm::createElement('submit', 'btnPre', $__Lang__['langPreStep'], "onclick=document.forms[0].Step.value='Step2' ");
     $step_nav[] =& HTML_QuickForm::createElement('button', 'btnNew', $__Lang__['langGeneralAdd'] . $__Lang__['langMenu'], "onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Add', 450, 450)\" ");
     $step_nav[] =& HTML_QuickForm::createElement('button', 'btnNext', $__Lang__['langFinish'], "onclick=\"window.location='?Module=Site&Page=Preview'\" ");
     $form->addGroup($step_nav, 'step_navigation', "    ");
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'Step');
     if ($form->validate()) {
         if ($_POST['Step'] == 'Step2') {
             $this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step2");
         } else {
             $this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step4");
         }
     }
     $smarty->assign("Main", $form->toHTML());
 }