mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Issue #2000 Enable news category to determine news category default template. Admin area completed. Frontend still to come.
This commit is contained in:
@@ -124,6 +124,8 @@ class news_cat_ui extends e_admin_ui
|
|||||||
protected $sortField = 'category_order';
|
protected $sortField = 'category_order';
|
||||||
protected $listOrder = "category_order ASC";
|
protected $listOrder = "category_order ASC";
|
||||||
|
|
||||||
|
protected $tabs = array(LAN_GENERAL, LAN_ADVANCED);
|
||||||
|
|
||||||
protected $fields = array(
|
protected $fields = array(
|
||||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||||
'category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
|
'category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
|
||||||
@@ -133,8 +135,9 @@ class news_cat_ui extends e_admin_ui
|
|||||||
'category_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE, 'writeParms'=>array('size'=>'xxlarge')),
|
'category_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE, 'writeParms'=>array('size'=>'xxlarge')),
|
||||||
'category_meta_keywords' => array('title'=> LAN_KEYWORDS, 'type' => 'tags', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
'category_meta_keywords' => array('title'=> LAN_KEYWORDS, 'type' => 'tags', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
||||||
'category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'readonly'=>FALSE, 'writeParms'=>array('size'=>'xxlarge', 'sef'=>'category_name')), // Display name
|
'category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'readonly'=>FALSE, 'writeParms'=>array('size'=>'xxlarge', 'sef'=>'category_name')), // Display name
|
||||||
'category_manager' => array('title'=> LAN_MANAGER,'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
|
'category_manager' => array('title'=> LAN_MANAGER,'type' => 'userclass', 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
|
||||||
'category_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
|
'category_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'tab'=>1, 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
|
||||||
|
'category_template' => array('title'=> LAN_TEMPLATE, 'type' => 'layouts', 'tab'=>1, 'width'=>'auto', 'thclass' => 'right', 'class'=> 'right', 'writeParms' => 'plugin=news&id=news&merge=0','help'=>'Template to use as the default view' ),
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center', 'sort' => true)
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center', 'sort' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -189,11 +192,17 @@ class news_cat_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sef = e107::getParser()->toDB($new_data['category_sef']);
|
$sef = e107::getParser()->toDB($new_data['category_sef']);
|
||||||
if(e107::getDb()->count('news_category', '(*)', "category_sef='{$sef}' AND category_id!=".intval($id)))
|
|
||||||
|
/* $message = "Error: sef: ".$sef." id: ".$id."\n";
|
||||||
|
$message .= print_r($new_data,true);
|
||||||
|
file_put_contents(e_LOG.'uiAjaxResponseInline.log', $message."\n\n", FILE_APPEND);*/
|
||||||
|
|
||||||
|
if(e107::getDb()->count('news_category', '(*)', "category_sef='{$sef}' AND category_id !=".intval($id)))
|
||||||
{
|
{
|
||||||
e107::getMessage()->addError(LAN_NEWS_65);
|
e107::getMessage()->addError(LAN_NEWS_65);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $new_data;
|
return $new_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -344,6 +344,7 @@ CREATE TABLE news_category (
|
|||||||
category_manager tinyint(3) unsigned NOT NULL default '254',
|
category_manager tinyint(3) unsigned NOT NULL default '254',
|
||||||
category_icon varchar(250) NOT NULL default '',
|
category_icon varchar(250) NOT NULL default '',
|
||||||
category_order tinyint(3) unsigned NOT NULL default '0',
|
category_order tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
category_template varchar(50) NOT NULL default '',
|
||||||
PRIMARY KEY (category_id),
|
PRIMARY KEY (category_id),
|
||||||
KEY category_order (category_order)
|
KEY category_order (category_order)
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
@@ -5496,7 +5496,21 @@ class e_form
|
|||||||
$where = vartrue($parms['area'], 'front'); //default is 'front'
|
$where = vartrue($parms['area'], 'front'); //default is 'front'
|
||||||
$filter = varset($parms['filter']);
|
$filter = varset($parms['filter']);
|
||||||
$merge = vartrue($parms['merge']) ? true : false;
|
$merge = vartrue($parms['merge']) ? true : false;
|
||||||
|
|
||||||
|
|
||||||
|
if($tmp = e107::getTemplateInfo($location,$ilocation, null,true,$merge)) // read xxxx_INFO array from template file.
|
||||||
|
{
|
||||||
|
$opt = array();
|
||||||
|
foreach($tmp as $k=>$inf)
|
||||||
|
{
|
||||||
|
$opt[$k] = $inf['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return vartrue($parms['pre'],'').$this->select($key,$opt,$value,$parms).vartrue($parms['post'],'');
|
||||||
|
}
|
||||||
|
|
||||||
$layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge, true);
|
$layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge, true);
|
||||||
|
|
||||||
if(varset($parms['default']) && !isset($layouts[0]['default']))
|
if(varset($parms['default']) && !isset($layouts[0]['default']))
|
||||||
{
|
{
|
||||||
$layouts[0] = array('default' => $parms['default']) + $layouts[0];
|
$layouts[0] = array('default' => $parms['default']) + $layouts[0];
|
||||||
|
Reference in New Issue
Block a user