Commit 9f0df527 authored by Janur J.'s avatar Janur J.
Browse files

Adaptation to the core v4.2

parent 39e41a98
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
class iaBackendController extends iaAbstractControllerModuleBackend class iaBackendController extends iaAbstractControllerModuleBackend
{ {
protected $_name = 'categories'; protected $_name = 'categories';
protected $_itemName = 'categs';
protected $_helperName = 'categ'; protected $_helperName = 'categ';
...@@ -168,7 +167,7 @@ SQL; ...@@ -168,7 +167,7 @@ SQL;
case 'pre_recount_listings': case 'pre_recount_listings':
$this->getHelper()->resetCounters(); $this->getHelper()->resetCounters();
$this->_iaCore->factoryModule('listing', $this->getModuleName(), iaCore::ADMIN); $this->_iaCore->factoryItem('listing');
$output['total'] = $this->_iaDb->one(iaDb::STMT_COUNT_ROWS, $output['total'] = $this->_iaDb->one(iaDb::STMT_COUNT_ROWS,
iaDb::convertIds(iaCore::STATUS_ACTIVE, 'status'), iaListing::getTable()); iaDb::convertIds(iaCore::STATUS_ACTIVE, 'status'), iaListing::getTable());
} }
......
...@@ -20,13 +20,12 @@ ...@@ -20,13 +20,12 @@
class iaBackendController extends iaAbstractControllerModuleBackend class iaBackendController extends iaAbstractControllerModuleBackend
{ {
protected $_name = 'listings'; protected $_name = 'listings';
protected $_itemName = 'listings';
protected $_helperName = 'listing'; protected $_helperName = 'listing';
protected $_gridColumns = ['title', 'title_alias', 'url', 'date_added', 'date_modified', 'reported_as_broken', 'reported_as_broken_comments', 'status']; protected $_gridColumns = ['title', 'title_alias', 'url', 'date_added', 'date_modified', 'reported_as_broken', 'reported_as_broken_comments', 'status'];
protected $_gridFilters = ['title' => self::LIKE, 'status' => self::EQUAL]; protected $_gridFilters = ['title' => self::LIKE, 'status' => self::EQUAL];
protected $_gridSorting = ['member' => ['fullname', 'm']]; protected $_gridSorting = ['member' => ['fullname', 'm'], 'category_title' => ['title', 'c', 'categ']];
protected $_gridQueryMainTableAlias = 'l'; protected $_gridQueryMainTableAlias = 'l';
protected $_tooltipsEnabled = true; protected $_tooltipsEnabled = true;
...@@ -40,11 +39,10 @@ class iaBackendController extends iaAbstractControllerModuleBackend ...@@ -40,11 +39,10 @@ class iaBackendController extends iaAbstractControllerModuleBackend
public function init() public function init()
{ {
$this->_iaCateg = $this->_iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN); $this->_iaCateg = $this->_iaCore->factoryItem('categ');
$this->_gridSorting['category_title'] = ['title_' . $this->_iaCore->language['iso'], 'c'];
} }
protected function _modifyGridParams(&$conditions, &$values, array $params) protected function _gridModifyParams(&$conditions, &$values, array $params)
{ {
if (!empty($params['text'])) { if (!empty($params['text'])) {
$langCode = $this->_iaCore->language['iso']; $langCode = $this->_iaCore->language['iso'];
......
<ul> <ul>
<li>Version: 4.2.0
<ul>
<li>Adapted to the core v4.2</li>
</ul>
</li>
<li>Version: 4.1.3 <li>Version: 4.1.3
<ul> <ul>
<li>Bug #21: Consistency recount does not work</li> <li>Bug #21: Consistency recount does not work</li>
......
...@@ -24,11 +24,13 @@ class iaCateg extends iaAbstractHelperCategoryFlat implements iaDirectoryModule ...@@ -24,11 +24,13 @@ class iaCateg extends iaAbstractHelperCategoryFlat implements iaDirectoryModule
protected $_moduleName = 'directory'; protected $_moduleName = 'directory';
protected $_itemName = 'categs'; protected $_itemName = 'categ';
protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE]; protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE];
protected $_activityLog = ['item' => 'category']; protected $_activityLog = ['item' => 'category'];
protected $_slugColumnName = 'title_alias';
protected $_recountOptions = [ protected $_recountOptions = [
'listingsTable' => 'listings' 'listingsTable' => 'listings'
]; ];
......
...@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul ...@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
protected static $_table = 'listings'; protected static $_table = 'listings';
protected static $_tableCrossed = 'listings_categs'; protected static $_tableCrossed = 'listings_categs';
protected $_itemName = 'listings'; protected $_itemName = 'listing';
protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE, iaCore::STATUS_APPROVAL, self::STATUS_BANNED, self::STATUS_SUSPENDED]; protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE, iaCore::STATUS_APPROVAL, self::STATUS_BANNED, self::STATUS_SUSPENDED];
...@@ -66,7 +66,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul ...@@ -66,7 +66,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
public function updateCounters($itemId, array $itemData, $action, $previousData = null) public function updateCounters($itemId, array $itemData, $action, $previousData = null)
{ {
$this->_checkIfCountersNeedUpdate($action, $itemData, $previousData, $this->_checkIfCountersNeedUpdate($action, $itemData, $previousData,
$this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN)); $this->iaCore->factoryItem('categ'));
$this->_checkCrossedLinksCounters($itemId, $itemData, $previousData, $action); $this->_checkCrossedLinksCounters($itemId, $itemData, $previousData, $action);
switch ($action) { switch ($action) {
...@@ -108,7 +108,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul ...@@ -108,7 +108,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
} }
if (isset($diff)) { if (isset($diff)) {
$iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN); $iaCateg = $this->iaCore->factoryItem('categ');
foreach ($crossedLinks as $entry) { foreach ($crossedLinks as $entry) {
$iaCateg->recountById($entry['category_id'], $diff); $iaCateg->recountById($entry['category_id'], $diff);
...@@ -118,7 +118,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul ...@@ -118,7 +118,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
public function saveCrossedLinks($itemId, $status, $mainCategoryId, $data) public function saveCrossedLinks($itemId, $status, $mainCategoryId, $data)
{ {
$iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN); $iaCateg = $this->iaCore->factoryItem('categ');
$this->iaDb->setTable(self::getTableCrossed()); $this->iaDb->setTable(self::getTableCrossed());
...@@ -273,7 +273,7 @@ SQL; ...@@ -273,7 +273,7 @@ SQL;
public function getTreeVars(array $entryData) public function getTreeVars(array $entryData)
{ {
$iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN); $iaCateg = $this->iaCore->factoryItem('categ');
$category = empty($entryData['category_id']) $category = empty($entryData['category_id'])
? $iaCateg->getRoot() ? $iaCateg->getRoot()
......
...@@ -24,11 +24,7 @@ class iaCateg extends iaAbstractFrontHelperCategoryFlat ...@@ -24,11 +24,7 @@ class iaCateg extends iaAbstractFrontHelperCategoryFlat
protected $_moduleName = 'directory'; protected $_moduleName = 'directory';
protected $_itemName = 'categs'; protected $_itemName = 'categ';
protected $_urlPatterns = [
'default' => ':base:title_alias'
];
public $coreSearchEnabled = true; public $coreSearchEnabled = true;
public $coreSearchOptions = [ public $coreSearchOptions = [
...@@ -36,11 +32,12 @@ class iaCateg extends iaAbstractFrontHelperCategoryFlat ...@@ -36,11 +32,12 @@ class iaCateg extends iaAbstractFrontHelperCategoryFlat
]; ];
public function url($action, array $data) public function getUrl(array $data)
{ {
$baseUrl = ($this->getModuleName() == $this->iaCore->get('default_package')) $baseUrl = ($this->getModuleName() == $this->iaCore->get('default_package'))
? IA_URL ? IA_URL
: $this->iaCore->modulesData[$this->getModuleName()]['url']; : $this->iaCore->modulesData[$this->getModuleName()]['url'];
$slug = isset($data['category_alias']) $slug = isset($data['category_alias'])
? $data['category_alias'] ? $data['category_alias']
: $data['title_alias']; : $data['title_alias'];
...@@ -129,7 +126,7 @@ SQL; ...@@ -129,7 +126,7 @@ SQL;
protected function _getCrossed($where) protected function _getCrossed($where)
{ {
$this->iaCore->factoryModule('listing', $this->getModuleName()); $this->iaCore->factoryItem('listing');
$sql = <<<SQL $sql = <<<SQL
SELECT c.`id`, c.`title_:lang` `title` SELECT c.`id`, c.`title_:lang` `title`
......
...@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul ...@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul
protected static $_table = 'listings'; protected static $_table = 'listings';
protected static $_tableCrossed = 'listings_categs'; protected static $_tableCrossed = 'listings_categs';
protected $_itemName = 'listings'; protected $_itemName = 'listing';
protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE, iaCore::STATUS_APPROVAL, self::STATUS_BANNED, self::STATUS_SUSPENDED]; protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE, iaCore::STATUS_APPROVAL, self::STATUS_BANNED, self::STATUS_SUSPENDED];
...@@ -53,7 +53,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul ...@@ -53,7 +53,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul
{ {
parent::init(); parent::init();
$this->_iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName()); $this->_iaCateg = $this->iaCore->factoryItem('categ');
$this->_baseUrl = $this->getModuleName() == $this->iaCore->get('default_package') $this->_baseUrl = $this->getModuleName() == $this->iaCore->get('default_package')
? IA_URL ? IA_URL
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
******************************************************************************/ ******************************************************************************/
$iaListing = $iaCore->factoryModule('listing', 'directory'); $iaListing = $iaCore->factoryItem('listing');
if ($listings = $iaDb->all(['id', 'domain', 'alexa_rank'], "`domain` != ''", 0, null, iaListing::getTable())) { if ($listings = $iaDb->all(['id', 'domain', 'alexa_rank'], "`domain` != ''", 0, null, iaListing::getTable())) {
include_once IA_MODULES . 'directory/includes/alexarank.inc.php'; include_once IA_MODULES . 'directory/includes/alexarank.inc.php';
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
******************************************************************************/ ******************************************************************************/
if (iaView::REQUEST_HTML == $iaView->getRequestType()) { if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$iaListing = $iaCore->factoryModule('listing', 'directory'); $iaListing = $iaCore->factoryItem('listing');
$iaCateg = $iaCore->factoryModule('categ', $iaListing->getModuleName()); $iaCateg = $iaCore->factoryItem('categ');
// set default values for blocks to avoid isset validation // set default values for blocks to avoid isset validation
$blocksData = ['recent' => [], 'featured' => [], 'sponsored' => []]; $blocksData = ['recent' => [], 'featured' => [], 'sponsored' => []];
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
******************************************************************************/ ******************************************************************************/
$iaCateg = $iaCore->factoryModule('categ', IA_CURRENT_MODULE); $iaCateg = $iaCore->factoryItem('categ');
if (iaView::REQUEST_JSON == $iaView->getRequestType()) { if (iaView::REQUEST_JSON == $iaView->getRequestType()) {
$output = []; $output = [];
...@@ -54,7 +54,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) { ...@@ -54,7 +54,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$order = ''; $order = '';
$iaListing = $iaCore->factoryModule('listing', IA_CURRENT_MODULE); $iaListing = $iaCore->factoryItem('listing');
$listings = []; $listings = [];
$orders = ['date_added-asc', 'date_added-desc', 'rank-desc', 'rank-asc', 'title-desc', 'title-asc']; $orders = ['date_added-asc', 'date_added-desc', 'rank-desc', 'rank-asc', 'title-desc', 'title-asc'];
...@@ -209,7 +209,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) { ...@@ -209,7 +209,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
} }
if (iaView::REQUEST_XML == $iaView->getRequestType()) { if (iaView::REQUEST_XML == $iaView->getRequestType()) {
$iaListing = $iaCore->factoryModule('listing', IA_CURRENT_MODULE); $iaListing = $iaCore->factoryItem('listing');
$limit = (int)$iaCore->get('directory_listings_perpage', 10); $limit = (int)$iaCore->get('directory_listings_perpage', 10);
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<summary>This package is intended to create web directory on your Subrion powered website.</summary> <summary>This package is intended to create web directory on your Subrion powered website.</summary>
<author>Intelliants LLC</author> <author>Intelliants LLC</author>
<contributor>Intelliants LLC</contributor> <contributor>Intelliants LLC</contributor>
<version>4.1.3</version> <version>4.2.0</version>
<date>2017-04-27</date> <date>2017-10-18</date>
<compatibility>4.1.3.12</compatibility> <compatibility>4.2.0</compatibility>
<url>listings</url> <url>listings</url>
<screenshots> <screenshots>
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
</screenshots> </screenshots>
<items> <items>
<item pages="favorites,view_member" main="view_listing,add_listing,edit_listing">listings</item> <item table_name="listings" pages="favorites,view_member" main="view_listing,add_listing,edit_listing">listing</item>
<item payable="0">categs</item> <item table_name="categs" payable="0">categ</item>
</items> </items>
<actions> <actions>
...@@ -122,7 +122,6 @@ ...@@ -122,7 +122,6 @@
<config group="directory" name="directory_listings_featured_limit" type="text" description="Listings in Featured block">6</config> <config group="directory" name="directory_listings_featured_limit" type="text" description="Listings in Featured block">6</config>
<config group="directory" name="directory_listings_sponsored_limit" type="text" description="Listings in Sponsored block">6</config> <config group="directory" name="directory_listings_sponsored_limit" type="text" description="Listings in Sponsored block">6</config>
<emails> <emails>
<email description="Directory" divider="1"><![CDATA[]]></email> <email description="Directory" divider="1"><![CDATA[]]></email>
<email name="new_active_listing" <email name="new_active_listing"
...@@ -204,31 +203,31 @@ ...@@ -204,31 +203,31 @@
</emails> </emails>
<fields_groups> <fields_groups>
<group item="listings" name="general" title="General"><![CDATA[]]></group> <group item="listing" name="general" title="General"><![CDATA[]]></group>
<group item="categs" name="general" title="General"><![CDATA[]]></group> <group item="categ" name="general" title="General"><![CDATA[]]></group>
</fields_groups> </fields_groups>
<fields> <fields>
<field name="title" item="listings" type="text" group="general" length="70" required="1" multilingual="1" <field name="title" item="listing" type="text" group="general" length="70" required="1" multilingual="1"
page="add_listing,edit_listing,view_member,view_listing,favorites,rss_listings">Title</field> page="add_listing,edit_listing,view_member,view_listing,favorites,rss_listings">Title</field>
<field name="url" item="listings" type="text" group="general" length="70" required="1" default="http://" <field name="url" item="listing" type="text" group="general" length="70" required="1" default="http://"
page="add_listing,edit_listing,view_member,view_listing,favorites,rss_listings">URL</field> page="add_listing,edit_listing,view_member,view_listing,favorites,rss_listings">URL</field>
<field name="description" item="listings" type="textarea" group="general" editor="1" required="1" multilingual="1" <field name="description" item="listing" type="textarea" group="general" editor="1" required="1" multilingual="1"
page="add_listing,edit_listing,view_listing,rss_listings">Description</field> page="add_listing,edit_listing,view_listing,rss_listings">Description</field>
<field name="reciprocal" item="listings" type="text" group="general" length="70" default="http://" <field name="reciprocal" item="listing" type="text" group="general" length="70" default="http://"
page="add_listing,edit_listing,view_listing,favorites">Reciprocal URL</field> page="add_listing,edit_listing,view_listing,favorites">Reciprocal URL</field>
<field name="email" item="listings" type="text" group="general" length="70" <field name="email" item="listing" type="text" group="general" length="70"
page="add_listing,edit_listing">Email</field> page="add_listing,edit_listing">Email</field>
<field name="meta_description" item="listings" type="textarea" group="general" editor="0" adminonly="1" multilingual="1">Meta-Description</field> <field name="meta_description" item="listing" type="textarea" group="general" editor="0" adminonly="1" multilingual="1">Meta-Description</field>
<field name="meta_keywords" item="listings" type="text" group="general" length="70" required="0" adminonly="1" multilingual="1">Meta-Keywords</field> <field name="meta_keywords" item="listing" type="text" group="general" length="70" required="0" adminonly="1" multilingual="1">Meta-Keywords</field>
<field name="title" item="categs" type="text" group="general" length="70" required="1" searchable="1" multilingual="1" <field name="title" item="categ" type="text" group="general" length="70" required="1" searchable="1" multilingual="1"
page="directory_home,rss_listings">Title</field> page="directory_home,rss_listings">Title</field>
<field name="description" item="categs" type="textarea" group="general" editor="1" required="0" searchable="1" <field name="description" item="categ" type="textarea" group="general" editor="1" required="0" searchable="1"
page="directory_home,rss_listings" multilingual="1">Description</field> page="directory_home,rss_listings" multilingual="1">Description</field>
<field name="meta_description" item="categs" type="textarea" group="general" editor="0" required="0" adminonly="1" multilingual="1">Meta-Description</field> <field name="meta_description" item="categ" type="textarea" group="general" editor="0" required="0" adminonly="1" multilingual="1">Meta-Description</field>
<field name="meta_keywords" item="categs" type="text" group="general" length="70" required="0" adminonly="1" multilingual="1">Meta-Keywords</field> <field name="meta_keywords" item="categ" type="text" group="general" length="70" required="0" adminonly="1" multilingual="1">Meta-Keywords</field>
<field name="icon" item="categs" type="iconpicker" group="general" default="fa-folder" adminonly="1" page="directory_home">Icon</field> <field name="icon" item="categ" type="iconpicker" group="general" default="fa-folder" adminonly="1" page="directory_home">Icon</field>
</fields> </fields>
<phrases> <phrases>
...@@ -264,13 +263,13 @@ ...@@ -264,13 +263,13 @@
<phrase category="common" key="alexa_rank">Alexa Rank</phrase> <phrase category="common" key="alexa_rank">Alexa Rank</phrase>
<phrase category="common" key="all_listings_num">Number of all listings</phrase> <phrase category="common" key="all_listings_num">Number of all listings</phrase>
<phrase category="common" key="are_you_sure_to_delete_selected_listing">Are you sure you wish to delete this listing?</phrase> <phrase category="common" key="are_you_sure_to_delete_selected_listing">Are you sure you wish to delete this listing?</phrase>
<phrase category="common" key="categs">Categories</phrase> <phrase category="common" key="categ">Category</phrase>
<phrase category="common" key="categories">Categories</phrase> <phrase category="common" key="categories">Categories</phrase>
<phrase category="common" key="crossed_categories">Crossed categories</phrase> <phrase category="common" key="crossed_categories">Crossed categories</phrase>
<phrase category="common" key="directory">Directory</phrase> <phrase category="common" key="directory">Directory</phrase>
<phrase category="common" key="field_category_id">Category</phrase> <phrase category="common" key="field_category_id">Category</phrase>
<phrase category="common" key="limit">Limit</phrase> <phrase category="common" key="limit">Limit</phrase>
<phrase category="common" key="listings">Listings</phrase> <phrase category="common" key="listing">Listing</phrase>
<phrase category="common" key="listing_added">Listing added.</phrase> <phrase category="common" key="listing_added">Listing added.</phrase>
<phrase category="common" key="listing_added_waiting">Thank you. Your listing has been submitted for administrator consideration. </phrase> <phrase category="common" key="listing_added_waiting">Thank you. Your listing has been submitted for administrator consideration. </phrase>
<phrase category="common" key="listings_found">Listings found</phrase> <phrase category="common" key="listings_found">Listings found</phrase>
...@@ -351,7 +350,7 @@ ...@@ -351,7 +350,7 @@
<hook name="phpAdminDatabaseConsistencyType" page_type="admin" pages="database"> <hook name="phpAdminDatabaseConsistencyType" page_type="admin" pages="database">
<![CDATA[ <![CDATA[
if ('repair_directorycats' == $type) { if ('repair_directorycats' == $type) {
$iaCateg = $iaCore->factoryModule('categ', 'directory', iaCore::ADMIN); $iaCateg = $iaCore->factoryItem('categ');
$iaCateg->rebuild(); $iaCateg->rebuild();
$iaCateg->syncLinkingData(); $iaCateg->syncLinkingData();
...@@ -374,7 +373,7 @@ switch ($option) { ...@@ -374,7 +373,7 @@ switch ($option) {
break; break;
case 'categs': case 'categs':
$iaCore->factoryModule('categ', 'directory', iaCore::ADMIN)->resetDbStructure(); $iaCore->factoryItem('categ')->resetDbStructure();
} }
]]> ]]>
</hook> </hook>
...@@ -382,7 +381,7 @@ switch ($option) { ...@@ -382,7 +381,7 @@ switch ($option) {
<![CDATA[ <![CDATA[
{if !empty($directory_categories)} {if !empty($directory_categories)}
<div class="ia-categories"> <div class="ia-categories">
{include 'ia-categories.tpl' categories=$directory_categories item='categs' id='directory-categories' show_amount=$core.config.directory_show_amount|default:true num_columns=$core.config.directory_categories_columns icons=true} {include 'ia-categories.tpl' categories=$directory_categories item='categ' id='directory-categories' show_amount=$core.config.directory_show_amount|default:true num_columns=$core.config.directory_categories_columns icons=true}
</div> </div>
{/if} {/if}
]]> ]]>
...@@ -487,7 +486,7 @@ CREATE TABLE IF NOT EXISTS `{prefix}listings`( ...@@ -487,7 +486,7 @@ CREATE TABLE IF NOT EXISTS `{prefix}listings`(
</sql> </sql>
<code> <code>
<![CDATA[ <![CDATA[
$iaCore->factoryModule('categ', 'directory', iaCore::ADMIN)->setupDbStructure(); $iaCore->factoryModule('categ', 'directory')->setupDbStructure();
]]> ]]>
</code> </code>
</install> </install>
......
Ext.onReady(function () { Ext.onReady(function () {
if (Ext.get('js-grid-placeholder')) { if (Ext.get('js-grid-placeholder')) {
var grid = new IntelliGrid( var grid = new IntelliGrid({
{ columns: [
columns: [ 'selection',
'selection', {name: 'title', title: _t('title'), width: 1, editor: 'text'},
{name: 'title', title: _t('title'), width: 1, editor: 'text'}, {
{ name: 'parent_title',
name: 'parent_title', title: _t('parent_category'),
title: _t('parent_category'), renderer: function (value, metadata, record) {
renderer: function (value, metadata, record) { return (record.data.level < 1)
return (record.data.level < 1) ? value
? value : '<a href="' + window.location.href + 'edit/' + record.data.parent_id + '/">' + value + '</a>'
: '<a href="' + window.location.href + 'edit/' + record.data.parent_id + '/">' + value + '</a>'
},
width: 1
},
{name: 'title_alias', title: _t('path'), width: 1},
{name: 'num_all_listings', title: _t('listings_num'), width: 140},
{
name: 'locked',
title: _t('locked'),
width: 60,
align: intelli.gridHelper.constants.ALIGN_CENTER,
renderer: intelli.gridHelper.renderer.check,
editor: Ext.create('Ext.form.ComboBox',
{
typeAhead: false,
editable: false,
lazyRender: true,
store: Ext.create('Ext.data.SimpleStore', {
fields: ['value', 'title'],
data: [[0, _t('no')], [1, _t('yes')]]
}),
displayField: 'title',
valueField: 'value'
})
}, },
{name: 'date_added', title: _t('date_added'), width: 100, hidden: true}, width: 1
{name: 'date_modified', title: _t('date_modified'), width: 100, hidden: true}, },
'status', {name: 'title_alias', title: _t('path'), width: 1},
'update', {name: 'num_all_listings', title: _t('listings_num'), width: 140},
'delete' {
], name: 'locked',
fields: ['parent_id', 'level'], title: _t('locked'),
texts: { width: 60,
delete_multiple: _t('are_you_sure_to_delete_selected_categs'), align: intelli.gridHelper.constants.ALIGN_CENTER,
delete_single: _t('are_you_sure_to_delete_selected_categ') renderer: intelli.gridHelper.renderer.check,
} editor: Ext.create('Ext.form.ComboBox', {
}, false); typeAhead: false,
editable: false,
lazyRender: true,
store: Ext.create('Ext.data.SimpleStore', {
fields: ['value', 'title'],
data: [[0, _t('no')], [1, _t('yes')]]
}),
displayField: 'title',
valueField: 'value'
})
},
{name: 'date_added', title: _t('date_added'), width: 100, hidden: true},
{name: 'date_modified', title: _t('date_modified'), width: 100, hidden: true},
'status',
'update',
'delete'
],
fields: ['parent_id', 'level'],
texts: {
delete_multiple: _t('are_you_sure_to_delete_selected_categs'),
delete_single: _t('are_you_sure_to_delete_selected_categ')
}