From eb40a9ac15ab4d3b75ac9abdfc41f65733b89a6c Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 31 May 2016 13:04:05 -0700 Subject: [PATCH] Added Experimental Inline editing for news items. --- e107_handlers/news_class.php | 22 +++++++++++++++++++++- e107_web/css/e107.css | 3 +++ e107_web/js/inline.php | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php index 1ecd192da..cd83b0dbd 100644 --- a/e107_handlers/news_class.php +++ b/e107_handlers/news_class.php @@ -376,10 +376,30 @@ class news { $wrapperKey = (!empty($param['template_key'])) ? 'news/'.$param['template_key'].'/item' : 'news/view/item'; + $editable = array( + 'table' => 'news', + 'pid' => 'news_id', + 'vars' => 'news_item', + 'perms' => '0', + 'shortcodes' => array( + 'newstitle' => array('field'=>'news_title', 'type'=>'text', 'container'=>'span'), + 'newsmetadiz' => array('field'=>'news_meta_description','type'=>'text', 'container'=>'div'), + 'newsbody' => array('field'=>'news_body', 'type'=>'html', 'container'=>'div'), + ) + + ); + + // Aliases + $editable['shortcodes']['newstitlelink'] = $editable['shortcodes']['newstitle']; + $editable['shortcodes']['news_title'] = $editable['shortcodes']['newstitle']; + $editable['shortcodes']['news_body'] = $editable['shortcodes']['newsbody']; + + $sc = e107::getScBatch('news') ->wrapper($wrapperKey) ->setScVar('news_item', $news) - ->setScVar('param', $param); + ->setScVar('param', $param) + ->editable($editable); $text = e107::getParser()->parseTemplate($NEWS_PARSE, true, $sc); diff --git a/e107_web/css/e107.css b/e107_web/css/e107.css index 4a73fa353..7f66e062f 100644 --- a/e107_web/css/e107.css +++ b/e107_web/css/e107.css @@ -327,3 +327,6 @@ optgroup.level-5 { padding-left:4em } img.e-emoticon { vertical-align:middle; border:0; width:24px } .e-editable-front:hover { background-color:#FCF8E3 } +.e-editable-front a:hover { background-color:#FCF8E3 } +#uiAlert { z-index: 10001 } +#uiAlert .alert { z-index:10000; box-shadow:1px 4px 5px rgba(0,0,0,0.4) } \ No newline at end of file diff --git a/e107_web/js/inline.php b/e107_web/js/inline.php index 6e3f185fd..d823429b5 100644 --- a/e107_web/js/inline.php +++ b/e107_web/js/inline.php @@ -89,10 +89,11 @@ class e107InlineEdit $ret['msg'] = "Saved"; // LAN_UPDATED; or LAN_SAVED $ret['status'] = 'ok'; } - else + else //FIXME only display error when query fails.. { $ret['msg'] = "Saving Failed"; // LAN_UPDATED_FAILED; $ret['status'] = 'error'; + return false; }