1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +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:
Cameron
2015-06-09 15:46:45 -07:00
parent 6be9ee6504
commit ff896c52a0
4 changed files with 22 additions and 8 deletions

View File

@@ -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_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_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_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_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), 'news_ping' => array('title' => LAN_PING, 'type' => 'checkbox', 'tab'=>1, 'data'=>false, 'writeParms'=>'value=0', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),

View File

@@ -1603,8 +1603,12 @@ function update_706_to_800($type='')
e107::getSingleton('e107plugin')->refresh('page'); 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, ', ', ',')");
}

View File

@@ -2748,6 +2748,8 @@ class e_form
{ {
return; 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'])) if(!varset($parm['limit']))
{ {
@@ -3245,18 +3247,26 @@ class e_form
if(empty($value)) if(empty($value))
{ {
$value = '-'; $value = '-';
$emptyValue = "data-value=''"; $setValue = "data-value=''";
} }
else 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 if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{ {
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], '')); $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}&amp;action=inline&amp;id={$id}&amp;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}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
} }
$value = vartrue($parms['pre']).$value.vartrue($parms['post']); $value = vartrue($parms['pre']).$value.vartrue($parms['post']);

View File

@@ -138,13 +138,13 @@
this.values.push(value) this.values.push(value)
this.createBadge(value) this.createBadge(value)
this.element.val(this.values.join(', ')) this.element.val(this.values.join(','))
} }
, remove: function ( index ) { , remove: function ( index ) {
if ( index >= 0 ) { if ( index >= 0 ) {
this.values.splice(index, 1) this.values.splice(index, 1)
this.element.siblings('.tag:eq(' + index + ')').remove() this.element.siblings('.tag:eq(' + index + ')').remove()
this.element.val(this.values.join(', ')) this.element.val(this.values.join(','))
} }
} }
, process: function () { , process: function () {