From d2d58451cffa1d266dd0d035da7e239d389cce85 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 23 Jan 2014 15:56:53 -0800 Subject: [PATCH] Fix for media-browser carousel issue. Fix for bbcode Youtube insert. Added [video] bbcode. --- e107_admin/header.php | 8 +- e107_admin/image.php | 90 +++++++++++-------- e107_core/bbcodes/bb_video.php | 41 +++++++++ .../shortcodes/batch/bbcode_shortcodes.php | 15 +++- .../shortcodes/batch/news_shortcodes.php | 22 ++++- e107_handlers/bbcode_handler.php | 4 +- e107_handlers/form_handler.php | 14 +-- e107_handlers/media_class.php | 10 ++- e107_plugins/social/e_shortcode.php | 6 +- e107_web/js/core/all.jquery.js | 2 +- e107_web/js/core/mediaManager.js | 53 ++++++----- 11 files changed, 185 insertions(+), 80 deletions(-) create mode 100644 e107_core/bbcodes/bb_video.php diff --git a/e107_admin/header.php b/e107_admin/header.php index c21c3df00..84b67dad0 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -456,15 +456,17 @@ e107::getJs()->renderJs('header', 4); e107::getJs()->renderJs('header_inline', 4); // ---------- Favicon --------- -if (file_exists(THEME."favicon.ico")) + +$sitetheme = e107::getPref('sitetheme'); +if (file_exists(e_THEME.$sitetheme."/favicon.ico")) { - echo "\n\n"; + echo "\n\n"; } elseif (file_exists(e_BASE."favicon.ico")) { echo "\n\n"; } - +unset($sitetheme); // // G: Send Theme Headers // diff --git a/e107_admin/image.php b/e107_admin/image.php index 83f34d63c..32467544a 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -1010,7 +1010,7 @@ class media_admin_ui extends e_admin_ui function mediaSelectUpload($type='image') { $frm = e107::getForm(); - + $videoActive = 'inactive'; $options = array(); $options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE; @@ -1018,13 +1018,17 @@ class media_admin_ui extends e_admin_ui $text = " -
-
+
"; -
- - "; + if($this->getQuery('bbcode') != 'video') + { + $text .= "
+
"; + + $text .= $this->imageTab($type,$options); + + $text .= "
"; + } + - $tag = ($options['bbcode']) ? "" : $this->getQuery('tagid'); - - if(varset($_GET['w'])) - { - $options['w'] = intval($_GET['w']); - } - - if($type == 'file') - { - $this->perPage = 0; - $this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load(); - $text .= $this->getUI()->getList(); - } - else - { - $text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'), $options); // eg. news, news-thumbnail - } - - $text .= " -
-
- -
+ $text .= "
"; $this->fields['media_category']['readonly'] = TRUE; @@ -1175,7 +1163,7 @@ class media_admin_ui extends e_admin_ui if($this->getQuery('video') || $this->getQuery('bbcode') == 'video') { - $text .= "
"; + $text .= "
"; // $text .= "
"; $text .= $this->videoTab(); $text .= "
"; @@ -1219,6 +1207,36 @@ class media_admin_ui extends e_admin_ui return $text; } + + + + function imageTab($type,$options) + { + $tag = ($options['bbcode']) ? "" : $this->getQuery('tagid'); + + if(varset($_GET['w'])) + { + $options['w'] = intval($_GET['w']); + } + + if($type == 'file') + { + $this->perPage = 0; + $this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load(); + $text = $this->getUI()->getList(); + } + else + { + $text = e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'), $options); // eg. news, news-thumbnail + } + + return $text; + } + + + + + function glyphTab($parm='') @@ -1327,7 +1345,7 @@ class media_admin_ui extends e_admin_ui ); } - $parms = array('width' => 200, 'height'=>113, 'type'=>'image', 'tagid'=> $this->getQuery('tagid'), 'action'=>'youtube','searchPlaceholder'=>'Search Youtube'); + $parms = array('width' => 200, 'height'=>113, 'type'=>'image', 'bbcode'=>'video', 'tagid'=> $this->getQuery('tagid'), 'action'=>'youtube','searchPlaceholder'=>'Search Youtube'); $text = e107::getMedia()->browserCarousel($items, $parms); diff --git a/e107_core/bbcodes/bb_video.php b/e107_core/bbcodes/bb_video.php new file mode 100644 index 000000000..be2868484 --- /dev/null +++ b/e107_core/bbcodes/bb_video.php @@ -0,0 +1,41 @@ +toVideo($code_text); + } + + +} + + + + + + + +?> \ No newline at end of file diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index 2677d67e4..565eb1fbf 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -124,11 +124,22 @@ class bbcode_shortcodes extends e_shortcode function bb_youtube($id) { + if($this->var['tagid'] == 'data_') // BC work-around for duplicate IDs. + { + $tag = "data"; + } + else + { + list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. + } + + + $data = "[youtube]*[/youtube]"; $event = $this->getEvent('addinput',$data,LANHELP_48); - $text = ""; + // $text = ""; // $text .=""; - + $text = ""; $text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48); $text .= ""; diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 9d97f4114..dd0659bc0 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -29,10 +29,17 @@ class news_shortcodes extends e_shortcode protected $e107; //protected $param; - shouldn't be set - see __set/__get methods of e_shortcode & news::render_newsitem() + protected $commentsDisabled; + + function __construct($eVars = null) { parent::__construct($eVars); $this->e107 = e107::getInstance(); + + $pref = e107::getPref(); + + $this->commentsDisabled = vartrue($pref['comments_disabled']); } function sc_newstitle() @@ -88,11 +95,11 @@ class news_shortcodes extends e_shortcode $pref = e107::getPref(); $sql = e107::getDb(); - if($pref['comments_disabled'] == 1) + if($this->commentsDisabled) { - return "Disabled"; + return; } - + $news_item = $this->news_item; $param = $this->param; @@ -192,6 +199,10 @@ class news_shortcodes extends e_shortcode */ function sc_newscommentlink($parm) { + if($this->commentsDisabled) + { + return; + } $class = varset($parm['class']) ? " ".$parm['class'] : ""; $text = ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : "news_item)."'>".$this->param['commentlink'].''); @@ -203,6 +214,11 @@ class news_shortcodes extends e_shortcode */ function sc_newscommentcount($parm) { + if($this->commentsDisabled) + { + return; + } + $text = varset($parm['glyph']) ? e107::getParser()->toGlyph($parm['glyph']) : ""; $text .= $this->news_item['news_comment_total']; return $text; diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index ddf8f81ee..dab791619 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -42,9 +42,9 @@ class e_bbcode 'html', 'flash', 'link', 'email', 'url', 'quote', 'left', 'right', 'b', 'justify', 'file', 'stream', - 'textarea', 'list', 'php', 'time', + 'textarea', 'list', 'time', 'spoiler', 'hide', 'youtube', 'sanitised', - 'p', 'h', 'nobr', 'block','table','th', 'tr','tbody','td','markdown' + 'p', 'h', 'nobr', 'block','table','th', 'tr','tbody','td','markdown','video' ); foreach($this->core_bb as $c) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 77e572729..4786653fa 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -696,6 +696,7 @@ class e_form */ function userpicker($name_fld, $id_fld, $default_name, $default_id, $options = array()) { + $tp = e107::getParser(); if(!is_array($options)) parse_str($options, $options); $default_name = vartrue($default_name, ''); @@ -706,11 +707,13 @@ class e_form $fldid = $this->name2id($name_fld); $hidden_fldid = $this->name2id($id_fld); - $ret = $this->text($name_fld,$default_name,20, "class=e-tip&title=Type name of user&typeahead=users&readonly=".vartrue($options['readonly'])) - .$this->hidden($id_fld,$default_id, array('id' => $this->name2id($id_fld)))." id# ".$default_id.''; - $ret .= " reset"; + $ret = '
'; + $ret .= $this->text($name_fld,$default_name,20, "class=e-tip&title=Type name of user&typeahead=users&readonly=".vartrue($options['readonly'])) + .$this->hidden($id_fld,$default_id, array('id' => $this->name2id($id_fld)))."".$tp->toGlyph('fa-user')." ".$default_id.''; + $ret .= "reset +
"; - e107::getJs()->footerInline(" + e107::js('footer-inline', " \$('#{$fldid}').blur(function () { \$('#{$fldid}-id').html(\$('#{$hidden_fldid}').val()); }); @@ -718,6 +721,7 @@ class e_form \$('#{$fldid}-id').html('0'); \$('#{$hidden_fldid}').val(0); \$('#{$fldid}').val(''); + return false; }); "); @@ -3240,7 +3244,7 @@ class e_form if(!isset($parms['__options'])) $parms['__options'] = array(); if(!is_array($parms['__options'])) parse_str($parms['__options'], $parms['__options']); - if((empty($value) && vartrue($parms['currentInit'])) || vartrue($parms['current'])) + if((empty($value) && varset($parms['currentInit'],USERID)!==0) || vartrue($parms['current'])) // include current user by default. { $value = USERID; if(vartrue($parms['current'])) diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 655d9cfef..e7a1bb09a 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -1025,7 +1025,8 @@ class e_media 'previewUrl' => $defaultThumb , 'thumbUrl' => $defaultThumb, 'title' => '', - 'gridClass' => 'span2' + 'gridClass' => 'span2', + 'bbcode' => '' ); @@ -1044,7 +1045,7 @@ class e_media \n\n" : ""; - $text .= "\n\n
 
\n\n"; + $text .= "
"; + $text .= "\n\n
 
\n\n"; + if(!e_AJAX_REQUEST) { $text .= "
"; diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index 0505b8828..df94cdb9a 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -72,10 +72,10 @@ class social_shortcodes extends e_shortcode $tp = e107::getParser(); $url = varset($parm['url'], e_REQUEST_URL); - $title = varset($parm['title'], deftrue('e_PAGETITLE')); + $title = varset($parm['title'], deftrue('e_PAGETITLE'). " | ". SITENAME ) ; $description = varset($parm['title'], e107::getUrl()->response()->getMetaDescription()); $media = ""; - $label = varset($parm['label'], defset('LAN_SHARE',"Share")); + $label = varset($parm['label'], $tp->toGlyph('icon-share')." ".defset('LAN_SHARE',"Share")); $size = varset($parm['size'],'md'); @@ -127,7 +127,7 @@ class social_shortcodes extends e_shortcode $dir = ($parm['dropdown'] == 'right') ? 'pull-right' : ''; $text = '
- '.$label.' + '.$label.'