diff --git a/e107_admin/image.php b/e107_admin/image.php index cc5b47a26..bbe4a1f5e 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -1382,7 +1382,7 @@ class media_admin_ui extends e_admin_ui $tp = e107::getParser(); $options = array(); - $options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE; + $options['bbcode'] = ($this->getQuery('bbcode')) ? $this->getQuery('bbcode') : FALSE; if(isset($_GET['from'])) { @@ -1400,6 +1400,13 @@ class media_admin_ui extends e_admin_ui 'core-media-glyphs' => array('caption'=> $tp->toGlyph('fa-flag')."Glyphs", 'method' => 'glyphTab'), ); + if(!empty($options['bbcode'])) + { + $tabOptions['core-media-img'] = $tabOptions['core-media-image']; + $tabOptions['core-media-glyph'] = $tabOptions['core-media-glyphs']; + + } + $tabs = array(); // check tab options against URL @@ -1415,13 +1422,27 @@ class media_admin_ui extends e_admin_ui } + if($options['bbcode'] === 'img') + { + $tabs['core-media-attributes'] = array('caption'=> $tp->toGlyph('fa-image').IMALAN_152, 'text' => $this->imageAttributesTab()); + } + if(getperms('A|A1')) { $tabs['core-media-upload'] = array('caption'=> $tp->toGlyph('fa-upload').IMALAN_150, 'text' => $this->uploadTab()); } + + $text = $frm->tabs($tabs, array('id'=>'admin-ui-media-manager', 'class'=>'media-manager')); + if($options['bbcode'] || E107_DEBUG_LEVEL > 0) + { + $text .= $this->mediaManagerSaveButtons($options); + } + + $text .= $this->mediaManagerPlaceholders(); + return $text; } @@ -1547,11 +1568,60 @@ class media_admin_ui extends e_admin_ui * */ - if($options['bbcode']) //TODO move to imagestyleTab(); + if($options['bbcode']) { - $text .= "
+ $text .= "
".$this->imageAttributesTab()."
"; + } + + + + if($this->getQuery('video') || $this->getQuery('bbcode') == 'video') + { + $text .= "
"; + $text .= $this->youtubeTab(); + $text .= "
"; + + } + + + if($this->getQuery('audio') || $this->getQuery('bbcode') == 'audio') + { + $text .= "
"; + $text .= $this->audioTab(); + $text .= "
"; + } + + if($this->getQuery('glyphs') == 1 || $this->getQuery('bbcode') == 'glyph') + { + $text .= "
"; + $text .= $this->glyphTab(); + $text .= "
+ "; + + } + + + $text .= "
"; + + // For BBCODE/TinyMce mode. + // e-dialog-save -
+ if($options['bbcode'] || E107_DEBUG_LEVEL > 0) + { + $text .= $this->mediaManagerSaveButtons($options); + } + + $text .= $this->mediaManagerPlaceholders(); + + return $text; + } + + + private function imageAttributesTab() + { + $frm = e107::getForm(); + + $text = "
@@ -1606,48 +1676,34 @@ class media_admin_ui extends e_admin_ui - "; - } - - - if($this->getQuery('video') || $this->getQuery('bbcode') == 'video') - { - $text .= "
"; - $text .= $this->youtubeTab(); - $text .= "
"; + return $text; - } - + } - if($this->getQuery('audio') || $this->getQuery('bbcode') == 'audio') - { - $text .= "
"; - $text .= $this->audioTab(); - $text .= "
"; - } - if($this->getQuery('glyphs') == 1 || $this->getQuery('bbcode') == 'glyph') - { - $text .= "
"; - $text .= $this->glyphTab(); - $text .= "
- "; + private function mediaManagerPlaceholders() + { + $type = (E107_DEBUG_LEVEL > 0) ? "text" : "hidden"; + $br = (E107_DEBUG_LEVEL > 0) ? "
" : ""; - } - - - $text .= ""; - - // For BBCODE/TinyMce mode. - // e-dialog-save - - if($options['bbcode'] || E107_DEBUG_LEVEL > 0) - { - - $text .= "
+ $text = " + ".$br." + ".$br." + ".$br." + ".$br." + "; + + return $text; + } + + + + private function mediaManagerSaveButtons($options = array()) + { + $text = "
"; - } - - $type = (E107_DEBUG_LEVEL > 0) ? "text" : "hidden"; - $br = (E107_DEBUG_LEVEL > 0) ? "
" : ""; - $text .= " - ".$br." - ".$br." - ".$br." - ".$br." - "; - return $text; } + /** * @deprecated to be replaced by imageTab2 * @param $type @@ -1785,7 +1831,7 @@ class media_admin_ui extends e_admin_ui 'action' =>'image2', // Used by AJAX to identify correct function. 'perPage' => 8, 'gridClass' => 'col-sm-3 media-carousel-item-image', - 'bbcode' => 'image', + 'bbcode' => 'img', // bbcode tag. 'close' => 'true' ); diff --git a/e107_web/js/core/mediaManager.js b/e107_web/js/core/mediaManager.js index 533c4b172..93985f725 100644 --- a/e107_web/js/core/mediaManager.js +++ b/e107_web/js/core/mediaManager.js @@ -46,8 +46,9 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; }); }); */ - $(context).on('click', '.e-media-select', function () + $(context).on('click', '.e-media-select', function (e) { + e.preventDefault(); e107.mediaManager.eMediaSelect(this); }); @@ -304,6 +305,9 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; */ e107.mediaManager.eMediaSelect = function (that) { + + + var $this = $(that); // ID of the Media Manager Item. var id = $this.attr('data-id'); @@ -334,6 +338,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; + // Remove "selected" class from elements. $('.e-media-select').removeClass('media-select-active'); @@ -341,6 +346,10 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; $this.addClass('media-select-active'); $this.closest('img').addClass('active'); + + + + if(bbcode === "file" && $bbcodeHolder.length > 0) // not needed for Tinymce { bbpath = '[file=' + id + ']' + name + '[/file]'; @@ -348,10 +357,12 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; return; } - if(bbcode === "video" && $bbcodeHolder.length > 0) + if((bbcode === "video" || bbcode === "img") && $bbcodeHolder.length > 0) { + e107.mediaManager.eMediaAttribute($this, bbcode); bbpath = '[' + bbcode + ']' + path + '[/' + bbcode + ']'; $bbcodeHolder.val(bbpath); + } if(bbcode === "glyph" && $bbcodeHolder.length > 0) @@ -439,7 +450,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; console.log("Mode: Image"); } - + console.log("Bbpath: " + bbpath); console.log("Preview: "+preview); console.log("Save Path: "+path);