Get("News_View"); if(!is_numeric($NewsView)) { $NewsView = $News_AllValue; } $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) { $News_Filter = ""; $News_View=127; } else { // FILTERING CODE V. 1.2 $where_clauses = Array(); $q = ''; // Group #1: Article Statuses (active,pending,disabled) $Status = array(-1); if($NewsView & $Bit_Pending) $Status[] = STATUS_PENDING; if($NewsView & $Bit_Active) $Status[] = STATUS_ACTIVE; if($NewsView & $Bit_Disabled) $Status[] = STATUS_DISABLED; if( count($Status) ) $where_clauses[] = 'Status IN ('.implode(',', $Status).')'; // Group #2: Article Statistics (new,popular,hot,pick) $Status = array(); if(!($NewsView & $Bit_New)) { $cutoff = adodb_date("U") - ($objConfig->Get("News_NewDays") * 86400); if($cutoff > 0) $q = 'CreatedOn > '.$cutoff; $q .= ' AND CachedVotesQty >= '.$objConfig->Get('News_MinPopVotes'); $q .= (!empty($q) ? ' OR ' : '').'NewItem = 1'; $Status[] = "NOT ($q)"; } if(!($NewsView & $Bit_Pop)) { $cutoff = $objArticleList->GetPopValue(); if($cutoff > 0) $q = 'CachedRating >= '.$cutoff; $q .= (!empty($q) ? ' OR ' : '').'PopItem = 1'; $Status[] = "NOT ($q)"; } if(!($NewsView & $Bit_Hot)) { $cutoff = $objArticleList->GetHotValue(); if($cutoff > 0) $q = 'Hits >= '.$cutoff; $q .= (!empty($q) ? ' OR ' : '').'HotItem = 1'; $Status[] = "NOT ($q)"; } if(!($NewsView & $Bit_Archived)) $Status[] = 'NOT (Archived = 1)'; if(!($NewsView & $Bit_LeadCat)) $Status[] = 'NOT (LeadCatStory = 1)'; if(!($NewsView & $Bit_FontLead)) $Status[] = 'NOT (LeadStory = 1)'; if(!($NewsView & $Bit_Ed)) $Status[] = 'NOT (EditorsPick = 1)'; if( count($Status) ) $where_clauses[] = '('.implode(') AND (', $Status).')'; $NewsFilter = count($where_clauses) ? '('.implode(') AND (', $where_clauses).')' : ''; } $list = $objSession->GetVariable("n_adv_view_search"); $objArticleList->Clear(); $objArticleList->EnablePaging = TRUE; $OrderBy = $objArticleList->QueryOrderByClause(TRUE,TRUE,TRUE); if(strlen($list)==0) { $where = $NewsFilter; $SearchQuery = ''; $objArticleList->LoadArticles($where,$OrderBy,false,false,'set_last'); } else { $SearchQuery = $objArticleList->AdminSearchWhereClause($list); if(strlen($SearchQuery)) { $SearchQuery = " (".$SearchQuery.")".($NewsFilter ? 'AND ('.$NewsFilter.')' : ''); $objArticleList->LoadArticles($SearchQuery,$OrderBy, false,false,'set_last'); } else $objArticleList->LoadArticles($NewsFilter,$OrderBy, false,false,'set_last'); } $objArticleList->QueryItemCount = TableCount($objArticleList->SourceTable,($SearchQuery ? $SearchQuery : $NewsFilter),0); $CatTotal = TableCount($objArticleList->SourceTable,null,0); $caption = language("la_ItemTab_News"); $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"; $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,2);",BitStatus(NewsView,2)); \$Menus['n_filtring_menu'].addMenuItem(lang_Hot,"FlipBit('News_View',NewsView,1);",BitStatus(NewsView,1)); \$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','Hits');",RadioIsSelected(News_SortField,'Hits')); // 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; ?>