diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 63edc3982..b8dd375e5 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.40 $ - * $Date: 2009-07-03 02:27:03 $ + * $Revision: 1.41 $ + * $Date: 2009-07-03 06:48:43 $ * $Author: e107coders $ */ require_once("../class2.php"); @@ -29,7 +29,7 @@ $pst->form = "core-newspost-create-form"; // form id of the form that will have $pst->page = "newspost.php?create"; // display preset options on which page(s). $pst->id = "admin_newspost"; // ------------------------------ - +require_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php"); // maybe this should be put in class2.php when 'admin' is detected. $newspost = new admin_newspost(e_QUERY, $pst); $gen = new convert(); @@ -41,7 +41,22 @@ function headerjs() global $newspost; require_once(e_HANDLER.'js_helper.php'); - $ret = " + + $ret .= ""; + + + $ret .= " - + "; if($newspost->getAction() == 'cat') @@ -147,6 +162,7 @@ class admin_newspost var $_request = array(); var $_cal = array(); var $_pst; + var $_fields; function admin_newspost($qry, $pstobj) { @@ -157,6 +173,22 @@ class admin_newspost $this->_pst = &$pstobj; + $this->_fields = array( + "news_id" => array("title" => LAN_NEWS_45, "type"=>"number", "width" => "5%", "thclass" => "center", "url" => e_SELF."?main.news_id.{$sort_link}.".$this->getFrom()), + "news_title" => array("title" => NWSLAN_40, "type"=>"text", "width" => "30%", "thclass" => "", "url" => e_SELF."?main.news_title.{$sort_link}.".$this->getFrom()), + "news_author" => array("title" => LAN_NEWS_50, "type"=>"user", "width" => "10%", "thclass" => "", "url" => ""), + "news_datestamp" => array("title" => LAN_NEWS_32, "type"=>"datestamp", "width" => "15%", "thclass" => "", "url" => ""), + "news_category" => array("title" => NWSLAN_6, "type"=>"dropdown", "width" => "auto", "thclass" => "", "url" => ""), + "news_class" => array("title" => NWSLAN_22, "type"=>"userclass", "width" => "auto", "thclass" => "", "url" => ""), + "news_render_type" => array("title" => LAN_NEWS_49, "type"=>"dropdown", "width" => "auto", "thclass" => "center", "url" => ""), + "news_thumbnail" => array("title" => LAN_NEWS_22, "width" => "auto", "thclass" => "", "url" => ""), + "news_sticky" => array("title" => LAN_NEWS_28, "type"=>"boolean", "width" => "auto", "thclass" => "", "url" => ""), + "news_allow_comments" => array("title" => NWSLAN_15, "type"=>"boolean", "width" => "auto", "thclass" => "", "url" => ""), + "news_comment_total" => array("title" => LAN_NEWS_60, "type"=>"number", "width" => "auto", "thclass" => "", "url" => ""), + "options" => array("title" => LAN_OPTIONS, "width" => "300px", "thclass" => "center last", "url" => "") + + ); + } function parseRequest($qry) @@ -208,6 +240,7 @@ class admin_newspost function ajax_observer() { $method = 'ajax_exec_'.$this->getAction(); + if(e_AJAX_REQUEST && method_exists($this, $method)) { $this->$method(); @@ -564,6 +597,12 @@ class admin_newspost $sort_link = $sort_order == 'asc' ? 'desc' : 'asc'; // Effectively toggle setting for headings $amount = 10;//TODO - pref + + + $field_columns = $this->_fields; + + $field_count = count($field_columns); + $e107 = &e107::getInstance(); // Grab news Category Names; @@ -575,7 +614,31 @@ class admin_newspost { $news_category[$val['category_id']] = $val['category_name']; } - // ------------------------------- + + + // ------ Search Filter ------ + + $text .= " +
+
+ + + + + + + +
". + $frm->admin_button('dupfield', "Add Filter", 'action', '', array('other' => 'onclick="duplicateHTML(\'filterline\',\'srch_container\');"')) + ." +
".$frm->filterType($field_columns)."".$frm->filterValue()."
+
". + $frm->admin_button('searchsubmit', NWSLAN_63, 'search')." +
+
+ "; + + // -------------------------------------------- if (varsettrue($_POST['searchquery'])) @@ -591,25 +654,7 @@ class admin_newspost { $newsarray = $e107->sql->db_getList(); - $field_columns = array( - "news_id" => array("title" => LAN_NEWS_45, "width" => "5%", "thclass" => "sortable center", "url" => e_SELF."?main.news_id.{$sort_link}.".$this->getFrom()), - "news_title" => array("title" => NWSLAN_40, "width" => "30%", "thclass" => "sortable", "url" => e_SELF."?main.news_title.{$sort_link}.".$this->getFrom()), - "news_author" => array("title" => LAN_NEWS_50, "width" => "10%", "thclass" => "sortable", "url" => ""), - "news_datestamp" => array("title" => LAN_NEWS_32, "width" => "15%", "thclass" => "sortable", "url" => ""), - "news_category" => array("title" => NWSLAN_6, "width" => "auto", "thclass" => "sortable", "url" => ""), - "news_class" => array("title" => NWSLAN_22, "width" => "auto", "thclass" => "sortable", "url" => ""), - "news_render_type" => array("title" => LAN_NEWS_49, "width" => "auto", "thclass" => "sortable center", "url" => ""), - "news_thumbnail" => array("title" => LAN_NEWS_22, "width" => "auto", "thclass" => "sortable", "url" => ""), - "news_sticky" => array("title" => LAN_NEWS_28, "width" => "auto", "thclass" => "", "url" => ""), - "news_allow_comments" => array("title" => NWSLAN_15, "width" => "auto", "thclass" => "", "url" => ""), - "news_comment_total" => array("title" => LAN_NEWS_60, "width" => "auto", "thclass" => "", "url" => ""), - "options" => array("title" => LAN_OPTIONS, "width" => "300px", "thclass" => "center last", "url" => "") - - ); - - $field_count = count($field_columns) - 1; - - $text = " + $text .= "
".NWSLAN_4." @@ -630,7 +675,6 @@ class admin_newspost $sticky = ($row['news_sticky'] == 1) ? ADMIN_TRUE_ICON : " "; $comments = ($row['news_allow_comments'] == 1) ? ADMIN_TRUE_ICON : " "; - $text .= "\n"; // Below must be in the same order as the field_columns above. @@ -638,8 +682,8 @@ class admin_newspost $text .= (in_array("news_id",$pref['admin_news_columns'])) ? "".$row['news_id']."\n" : ""; $text .= (in_array("news_title",$pref['admin_news_columns'])) ? "".($row['news_title'] ? $e107->tp->toHTML($row['news_title'], false,"TITLE") : "[".NWSLAN_42."]")." \n" : ""; $text .= (in_array("news_author",$pref['admin_news_columns'])) ? "".$author['user_name']."\n" : ""; - $text .= (in_array("news_datestamp",$pref['admin_news_columns'])) ? "".$gen->convert_date($row['news_datestamp'],'short')." \n" : ""; - $text .= (in_array("news_category",$pref['admin_news_columns'])) ? "".$news_category[$row['news_category']]." \n" : ""; + $text .= (in_array("news_datestamp",$pref['admin_news_columns'])) ? "".$gen->convert_date($row['news_datestamp'],'short')." \n" : ""; + $text .= (in_array("news_category",$pref['admin_news_columns'])) ? "".$news_category[$row['news_category']]." \n" : ""; $text .= (in_array("news_class",$pref['admin_news_columns'])) ? "".r_userclass_name($row['news_class'])." \n" : ""; $text .= (in_array("news_render_type",$pref['admin_news_columns'])) ? "".$ren_type[$row['news_render_type']]."\n" : ""; $text .= (in_array("news_thumbnail",$pref['admin_news_columns'])) ? "".$thumbnail."\n" : ""; @@ -647,7 +691,6 @@ class admin_newspost $text .= (in_array("news_allow_comments",$pref['admin_news_columns'])) ? "".$comments."\n" : ""; $text .= (in_array("news_comment_total",$pref['admin_news_columns'])) ? "".$row['news_comment_total']."\n" : ""; - $text .= " ".ADMIN_EDIT_ICON." @@ -679,14 +722,6 @@ class admin_newspost } - - $text .= " - -
- ".$frm->text('searchquery', '', 50).$frm->admin_button('searchsubmit', NWSLAN_63, 'search')." -
- - "; $emessage = &eMessage::getInstance(); $e107->ns->tablerender(NWSLAN_4, $emessage->render().$text); } @@ -1469,6 +1504,14 @@ class admin_newspost echo $frm->selectbox('newsposts_archive', $this->_optrange(intval($this->getSubAction()) - 1), intval($pref['newsposts_archive']), 'class=tbox&tabindex='.intval($this->getId())); } + + + function ajax_exec_searchValue() + { + require_once(e_HANDLER."form_handler.php"); + $frm = new e_form(true); + echo $frm->filterValue($_POST['filtertype'],$this->_fields); + } function show_news_prefs() diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index b162c27f8..d08118b10 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -9,8 +9,8 @@ * Form Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ - * $Revision: 1.25 $ - * $Date: 2009-07-03 02:27:03 $ + * $Revision: 1.26 $ + * $Date: 2009-07-03 06:48:43 $ * $Author: e107coders $ * */ @@ -616,7 +616,7 @@ class e_form if(in_array($key,$pref[$columnPref]) || $key == "options") { $cl = ($val['thclass']) ? "class='".$val['thclass']."'" : ""; - $text .= "\n\t"; + $text .= "\n\t"; $text .= ($val['url']) ? "" : ""; $text .= $val['title']; $text .= ($key == "options") ? $this->columnSelector($fieldarray,$pref[$columnPref]) : ""; @@ -629,6 +629,55 @@ class e_form return $text; } + + // The 2 functions below are for demonstration purposes only, and may be moved/modified before release. + function filterType($fieldarray) + { + define("e_AJAX_REQUEST",TRUE); + $text .= ""; + return $text; + } + + function filterValue($type,$fields) + { + if($type) + { + + switch ($fields[$type]['type']) { + case "datestamp": + return "[date field]"; + break; + + case "boolean": + + return ""; + break; + + case "user": + return ""; + break; + + + default : + + return $this->text('searchquery', '', 50); + + } + } + else + { + return $this->text('searchquery', '', 50); + } + // This needs to be dynamic for the various form types, and be loaded via ajax. + } } class form {