Get("News_View"); if(!is_numeric($NewsView)) { $NewsView = $News_AllValue; } // set default sorting parameters $News_SortField = $objConfig->Get('News_SortField'); if( !strlen($News_SortField) ) $News_SortField = 'Priority'; $News_SortOrder = $objConfig->Get('News_SortOrder'); if( !strlen($News_SortOrder) ) $News_SortOrder = 'desc'; $Perpage_News = (int)$objConfig->Get("Perpage_News"); if(!$Perpage_News) $Perpage_News=20; if($NewsView == $News_AllValue) { $News_ShowAll = 1; } else $News_ShowAll = 0; if($News_ShowAll) { $NewsFilter = ""; $News_View = 1023; } else { $Status = array(); $Mod = array(); if($NewsView & $Bit_Pending) $Status[] = STATUS_PENDING; if($NewsView & $Bit_Active) $Status[] = STATUS_ACTIVE; if($NewsView & $Bit_Disabled) $Status[] = STATUS_DISABLED; if(count($Status)) { $NewsFilter .= " AND (Status IN (".implode(",",$Status).") "; } else $NewsFilter .= " AND ((Status=-1) "; if($NewsView & $Bit_Ed) { $NewsFilter .= " OR (EditorsPick=1) "; } if($NewsView & $Bit_New) { $cutoff = adodb_date("U") - ($objConfig->Get("News_NewDays") * 86400); $NewsFilter .= " OR (CreatedOn > ".$cutoff.") OR (NewItem=1) "; } if($NewsView & $Bit_Pop) { $cutoff = $objArticleList->GetPopValue(); if($cutoff>0) $NewsFilter .= " OR (CachedRating >= ".$cutoff.") "; $NewsFilter .= "OR (PopItem=1) "; } if($NewsView & $Bit_Hot) { $cutoff = $objArticleList->GetHotValue(); if($cutoff>0) $NewsFilter .= " OR (Hits >= ".$cutoff.") "; $NewsFilter .= "OR (HotItem=1) "; } if($NewsView & $Bit_Archived) $NewsFilter .= " OR (Archived=1) "; if($NewsView & $Bit_LeadCat) $NewsFilter .= " OR (LeadCatStory=1)"; if($NewsView & $Bit_FrontLead) $NewsFilter .= " OR (LeadStory=1)"; $NewsFilter .= ")"; } $list = $objSession->GetVariable("SearchWord"); $NewsSearch = (strlen($list)>0 && $SearchType =="News" || $SearchType=="all");// || (strlen($list)==0); $objArticleList->Clear(); $NewsSearch = $NewsSearch && ($objSession->HasCatPermission("NEWS.VIEW")); $objArticleList->EnablePaging = TRUE; if($NewsSearch) { $OrderBy = $objArticleList->QueryOrderByClause(TRUE,TRUE,TRUE); if(strlen($list)==0) { $where = "CategoryId=".$objCatList->CurrentCategoryID().$NewsFilter; $objArticleList->LoadArticles($where,$OrderBy); } else { $SearchQuery = $objArticleList->AdminSearchWhereClause($list); if(strlen($SearchQuery)) { $SearchQuery = " (".$SearchQuery.")"; if(strlen($CatScopeClause)) $SearchQuery .= " AND ".$CatScopeClause; $objArticleList->LoadArticles($SearchQuery.$NewsFilter,$OrderBy); } else $objArticleList->LoadArticles("CategoryId=".$objCatList->CurrentCategoryID().$NewsFilter,$OrderBy); } //if(strlen($NewsFilter)>0) //{ $CatTotal = TableCount($objArticleList->SourceTable," CategoryId=".$objCatList->CurrentCategoryID(),TRUE); //} //else //$CatTotal = $objArticleList->QueryItemCount; // $where = $objArticleList->AdminSearchWhereClause($list); // $objArticleList->QueryItemCount = TableCount($objArticleList->SourceTable, $SearchQuery,TRUE); $ItemTabs->AddTab(language("la_ItemTab_News"),"news",$objArticleList->QueryItemCount, $m_tab_News_hide,$CatTotal); $TotalItemCount += $objArticleList->QueryItemCount; $News_Paste = "false"; if($objArticleList->ItemsOnClipboard()>0) $News_Paste = "true"; } else $News_Paste = "false"; $caption = language("la_ItemTab_News"); $lang_Leading = language("la_Text_Leading"); $lang_Archived = language("la_Text_Archived"); $lang_Title = language("la_Prompt_Title"); $lang_Excerpt = language("la_prompt_ArticleExcerpt"); $lang_Author = language("la_prompt_Author"); $lang_Body = language("la_prompt_ArticleBody"); $lang_StartDate = language("la_prompt_StartDate"); $lang_ArchiveDate = language("la_prompt_ArchiveDate"); $lang_Catlead = language("la_prompt_LeadCat"); $lang_FrontLead = language("la_prompt_FrontLead"); $lang_Articles = language("la_Text_Articles"); print << var News_SortField = '$News_SortField'; var News_SortOrder = '$News_SortOrder'; var News_Perpage = $Perpage_News; var NewsView = $NewsView; var NewsTitle = '$caption'; //News Related language vars var lang_Leading = '$lang_Leading'; var lang_Archived = '$lang_Archived'; var lang_Title = '$lang_Title'; var lang_Author = '$lang_Author'; var lang_Body = '$lang_Body'; var lang_Excerpt = '$lang_Excerpt'; var lang_StartDate = '$lang_StartDate'; var lang_ArchiveDate = '$lang_ArchiveDate'; var lang_CatLead = "$lang_Catlead"; var lang_FrontLead = "$lang_FrontLead"; var lang_Articles = "$lang_Articles"; var News_Paste = $News_Paste; PasteButton = PasteButton || News_Paste; \$fw_menus['n_view_menu'] = function() { // filtring menu \$Menus['n_filtring_menu'] = new Menu(lang_View); \$Menus['n_filtring_menu'].addMenuItem(lang_All,"config_val('News_View', $News_AllValue);",NewsView==$News_AllValue); \$Menus['n_filtring_menu'].addMenuItem(lang_None,"config_val('News_View', 0);",NewsView==0); \$Menus['n_filtring_menu'].addMenuSeparator(); \$Menus['n_filtring_menu'].addMenuItem(lang_Active,"FlipBit('News_View',NewsView,6);",BitStatus(NewsView,6)); \$Menus['n_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('News_View',NewsView,5);", BitStatus(NewsView,5)); \$Menus['n_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('News_View',NewsView,4);",BitStatus(NewsView,4)); \$Menus['n_filtring_menu'].addMenuSeparator(); \$Menus['n_filtring_menu'].addMenuItem(lang_New,"FlipBit('News_View',NewsView,3);",BitStatus(NewsView,3)); \$Menus['n_filtring_menu'].addMenuItem(lang_Pop,"FlipBit('News_View',NewsView,1);",BitStatus(NewsView,1)); \$Menus['n_filtring_menu'].addMenuItem(lang_Hot,"FlipBit('News_View',NewsView,2);",BitStatus(NewsView,2)); \$Menus['n_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('News_View',NewsView,0);",BitStatus(NewsView,0)); \$Menus['n_filtring_menu'].addMenuItem(lang_CatLead,"FlipBit('News_View',NewsView,8);",BitStatus(NewsView,8)); \$Menus['n_filtring_menu'].addMenuItem(lang_FrontLead,"FlipBit('News_View',NewsView,9);",BitStatus(NewsView,9)); \$Menus['n_filtring_menu'].addMenuItem(lang_Archived,"FlipBit('News_View',NewsView,7);",BitStatus(NewsView,7)); // sorting menu \$Menus['n_sorting_menu'] = new Menu(lang_Sort); \$Menus['n_sorting_menu'].addMenuItem(lang_Asc,"config_val('News_SortOrder','asc');",RadioIsSelected(News_SortOrder,'asc')); \$Menus['n_sorting_menu'].addMenuItem(lang_Desc,"config_val('News_SortOrder','desc');",RadioIsSelected(News_SortOrder,'desc')); \$Menus['n_sorting_menu'].addMenuSeparator(); \$Menus['n_sorting_menu'].addMenuItem(lang_Default,"config_val('News_SortField','Title');",""); \$Menus['n_sorting_menu'].addMenuItem(lang_Title,"config_val('News_SortField','Title');",RadioIsSelected(News_SortField,'Title')); \$Menus['n_sorting_menu'].addMenuItem(lang_Author,"config_val('News_SortField','Author');",RadioIsSelected(News_SortField,'Author')); \$Menus['n_sorting_menu'].addMenuItem(lang_Body,"config_val('News_SortField','Body');",RadioIsSelected(News_SortField,'Body')); \$Menus['n_sorting_menu'].addMenuItem(lang_Excerpt,"config_val('News_SortField','Excerpt');",RadioIsSelected(News_SortField,'Excerpt')); \$Menus['n_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('News_SortField','CreatedOn');",RadioIsSelected(News_SortField,'CreatedOn')); \$Menus['n_sorting_menu'].addMenuItem(lang_StartDate,"config_val('News_SortField','StartDate');",RadioIsSelected(News_SortField,'StartDate')); \$Menus['n_sorting_menu'].addMenuItem(lang_ArchiveDate,"config_val('News_SortField','EndOn');",RadioIsSelected(News_SortField,'EndOn')); \$Menus['n_sorting_menu'].addMenuItem(lang_Rating,"config_val('News_SortField','CachedRating');",RadioIsSelected(News_SortField,'CachedRating')); \$Menus['n_sorting_menu'].addMenuItem(lang_Votes,"config_val('News_SortField','CachedVotesQty');",RadioIsSelected(News_SortField,'CachedVotesQty')); \$Menus['n_sorting_menu'].addMenuItem(lang_Views,"config_val('News_SortField','CachedHits');",RadioIsSelected(News_SortField,'CachedHits')); // perpage menu \$Menus['n_perpage_menu'] = new Menu(lang_PerPage); \$Menus['n_perpage_menu'].addMenuItem("10","config_val('Perpage_News', '10');",RadioIsSelected(News_Perpage,10)); \$Menus['n_perpage_menu'].addMenuItem("20","config_val('Perpage_News', '20');",RadioIsSelected(News_Perpage,20)); \$Menus['n_perpage_menu'].addMenuItem("50","config_val('Perpage_News', '50');",RadioIsSelected(News_Perpage,50)); \$Menus['n_perpage_menu'].addMenuItem("100","config_val('Perpage_News', '100');",RadioIsSelected(News_Perpage,100)); \$Menus['n_perpage_menu'].addMenuItem("500","config_val('Perpage_News', '500');",RadioIsSelected(News_Perpage,500)); // select menu \$Menus['n_select_menu'] = new Menu(lang_Select); \$Menus['n_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');",""); \$Menus['n_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');",""); \$Menus['n_select_menu'].addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');",""); // view menu \$Menus['n_view_menu'] = new Menu(NewsTitle); \$Menus['n_view_menu'].addMenuItem( \$Menus['n_filtring_menu'] ); \$Menus['n_view_menu'].addMenuItem( \$Menus['n_sorting_menu'] ); \$Menus['n_view_menu'].addMenuItem( \$Menus['n_perpage_menu'] ); \$Menus['n_view_menu'].addMenuItem( \$Menus['n_select_menu'] ); } END; ?>