diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 08a279062..1d3e632e5 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -9,8 +9,8 @@ * News Administration * * $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ - * $Revision: 1.23 $ - * $Date: 2009-01-17 01:30:35 $ + * $Revision: 1.24 $ + * $Date: 2009-01-17 22:48:14 $ * $Author: secretr $ */ require_once("../class2.php"); @@ -31,6 +31,10 @@ $pst->id = "admin_newspost"; // ------------------------------ $newspost = new admin_newspost(e_QUERY, $pst); + +//Handle Ajax Calls +if($newspost->ajax_observer()) exit; + function headerjs() { global $newspost; @@ -62,6 +66,41 @@ function headerjs() "; + + if($newspost->getAction() == 'cat') + { + $ret .= " + + "; + } + elseif ($newspost->getAction() == 'pref') + { + $ret .= " + + "; + } $ret .= $newspost->_cal->load_files(); return $ret; @@ -163,6 +202,17 @@ class admin_newspost $e107->ecache->clear("othernews"); $e107->ecache->clear("othernews2"); } + + function ajax_observer() + { + $method = 'ajax_exec_'.$this->getAction(); + if(e_AJAX_REQUEST && method_exists($this, $method)) + { + $this->$method(); + return true; + } + return false; + } function observer() { @@ -387,9 +437,9 @@ class admin_newspost } else { - $_POST['category_button'] = $tp->toDB($_POST['category_button']); + $_POST['category_button'] = $e107->tp->toDB($_POST['category_button']); } - $_POST['category_name'] = $tp->toDB($_POST['category_name']); + $_POST['category_name'] = $e107->tp->toDB($_POST['category_name']); $e107->sql->db_Insert('news_category', "'0', '{$_POST['category_name']}', '{$_POST['category_button']}'"); $admin_log->log_event('NEWS_04',$_POST['category_name'].', '.$_POST['category_button'],E_LOG_INFORMATIVE,''); $this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS); @@ -414,17 +464,20 @@ class admin_newspost function _observe_save_prefs() { global $pref, $admin_log; + + $e107 = e107::getInstance(); + $temp = array(); $temp['newsposts'] = intval($_POST['newsposts']); $temp['newsposts_archive'] = intval($_POST['newsposts_archive']); - $temp['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']); + $temp['newsposts_archive_title'] = $e107->tp->toDB($_POST['newsposts_archive_title']); $temp['news_cats'] = intval($_POST['news_cats']); $temp['nbr_cols'] = intval($_POST['nbr_cols']); $temp['subnews_attach'] = intval($_POST['subnews_attach']); $temp['subnews_resize'] = intval($_POST['subnews_resize']); $temp['subnews_class'] = intval($_POST['subnews_class']); $temp['subnews_htmlarea'] = intval($_POST['subnews_htmlarea']); - $temp['news_subheader'] = $tp->toDB($_POST['news_subheader']); + $temp['news_subheader'] = $e107->tp->toDB($_POST['news_subheader']); $temp['news_newdateheader'] = intval($_POST['news_newdateheader']); $temp['news_unstemplate'] = intval($_POST['news_unstemplate']); $temp['news_editauthor'] = intval($_POST['news_editauthor']); @@ -1183,27 +1236,49 @@ class admin_newspost "; } - - function show_message($message, $type = E_MESSAGE_INFO, $session = false) + + function ajax_exec_cat() { - // ##### Display comfort --------------------------------------------------------------------------------------------------------- - //global $ns; - //$ns->tablerender("", "