Get("Topic_View"); if(!is_numeric($TopicView)) { $TopicView = $Topics_AllValue; } // default sorting params $Topic_SortField = $objConfig->Get('Topic_SortField'); if( !strlen($Topic_SortField) ) $Topic_SortField = 'Priority'; $Topic_SortOrder = $objConfig->Get('Topic_SortOrder'); if( !strlen($Topic_SortOrder) ) $Topic_SortOrder = 'desc'; $Perpage_Topics = (int)$objConfig->Get("Perpage_Topics"); if(!$Perpage_Topics) $Perpage_Topics="'all'"; if($TopicView == $Topics_AllValue) { $Topic_ShowAll = 1; } else $Topic_ShowAll = 0; if($Topic_ShowAll) { $TopicFilter = ""; $Topic_View=$Topics_AllValue; } else { $Status = array(); $Mod = array(); if($TopicView & $Bit_Pending) $Status[] = STATUS_PENDING; if($TopicView & $Bit_Active) $Status[] = STATUS_ACTIVE; if($TopicView & $Bit_Disabled) $Status[] = STATUS_DISABLED; if(count($Status)) { $TopicFilter .= " AND (Status IN (".implode(",",$Status).") "; } else $TopicFilter .= " AND ((Status=-1) "; if($TopicView & $Bit_Ed) { $TopicFilter .= " OR (EditorsPick=1) "; } if($TopicView & $Bit_New) { $cutoff = adodb_date("U") - ($objConfig->Get("Topic_NewDays") * 86400); $TopicFilter .= " OR (CreatedOn > ".$cutoff.") "; } if($TopicView & $Bit_Pop) { $cutoff = $objTopicList->GetPopValue(); if($cutoff>0) $TopicFilter .= " OR (CachedRating >= ".$cutoff.") "; } if($TopicView & $Bit_Hot) { $cutoff = $objTopicList->GetHotValue(); if($cutoff>0) $TopicFilter .= " OR (Posts >= ".$cutoff.") "; } $TopicFilter .= ")"; } $list = $objSession->GetVariable("SearchWord"); $TopicSearch = (strlen($list)>0 && $SearchType =="Topics" || $SearchType="all") || (strlen($list)==0); $TopicSearch = $TopicSearch && ($objSession->HasCatPermission("TOPIC.VIEW")); $objTopicList->Clear(); $objTopicList->EnablePaging = TRUE; if($TopicSearch) { $OrderBy = $objTopicList->QueryOrderByClause(TRUE,TRUE,TRUE); if(strlen($list)==0) { $objTopicList->LoadTopics("CategoryId=".$objCatList->CurrentCategoryID().$TopicFilter,$OrderBy); } else { $SearchQuery = $objTopicList->AdminSearchWhereClause($list); if(strlen($SearchQuery)) { $SearchQuery = " (".$SearchQuery.")"; if(strlen($CatScopeClause)) $SearchQuery .= " AND ". $CatScopeClause; $objTopicList->LoadTopics($SearchQuery.$TopicFilter,$OrderBy); } else $objTopicList->LoadTopics("CategoryId=".$objCatList->CurrentCategoryID().$TopicFilter,$OrderBy); } $CatTotal = TableCount($objTopicList->SourceTable," CategoryId=".$objCatList->CurrentCategoryID(),TRUE); $ItemTabs->AddTab(admin_language("la_ItemTab_Topics"),"topics",$objTopicList->QueryItemCount, $m_tab_Forum_hide,$CatTotal); $TotalItemCount += $objTopicList->QueryItemCount; $Topics_Paste = "false"; if($objTopicList->ItemsOnClipboard()>0) $Topics_Paste = "true"; } else $Topics_Paste = "false"; $caption = admin_language("la_ItemTab_Topics"); $lang_Replies = admin_language("la_Text_Replies"); $lang_PostedBy = admin_language("la_prompt_PostedBy"); $lang_Topics = admin_language("la_Text_Topics"); print << var Topic_SortField = '$Topic_SortField'; var Topic_SortOrder = '$Topic_SortOrder'; var Topics_Perpage = $Perpage_Topics; var TopicView = $TopicView; var TopicText = '$caption'; var lang_Replies = "$lang_Replies"; var lang_PostedBy = "$lang_PostedBy"; var lang_Topics = "$lang_Topics"; var Topics_Paste = $Topics_Paste; PasteButton = PasteButton || Topics_Paste; \$fw_menus['t_view_menu'] = function() { // filtring menu \$Menus['t_filtring_menu'] = new Menu(lang_View); \$Menus['t_filtring_menu'].addMenuItem(lang_All,"config_val('Topic_View', $Topics_AllValue);",TopicView==$Topics_AllValue); \$Menus['t_filtring_menu'].addMenuItem(lang_None,"config_val('Topic_View', 0);",TopicView==0); \$Menus['t_filtring_menu'].addMenuSeparator(); \$Menus['t_filtring_menu'].addMenuItem(lang_Active,"FlipBit('Topic_View',TopicView,6);",BitStatus(TopicView,6)); \$Menus['t_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('Topic_View',TopicView,5);", BitStatus(TopicView,5)); \$Menus['t_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('Topic_View',TopicView,4);",BitStatus(TopicView,4)); \$Menus['t_filtring_menu'].addMenuSeparator(); \$Menus['t_filtring_menu'].addMenuItem(lang_New,"FlipBit('Topic_View',TopicView,3);",BitStatus(TopicView,3)); \$Menus['t_filtring_menu'].addMenuItem(lang_Hot,"FlipBit('Topic_View',TopicView,2);",BitStatus(TopicView,2)); \$Menus['t_filtring_menu'].addMenuItem(lang_Pop,"FlipBit('Topic_View',TopicView,1);",BitStatus(TopicView,1)); \$Menus['t_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('Topic_View',TopicView,0);",BitStatus(TopicView,0)); // sorting menu \$Menus['t_sorting_menu'] = new Menu(lang_Sort); \$Menus['t_sorting_menu'].addMenuItem(lang_Asc,"config_val('Topic_SortOrder','asc');",RadioIsSelected(Topic_SortOrder,'asc')); \$Menus['t_sorting_menu'].addMenuItem(lang_Desc,"config_val('Topic_SortOrder','desc');",RadioIsSelected(Topic_SortOrder,'desc')); \$Menus['t_sorting_menu'].addMenuSeparator(); \$Menus['t_sorting_menu'].addMenuItem(lang_Default,"config_val('Topic_SortField','Name');",""); \$Menus['t_sorting_menu'].addMenuItem(lang_Name,"config_val('Topic_SortField','TopicText');",RadioIsSelected(Topic_SortField,'TopicText')); \$Menus['t_sorting_menu'].addMenuItem(lang_PostedBy,"config_val('Topic_SortField','PostedBy');",RadioIsSelected(Topic_SortField,'PostedBy')); \$Menus['t_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('Topic_SortField','CreatedOn');",RadioIsSelected(Topic_SortField,'CreatedOn')); \$Menus['t_sorting_menu'].addMenuItem(lang_Replies,"config_val('Topic_SortField','Posts');",RadioIsSelected(Topic_SortField,'Posts')); \$Menus['t_sorting_menu'].addMenuItem(lang_Hits,"config_val('Topic_SortField','Views');",RadioIsSelected(Topic_SortField,'Views')); // perpage menu \$Menus['t_perpage_menu'] = new Menu(lang_PerPage); \$Menus['t_perpage_menu'].addMenuItem("10","config_val('Perpage_Topics', '10');",RadioIsSelected(Topics_Perpage,10)); \$Menus['t_perpage_menu'].addMenuItem("20","config_val('Perpage_Topics', '20');",RadioIsSelected(Topics_Perpage,20)); \$Menus['t_perpage_menu'].addMenuItem("50","config_val('Perpage_Topics', '50');",RadioIsSelected(Topics_Perpage,50)); \$Menus['t_perpage_menu'].addMenuItem("100","config_val('Perpage_Topics', '100');",RadioIsSelected(Topics_Perpage,100)); \$Menus['t_perpage_menu'].addMenuItem("500","config_val('Perpage_Topics', '500');",RadioIsSelected(Topics_Perpage,500)); // select menu \$Menus['t_select_menu'] = new Menu(lang_Select); \$Menus['t_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');",""); \$Menus['t_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');",""); \$Menus['t_select_menu'].addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');",""); // view menu \$Menus['t_view_menu'] = new Menu(lang_Topics); \$Menus['t_view_menu'].addMenuItem( \$Menus['t_filtring_menu'] ); \$Menus['t_view_menu'].addMenuItem( \$Menus['t_sorting_menu'] ); \$Menus['t_view_menu'].addMenuItem( \$Menus['t_perpage_menu'] ); \$Menus['t_view_menu'].addMenuItem( \$Menus['t_select_menu'] ); } END; ?>