Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Sep 18, 11:48 PM

in-portal

Index: trunk/kernel/admin_templates/incs/catalog.js
===================================================================
--- trunk/kernel/admin_templates/incs/catalog.js (revision 5005)
+++ trunk/kernel/admin_templates/incs/catalog.js (revision 5006)
@@ -1,147 +1,127 @@
var $is_catalog = true;
function Catalog($url_mask) {
this.BusyRequest = false;
this.URLMask = $url_mask;
this.Separator = '#separator#';
this.TabRegistry = new Array();
// get from cookie
this.ActivePrefix = '';
}
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
// ActivePrefix not set or has non-existing prefix value
this.ActivePrefix = this.TabRegistry[1]['prefix'];
}
}
Catalog.prototype.submit_kernel_form = function($form_name, $result_div) {
var $kf = document.getElementById($form_name);
set_hidden_field('ajax', 'yes');
Request.params = Request.serializeForm($kf);
Request.method = $kf.method.toUpperCase();
Request.makeRequest($kf.action, this.BusyRequest, $result_div, this.successCallback, this.errorCallback, $result_div);
};
Catalog.prototype.successCallback = function($request, $params) {
var $text = $request.responseText;
$params = $params.split(',');
var $js_end = $text.indexOf($Catalog.Separator);
if ($js_end != -1) {
document.getElementById($params[0]).innerHTML = $text.substring($js_end + $Catalog.Separator.length);
eval($text.substring(0, $js_end));
}
else {
document.getElementById($params[0]).innerHTML = $text;
}
if ($params[0] == 'categories_div') {
// category has been changed -> refresh current item tab
$Catalog.switchTab();
}
if (isset($Debugger)) $Debugger.Clear();
}
Catalog.prototype.errorCallback = function($request, $params) {
alert('AJAX ERROR: ' + Request.getErrorHtml($request));
}
Catalog.prototype.submit_event = function($prefix_special, $event, $t, $result_div, $source_form) {
// set form name first, because set_hidden_field uses it
if (isset($source_form)) $form_name = $source_form;
if (isset($event)) set_hidden_field('events['+$prefix_special+']', $event);
if (isset($t)) set_hidden_field('t', $t);
this.submit_kernel_form($form_name, $result_div);
}
Catalog.prototype.go_to_cat = function($cat_id) {
if (!isset($cat_id)) {
$cat_id = get_hidden_field('m_cat_id');
}
var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id);
Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div');
}
Catalog.prototype.switchTab = function($prefix) {
if (!isset($prefix)) $prefix = this.ActivePrefix;
if (this.ActivePrefix != $prefix) {
// hide source tab
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-unselected';
document.getElementById(this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id') + '_div').style.display = 'none';
}
// show destination tab
this.ActivePrefix = $prefix;
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected';
var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div'; // destination tab
document.getElementById($div_id).style.display = 'block';
// this.TabRegistry.length == 1
var $cat_id = get_hidden_field('m_cat_id');
var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
if ($cat_id != $tab_cat_id) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab');
$url = $url.replace('#CATEGORY_ID#', $cat_id);
Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
}
}
// adds information about tab to tab_registry
Catalog.prototype.registerTab = function($tab_id) {
var $tab = document.getElementById($tab_id + '_div');
var $index = this.TabRegistry.length;
this.TabRegistry[$index] = new Array();
this.TabRegistry[$index]['tab_id'] = $tab_id;
this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
this.TabRegistry[$index]['module_path'] = $tab.getAttribute('edit_template').substring(0, $tab.getAttribute('edit_template').indexOf('/'));
this.TabRegistry[$index]['edit_template'] = $tab.getAttribute('edit_template');
this.TabRegistry[$index]['index'] = $index;
}
// allows to get any information about tab
Catalog.prototype.queryTabRegistry = function($search_key, $search_value, $return_key) {
var $i = 0;
while ($i < this.TabRegistry.length) {
if (this.TabRegistry[$i][$search_key] == $search_value) {
return this.TabRegistry[$i][$return_key];
break;
}
$i++;
}
return false;
-}
-
-Catalog.prototype.HideTab = function($prefix) {
-
- var $tab = document.getElementById($prefix + '_tab_container');
- if ($tab) {
- $tab.style.display = 'none';
- var $index = this.queryTabRegistry('prefix', $prefix, 'index'); // index of hidden tab
- if ($index + 1 < this.TabRegistry.length) {
- // some tabs exists after hidden tab
- this.ShowTab(this.queryTabRegistry('index', $index + 1, 'prefix'));
- }
- }
-}
-
-Catalog.prototype.ShowTab = function($prefix) {
- var $tab = document.getElementById($prefix + '_tab_container');
- if ($tab) {
- $tab.style.display = 'block';
- }
}
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/incs/catalog.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/kernel/admin_templates/incs/grid.js
===================================================================
--- trunk/kernel/admin_templates/incs/grid.js (revision 5005)
+++ trunk/kernel/admin_templates/incs/grid.js (revision 5006)
@@ -1,327 +1,327 @@
function GridItem(grid, an_element, cb, item_id, class_on, class_off)
{
this.Grid = grid;
this.selected = false;
this.id = an_element.id;
this.ItemId = item_id;
this.sequence = parseInt(an_element.getAttribute('sequence'));
this.class_on = class_on;
if (class_off == ':original') {
this.class_off = an_element.className;
}
else
this.class_off = class_off;
this.HTMLelement = an_element;
this.CheckBox = cb;
this.value = this.ItemId;
this.ItemType = 11;
}
GridItem.prototype.Init = function ()
{
this.HTMLelement.GridItem = this;
this.HTMLelement.onclick = function(ev) {
this.GridItem.Click(ev);
};
this.HTMLelement.ondblclick = function(ev) {
this.GridItem.DblClick(ev);
}
if ( isset(this.CheckBox) ) {
this.CheckBox.GridItem = this;
this.CheckBox.onclick = function(ev) {
this.GridItem.cbClick(ev);
};
this.CheckBox.ondblclick = function(ev) {
this.GridItem.DblClick(ev);
}
}
}
GridItem.prototype.DisableClicking = function ()
{
this.HTMLelement.onclick = function(ev) {
return false;
};
this.HTMLelement.ondblclick = function(ev) {
return false;
}
if ( isset(this.CheckBox) ) {
this.CheckBox.onclick = function(ev) {
return false;
};
}
}
GridItem.prototype.Select = function ()
{
if (this.selected) return;
this.selected = true;
this.HTMLelement.className = this.class_on;
if ( isset(this.CheckBox) ) {
this.CheckBox.checked = true;
}
this.Grid.LastSelectedId = this.ItemId;
this.Grid.SelectedCount++;
// this is for in-portal only (used in relation select)
LastCheckedItem = this;
}
GridItem.prototype.UnSelect = function ( force )
{
if ( !this.selected && !force) return;
this.selected = false;
this.HTMLelement.className = this.class_off;
if ( isset(this.CheckBox) ) {
this.CheckBox.checked = false;
}
this.Grid.SelectedCount--;
}
GridItem.prototype.Click = function (ev)
{
if (!is.ie) {
var e = ev;
window.getSelection().removeAllRanges(); //Other browsers
}
else {
var e = window.event;
document.selection.empty() //IE
}
- this.Grid.ClearAlternativeGridsSelection();
+ this.Grid.ClearAlternativeGridsSelection('GridItem.Click');
if (e.shiftKey && !this.Grid.RadioMode) {
this.Grid.SelectRangeUpTo(this.sequence);
}
else {
if (e.ctrlKey && !this.Grid.RadioMode) {
this.Toggle()
}
else {
this.Grid.ClearSelection(null,'GridItem.Click');
this.Toggle();
}
}
this.Grid.CheckDependencies();
e.cancelBubble = true;
}
GridItem.prototype.cbClick = function (ev)
{
var e = is.ie ? window.event : ev;
if (this.Grid.RadioMode) this.Grid.ClearSelection(null,'GridItem.cbClick');
- this.Grid.ClearAlternativeGridsSelection();
+ this.Grid.ClearAlternativeGridsSelection('GridItem.cbClick');
this.Toggle();
this.Grid.CheckDependencies();
e.cancelBubble = true;
}
GridItem.prototype.DblClick = function (ev)
{
var e = is.ie ? window.event : ev;
this.Grid.Edit();
}
GridItem.prototype.Toggle = function ()
{
if (this.selected) this.UnSelect()
else {
this.Grid.LastSelectedSequence = this.sequence;
this.Select();
}
}
GridItem.prototype.FallsInRange = function (from, to)
{
return (from <= to) ?
(this.sequence >= from && this.sequence <= to) :
(this.sequence >= to && this.sequence <= from);
}
function Grid(class_on, class_off, dbl_click, toolbar)
{
this.class_on = class_on;
this.class_off = class_off;
this.Items = new Array();
this.LastSelectedSequence = 1;
this.LastSelectedId = null;
this.DblClick = dbl_click;
this.ToolBar = toolbar;
this.SelectedCount = 0;
this.AlternativeGrids = new Array();
this.DependantButtons = new Array();
this.RadioMode = false;
}
Grid.prototype.AddItem = function( an_item ) {
this.Items[an_item.id] = an_item;
}
Grid.prototype.AddItemsByIdMask = function ( tag, mask, cb_mask ) {
var $item_id=0;
elements = document.getElementsByTagName(tag.toUpperCase());
for (var i=0; i < elements.length; i++) {
if ( typeof(elements[i].id) == 'undefined') {
continue;
}
if ( !elements[i].id.match(mask)) continue;
$item_id=RegExp.$1;
cb_name = cb_mask.replace('$$ID$$',$item_id);
cb = document.getElementById(cb_name);
if (typeof(cb) == 'undefined') alert ('No Checkbox defined for item '+elements[i].id);
this.AddItem( new GridItem( this, elements[i], cb, $item_id, this.class_on, this.class_off ) );
}
}
Grid.prototype.InitItems = function() {
for (var i in this.Items) {
this.Items[i].Init();
}
this.ClearSelection( true,'Grid.InitItems' );
}
Grid.prototype.DisableClicking = function() {
for (var i in this.Items) {
this.Items[i].DisableClicking();
}
this.ClearSelection( true, 'Grid.DisableClicking' );
}
Grid.prototype.ClearSelection = function( force, called_from ) {
// alert('selection clear. force: '+force+'; called_from: '+called_from);
if (typeof(force) == 'undefined') force = false;
if (this.CountSelected() == 0 && !force) return;
for (var i in this.Items) {
this.Items[i].UnSelect(force);
}
this.SelectedCount = 0;
this.CheckDependencies();
}
Grid.prototype.GetSelected = function() {
var $ret = new Array();
for (var i in this.Items) {
if (this.Items[i].selected) {
$ret[$ret.length] = this.Items[i].ItemId;
}
}
return $ret;
}
Grid.prototype.InvertSelection = function() {
for (var i in this.Items)
{
if( this.Items[i].selected )
{
this.Items[i].UnSelect();
}
else
{
this.Items[i].Select();
}
}
this.CheckDependencies();
}
Grid.prototype.SelectAll = function() {
for (var i in this.Items) {
this.Items[i].Select();
}
this.CheckDependencies();
- this.ClearAlternativeGridsSelection();
+ this.ClearAlternativeGridsSelection('Grid.SelectAll');
}
Grid.prototype.SelectRangeUpTo = function( last_sequence ) {
for (var i in this.Items) {
if (this.Items[i].FallsInRange(this.LastSelectedSequence, last_sequence)) {
this.Items[i].Select();
}
}
}
Grid.prototype.CountSelected = function ()
{
return this.SelectedCount;
}
Grid.prototype.Edit = function() {
if ( this.CountSelected() == 0 ) return;
this.DblClick();
}
Grid.prototype.SetDependantToolbarButtons = function($buttons, $direct, $mode) {
if (!isset($direct)) $direct = true; // direct (use false for invert mode)
if (!isset($mode)) $mode = 1; // enable/disable (use 2 for show/hide mode)
for (var i in $buttons) {
this.DependantButtons.push(new Array($buttons[i], $direct, $mode));
}
//this.DependantButtons = buttons;
this.CheckDependencies();
}
Grid.prototype.CheckDependencies = function()
{
var enabling = (this.CountSelected() > 0);
for (var i in this.DependantButtons) {
if (this.DependantButtons[i][0].match("portal:(.*)")) {
button_name = RegExp.$1;
if (toolbar) {
if (enabling == this.DependantButtons[i][1]) {
toolbar.enableButton(button_name, true);
}
else
{
toolbar.disableButton(button_name, true);
}
}
}
else {
if (this.DependantButtons[i][2] == 1) {
this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
}
else {
this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
}
}
}
- //if (enabling) this.ClearAlternativeGridsSelection();
+ //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies');
}
-Grid.prototype.ClearAlternativeGridsSelection = function ()
+Grid.prototype.ClearAlternativeGridsSelection = function (called_from)
{
for (var i in this.AlternativeGrids) {
- this.AlternativeGrids[i].ClearSelection(null,'Grid.ClearAlternativeGridsSelection');
+ this.AlternativeGrids[i].ClearSelection(null, called_from + ' -> Grid.ClearAlternativeGridsSelection');
}
}
Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal)
{
this.AlternativeGrids.push(alt_grid);
if (typeof(reciprocal) != 'undefined' && reciprocal) {
alt_grid.AddAlternativeGrid(this);
}
}
Grid.prototype.FirstSelected = function ()
{
min_sequence = null;
var res = null
for (var i in this.Items) {
if (!this.Items[i].selected) continue;
if (min_sequence == null)
min_sequence = this.Items[i].sequence;
if (this.Items[i].sequence <= min_sequence) {
res = this.Items[i].ItemId;
min_sequence = this.Items[i].sequence;
}
}
return res;
}
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/incs/grid.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/admin_templates/catalog.tpl
===================================================================
--- trunk/kernel/admin_templates/catalog.tpl (revision 5005)
+++ trunk/kernel/admin_templates/catalog.tpl (revision 5006)
@@ -1,217 +1,217 @@
<inp2:m_include t="incs/header" nobody="yes" noform="yes"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$Catalog.go_to_cat();">
<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="!la_title_Browse!"/>
<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="catalog" module="in-portal"/>
<!-- main kernel_form: begin -->
<inp2:m_RenderElement name="kernel_form"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<input type="hidden" name="m_cat_id" value="<inp2:m_get name="m_cat_id"/>"/>
<script type="text/javascript" src="incs/ajax.js"></script>
<script type="text/javascript" src="incs/catalog.js"></script>
<script type="text/javascript">
_progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
$Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" m_cat_id="#CATEGORY_ID#" ajax="yes" no_amp="1"/>');
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('upcat', '<inp2:m_phrase label="la_ToolTip_Up" escape="1"/>', function() {
Catalog.submit_event('c', 'OnCategoryUp', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarButton('homecat', '<inp2:m_phrase label="la_ToolTip_Home" escape="1"/>', function() {
Catalog.submit_event('c', 'OnGoHome', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('new_cat', '<inp2:m_phrase label="la_ToolTip_New_Category" escape="1"/>', function() {
std_precreate_item('c', 'categories/categories_edit');
}
) );
a_toolbar.AddButton( new ToolBarButton('editcat', '<inp2:m_phrase label="la_ToolTip_Edit_Current_Category" escape="1"/>', edit) );
<inp2:m_ModuleInclude template="catalog_tab" tab_init="1"/>
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
function() {
std_delete_items('c')
} ) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Approve" escape="1"/>', function() {
Catalog.submit_event('c','OnMassApprove', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>', function() {
Catalog.submit_event('c','OnMassDecline', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
a_toolbar.AddButton( new ToolBarButton('export', '<inp2:m_phrase label="la_ToolTip_Export" escape="1"/>', function() {
alert( Request.serializeForm('categories_form') );
}
) );
a_toolbar.AddButton( new ToolBarButton('rebuild_cache', '<inp2:m_phrase label="la_ToolTip_RebuildCategoryCache" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep4') );
a_toolbar.AddButton( new ToolBarButton('cut', '<inp2:m_phrase label="la_ToolTip_Cut" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('copy', '<inp2:m_phrase label="la_ToolTip_Copy" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('paste', '<inp2:m_phrase label="la_ToolTip_Paste" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep5') );
a_toolbar.AddButton( new ToolBarButton('move_up', '<inp2:m_phrase label="la_ToolTip_Move_Up" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('move_down', '<inp2:m_phrase label="la_ToolTip_Move_Down" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep6') );
a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
show_viewmenu(a_toolbar,'view');
}
) );
a_toolbar.Render();
function edit()
{
std_edit_item('c', 'categories/categories_edit');
}
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_RenderElement name="kernel_form_end"/>
<!-- main kernel_form: end -->
<!-- category path + search box: begin -->
<table class="toolbar" cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder_full_a">
<tr bgcolor="#e0e0da" height="20">
<td width="100%" valign="middle">
<img height="15" src="img/arrow.gif" width="15" align="absmiddle" border="0"><span id="category_path"></span>
</td>
<td align="right">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>Search:&nbsp;</td>
<td>
<input type="text" id="c_search_keyword" name="c_search_keyword" value="<inp2:c_SearchKeyword no_special="1"/>" PrefixSpecial="c" Grid="Default" style="border: 1px solid grey;">
<inp2:m_recall var="c_search_keyword" no_null="no_null" special="1"/>
</td>
<td>
<script type="text/javascript">
document.getElementById('c_search_keyword').onkeydown = search_keydown;
Toolbars['c_search'] = new ToolBar('icon16_');
Toolbars['c_search'].AddButton( new ToolBarButton('search', 'Search', function() { search('<inp2:c_ListMarker list_name="cats"/>','Default') } ) );
Toolbars['c_search'].AddButton( new ToolBarButton('search_reset', 'Reset', function() { search_reset('<inp2:c_ListMarker list_name="cats"/>') } ) );
Toolbars['c_search'].Render();
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<!-- category path + search box: end -->
<!-- categories list: begin -->
<div id="categories_div" prefix="c" edit_template="categories/categories_edit"></div>
<script type="text/javascript">$Catalog.registerTab('categories');</script>
<!-- categories list: end -->
<!-- item tabs: begin -->
<table cellpadding="0" cellspacing="0">
<tr>
<inp2:m_DefineElement name="item_tab" title="">
- <td id="<inp2:m_param name="prefix"/>_tab_container" nowrap="nowrap" width="200">
+ <td nowrap="nowrap" width="200">
<table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('<inp2:m_param name="prefix"/>');">
<tr>
<td class="catalog-tab-left">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
<inp2:m_param name="title"/> <span class="cats_stats">(<span id="<inp2:m_param name="prefix"/>_item_count">?</span>)</span>
</td>
<td class="catalog-tab-right">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td style="background-color: #FFFFFF;">
<img src="img/spacer.gif" height="1" width="5" />
</td>
</tr>
</table>
</td>
</inp2:m_DefineElement>
<inp2:adm_ListCatalogTabs render_as="item_tab"/>
</tr>
</table>
<!-- item tabs: end -->
<inp2:m_ModuleInclude template="catalog_tab" tab_init="2"/>
<script type="text/javascript" src="incs/fw_menu.js"></script>
<!-- Products -->
<!--<inp2:m_block name="product_caption_td" />
<td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid"/>
<span class="priority"><inp2:m_if prefix="$PrefixSpecial" function="fieldequals" field="Priority" value="0"/><inp2:m_else/><sup><inp2:$PrefixSpecial_field field="Priority"/></sup><inp2:m_endif/></span></td>
<inp2:m_blockend />
<inp2:m_ParseBlock name="grid" PrefixSpecial="p" IdField="ResourceId" grid="Default" header_block="grid_column_title" data_block="grid_data_td" no_toolbar="no_toolbar" search="on"/>
-->
<inp2:m_include t="incs/footer" noform="yes"/>
<script type="text/javascript">
$ViewMenus = new Array('<inp2:c_ListMarker list_name="cats"/>');
$Catalog.Init();
</script>
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/catalog.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/core/admin_templates/catalog/catalog.tpl
===================================================================
--- trunk/core/admin_templates/catalog/catalog.tpl (revision 5005)
+++ trunk/core/admin_templates/catalog/catalog.tpl (revision 5006)
@@ -1,217 +1,217 @@
<inp2:m_include t="incs/header" nobody="yes" noform="yes"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$Catalog.go_to_cat();">
<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="!la_title_Browse!"/>
<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="catalog" module="in-portal"/>
<!-- main kernel_form: begin -->
<inp2:m_RenderElement name="kernel_form"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<input type="hidden" name="m_cat_id" value="<inp2:m_get name="m_cat_id"/>"/>
<script type="text/javascript" src="incs/ajax.js"></script>
<script type="text/javascript" src="incs/catalog.js"></script>
<script type="text/javascript">
_progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
$Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" m_cat_id="#CATEGORY_ID#" ajax="yes" no_amp="1"/>');
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('upcat', '<inp2:m_phrase label="la_ToolTip_Up" escape="1"/>', function() {
Catalog.submit_event('c', 'OnCategoryUp', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarButton('homecat', '<inp2:m_phrase label="la_ToolTip_Home" escape="1"/>', function() {
Catalog.submit_event('c', 'OnGoHome', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('new_cat', '<inp2:m_phrase label="la_ToolTip_New_Category" escape="1"/>', function() {
std_precreate_item('c', 'categories/categories_edit');
}
) );
a_toolbar.AddButton( new ToolBarButton('editcat', '<inp2:m_phrase label="la_ToolTip_Edit_Current_Category" escape="1"/>', edit) );
<inp2:m_ModuleInclude template="catalog_tab" tab_init="1"/>
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
function() {
std_delete_items('c')
} ) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Approve" escape="1"/>', function() {
Catalog.submit_event('c','OnMassApprove', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>', function() {
Catalog.submit_event('c','OnMassDecline', null, 'categories_div', 'categories_form');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
a_toolbar.AddButton( new ToolBarButton('export', '<inp2:m_phrase label="la_ToolTip_Export" escape="1"/>', function() {
alert( Request.serializeForm('categories_form') );
}
) );
a_toolbar.AddButton( new ToolBarButton('rebuild_cache', '<inp2:m_phrase label="la_ToolTip_RebuildCategoryCache" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep4') );
a_toolbar.AddButton( new ToolBarButton('cut', '<inp2:m_phrase label="la_ToolTip_Cut" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('copy', '<inp2:m_phrase label="la_ToolTip_Copy" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('paste', '<inp2:m_phrase label="la_ToolTip_Paste" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep5') );
a_toolbar.AddButton( new ToolBarButton('move_up', '<inp2:m_phrase label="la_ToolTip_Move_Up" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarButton('move_down', '<inp2:m_phrase label="la_ToolTip_Move_Down" escape="1"/>', function() {
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep6') );
a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
show_viewmenu(a_toolbar,'view');
}
) );
a_toolbar.Render();
function edit()
{
std_edit_item('c', 'categories/categories_edit');
}
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_RenderElement name="kernel_form_end"/>
<!-- main kernel_form: end -->
<!-- category path + search box: begin -->
<table class="toolbar" cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder_full_a">
<tr bgcolor="#e0e0da" height="20">
<td width="100%" valign="middle">
<img height="15" src="img/arrow.gif" width="15" align="absmiddle" border="0"><span id="category_path"></span>
</td>
<td align="right">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>Search:&nbsp;</td>
<td>
<input type="text" id="c_search_keyword" name="c_search_keyword" value="<inp2:c_SearchKeyword no_special="1"/>" PrefixSpecial="c" Grid="Default" style="border: 1px solid grey;">
<inp2:m_recall var="c_search_keyword" no_null="no_null" special="1"/>
</td>
<td>
<script type="text/javascript">
document.getElementById('c_search_keyword').onkeydown = search_keydown;
Toolbars['c_search'] = new ToolBar('icon16_');
Toolbars['c_search'].AddButton( new ToolBarButton('search', 'Search', function() { search('<inp2:c_ListMarker list_name="cats"/>','Default') } ) );
Toolbars['c_search'].AddButton( new ToolBarButton('search_reset', 'Reset', function() { search_reset('<inp2:c_ListMarker list_name="cats"/>') } ) );
Toolbars['c_search'].Render();
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<!-- category path + search box: end -->
<!-- categories list: begin -->
<div id="categories_div" prefix="c" edit_template="categories/categories_edit"></div>
<script type="text/javascript">$Catalog.registerTab('categories');</script>
<!-- categories list: end -->
<!-- item tabs: begin -->
<table cellpadding="0" cellspacing="0">
<tr>
<inp2:m_DefineElement name="item_tab" title="">
- <td id="<inp2:m_param name="prefix"/>_tab_container" nowrap="nowrap" width="200">
+ <td nowrap="nowrap" width="200">
<table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('<inp2:m_param name="prefix"/>');">
<tr>
<td class="catalog-tab-left">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
<inp2:m_param name="title"/> <span class="cats_stats">(<span id="<inp2:m_param name="prefix"/>_item_count">?</span>)</span>
</td>
<td class="catalog-tab-right">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td style="background-color: #FFFFFF;">
<img src="img/spacer.gif" height="1" width="5" />
</td>
</tr>
</table>
</td>
</inp2:m_DefineElement>
<inp2:adm_ListCatalogTabs render_as="item_tab"/>
</tr>
</table>
<!-- item tabs: end -->
<inp2:m_ModuleInclude template="catalog_tab" tab_init="2"/>
<script type="text/javascript" src="incs/fw_menu.js"></script>
<!-- Products -->
<!--<inp2:m_block name="product_caption_td" />
<td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid"/>
<span class="priority"><inp2:m_if prefix="$PrefixSpecial" function="fieldequals" field="Priority" value="0"/><inp2:m_else/><sup><inp2:$PrefixSpecial_field field="Priority"/></sup><inp2:m_endif/></span></td>
<inp2:m_blockend />
<inp2:m_ParseBlock name="grid" PrefixSpecial="p" IdField="ResourceId" grid="Default" header_block="grid_column_title" data_block="grid_data_td" no_toolbar="no_toolbar" search="on"/>
-->
<inp2:m_include t="incs/footer" noform="yes"/>
<script type="text/javascript">
$ViewMenus = new Array('<inp2:c_ListMarker list_name="cats"/>');
$Catalog.Init();
</script>
\ No newline at end of file
Property changes on: trunk/core/admin_templates/catalog/catalog.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/core/admin_templates/js/catalog.js
===================================================================
--- trunk/core/admin_templates/js/catalog.js (revision 5005)
+++ trunk/core/admin_templates/js/catalog.js (revision 5006)
@@ -1,147 +1,127 @@
var $is_catalog = true;
function Catalog($url_mask) {
this.BusyRequest = false;
this.URLMask = $url_mask;
this.Separator = '#separator#';
this.TabRegistry = new Array();
// get from cookie
this.ActivePrefix = '';
}
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
// ActivePrefix not set or has non-existing prefix value
this.ActivePrefix = this.TabRegistry[1]['prefix'];
}
}
Catalog.prototype.submit_kernel_form = function($form_name, $result_div) {
var $kf = document.getElementById($form_name);
set_hidden_field('ajax', 'yes');
Request.params = Request.serializeForm($kf);
Request.method = $kf.method.toUpperCase();
Request.makeRequest($kf.action, this.BusyRequest, $result_div, this.successCallback, this.errorCallback, $result_div);
};
Catalog.prototype.successCallback = function($request, $params) {
var $text = $request.responseText;
$params = $params.split(',');
var $js_end = $text.indexOf($Catalog.Separator);
if ($js_end != -1) {
document.getElementById($params[0]).innerHTML = $text.substring($js_end + $Catalog.Separator.length);
eval($text.substring(0, $js_end));
}
else {
document.getElementById($params[0]).innerHTML = $text;
}
if ($params[0] == 'categories_div') {
// category has been changed -> refresh current item tab
$Catalog.switchTab();
}
if (isset($Debugger)) $Debugger.Clear();
}
Catalog.prototype.errorCallback = function($request, $params) {
alert('AJAX ERROR: ' + Request.getErrorHtml($request));
}
Catalog.prototype.submit_event = function($prefix_special, $event, $t, $result_div, $source_form) {
// set form name first, because set_hidden_field uses it
if (isset($source_form)) $form_name = $source_form;
if (isset($event)) set_hidden_field('events['+$prefix_special+']', $event);
if (isset($t)) set_hidden_field('t', $t);
this.submit_kernel_form($form_name, $result_div);
}
Catalog.prototype.go_to_cat = function($cat_id) {
if (!isset($cat_id)) {
$cat_id = get_hidden_field('m_cat_id');
}
var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id);
Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div');
}
Catalog.prototype.switchTab = function($prefix) {
if (!isset($prefix)) $prefix = this.ActivePrefix;
if (this.ActivePrefix != $prefix) {
// hide source tab
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-unselected';
document.getElementById(this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id') + '_div').style.display = 'none';
}
// show destination tab
this.ActivePrefix = $prefix;
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected';
var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div'; // destination tab
document.getElementById($div_id).style.display = 'block';
// this.TabRegistry.length == 1
var $cat_id = get_hidden_field('m_cat_id');
var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
if ($cat_id != $tab_cat_id) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab');
$url = $url.replace('#CATEGORY_ID#', $cat_id);
Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
}
}
// adds information about tab to tab_registry
Catalog.prototype.registerTab = function($tab_id) {
var $tab = document.getElementById($tab_id + '_div');
var $index = this.TabRegistry.length;
this.TabRegistry[$index] = new Array();
this.TabRegistry[$index]['tab_id'] = $tab_id;
this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
this.TabRegistry[$index]['module_path'] = $tab.getAttribute('edit_template').substring(0, $tab.getAttribute('edit_template').indexOf('/'));
this.TabRegistry[$index]['edit_template'] = $tab.getAttribute('edit_template');
this.TabRegistry[$index]['index'] = $index;
}
// allows to get any information about tab
Catalog.prototype.queryTabRegistry = function($search_key, $search_value, $return_key) {
var $i = 0;
while ($i < this.TabRegistry.length) {
if (this.TabRegistry[$i][$search_key] == $search_value) {
return this.TabRegistry[$i][$return_key];
break;
}
$i++;
}
return false;
-}
-
-Catalog.prototype.HideTab = function($prefix) {
-
- var $tab = document.getElementById($prefix + '_tab_container');
- if ($tab) {
- $tab.style.display = 'none';
- var $index = this.queryTabRegistry('prefix', $prefix, 'index'); // index of hidden tab
- if ($index + 1 < this.TabRegistry.length) {
- // some tabs exists after hidden tab
- this.ShowTab(this.queryTabRegistry('index', $index + 1, 'prefix'));
- }
- }
-}
-
-Catalog.prototype.ShowTab = function($prefix) {
- var $tab = document.getElementById($prefix + '_tab_container');
- if ($tab) {
- $tab.style.display = 'block';
- }
}
\ No newline at end of file
Property changes on: trunk/core/admin_templates/js/catalog.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property

Event Timeline