Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Fri, Jun 27, 6:28 AM

in-portal

Index: branches/unlabeled/unlabeled-1.12.2/kernel/units/general/cat_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/kernel/units/general/cat_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/kernel/units/general/cat_tag_processor.php (revision 6099)
@@ -0,0 +1,226 @@
+<?php
+
+ class kCatDBTagProcessor extends kDBTagProcessor {
+
+ /**
+ * Permission Helper
+ *
+ * @var kPermissionsHelper
+ */
+ var $PermHelper = null;
+
+ function kCatDBTagProcessor()
+ {
+ parent::kDBTagProcessor();
+ $this->PermHelper = $this->Application->recallObject('PermissionsHelper');
+ }
+
+ function ItemIcon($params)
+ {
+ $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
+
+ $grids = $this->Application->getUnitOption($this->Prefix,'Grids');
+ $icons =& $grids[ $params['grid'] ]['Icons'];
+
+ $status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
+ if (!$status_fields) return $icons['default'];
+
+ $value = $object->GetDBField($status_fields[0]); // sets base status icon
+ if ($value == STATUS_ACTIVE) {
+ if( $object->GetDBField('IsPop') ) $value = 'POP';
+ if( $object->GetDBField('IsHot') ) $value = 'HOT';
+ if( $object->GetDBField('IsNew') ) $value = 'NEW';
+ if( $object->GetDBField('EditorsPick') ) $value = 'PICK';
+ }
+
+ return isset($icons[$value]) ? $icons[$value] : $icons['default'];
+ }
+
+ function ItemLink($params)
+ {
+ // 'p_id'=>'0', ??
+ $params = array_merge($params, array('pass'=>'m,'.$this->Prefix));
+ $item_id = getArrayValue($params,$this->Prefix.'_id');
+ if (!$item_id) {
+ $item_id = $this->Application->GetVar($this->Prefix.'_id');
+ }
+ $params[$this->Prefix.'_id'] = $item_id;
+
+ $item =& $this->Application->recallObject($this->getPrefixSpecial());
+ $params['m_cat_id'] = $item->GetDBField('CategoryId');
+
+ $main_processor =& $this->Application->recallObject('m_TagProcessor');
+ return $main_processor->T($params);
+ }
+
+ /**
+ * Returns path where exported category items should be saved
+ *
+ * @param Array $params
+ */
+ function ExportPath($params)
+ {
+ $ret = EXPORT_PATH.'/';
+
+ if( getArrayValue($params, 'as_url') )
+ {
+ $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret);
+ }
+
+ $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options'));
+ $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml');
+
+ return $ret;
+ }
+
+ function CategoryPath($params)
+ {
+ if (!isset($params['cat_id'])) {
+ $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
+ }
+
+ return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ }
+
+ function BuildListSpecial($params)
+ {
+ if ($this->Special != '') return $this->Special;
+ if ( isset($params['parent_cat_id']) ) {
+ $parent_cat_id = $params['parent_cat_id'];
+ }
+ else {
+ $parent_cat_id = $this->Application->GetVar('c_id');
+ if (!$parent_cat_id) {
+ $parent_cat_id = $this->Application->GetVar('m_cat_id');
+ }
+ }
+
+ $recursive = isset($params['recursive']);
+
+ $types = $this->SelectParam($params, 'types');
+ $except = $this->SelectParam($params, 'except');
+
+ if ($types.$except.$recursive == '') {
+ return parent::BuildListSpecial($params);
+ }
+
+ $special = crc32($parent_cat_id.$types.$except.$recursive);
+ return $special;
+ }
+
+ function ExportStatus($params)
+ {
+ $export_object =& $this->Application->recallObject('CatItemExportHelper');
+
+ $event = new kEvent($this->getPrefixSpecial().':OnDummy');
+
+ $action_method = 'perform'.ucfirst($this->Special);
+ $field_values = $export_object->$action_method($event);
+
+ // finish code is done from JS now
+ if ($field_values['start_from'] == $field_values['total_records'])
+ {
+ if ($this->Special == 'import') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1));
+ }
+ elseif ($this->Special == 'export') {
+ $template = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder').'/'.$this->Special.'_finish';
+ $this->Application->Redirect($template, Array('pass' => 'all'));
+ }
+ }
+
+ $export_options = $export_object->loadOptions($event);
+ return $export_options['start_from'] * 100 / $export_options['total_records'];
+ }
+
+ function CatalogItemCount($params)
+ {
+ $object =& $this->GetList($params);
+ if (!$object->Counted) {
+ $object->CountRecs();
+ }
+ return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
+ }
+
+ function ListReviews($params)
+ {
+ $prefix = $this->Prefix.'-rev';
+ $review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
+ return $review_tag_processor->PrintList($params);
+ }
+
+ function ReviewCount($params)
+ {
+ $review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
+ return $review_tag_processor->TotalRecords($params);
+ }
+
+ function InitCatalogTab($params)
+ {
+ $tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
+ $tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
+ $tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
+
+ // set default params (same as in catalog)
+ if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
+ if ($tab_params['special'] === false) $tab_params['special'] = '';
+ if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
+
+ // pass params to block with tab content
+ $params['name'] = $params['render_as'];
+ $params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['tab_mode'] = $tab_params['mode'];
+ $params['tab_dependant'] = $tab_params['dependant'];
+ $params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
+
+ return $this->Application->ParseBlock($params, 1);
+ }
+
+ /**
+ * Show CachedNavbar of current item primary category
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CategoryName($params)
+ {
+ // show category cachednavbar of
+ $object =& $this->getObject($params);
+ $category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
+
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ /**
+ * Allows to determine if original value should be shown
+ *
+ * @param Array $params
+ * @return bool
+ */
+ function DisplayOriginal($params)
+ {
+ // original id found & greather then zero + show original
+ $display_original = isset($params['display_original']) && $params['display_original'];
+
+ $object =& $this->getObject($params);
+ $perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $this->Prefix);
+
+ return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/kernel/units/general/cat_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/kernel/admin/include/toolbar/advanced_view.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/kernel/admin/include/toolbar/advanced_view.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/kernel/admin/include/toolbar/advanced_view.php (revision 6099)
@@ -0,0 +1,555 @@
+<?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"];
+
+$application =& kApplication::Instance();
+$force_tab = $application->RecallVar('force_tab');
+if ($force_tab) {
+ $DefaultTab = $force_tab;
+ $application->RemoveVar('force_tab');
+}
+
+
+// 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");
+
+// View, Sort, Select, Per Page
+$lang_View = language('la_Text_View');
+$lang_Sort = language('la_Text_Sort');
+$lang_PerPage = language('la_prompt_PerPage');
+$lang_Select = language('la_Text_Select');
+
+$ItemTabs->AddTab(language("la_ItemTab_Categories"),"category",$objCatList->QueryItemCount, $m_tab_Categories_hide, $CatTotal);
+
+print <<<END
+
+<script language="JavaScript">
+// global usage phrases
+var lang_View = '$lang_View';
+var lang_Sort = '$lang_Sort';
+var lang_PerPage = '$lang_PerPage';
+var lang_Select = '$lang_Select';
+
+// local usage phrases
+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();
+
+
+
+ // K4 code for handling toolbar operations: begin
+ var \$TabRegistry = Array();
+
+ function InpGrid(tab)
+ {
+ this.TabId = tab;
+ }
+
+ InpGrid.prototype.ClearSelection = function(force,called_from)
+ {
+ unselectAll(this.TabId, 1); //1 means don't upate toolbar
+ }
+
+ function registerTab(\$tab_id)
+ {
+ var \$tab = document.getElementById(\$tab_id);
+ var \$index = \$TabRegistry.length;
+
+ \$TabRegistry[\$index] = new Array();
+ \$TabRegistry[\$index]['tab_id'] = \$tab_id;
+ \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial');
+ \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL');
+ }
+
+ function queryTabRegistry(\$search_key, \$search_value, \$return_key)
+ {
+ var \$i = 0;
+ while(\$i < \$TabRegistry.length)
+ {
+ if(\$TabRegistry[\$i][\$search_key] == \$search_value)
+ {
+ return \$TabRegistry[\$i][\$return_key];
+ break;
+ }
+ \$i++;
+ }
+ return '<'+\$search_key+'='+\$search_value+'>';
+ }
+
+ function k4_actionHandler(action, prefix_special)
+ {
+ var k4_action = '';
+ switch (action)
+ {
+ case 'edit':
+ k4_action = 'edit_item("'+prefix_special+'")';
+ break;
+ case 'delete':
+ k4_action = 'delete_items("'+prefix_special+'")';
+ break;
+ case 'unselect':
+ k4_action = 'unselect("'+prefix_special+'")';
+ break;
+ case 'approve':
+ k4_action = 'approve_items("'+prefix_special+'")';
+ break;
+ case 'decline':
+ k4_action = 'decine_items("'+prefix_special+'")';
+ break;
+ }
+ if (k4_action != '')
+ {
+ \$form_name = queryTabRegistry('prefix_special', prefix_special, 'tab_id') + '_form';
+ eval(k4_action);
+ }
+ else alert(action+' not implemented');
+
+ }
+
+ function approve_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassApprove','')
+ }
+
+ function decine_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassDecline','')
+ }
+
+ function edit()
+ {
+ edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') );
+ }
+
+ function edit_item(prefix_special)
+ {
+ opener_action('d');
+ set_hidden_field(prefix_special+'_mode', 't');
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+
+ submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index.php');
+ }
+
+ function delete_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassDelete','')
+ }
+
+ function unselect(prefix_special)
+ {
+ Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect');
+ }
+ // K4 code for handling toolbar operations: end
+
+
+
+ // 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/advanced_view','delete');"); //delete
+ AddButtonAction('approve',"check_submit('$admin/advanced_view','approve');"); //approve
+ AddButtonAction('decline',"check_submit('$admin/advanced_view','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");
+
+ if ( action_prefix.match("k4:(.*)") )
+ {
+ act = RegExp.$1;
+ act = act.replace('$\$event$$', actionValue);
+ act = act.replace('$\$prefix$$', activeTab.getAttribute("PrefixSpecial") );
+ eval(act);
+ return;
+ }
+ }
+
+ 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);
+ }
+ }
+
+ \$fw_menus['c_view_menu'] = function()
+ {
+ // filtring menu
+ \$Menus['c_filtring_menu'] = new Menu(lang_View);
+ \$Menus['c_filtring_menu'].addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
+ \$Menus['c_filtring_menu'].addMenuSeparator();
+ \$Menus['c_filtring_menu'].addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
+ \$Menus['c_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
+
+ // sorting menu
+ \$Menus['c_sorting_menu'] = new Menu(lang_Sort);
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
+ \$Menus['c_sorting_menu'].addMenuSeparator();
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
+ \$Menus['c_sorting_menu'].addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
+
+ // perpage menu
+ \$Menus['c_perpage_menu'] = new Menu(lang_PerPage);
+ \$Menus['c_perpage_menu'].addMenuItem("10","config_val('Perpage_Category', '10');",RadioIsSelected(Category_Perpage,10));
+ \$Menus['c_perpage_menu'].addMenuItem("20","config_val('Perpage_Category', '20');",RadioIsSelected(Category_Perpage,20));
+ \$Menus['c_perpage_menu'].addMenuItem("50","config_val('Perpage_Category', '50');",RadioIsSelected(Category_Perpage,50));
+ \$Menus['c_perpage_menu'].addMenuItem("100","config_val('Perpage_Category', '100');",RadioIsSelected(Category_Perpage,100));
+ \$Menus['c_perpage_menu'].addMenuItem("500","config_val('Perpage_Category', '500');",RadioIsSelected(Category_Perpage,500));
+
+ // select menu
+ \$Menus['c_select_menu'] = new Menu(lang_Select);
+ \$Menus['c_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('"+activeTab.id+"');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
+ \$Menus['c_select_menu'].addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
+
+ // view menu
+ \$Menus['c_view_menu'] = new Menu(lang_Categories);
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_filtring_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_sorting_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_perpage_menu'] );
+ \$Menus['c_view_menu'].addMenuItem( \$Menus['c_select_menu'] );
+ }
+
+ function toggleMenu()
+ {
+ var prefix_special = activeTab.getAttribute('PrefixSpecial');
+ \$fw_menus[prefix_special+'_view_menu']();
+ window.cat_menu = \$Menus[prefix_special+'_view_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/advanced_view','delete');","");
+ contextMenu.addMenuSeparator();
+ contextMenu.addMenuItem("Approve","check_submit('admin/advanced_view','approve');","");
+ contextMenu.addMenuItem("Decline","check_submit('admin/advanced_view','decline');","");
+
+ window.triedToWriteMenus = false;
+ window.contextMenu.writeMenus();
+ return true;
+ }
+
+ // 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;
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/kernel/admin/include/toolbar/advanced_view.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/core/kernel/processors/tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/core/kernel/processors/tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/core/kernel/processors/tag_processor.php (revision 6099)
@@ -0,0 +1,174 @@
+<?php
+
+ class TagProcessor extends kBase {
+
+ /**
+ * Processes tag
+ *
+ * @param Tag $tag
+ * @return string
+ * @access public
+ */
+ function ProcessTag(&$tag)
+ {
+ return $this->ProcessParsedTag($tag->Tag, $tag->NP, $tag->getPrefixSpecial());
+
+ /*$Method=$tag->Tag;
+ if(method_exists($this, $Method))
+ {
+ //echo htmlspecialchars($tag->GetFullTag()).'<br>';
+ return $this->$Method($tag->NP);
+ }
+ else
+ {
+ if ($this->Application->hasObject('TagsAggregator')) {
+ $aggregator =& $this->Application->recallObject('TagsAggregator');
+ $tag_mapping = $aggregator->GetArrayValue($tag->Prefix, $Method);
+ if ($tag_mapping) {
+
+ $mapped_tag =& new Tag('', $this->Application->Parser);
+ $mapped_tag->CopyFrom($tag);
+ $mapped_tag->Processor = $tag_mapping[0];
+ $mapped_tag->Tag = $tag_mapping[1];
+ $mapped_tag->NP['PrefixSpecial'] = $tag->getPrefixSpecial();
+ $mapped_tag->RebuildTagData();
+ return $mapped_tag->DoProcessTag();
+ }
+ }
+ trigger_error('Tag '.$Method.' Undefined in '.get_class($this).'[Agregated Tag]:<br><b>'.$tag->RebuildTagData().'</b>',E_USER_WARNING);
+ return false;
+ }*/
+ }
+
+ function ProcessParsedTag($tag, $params, $prefix)
+ {
+ $Method = $tag;
+ if(method_exists($this, $Method))
+ {
+ if ($this->Application->isDebugMode() && constOn('DBG_SHOW_TAGS')) {
+ $this->Application->Debugger->appendHTML('Processing PreParsed Tag '.$Method.' in '.$this->Prefix);
+ }
+
+ // pass_params for non ParseBlock tags :)
+ if (isset($params['pass_params']) && $params['pass_params']) {
+ $params = array_merge_recursive2($this->Application->Parser->Params, $params);
+ unset($params['pass_params']);
+ }
+
+ $backup_prefix = $this->Prefix;
+ $backup_special = $this->Special;
+
+ $ret = $this->$Method($params);
+
+ $this->Prefix = $backup_prefix;
+ $this->Special = $backup_special;
+
+ if (isset($params['js_escape']) && $params['js_escape']) {
+ $ret = str_replace('\'', '&#39;', $ret);
+ $ret = addslashes($ret);
+ $ret = str_replace(Array("\r", "\n"), Array('\r', '\n'), $ret);
+ }
+ if (isset($params['result_to_var'])) {
+ $this->Application->Parser->SetParam($params['result_to_var'], $ret);
+ $ret = '';
+ }
+ return $ret;
+ }
+ else
+ {
+ if ($this->Application->hasObject('TagsAggregator')) {
+ $aggregator =& $this->Application->recallObject('TagsAggregator');
+ $tmp = $this->Application->processPrefix($prefix);
+ $tag_mapping = $aggregator->GetArrayValue($tmp['prefix'], $Method);
+ if ($tag_mapping) {
+ $tmp = $this->Application->processPrefix($tag_mapping[0]);
+ $__tag_processor = $tmp['prefix'].'_TagProcessor';
+ $processor =& $this->Application->recallObject($__tag_processor);
+ $processor->Prefix = $tmp['prefix'];
+ $processor->Special = getArrayValue($tag_mapping, 2) ? $tag_mapping[2] : $tmp['special'];
+ $params['PrefixSpecial'] = $prefix;
+ $ret = $processor->ProcessParsedTag($tag_mapping[1], $params, $prefix);
+ if (isset($params['result_to_var'])) {
+ $this->Application->Parser->SetParam($params['result_to_var'], $ret);
+ $ret = '';
+ }
+ return $ret;
+ }
+ trigger_error('Tag <b>'.$Method.'</b> Undefined in '.get_class($this).'[Agregated Tag]:<br><b>'.$tag.'</b>', E_USER_WARNING);
+ }
+ trigger_error('Tag Undefined:<br><b>'.$prefix.':'.$tag.'</b>',E_USER_WARNING);
+ return false;
+ }
+ }
+
+
+ /**
+ * Not tag, method for parameter
+ * selection from list in this TagProcessor
+ *
+ * @param Array $params
+ * @param string $possible_names
+ * @return string
+ * @access public
+ */
+ function SelectParam($params, $possible_names)
+ {
+ if (!is_array($params)) return;
+ if (!is_array($possible_names))
+
+ $possible_names = explode(',', $possible_names);
+ foreach ($possible_names as $name)
+ {
+ if( isset($params[$name]) ) return $params[$name];
+ }
+ return false;
+ }
+ }
+
+/*class ProcessorsPool {
+ var $Processors = Array();
+ var $Application;
+ var $Prefixes = Array();
+ var $S;
+
+ function ProcessorsPool()
+ {
+ $this->Application =& KernelApplication::Instance();
+ $this->S =& $this->Application->Session;
+ }
+
+ function RegisterPrefix($prefix, $path, $class)
+ {
+ // echo " RegisterPrefix $prefix, $path, $class <br>";
+ $prefix_item = Array(
+ 'path' => $path,
+ 'class' => $class
+ );
+ $this->Prefixes[$prefix] = $prefix_item;
+ }
+
+ function CreateProcessor($prefix, &$tag)
+ {
+ // echo " prefix : $prefix <br>";
+ if (!isset($this->Prefixes[$prefix]))
+ $this->Application->ApplicationDie ("<b>Filepath and ClassName for prefix $prefix not defined while processing ".htmlspecialchars($tag->GetFullTag())."!</b>");
+ include_once($this->Prefixes[$prefix]['path']);
+ $ClassName = $this->Prefixes[$prefix]['class'];
+ $a_processor =& new $ClassName($prefix);
+ $this->SetProcessor($prefix, $a_processor);
+ }
+
+ function SetProcessor($prefix, &$a_processor)
+ {
+ $this->Processors[$prefix] =& $a_processor;
+ }
+
+ function &GetProcessor($prefix, &$tag)
+ {
+ if (!isset($this->Processors[$prefix]))
+ $this->CreateProcessor($prefix, $tag);
+ return $this->Processors[$prefix];
+ }
+}*/
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/core/kernel/processors/tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/core/units/general/cat_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/core/units/general/cat_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/core/units/general/cat_tag_processor.php (revision 6099)
@@ -0,0 +1,226 @@
+<?php
+
+ class kCatDBTagProcessor extends kDBTagProcessor {
+
+ /**
+ * Permission Helper
+ *
+ * @var kPermissionsHelper
+ */
+ var $PermHelper = null;
+
+ function kCatDBTagProcessor()
+ {
+ parent::kDBTagProcessor();
+ $this->PermHelper = $this->Application->recallObject('PermissionsHelper');
+ }
+
+ function ItemIcon($params)
+ {
+ $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
+
+ $grids = $this->Application->getUnitOption($this->Prefix,'Grids');
+ $icons =& $grids[ $params['grid'] ]['Icons'];
+
+ $status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
+ if (!$status_fields) return $icons['default'];
+
+ $value = $object->GetDBField($status_fields[0]); // sets base status icon
+ if ($value == STATUS_ACTIVE) {
+ if( $object->GetDBField('IsPop') ) $value = 'POP';
+ if( $object->GetDBField('IsHot') ) $value = 'HOT';
+ if( $object->GetDBField('IsNew') ) $value = 'NEW';
+ if( $object->GetDBField('EditorsPick') ) $value = 'PICK';
+ }
+
+ return isset($icons[$value]) ? $icons[$value] : $icons['default'];
+ }
+
+ function ItemLink($params)
+ {
+ // 'p_id'=>'0', ??
+ $params = array_merge($params, array('pass'=>'m,'.$this->Prefix));
+ $item_id = getArrayValue($params,$this->Prefix.'_id');
+ if (!$item_id) {
+ $item_id = $this->Application->GetVar($this->Prefix.'_id');
+ }
+ $params[$this->Prefix.'_id'] = $item_id;
+
+ $item =& $this->Application->recallObject($this->getPrefixSpecial());
+ $params['m_cat_id'] = $item->GetDBField('CategoryId');
+
+ $main_processor =& $this->Application->recallObject('m_TagProcessor');
+ return $main_processor->T($params);
+ }
+
+ /**
+ * Returns path where exported category items should be saved
+ *
+ * @param Array $params
+ */
+ function ExportPath($params)
+ {
+ $ret = EXPORT_PATH.'/';
+
+ if( getArrayValue($params, 'as_url') )
+ {
+ $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret);
+ }
+
+ $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options'));
+ $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml');
+
+ return $ret;
+ }
+
+ function CategoryPath($params)
+ {
+ if (!isset($params['cat_id'])) {
+ $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
+ }
+
+ return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ }
+
+ function BuildListSpecial($params)
+ {
+ if ($this->Special != '') return $this->Special;
+ if ( isset($params['parent_cat_id']) ) {
+ $parent_cat_id = $params['parent_cat_id'];
+ }
+ else {
+ $parent_cat_id = $this->Application->GetVar('c_id');
+ if (!$parent_cat_id) {
+ $parent_cat_id = $this->Application->GetVar('m_cat_id');
+ }
+ }
+
+ $recursive = isset($params['recursive']);
+
+ $types = $this->SelectParam($params, 'types');
+ $except = $this->SelectParam($params, 'except');
+
+ if ($types.$except.$recursive == '') {
+ return parent::BuildListSpecial($params);
+ }
+
+ $special = crc32($parent_cat_id.$types.$except.$recursive);
+ return $special;
+ }
+
+ function ExportStatus($params)
+ {
+ $export_object =& $this->Application->recallObject('CatItemExportHelper');
+
+ $event = new kEvent($this->getPrefixSpecial().':OnDummy');
+
+ $action_method = 'perform'.ucfirst($this->Special);
+ $field_values = $export_object->$action_method($event);
+
+ // finish code is done from JS now
+ if ($field_values['start_from'] == $field_values['total_records'])
+ {
+ if ($this->Special == 'import') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1));
+ }
+ elseif ($this->Special == 'export') {
+ $template = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder').'/'.$this->Special.'_finish';
+ $this->Application->Redirect($template, Array('pass' => 'all'));
+ }
+ }
+
+ $export_options = $export_object->loadOptions($event);
+ return $export_options['start_from'] * 100 / $export_options['total_records'];
+ }
+
+ function CatalogItemCount($params)
+ {
+ $object =& $this->GetList($params);
+ if (!$object->Counted) {
+ $object->CountRecs();
+ }
+ return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
+ }
+
+ function ListReviews($params)
+ {
+ $prefix = $this->Prefix.'-rev';
+ $review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
+ return $review_tag_processor->PrintList($params);
+ }
+
+ function ReviewCount($params)
+ {
+ $review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
+ return $review_tag_processor->TotalRecords($params);
+ }
+
+ function InitCatalogTab($params)
+ {
+ $tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
+ $tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
+ $tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
+
+ // set default params (same as in catalog)
+ if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
+ if ($tab_params['special'] === false) $tab_params['special'] = '';
+ if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
+
+ // pass params to block with tab content
+ $params['name'] = $params['render_as'];
+ $params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['tab_mode'] = $tab_params['mode'];
+ $params['tab_dependant'] = $tab_params['dependant'];
+ $params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
+
+ return $this->Application->ParseBlock($params, 1);
+ }
+
+ /**
+ * Show CachedNavbar of current item primary category
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CategoryName($params)
+ {
+ // show category cachednavbar of
+ $object =& $this->getObject($params);
+ $category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
+
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ /**
+ * Allows to determine if original value should be shown
+ *
+ * @param Array $params
+ * @return bool
+ */
+ function DisplayOriginal($params)
+ {
+ // original id found & greather then zero + show original
+ $display_original = isset($params['display_original']) && $params['display_original'];
+
+ $object =& $this->getObject($params);
+ $perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $this->Prefix);
+
+ return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/core/units/general/cat_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline