diff --git a/e107_admin/header.php b/e107_admin/header.php index 0768e3d82..338405ce1 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -46,6 +46,8 @@ e107::js("core", "plupload/customUpload.js","jquery",3); e107::js("core", "core/mediaManager.js","jquery",3); +e107::js("core", "tooltip/jquery.qtip-1.0.0-rc3.min.js","jquery",3); + e107::css('core', 'core/admin.jquery.css', 'jquery'); e107::css('core', 'core/all.jquery.css', 'jquery'); diff --git a/e107_admin/image.php b/e107_admin/image.php index def8d6868..65c505bb1 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -209,8 +209,10 @@ class media_form_ui extends e_admin_form_ui $tagid = $_GET['tagid']; $path = $this->getController()->getListModel()->get('media_url'); $preview = basename($path); + + $bbcode = ($_GET['bbcode']==1) ? "file" : ""; - return ""; + return ""; } @@ -380,9 +382,12 @@ class media_admin_ui extends e_admin_ui if($this->getQuery('iframe')) { + + + if($this->getQuery('bbcode')) { - e107::getJs()->headerFile(e_PLUGIN_ABS.'tinymce/tiny_mce_popup.js',2); + e107::getJS()->headerInline(" /* Send the generated IMG bbcode back to the textarea/window */ @@ -591,8 +596,8 @@ class media_admin_ui extends e_admin_ui $text .= "
"); - $("textarea").keyup(function(){ - - // var max=$(this).attr("maxlength"); - var max = 100; - var el = "#" + $(this).attr("name") + "-remainingCharacters"; - var valLen=$(this).val().length; - $(el).text( valLen + " characters") - }); - - // Dialog - $("a.e-dialog").colorbox({ - iframe:true, - width:"60%", - height:"70%", - speed:100 - }); - - $(".e-dialog-close").click(function () { - parent.$.colorbox.close() - }); - - - // Modal Box - uses inline hidden content - $(".e-modal").click(function () { - var id = $(this).attr("href"); - $(id).dialog({ - minWidth: 800, - maxHeight: 700, - modal: true - }); - }); - // Modal Box - uses inline hidden content // NEEDS work - see customize link for admin-infopanel. $(".e-modal-iframe").click(function (e) { @@ -509,348 +413,5 @@ $(document).ready(function() }) -// Legacy Stuff to be converted. - -// BC Expandit() function - - function expandit(e) { - - var href = $(e).attr("href"); - - if(href === "#" || href == "") - { - idt = $(e).next("div"); - $(idt).toggle("slow"); - return false;; - } - - var id = "#" + e; - $(id).toggle("slow"); - return false; - }; - - - var addinput = function(text) { - - // quick fix to prevent JS errors - proper match was done only for latin words - var rep = text.match(/\=([^\]]*)\]/); - var val = rep ? prompt(rep[1]) : prompt('http://'); - - if(!val) - { - return; - } - var newtext = text.replace(rep[1], val); - emote = ''; - addtext(newtext, emote); - return; - } - - - - - function SyncWithServerTime(serverTime,domain) - { - if (serverTime) - { - /* update time difference cookie */ - var serverDelta=Math.floor(localTime-serverTime); - - document.cookie = 'e107_tdOffset='+serverDelta+'; path=/; domain= .'+domain; - document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path=/; domain=.'+domain; /* server time when set */ - } - - var tzCookie = 'e107_tzOffset='; - // if (document.cookie.indexOf(tzCookie) < 0) { - /* set if not already set */ - var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */ - document.cookie = tzCookie + timezoneOffset+'; path=/; domain=.'+domain; - // } - } - - - function urljump(url){ - top.window.location = url; - } - - function setInner(id, txt) { - document.getElementById(id).innerHTML = txt; - } - - function jsconfirm(thetext){ - return confirm(thetext); - } - - function insertext(str,tagid,display){ - document.getElementById(tagid).value = str; - if(display){ - document.getElementById(display).style.display='none'; - } - } - - function appendtext(str,tagid,display){ - document.getElementById(tagid).value += str; - document.getElementById(tagid).focus(); - if(display){ - document.getElementById(display).style.display='none'; - } - } - - function open_window(url,wth,hgt) { - if('full' == wth){ - pwindow = window.open(url); - } else { - if (wth) { - mywidth=wth; - } else { - mywidth=600; - } - - if (hgt) { - myheight=hgt; - } else { - myheight=400; - } - - pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height='+myheight+',scrollbars=yes,menubar=yes'); - } - pwindow.focus(); - } - - function ejs_preload(ejs_path, ejs_imageString){ - var ejs_imageArray = ejs_imageString.split(','); - for(ejs_loadall=0; ejs_loadall
"); $("textarea").keyup(function(){ // var max=$(this).attr("maxlength"); @@ -154,7 +220,7 @@ $(document).ready(function() // targetType : 'number', targetText : $('#e-rate-'+tmp).text(), // cancel : true, - css : 'e-rate-star', + // css : 'e-rate-star', click: function(score, evt) { $(this).find('img').unbind('click'); $(this).find('img').unbind(); @@ -177,12 +243,18 @@ $(document).ready(function() }); }); - + // $( ".field-help" ).tooltip(); + // Allow Tabs to be used inside textareas. + $( 'textarea' ).keypress( function( e ) { + if ( e.keyCode == 9 ) { + e.preventDefault(); + $( this ).val( $( this ).val() + '\t' ); + } + }); - - // Text-area AutoGrow - // $("textarea.e-autoheight").elastic(); + // Text-area AutoGrow + $("textarea.e-autoheight").elastic(); @@ -215,17 +287,18 @@ $(document).ready(function() }; - var addinput = function(text) { + var addinput = function(text,rep) { // quick fix to prevent JS errors - proper match was done only for latin words - var rep = text.match(/\=([^\]]*)\]/); - var val = rep ? prompt(rep[1]) : prompt('http://'); + // var rep = text.match(/\=([^\]]*)\]/); + // var rep = ''; + var val = rep ? prompt(rep) : prompt('http://'); if(!val) { return; } - var newtext = text.replace(rep[1], val); + var newtext = text.replace('*', val); emote = ''; addtext(newtext, emote); return; @@ -397,7 +470,7 @@ function mozSwap(txtarea, newtext){ /** * New improved version - fixed scroll to top behaviour when inserting BBcodes - * @TODO - improve it more (0.8) - Prototype + * @TODO - improve it more (0.8) */ function addtext(text, emote) { diff --git a/e107_files/jslib/core/mediaManager.js b/e107_files/jslib/core/mediaManager.js index f065feb47..0e3e1a569 100644 --- a/e107_files/jslib/core/mediaManager.js +++ b/e107_files/jslib/core/mediaManager.js @@ -3,13 +3,17 @@ $(document).ready(function() $(".e-dialog-save").click(function () { // FIXME TODO missing caret , text selection overwrite etc. + //alert('hello'); var newval = $('#bbcode_holder').val(); + // alert(newval); var target = $(this).attr('data-target'); - ('#' + target, window.top.document).insertAtCaret(newVal); + //('#' + target, window.top.document).insertAtCaret(newVal); // $('#' + target, window.parent.document).append(newval); //FIXME caret!! // var t = $('#' + target, window.parent.document).text(); - // addtext(newval); + + $('#' + target, window.top.document).attr('value',newval); // set new value + // inserttext(newval,target); // alert(newval); }); @@ -106,11 +110,21 @@ $(document).ready(function() var path = $(this).attr('data-path'); var preview = $(this).attr('data-preview'); var src = $(this).attr('data-src'); + var bbcode = $(this).attr('data-bbcode'); $(this).addClass("media-select-active"); $(this).closest("img").addClass("active"); - - $('#' + target, window.top.document).attr('value',path); // set new value + + // TinyMce? + $('input#' + target, window.top.document).attr('value',path); // set new value + + if(bbcode) + { + bbpath = '['+bbcode+']'+ path + '[/' + bbcode + ']'; + $('textarea#' + target, window.top.document).attr('value',bbpath); + } + + $('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value $('div#' + target + "_prev", window.top.document).html(preview); // set new value $('span#' + target + "_prev", window.top.document).html(preview); // set new value diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 80007739c..7235036f4 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -629,33 +629,36 @@ class e_form // auto-height support $options = array('class' => 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg'); $bbbar = ''; + // FIXME - see ren_help.php - // if(!deftrue('e_WYSIWYG')) - { - require_once(e_HANDLER."ren_help.php"); - $options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; - $bbbar = display_help($help_tagid, $help_mod, 'addtext', 'help', $size); - } + + require_once(e_HANDLER."ren_help.php"); + $help_tagid = $this->name2id($name)."--preview"; // required as it needs to have some matching name with textarea. + $options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; + $bbbar = display_help($help_tagid, $help_mod, 'addtext', 'help', $size); - $toggleID = "bbcode-panel-".$help_tagid; - $tinyMceID = str_replace("_","-",$name); $ret = " "; + // Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler - e107::getJs()->footerInline(" - if(typeof tinyMCE === 'undefined') - { - \$$('a.e-wysiwyg-switch').invoke('hide'); - } - "); - + /* + + e107::getJs()->footerInline(" + if(typeof tinyMCE === 'undefined') + { + \$$('a.e-wysiwyg-switch').invoke('hide'); + } + "); + */ + return $ret; } diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 83261172f..7e18ab17e 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -508,14 +508,17 @@ class e_media document.getElementById('preview').src = '{$realPath}'; return false;"; + $onclicki = ""; $class .= " e-media-select"; $onclicki = ""; } + + $data_bb = ($bbcode) ? "img" : ""; $img_url = ($cat !='_icon') ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path; - $text .= ""; + $text .= ""; $text .= "