Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1244492
reviews.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 21, 2:08 AM
Size
15 KB
Mime Type
text/x-php
Expires
Sun, Nov 23, 2:08 AM (1 d, 10 h)
Engine
blob
Format
Raw Data
Handle
809566
Attached To
rINP In-Portal
reviews.php
View Options
<?php
global
$objConfig
,
$objSections
,
$section
,
$rootURL
,
$adminURL
,
$admin
,
$imagesURL
,
$envar
,
$m_var_list_update
,
$objCatList
,
$homeURL
,
$upURL
,
$objSession
,
$DefaultTab
;
global
$CategoryFilter
,
$TotalItemCount
;
global
$Bit_All
,
$Bit_Pending
,
$Bit_Disabled
,
$Bit_New
,
$Bit_Pop
,
$Bit_Hot
,
$Bit_Ed
;
//global $hideSelectAll;
$m_tab_Categories_hide
=
isset
(
$DefaultTab
)
&&
(
$DefaultTab
==
'category'
)
?
0
:
1
;
/* bit place holders for category view menu */
$Bit_Active
=
64
;
$Bit_Pending
=
32
;
$Bit_Disabled
=
16
;
$Bit_New
=
8
;
$Bit_Pop
=
4
;
$Bit_Hot
=
2
;
$Bit_Ed
=
1
;
if
(
isset
(
$_GET
[
'SetTab'
])
)
$DefaultTab
=
$_GET
[
"SetTab"
];
// category list filtering stuff: begin
$CategoryView
=
$objConfig
->
Get
(
"Category_View"
);
if
(!
is_numeric
(
$CategoryView
))
{
$CategoryView
=
127
;
}
$Category_Sortfield
=
$objConfig
->
Get
(
"Category_Sortfield"
);
if
(
!
strlen
(
$Category_Sortfield
)
)
$Category_Sortfield
=
"Name"
;
$Category_Sortorder
=
$objConfig
->
Get
(
"Category_Sortorder"
);
if
(
!
strlen
(
$Category_Sortorder
)
)
$Category_Sortorder
=
"desc"
;
$Perpage_Category
=
(
int
)
$objConfig
->
Get
(
"Perpage_Category"
);
if
(!
$Perpage_Category
)
$Perpage_Category
=
"'all'"
;
if
(
$CategoryView
==
127
)
{
$Category_ShowAll
=
1
;
}
else
{
$Category_ShowAll
=
0
;
// FILTERING CODE V. 1.2
$where_clauses
=
Array
();
$q
=
''
;
//Group #1: Category Statuses (active,pending,disabled)
$Status
=
array
(-
1
);
if
(
$CategoryView
&
$Bit_Pending
)
$Status
[]
=
STATUS_PENDING
;
if
(
$CategoryView
&
$Bit_Active
)
$Status
[]
=
STATUS_ACTIVE
;
if
(
$CategoryView
&
$Bit_Disabled
)
$Status
[]
=
STATUS_DISABLED
;
if
(
count
(
$Status
)
)
$where_clauses
[]
=
'Status IN ('
.
implode
(
','
,
$Status
).
')'
;
//Group #2: Category Statistics (new,pick)
$Status
=
array
();
if
(!(
$CategoryView
&
$Bit_New
))
{
$cutoff
=
adodb_date
(
"U"
)
-
(
$objConfig
->
Get
(
"Category_DaysNew"
)
*
86400
);
if
(
$cutoff
>
0
)
$q
=
'CreatedOn > '
.
$cutoff
;
$q
.=
(!
empty
(
$q
)
?
' OR '
:
''
).
'NewItem = 1'
;
$Status
[]
=
"NOT ($q)"
;
}
if
(!(
$CategoryView
&
$Bit_Ed
))
$Status
[]
=
'NOT (EditorsPick = 1)'
;
if
(
count
(
$Status
)
)
$where_clauses
[]
=
'('
.
implode
(
') AND ('
,
$Status
).
')'
;
$CategoryFilter
=
count
(
$where_clauses
)
?
'('
.
implode
(
') AND ('
,
$where_clauses
).
')'
:
''
;
}
// category list filtering stuff: end
$OrderBy
=
$objCatList
->
QueryOrderByClause
(
TRUE
,
TRUE
,
TRUE
);
$objCatList
->
Clear
();
$IsSearch
=
FALSE
;
$list
=
$objSession
->
GetVariable
(
"m_adv_view_search"
);
$SearchQuery
=
$objCatList
->
AdminSearchWhereClause
(
$list
);
if
(
strlen
(
$SearchQuery
))
{
$SearchQuery
=
" ("
.
$SearchQuery
.
")"
.(
$CategoryFilter
?
'AND ('
.
$CategoryFilter
.
')'
:
''
);
$objCatList
->
LoadCategories
(
$SearchQuery
,
$OrderBy
,
false
,
'set_last'
);
$IsSearch
=
TRUE
;
}
else
$objCatList
->
LoadCategories
(
$CategoryFilter
,
$OrderBy
,
false
,
'set_last'
);
$TotalItemCount
+=
$objCatList
->
QueryItemCount
;
$CatTotal
=
TableCount
(
$objCatList
->
SourceTable
,
null
,
false
);
$mnuClearSearch
=
language
(
"la_SearchMenu_Clear"
);
$mnuNewSearch
=
language
(
"la_SearchMenu_New"
);
$mnuSearchCategory
=
language
(
"la_SearchMenu_Categories"
);
$lang_New
=
language
(
"la_Text_New"
);
$lang_Hot
=
language
(
"la_Text_Hot"
);
$lang_EdPick
=
language
(
"la_prompt_EditorsPick"
);
$lang_Pop
=
language
(
"la_Text_Pop"
);
$lang_Rating
=
language
(
"la_prompt_Rating"
);
$lang_Hits
=
language
(
"la_prompt_Hits"
);
$lang_Votes
=
language
(
"la_prompt_Votes"
);
$lang_Name
=
language
(
"la_prompt_Name"
);
$lang_Categories
=
language
(
"la_ItemTab_Categories"
);
$lang_Description
=
language
(
"la_prompt_Description"
);
$lang_MetaKeywords
=
language
(
"la_prompt_MetaKeywords"
);
$lang_SubSearch
=
language
(
"la_prompt_SubSearch"
);
$lang_Within
=
language
(
"la_Text_Within"
);
$lang_Current
=
language
(
"la_Text_Current"
);
$lang_Active
=
language
(
"la_Text_Active"
);
$lang_SubCats
=
language
(
"la_Text_SubCats"
);
$lang_SubItems
=
language
(
"la_Text_Subitems"
);
print
<<<END
<script language="JavaScript">
var default_tab = "$DefaultTab";
var Category_Sortfield = '$Category_Sortfield';
var Category_Sortorder = '$Category_Sortorder';
var Category_Perpage = $Perpage_Category;
var Category_ShowAll = $Category_ShowAll;
var CategoryView = $CategoryView;
//JS Language variables
var lang_New = "$lang_New";
var lang_Hot = "$lang_Hot";
var lang_EdPick = "$lang_EdPick";
var lang_Pop = "$lang_Pop";
var lang_Rating = "$lang_Rating";
var lang_Hits = "$lang_Hits";
var lang_Votes = "$lang_Votes";
var lang_Name = "$lang_Name";
var lang_Categories = "$lang_Categories";
var lang_Description = "$lang_Description";
var lang_MetaKeywords = "$lang_MetaKeywords";
var lang_SubSearch = "$lang_SubSearch";
var lang_Within="$lang_Within";
var lang_Current = "$lang_Current";
var lang_Active = "$lang_Active";
var lang_SubCats = "$lang_SubCats";
var lang_SubItems = "$lang_SubItems";
var hostname = '$rootURL';
var env = '$envar';
var actionlist = new Array();
// Common function for all "Advanced View" page
function InitPage()
{
addCommonActions();
initToolbar('mainToolBar', actionHandler);
initCheckBoxes(null, false);
toggleMenu();
}
function AddButtonAction(actionname,actionval)
{
var item = new Array(actionname,actionval);
actionlist[actionlist.length] = item;
}
function actionHandler(button)
{
for(i=0; i<actionlist.length;i++)
{
a = actionlist[i];
if(button.action == a[0])
{
eval(a[1]);
break;
}
}
}
function addCommonActions()
{
AddButtonAction('edit',"check_submit('','edit');"); //edit
AddButtonAction('delete',"check_submit('$admin/reviews','delete');"); //delete
AddButtonAction('approve',"check_submit('$admin/reviews','approve');"); //approve
AddButtonAction('decline',"check_submit('$admin/reviews','decline');"); //decline
AddButtonAction('print',"window.print();"); //print ?
AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
}
function check_submit(page,actionValue)
{
if (actionValue.match(/delete$/))
if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
var formname = '';
var action_prefix ='';
if (activeTab)
{
form_name = activeTab.id;
action_prefix = activeTab.getAttribute("ActionPrefix");
if(page.length == 0) page = activeTab.getAttribute("EditURL");
}
var f = document.getElementsByName(form_name+'_form')[0];
if(f)
{
f.Action.value = action_prefix + actionValue;
f.action = '$rootURL' + page + '.php?'+ env;
f.submit();
}
}
function flip_current(field_suffix)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
return flip(eval(field));
}
}
function config_current(field_suffix,value)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
config_val(field,value);
}
}
function toggleMenu()
{
if (activeTab)
{
// module filtring menu
filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu(cat_menu_filter);';
window.cat_menu_filter = new Menu(lang_View);
cat_menu_filter = eval(filterfunc);
// module select menu
selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu(cat_menu_select);";
window.cat_menu_select = new Menu(lang_Select);
cat_menu_select = eval(selectfunc);
// module per-page menu (in case if module selected)
pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
window.PerPageMenu = eval(pagefunc);
}
window.cat_menu = new Menu("root");
if (activeTab)
{
// add root ViewMenu elements
window.cat_menu.addMenuItem(cat_menu_filter); // "View" menu
window.cat_menu.addMenuItem(PerPageMenu); // Module "Per-Page" menu
window.cat_menu.addMenuItem(cat_menu_select); // "Select" menu
}
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId != tabId)
{
if (activeTab)
{
//alert('switching to tab');
toggleTab(tabId, true)
}
else
{
//alert('opening tab');
toggleTab(tabId, atm)
}
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
// process all module tabs
var active_str = '';
for (var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
// find tab
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
active_str = (tab.active) ? "tab_active" : "tab_inactive";
if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
// module tab is selected
TabActive = tabId;
SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
else
{
// module tab is not selected
SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
function SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
function initContextMenu()
{
window.contextMenu = new Menu("Context");
contextMenu.addMenuItem("Edit","check_submit('','edit');","");
contextMenu.addMenuItem("Delete","check_submit('admin/reviews','delete');","");
contextMenu.addMenuSeparator();
contextMenu.addMenuItem("Approve","check_submit('admin/reviews','approve');","");
contextMenu.addMenuItem("Decline","check_submit('admin/reviews','decline');","");
window.triedToWriteMenus = false;
window.contextMenu.writeMenus();
return true;
}
// only "Category" tab functions
function Categories_SortMenu(menu_sorting)
{
if(menu_sorting == null && typeof(menu_sorting) == 'undefined') menu_sorting = new Menu(lang_Categories);
menu_sorting.addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
menu_sorting.addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
menu_sorting.addMenuSeparator();
menu_sorting.addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
menu_sorting.addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
menu_sorting.addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
menu_sorting.addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
menu_sorting.addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
menu_sorting.addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
return menu_sorting;
}
function Categories_FilterMenu(menu_filter)
{
if(menu_filter == null && typeof(menu_filter) == 'undefined') menu_filter = new Menu(lang_Categories);
menu_filter.addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
menu_filter.addMenuSeparator();
menu_filter.addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
menu_filter.addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
menu_filter.addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
menu_filter.addMenuSeparator();
menu_filter.addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
menu_filter.addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
return menu_filter;
}
function Categories_SelectMenu(menu_select)
{
if(menu_select == null && typeof(menu_select) == 'undefined') menu_select = new Menu(lang_Categories);
menu_select.addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
menu_select.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
return menu_select;
}
function Categories_PerPageMenu()
{
caption = lang_Categories +" "+lang_PerPage;
menu_results = new Menu(caption);
menu_results.addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
menu_results.addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
menu_results.addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
menu_results.addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
menu_results.addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
return menu_results;
}
// Event Handling Stuff Cross-Browser
getEvent = window.Event
? function(e){return e}
: function() {return event}
getEventSrcElement = window.Event
? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode}
: function() {return event.srcElement}
function getKeyCode(e){return e.charCode||e.keyCode}
function getKey(eMoz)
{
var e = getEvent(eMoz)
var keyCode = getKeyCode(e)
if(keyCode == 13)
{
var el = document.getElementById(TabActive+'_imgSearch');
if(typeof(el) != 'undefined') el.onclick();
}
}
</script>
END;
?>
Event Timeline
Log In to Comment