mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Inline editing of keywords enabled on admin newspost. Fixes empty space between tags in database (causing issues with 'related' SQL queries).
This commit is contained in:
@@ -391,7 +391,7 @@ class news_admin_ui extends e_admin_ui
|
||||
'news_body' => array('title' => "", 'type' => 'method', 'tab'=>0, 'nolist'=>true, 'writeParms'=>'nolabel=1','data'=>'str', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_extended' => array('title' => "", 'type' => null, 'tab'=>0, 'nolist'=>true, 'writeParms'=>'nolabel=1','data'=>'str', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
||||
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'tags', 'tab'=>1, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'tags', 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'textarea', 'tab'=>1, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'tab'=>1, 'writeParms'=>'size=xxlarge', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_ping' => array('title' => LAN_PING, 'type' => 'checkbox', 'tab'=>1, 'data'=>false, 'writeParms'=>'value=0', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
@@ -1603,8 +1603,12 @@ function update_706_to_800($type='')
|
||||
e107::getSingleton('e107plugin')->refresh('page');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Clean up news keywords. - remove spaces between commas.
|
||||
if($sql->select('news', 'news_id', "news_meta_keywords LIKE '%, %' LIMIT 1"))
|
||||
{
|
||||
if ($just_check) return update_needed('News keywords contain spaces between commas and needs to be updated. ');
|
||||
$sql->update('news', "news_meta_keywords = REPLACE(news_meta_keywords, ', ', ',')");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -2748,6 +2748,8 @@ class e_form
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$tags = str_replace(', ',',', $tags); //BC Fix, all tags should be comma separated without spaces ie. one,two NOT one, two
|
||||
|
||||
if(!varset($parm['limit']))
|
||||
{
|
||||
@@ -3245,18 +3247,26 @@ class e_form
|
||||
if(empty($value))
|
||||
{
|
||||
$value = '-';
|
||||
$emptyValue = "data-value=''";
|
||||
$setValue = "data-value=''";
|
||||
}
|
||||
else
|
||||
{
|
||||
$emptyValue = "";
|
||||
$setValue = "";
|
||||
|
||||
if($attributes['type'] == 'tags' && !empty($value))
|
||||
{
|
||||
$setValue = "data-value='".$value."'";
|
||||
$value = str_replace(",", ", ", $value); // add spaces so it wraps, but don't change the actual values.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
|
||||
{
|
||||
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
|
||||
$value = "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='".$field."' title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='text' data-pk='".$id."' ".$emptyValue." data-url='".e_SELF."?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>";
|
||||
$value = "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='".$field."' title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='text' data-pk='".$id."' ".$setValue." data-url='".e_SELF."?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>";
|
||||
}
|
||||
|
||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||
|
4
e107_web/js/bootstrap-tag/bootstrap-tag.js
vendored
4
e107_web/js/bootstrap-tag/bootstrap-tag.js
vendored
@@ -138,13 +138,13 @@
|
||||
this.values.push(value)
|
||||
this.createBadge(value)
|
||||
|
||||
this.element.val(this.values.join(', '))
|
||||
this.element.val(this.values.join(','))
|
||||
}
|
||||
, remove: function ( index ) {
|
||||
if ( index >= 0 ) {
|
||||
this.values.splice(index, 1)
|
||||
this.element.siblings('.tag:eq(' + index + ')').remove()
|
||||
this.element.val(this.values.join(', '))
|
||||
this.element.val(this.values.join(','))
|
||||
}
|
||||
}
|
||||
, process: function () {
|
||||
|
Reference in New Issue
Block a user