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

Adaptation to the core v4.2

parent 39e41a98
......@@ -20,7 +20,6 @@
class iaBackendController extends iaAbstractControllerModuleBackend
{
protected $_name = 'categories';
protected $_itemName = 'categs';
protected $_helperName = 'categ';
......@@ -168,7 +167,7 @@ SQL;
case 'pre_recount_listings':
$this->getHelper()->resetCounters();
$this->_iaCore->factoryModule('listing', $this->getModuleName(), iaCore::ADMIN);
$this->_iaCore->factoryItem('listing');
$output['total'] = $this->_iaDb->one(iaDb::STMT_COUNT_ROWS,
iaDb::convertIds(iaCore::STATUS_ACTIVE, 'status'), iaListing::getTable());
}
......
......@@ -20,13 +20,12 @@
class iaBackendController extends iaAbstractControllerModuleBackend
{
protected $_name = 'listings';
protected $_itemName = 'listings';
protected $_helperName = 'listing';
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 $_gridSorting = ['member' => ['fullname', 'm']];
protected $_gridSorting = ['member' => ['fullname', 'm'], 'category_title' => ['title', 'c', 'categ']];
protected $_gridQueryMainTableAlias = 'l';
protected $_tooltipsEnabled = true;
......@@ -40,11 +39,10 @@ class iaBackendController extends iaAbstractControllerModuleBackend
public function init()
{
$this->_iaCateg = $this->_iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN);
$this->_gridSorting['category_title'] = ['title_' . $this->_iaCore->language['iso'], 'c'];
$this->_iaCateg = $this->_iaCore->factoryItem('categ');
}
protected function _modifyGridParams(&$conditions, &$values, array $params)
protected function _gridModifyParams(&$conditions, &$values, array $params)
{
if (!empty($params['text'])) {
$langCode = $this->_iaCore->language['iso'];
......
<ul>
<li>Version: 4.2.0
<ul>
<li>Adapted to the core v4.2</li>
</ul>
</li>
<li>Version: 4.1.3
<ul>
<li>Bug #21: Consistency recount does not work</li>
......
......@@ -24,11 +24,13 @@ class iaCateg extends iaAbstractHelperCategoryFlat implements iaDirectoryModule
protected $_moduleName = 'directory';
protected $_itemName = 'categs';
protected $_itemName = 'categ';
protected $_statuses = [iaCore::STATUS_ACTIVE, iaCore::STATUS_INACTIVE];
protected $_activityLog = ['item' => 'category'];
protected $_slugColumnName = 'title_alias';
protected $_recountOptions = [
'listingsTable' => 'listings'
];
......
......@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
protected static $_table = 'listings';
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];
......@@ -66,7 +66,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
public function updateCounters($itemId, array $itemData, $action, $previousData = null)
{
$this->_checkIfCountersNeedUpdate($action, $itemData, $previousData,
$this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN));
$this->iaCore->factoryItem('categ'));
$this->_checkCrossedLinksCounters($itemId, $itemData, $previousData, $action);
switch ($action) {
......@@ -108,7 +108,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
}
if (isset($diff)) {
$iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN);
$iaCateg = $this->iaCore->factoryItem('categ');
foreach ($crossedLinks as $entry) {
$iaCateg->recountById($entry['category_id'], $diff);
......@@ -118,7 +118,7 @@ class iaListing extends abstractDirectoryModuleAdmin implements iaDirectoryModul
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());
......@@ -273,7 +273,7 @@ SQL;
public function getTreeVars(array $entryData)
{
$iaCateg = $this->iaCore->factoryModule('categ', $this->getModuleName(), iaCore::ADMIN);
$iaCateg = $this->iaCore->factoryItem('categ');
$category = empty($entryData['category_id'])
? $iaCateg->getRoot()
......
......@@ -24,11 +24,7 @@ class iaCateg extends iaAbstractFrontHelperCategoryFlat
protected $_moduleName = 'directory';
protected $_itemName = 'categs';
protected $_urlPatterns = [
'default' => ':base:title_alias'
];
protected $_itemName = 'categ';
public $coreSearchEnabled = true;
public $coreSearchOptions = [
......@@ -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'))
? IA_URL
: $this->iaCore->modulesData[$this->getModuleName()]['url'];
$slug = isset($data['category_alias'])
? $data['category_alias']
: $data['title_alias'];
......@@ -129,7 +126,7 @@ SQL;
protected function _getCrossed($where)
{
$this->iaCore->factoryModule('listing', $this->getModuleName());
$this->iaCore->factoryItem('listing');
$sql = <<<SQL
SELECT c.`id`, c.`title_:lang` `title`
......
......@@ -22,7 +22,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul
protected static $_table = 'listings';
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];
......@@ -53,7 +53,7 @@ class iaListing extends abstractDirectoryModuleFront implements iaDirectoryModul
{
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')
? IA_URL
......
......@@ -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())) {
include_once IA_MODULES . 'directory/includes/alexarank.inc.php';
......
......@@ -18,8 +18,8 @@
******************************************************************************/
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$iaListing = $iaCore->factoryModule('listing', 'directory');
$iaCateg = $iaCore->factoryModule('categ', $iaListing->getModuleName());
$iaListing = $iaCore->factoryItem('listing');
$iaCateg = $iaCore->factoryItem('categ');
// set default values for blocks to avoid isset validation
$blocksData = ['recent' => [], 'featured' => [], 'sponsored' => []];
......
......@@ -17,7 +17,7 @@
*
******************************************************************************/
$iaCateg = $iaCore->factoryModule('categ', IA_CURRENT_MODULE);
$iaCateg = $iaCore->factoryItem('categ');
if (iaView::REQUEST_JSON == $iaView->getRequestType()) {
$output = [];
......@@ -54,7 +54,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$order = '';
$iaListing = $iaCore->factoryModule('listing', IA_CURRENT_MODULE);
$iaListing = $iaCore->factoryItem('listing');
$listings = [];
$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()) {
}
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);
......
......@@ -4,9 +4,9 @@
<summary>This package is intended to create web directory on your Subrion powered website.</summary>
<author>Intelliants LLC</author>
<contributor>Intelliants LLC</contributor>
<version>4.1.3</version>
<date>2017-04-27</date>
<compatibility>4.1.3.12</compatibility>
<version>4.2.0</version>
<date>2017-10-18</date>
<compatibility>4.2.0</compatibility>
<url>listings</url>
<screenshots>
......@@ -21,8 +21,8 @@
</screenshots>
<items>
<item pages="favorites,view_member" main="view_listing,add_listing,edit_listing">listings</item>
<item payable="0">categs</item>
<item table_name="listings" pages="favorites,view_member" main="view_listing,add_listing,edit_listing">listing</item>
<item table_name="categs" payable="0">categ</item>
</items>
<actions>
......@@ -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_sponsored_limit" type="text" description="Listings in Sponsored block">6</config>
<emails>
<email description="Directory" divider="1"><![CDATA[]]></email>
<email name="new_active_listing"
......@@ -204,31 +203,31 @@
</emails>
<fields_groups>
<group item="listings" name="general" title="General"><![CDATA[]]></group>
<group item="categs" name="general" title="General"><![CDATA[]]></group>
<group item="listing" name="general" title="General"><![CDATA[]]></group>
<group item="categ" name="general" title="General"><![CDATA[]]></group>
</fields_groups>
<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>
<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>
<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>
<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>
<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>
<field name="meta_description" item="listings" 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_description" item="listing" type="textarea" group="general" editor="0" adminonly="1" multilingual="1">Meta-Description</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>
<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>
<field name="meta_description" item="categs" 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="icon" item="categs" type="iconpicker" group="general" default="fa-folder" adminonly="1" page="directory_home">Icon</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="categ" type="text" group="general" length="70" required="0" adminonly="1" multilingual="1">Meta-Keywords</field>
<field name="icon" item="categ" type="iconpicker" group="general" default="fa-folder" adminonly="1" page="directory_home">Icon</field>
</fields>
<phrases>
......@@ -264,13 +263,13 @@
<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="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="crossed_categories">Crossed categories</phrase>
<phrase category="common" key="directory">Directory</phrase>
<phrase category="common" key="field_category_id">Category</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_waiting">Thank you. Your listing has been submitted for administrator consideration. </phrase>
<phrase category="common" key="listings_found">Listings found</phrase>
......@@ -351,7 +350,7 @@
<hook name="phpAdminDatabaseConsistencyType" page_type="admin" pages="database">
<![CDATA[
if ('repair_directorycats' == $type) {
$iaCateg = $iaCore->factoryModule('categ', 'directory', iaCore::ADMIN);
$iaCateg = $iaCore->factoryItem('categ');
$iaCateg->rebuild();
$iaCateg->syncLinkingData();
......@@ -374,7 +373,7 @@ switch ($option) {
break;
case 'categs':
$iaCore->factoryModule('categ', 'directory', iaCore::ADMIN)->resetDbStructure();
$iaCore->factoryItem('categ')->resetDbStructure();
}
]]>
</hook>
......@@ -382,7 +381,7 @@ switch ($option) {
<![CDATA[
{if !empty($directory_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>
{/if}
]]>
......@@ -487,7 +486,7 @@ CREATE TABLE IF NOT EXISTS `{prefix}listings`(
</sql>
<code>
<![CDATA[
$iaCore->factoryModule('categ', 'directory', iaCore::ADMIN)->setupDbStructure();
$iaCore->factoryModule('categ', 'directory')->setupDbStructure();
]]>
</code>
</install>
......
Ext.onReady(function () {
if (Ext.get('js-grid-placeholder')) {
var grid = new IntelliGrid(
{
var grid = new IntelliGrid({
columns: [
'selection',
{name: 'title', title: _t('title'), width: 1, editor: 'text'},
......@@ -23,8 +22,7 @@ Ext.onReady(function () {
width: 60,
align: intelli.gridHelper.constants.ALIGN_CENTER,
renderer: intelli.gridHelper.renderer.check,
editor: Ext.create('Ext.form.ComboBox',
{
editor: Ext.create('Ext.form.ComboBox', {
typeAhead: false,
editable: false,
lazyRender: true,
......@@ -101,7 +99,7 @@ Ext.onReady(function () {
data: {
data: function (n) {
var params = {};
if (n.id != '#') params.id = n.id;
if (n.id !== '#') params.id = n.id;
return params;
},
......@@ -146,11 +144,11 @@ Ext.onReady(function () {
intelli.titleCache = '';
intelli.fillUrlBox = function () {
var alias = $('#field_title_alias').val();
var title = ('' == alias ? $('input:first', '#title_fieldzone').val() : alias);
var title = (alias ? alias : $('#field_categ_title').val());
var category = $('#input-tree').val();
var cache = title + '%%' + category;
if ('' !== title && intelli.titleCache != cache) {
if ('' !== title && intelli.titleCache !== cache) {
$.get(intelli.config.admin_url + '/directory/categories/slug.json', {
title: title,
category: category
......@@ -165,6 +163,6 @@ intelli.fillUrlBox = function () {
intelli.titleCache = cache;
};
$(function () {
$('#title_fieldzone input:first, #field_title_alias').blur(intelli.fillUrlBox).blur();
$(function() {
$('#field_categ_title, #field_title_alias').blur(intelli.fillUrlBox).blur();
});
\ No newline at end of file
$(function () {
$(function() {
$('#js-cmd-recount-listings').on('click', function (e) {
e.preventDefault();
......
Ext.onReady(function () {
Ext.onReady(function() {
if (Ext.get('js-grid-placeholder')) {
var grid = new IntelliGrid(
{
var grid = new IntelliGrid({
columns: [
'selection',
{name: 'id', title: _t('id'), width: 50},
......@@ -13,14 +12,12 @@ Ext.onReady(function () {
{name: 'date_added', title: _t('date_added'), width: 100},
{name: 'date_modified', title: _t('date_modified'), width: 100},
'status',
{
name: 'reported_as_broken', title: _t('broken'), icon: 'info', click: function (node) {
{name: 'reported_as_broken', title: _t('broken'), icon: 'info', click: function (node) {
Ext.MessageBox.alert(
_t('reported_as_broken_comments'),
node.data.reported_as_broken_comments.replace(/(?:\r\n|\r|\n)/g, '<br />')
)
}
},
}},
'update',
'delete'
],
......@@ -94,7 +91,7 @@ Ext.onReady(function () {
}
}
else {
$('#field_listings_title').keyup(function () {
$('#field_listing_title').keyup(function () {
if ($(this).val()) {
$('#title_alias').show();
}
......@@ -155,7 +152,7 @@ Ext.onReady(function () {
});
}
$('#field_listings_title, #field_title_alias').blur(intelli.fillUrlBox).trigger('blur');
$('#field_listing_title, #field_title_alias').blur(intelli.fillUrlBox).trigger('blur');
$('input[name="reported_as_broken"]').change(function () {
var $comments = $('#reported-as-broken-comments');
......@@ -167,13 +164,13 @@ Ext.onReady(function () {
intelli.titleCache = '';
intelli.fillUrlBox = function () {
var titleAlias = $('#field_title_alias').val();
var title = ('' == titleAlias ? $('#field_listings_title').val() : titleAlias);
var title = (titleAlias ? titleAlias : $('#field_listing_title').val());
var category = $('#input-tree').val();
var id = $('#js-listing-id').val();
var cache = title + '%%' + category;
if ('' != title && intelli.titleCache != cache) {
if (title && intelli.titleCache !== cache) {
var params = {title: title, category: category, id: id};
if (titleAlias) params.alias = 1;
......
......@@ -17,7 +17,7 @@
*
******************************************************************************/
$iaCateg = $iaCore->factoryModule('categ', IA_CURRENT_MODULE);
$iaCateg = $iaCore->factoryItem('categ');
if (iaView::REQUEST_JSON == $iaView->getRequestType()) {
if (1 == count($iaCore->requestPath) && 'tree' == $iaCore->requestPath[0]) {
......@@ -29,7 +29,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$iaField = $iaCore->factory('field');
$iaUtil = $iaCore->factory('util');
$iaListing = $iaCore->factoryModule('listing', IA_CURRENT_MODULE);
$iaListing = $iaCore->factoryItem('listing');
iaBreadcrumb::replace(iaLanguage::get(IA_CURRENT_MODULE),
$iaCore->factory('page', iaCore::FRONT)->getUrlByName('directory_home'), 2);
......
......@@ -17,7 +17,7 @@
*
******************************************************************************/
$iaListing = $iaCore->factoryModule('listing', IA_CURRENT_MODULE);
$iaListing = $iaCore->factoryItem('listing');
if (iaView::REQUEST_JSON == $iaView->getRequestType()) {
if ('report' == $_POST['action']) {
......@@ -101,7 +101,7 @@ if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
// iaUtil::go_to($validUrl);
// }
$iaCateg = $iaCore->factoryModule('categ', IA_CURRENT_MODULE);
$iaCateg = $iaCore->factoryItem('categ');
$category = $iaCateg->getById($listing['category_id']);
$iaView->assign('category', $category);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment