Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1162713
in-portal
No One
Temporary
Actions
View 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
Sat, Sep 20, 11:55 PM
Size
18 KB
Mime Type
text/x-diff
Expires
Mon, Sep 22, 11:55 PM (2 h, 23 m)
Engine
blob
Format
Raw Data
Handle
752310
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/units/general/cat_tag_processor.php
===================================================================
--- trunk/kernel/units/general/cat_tag_processor.php (revision 5094)
+++ trunk/kernel/units/general/cat_tag_processor.php (revision 5095)
@@ -1,137 +1,136 @@
<?php
class kCatDBTagProcessor extends kDBTagProcessor {
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'];
+ if (!$status_fields) return $icons['default'];
$value = $object->GetDBField($status_fields[0]); // sets base status icon
- if($value == STATUS_ACTIVE)
- {
+ 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'];
}
/**
* 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);
}
$block_params['separator'] = $params['separator'];
if($params['cat_id'] == 0)
{
$block_params['name'] = $params['rootcatblock'];
return $this->Application->ParseBlock($block_params);
}
else
{
$cat_object =& $this->Application->recallObject('c', 'c_List');
$sql = 'SELECT CategoryId, ParentId, Name FROM '.$cat_object->TableName.' WHERE CategoryId = '.$params['cat_id'];
$res = $this->Conn->GetRow($sql);
if ($res === false) {
// in case if category is deleted
return '';
}
$block_params['name'] = $params['block'];
$block_params['cat_name'] = $res['Name'];
$block_params['cat_id'] = $res['CategoryId'];
$next_params['separator'] = $params['separator'];
$next_params['rootcatblock'] = $params['rootcatblock'];
$next_params['block'] = $params['block'];
$next_params['cat_id'] = $res['ParentId'];
return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_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);
}
}
$export_options = $export_object->loadOptions($event);
return $export_options['start_from'] * 100 / $export_options['total_records'];
}
function CatalogItemCount($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List', $params);
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/general/cat_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7
\ No newline at end of property
+1.8
\ No newline at end of property
Index: trunk/kernel/admin_templates/xml/categories_list.tpl
===================================================================
--- trunk/kernel/admin_templates/xml/categories_list.tpl (revision 5094)
+++ trunk/kernel/admin_templates/xml/categories_list.tpl (revision 5095)
@@ -1,67 +1,68 @@
<inp2:m_include t="incs/blocks"/>
<inp2:m_include t="incs/grid_blocks"/>
<inp2:c_InitList no_special="1" per_page="-1"/>
Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar);
Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]');
Grids['c'].InitItems();
Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
<inp2:c_ViewMenu block="viewmenu_declaration" grid="Default" no_special="1" menu_perpage="no" menu_filters="yes" ajax="1"/>
<!-- substiture form action, like from was created from here -->
document.getElementById('categories_form').action = '<inp2:m_t pass="all" js_escape="1"/>';
$Catalog.setItemCount('c', '<inp2:c_TotalRecords no_special="1"/>');
$Catalog.ParentCategoryID = <inp2:c_GetParentCategory/>;
document.getElementById('c_search_warning').style.display = '<inp2:m_if check="m_RecallEquals" var="c_search_keyword" value="" inverse="inverse">block<inp2:m_else/>none</inp2:m_if>';
document.getElementById('c_search_keyword').value = '<inp2:c_SearchKeyword no_special="1" js_escape="1"/>';
<inp2:m_DefineElement name="root_cat_caption">
<span class="NAV_CURRENT_ITEM">
<inp2:m_if check="m_ParamEquals" name="current" value="1">
<inp2:c_RootCategoryName />
<inp2:m_else/>
<a class="control_link" href="javascript:$Catalog.go_to_cat(0);"><inp2:c_RootCategoryName /></a>
</inp2:m_if>
</span>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="category_caption">
<span class="NAV_CURRENT_ITEM">
<inp2:m_param name="separator"/>
<inp2:m_if check="m_ParamEquals" name="current" value="1" inverse="1">
<a class="control_link" href="javascript:$Catalog.go_to_cat(<inp2:m_param name="cat_id"/>);"><inp2:m_param name="cat_name"/></a>
<inp2:m_else/>
<inp2:m_param name="cat_name"/>
</inp2:m_if>
</span>
</inp2:m_DefineElement>
setInnerHTML('category_path', '<inp2:c_CategoryPath separator=">" rootcatblock="root_cat_caption" rootmoduleblock="category_caption" currentblock="category_caption" block="category_caption" js_escape="1"/>');
<inp2:m_if check="m_GetEquals" name="m_cat_id" value="0">
a_toolbar.DisableButton('upcat');
a_toolbar.DisableButton('homecat');
<inp2:m_else/>
a_toolbar.EnableButton('upcat');
a_toolbar.EnableButton('homecat');
</inp2:m_if>
#separator#
<inp2:c_UpdateLastTemplate template="catalog"/>
+<inp2:m_include t="categories/ci_blocks"/>
<br />
<table border="0" width="100%">
<inp2:m_DefineElement name="category_td">
<td valign="top" class="table_white text" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="CategoryId"/>">
<input type="checkbox" name="<inp2:InputName field="$IdField"/>" id="<inp2:InputName field="$IdField"/>">
<img src="<inp2:ModulePath />img/itemicons/<inp2:ItemIcon grid="Default"/>"> <span class="priority"><inp2:m_if check="FieldEquals" field="Priority" value="0" inverse="inverse"><sup><inp2:Field field="Priority"/></sup></inp2:m_if></span>
<a class="link" href="javascript:$Catalog.go_to_cat(<inp2:m_get name="c_id"/>);"><b><inp2:Field name="Name"/></b></a><span class="cat_desc">:</span>
<span class="cat_pick"><inp2:m_if check="IsPick">Pick</inp2:m_if></span>
- <span class="cat_new"><inp2:m_if check="IsNew">New</inp2:m_if></span>
+ <span class="cat_new"><inp2:m_if check="IsNew">New</inp2:m_if></span>
<span class="cats_stats">(<inp2:SubCatCount/> / <inp2:ItemCount/>)</span><br>
<div style="padding-left: 3px;">
<span class="cat_desc"><inp2:Field field="Description"/></span><br>
<span class="cats_stats">(<inp2:Field field="CreatedOn" format="_regional_DateFormat"/>)</span>
</div>
</td>
</inp2:m_DefineElement>
<inp2:m_if check="c_TotalRecords" no_special="1">
<inp2:c_CategoryList no_special="1" block_main="category_td" per_page="-1" columns="2" direction="V" IdField="CategoryId" />
<inp2:m_else/>
<span class="text"><inp2:m_phrase name="la_text_NoCategories"/></span>
</inp2:m_if>
</table></br>
Property changes on: trunk/kernel/admin_templates/xml/categories_list.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/core/units/general/cat_tag_processor.php
===================================================================
--- trunk/core/units/general/cat_tag_processor.php (revision 5094)
+++ trunk/core/units/general/cat_tag_processor.php (revision 5095)
@@ -1,137 +1,136 @@
<?php
class kCatDBTagProcessor extends kDBTagProcessor {
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'];
+ if (!$status_fields) return $icons['default'];
$value = $object->GetDBField($status_fields[0]); // sets base status icon
- if($value == STATUS_ACTIVE)
- {
+ 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'];
}
/**
* 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);
}
$block_params['separator'] = $params['separator'];
if($params['cat_id'] == 0)
{
$block_params['name'] = $params['rootcatblock'];
return $this->Application->ParseBlock($block_params);
}
else
{
$cat_object =& $this->Application->recallObject('c', 'c_List');
$sql = 'SELECT CategoryId, ParentId, Name FROM '.$cat_object->TableName.' WHERE CategoryId = '.$params['cat_id'];
$res = $this->Conn->GetRow($sql);
if ($res === false) {
// in case if category is deleted
return '';
}
$block_params['name'] = $params['block'];
$block_params['cat_name'] = $res['Name'];
$block_params['cat_id'] = $res['CategoryId'];
$next_params['separator'] = $params['separator'];
$next_params['rootcatblock'] = $params['rootcatblock'];
$next_params['block'] = $params['block'];
$next_params['cat_id'] = $res['ParentId'];
return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_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);
}
}
$export_options = $export_object->loadOptions($event);
return $export_options['start_from'] * 100 / $export_options['total_records'];
}
function CatalogItemCount($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List', $params);
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/general/cat_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7
\ No newline at end of property
+1.8
\ No newline at end of property
Index: trunk/core/admin_templates/categories/xml/categories_list.tpl
===================================================================
--- trunk/core/admin_templates/categories/xml/categories_list.tpl (revision 5094)
+++ trunk/core/admin_templates/categories/xml/categories_list.tpl (revision 5095)
@@ -1,67 +1,68 @@
<inp2:m_include t="incs/blocks"/>
<inp2:m_include t="incs/grid_blocks"/>
<inp2:c_InitList no_special="1" per_page="-1"/>
Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar);
Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]');
Grids['c'].InitItems();
Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
<inp2:c_ViewMenu block="viewmenu_declaration" grid="Default" no_special="1" menu_perpage="no" menu_filters="yes" ajax="1"/>
<!-- substiture form action, like from was created from here -->
document.getElementById('categories_form').action = '<inp2:m_t pass="all" js_escape="1"/>';
$Catalog.setItemCount('c', '<inp2:c_TotalRecords no_special="1"/>');
$Catalog.ParentCategoryID = <inp2:c_GetParentCategory/>;
document.getElementById('c_search_warning').style.display = '<inp2:m_if check="m_RecallEquals" var="c_search_keyword" value="" inverse="inverse">block<inp2:m_else/>none</inp2:m_if>';
document.getElementById('c_search_keyword').value = '<inp2:c_SearchKeyword no_special="1" js_escape="1"/>';
<inp2:m_DefineElement name="root_cat_caption">
<span class="NAV_CURRENT_ITEM">
<inp2:m_if check="m_ParamEquals" name="current" value="1">
<inp2:c_RootCategoryName />
<inp2:m_else/>
<a class="control_link" href="javascript:$Catalog.go_to_cat(0);"><inp2:c_RootCategoryName /></a>
</inp2:m_if>
</span>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="category_caption">
<span class="NAV_CURRENT_ITEM">
<inp2:m_param name="separator"/>
<inp2:m_if check="m_ParamEquals" name="current" value="1" inverse="1">
<a class="control_link" href="javascript:$Catalog.go_to_cat(<inp2:m_param name="cat_id"/>);"><inp2:m_param name="cat_name"/></a>
<inp2:m_else/>
<inp2:m_param name="cat_name"/>
</inp2:m_if>
</span>
</inp2:m_DefineElement>
setInnerHTML('category_path', '<inp2:c_CategoryPath separator=">" rootcatblock="root_cat_caption" rootmoduleblock="category_caption" currentblock="category_caption" block="category_caption" js_escape="1"/>');
<inp2:m_if check="m_GetEquals" name="m_cat_id" value="0">
a_toolbar.DisableButton('upcat');
a_toolbar.DisableButton('homecat');
<inp2:m_else/>
a_toolbar.EnableButton('upcat');
a_toolbar.EnableButton('homecat');
</inp2:m_if>
#separator#
<inp2:c_UpdateLastTemplate template="catalog"/>
+<inp2:m_include t="categories/ci_blocks"/>
<br />
<table border="0" width="100%">
<inp2:m_DefineElement name="category_td">
<td valign="top" class="table_white text" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="CategoryId"/>">
<input type="checkbox" name="<inp2:InputName field="$IdField"/>" id="<inp2:InputName field="$IdField"/>">
<img src="<inp2:ModulePath />img/itemicons/<inp2:ItemIcon grid="Default"/>"> <span class="priority"><inp2:m_if check="FieldEquals" field="Priority" value="0" inverse="inverse"><sup><inp2:Field field="Priority"/></sup></inp2:m_if></span>
<a class="link" href="javascript:$Catalog.go_to_cat(<inp2:m_get name="c_id"/>);"><b><inp2:Field name="Name"/></b></a><span class="cat_desc">:</span>
<span class="cat_pick"><inp2:m_if check="IsPick">Pick</inp2:m_if></span>
- <span class="cat_new"><inp2:m_if check="IsNew">New</inp2:m_if></span>
+ <span class="cat_new"><inp2:m_if check="IsNew">New</inp2:m_if></span>
<span class="cats_stats">(<inp2:SubCatCount/> / <inp2:ItemCount/>)</span><br>
<div style="padding-left: 3px;">
<span class="cat_desc"><inp2:Field field="Description"/></span><br>
<span class="cats_stats">(<inp2:Field field="CreatedOn" format="_regional_DateFormat"/>)</span>
</div>
</td>
</inp2:m_DefineElement>
<inp2:m_if check="c_TotalRecords" no_special="1">
<inp2:c_CategoryList no_special="1" block_main="category_td" per_page="-1" columns="2" direction="V" IdField="CategoryId" />
<inp2:m_else/>
<span class="text"><inp2:m_phrase name="la_text_NoCategories"/></span>
</inp2:m_if>
</table></br>
Property changes on: trunk/core/admin_templates/categories/xml/categories_list.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Event Timeline
Log In to Comment