Index: CHANGELOG.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/CHANGELOG.txt,v retrieving revision 1.23.2.36.2.12 diff -u -p -r1.23.2.36.2.12 CHANGELOG.txt --- CHANGELOG.txt 27 Oct 2008 19:15:35 -0000 1.23.2.36.2.12 +++ CHANGELOG.txt 26 Dec 2008 17:29:51 -0000 @@ -6,6 +6,7 @@ Img_Assist x.x-x.x, xxxx-xx-xx Img_Assist 5.x-2.x, xxxx-xx-xx ------------------------------ +#245799 by sun: Added support for TinyMCE 3; dropped support for TinyMCE 2. #326640 by Anselm Heaton, sun: Fixed wysiwyg_editor renamed to wysiwyg module. #308005 by sun: Moved includes into /includes. #295946 by smk-ka: Fixed module settings cannot be saved without Token module. Index: img_assist.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/img_assist.js,v retrieving revision 1.4.2.5 diff -u -p -r1.4.2.5 img_assist.js --- img_assist.js 19 Nov 2007 02:27:49 -0000 1.4.2.5 +++ img_assist.js 26 Dec 2008 17:59:50 -0000 @@ -3,15 +3,15 @@ var currentMode; function onChangeBrowseBy(el) { - frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/' + el.value; + frames['img_assist_main'].window.location.href = Drupal.settings.basePath + 'index.php?q=img_assist/thumbs/' + el.value; } function onClickUpload() { - frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/upload'; + frames['img_assist_main'].window.location.href = Drupal.settings.basePath + 'index.php?q=img_assist/upload'; } function onClickStartOver() { - frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/myimages'; + frames['img_assist_main'].window.location.href = Drupal.settings.basePath + 'index.php?q=img_assist/thumbs/myimages'; } function updateCaption() { @@ -40,14 +40,14 @@ function onChangeWidth() { function onChangeLink() { var formObj = frames['img_assist_main'].document.forms[0]; - if (formObj['edit-link-options-visible'].value == 1) { - if (formObj['edit-link'].value == 'url') { - showElement('edit-url', 'inline'); - } - else { - hideElement('edit-url'); - } - } + if (formObj['edit-link-options-visible'].value == 1) { + if (formObj['edit-link'].value == 'url') { + showElement('edit-url', 'inline'); + } + else { + hideElement('edit-url'); + } + } } function onChangeSizeLabel() { @@ -65,11 +65,11 @@ function onChangeSizeLabel() { var width = size[0]; var height = size[1]; if (Math.round(width / aspect) <= height) { - // width is controlling factor + // width is controlling factor height = Math.round(width / aspect); } else { - // height is controlling factor + // height is controlling factor width = Math.round(height * aspect); } // fill the hidden width and height textboxes with these values @@ -79,10 +79,10 @@ function onChangeSizeLabel() { } function setHeader(mode) { - if (currentMode != mode) { - frames['img_assist_header'].window.location.href = BASE_URL + 'index.php?q=img_assist/header/' + mode; - } - currentMode = mode; + if (currentMode != mode) { + frames['img_assist_header'].window.location.href = Drupal.settings.basePath + 'index.php?q=img_assist/header/' + mode; + } + currentMode = mode; } function showElement(id, format) { @@ -113,50 +113,50 @@ function hideElement(id) { } function launch_popup(nid, mw, mh) { - var ox = mw; - var oy = mh; - if((ox>=screen.width) || (oy>=screen.height)) { - var ox = screen.width-150; - var oy = screen.height-150; - var winx = (screen.width / 2)-(ox / 2); - var winy = (screen.height / 2)-(oy / 2); - var use_scrollbars = 1; - } - else { - var winx = (screen.width / 2)-(ox / 2); - var winy = (screen.height / 2)-(oy / 2); - var use_scrollbars = 0; - } - var win = window.open(BASE_URL + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable'); + var ox = mw; + var oy = mh; + if((ox>=screen.width) || (oy>=screen.height)) { + var ox = screen.width-150; + var oy = screen.height-150; + var winx = (screen.width / 2)-(ox / 2); + var winy = (screen.height / 2)-(oy / 2); + var use_scrollbars = 1; + } + else { + var winx = (screen.width / 2)-(ox / 2); + var winy = (screen.height / 2)-(oy / 2); + var use_scrollbars = 0; + } + var win = window.open(Drupal.settings.basePath + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable'); } function insertImage() { - if (window.opener) { + if (window.opener || !tinyMCEPopup.isWindow) { // Get variables from the fields on the properties frame var formObj = frames['img_assist_main'].document.forms[0]; - // Get mode (see img_assist.module for detailed comments) - if (formObj['edit-insertmode'].value == 'html') { - // return so the page can submit normally and generate the HTML code - return true; - } - else if (formObj['edit-insertmode'].value == 'html2') { - // HTML step 2 (processed code, ready to be inserted) - var content = getHTML(formObj); - } - else { - var content = getFilterTag(formObj); - } - insertToEditor(content); - return false; - + // Get mode (see img_assist.module for detailed comments) + if (formObj['edit-insertmode'].value == 'html') { + // return so the page can submit normally and generate the HTML code + return true; + } + else if (formObj['edit-insertmode'].value == 'html2') { + // HTML step 2 (processed code, ready to be inserted) + var content = getHTML(formObj); + } + else { + var content = getFilterTag(formObj); + } + insertToEditor(content); + return false; + } else { - alert('The image cannot be inserted because the parent window cannot be found.'); - return false; - } + alert('The image cannot be inserted because the parent window cannot be found.'); + return false; + } } function getHTML(formObj) { - var html = frames['img_assist_main'].document.getElementById('finalhtmlcode').value; - return html; + var html = frames['img_assist_main'].document.getElementById('finalhtmlcode').value; + return html; } Index: img_assist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/img_assist.module,v retrieving revision 1.68.2.50.2.12 diff -u -p -r1.68.2.50.2.12 img_assist.module --- img_assist.module 27 Oct 2008 19:15:35 -0000 1.68.2.50.2.12 +++ img_assist.module 26 Dec 2008 17:56:52 -0000 @@ -103,8 +103,8 @@ function img_assist_menu($may_cache) { if (variable_get('img_assist_page_styling', 'yes') == 'yes') { drupal_add_css($path .'/img_assist.css'); } - // Assign base_path to insert in image source by javascript. - drupal_add_js('var BASE_URL = "'. base_path() .'";', 'inline'); + // Ensure Drupal.settings.basePath for popup windows. + drupal_add_js(array('basePath' => base_path()), 'setting'); drupal_add_js($path .'/img_assist.js'); } return $items; @@ -521,26 +521,21 @@ function img_assist_cache_clear() { * @todo Remove hard-coded TinyMCE integration. */ function img_assist_loader() { + $path = drupal_get_path('module', 'img_assist'); $editor = arg(2) ? arg(2) : 'textarea'; - + + drupal_add_js($path .'/img_assist.js'); + if ($editor == 'tinymce') { + $tinymce_path = drupal_get_path('module', 'wysiwyg'); + drupal_add_js($tinymce_path .'/tinymce/jscripts/tiny_mce/tiny_mce_popup.js'); + } + drupal_add_js($path .'/img_assist_'. $editor .'.js'); + $output = ''."\n"; $output .= "\n"; $output .= "\n"; $output .= ''. t('Add image') ."\n"; - $output .= "\n\n"; - - $path = drupal_get_path('module', 'img_assist'); - $output .= ''."\n"; - if ($editor == 'tinymce') { - $tinymce_path = drupal_get_path('module', 'wysiwyg'); - $tinymce_js = base_path() . $tinymce_path .'/tinymce/jscripts/tiny_mce/tiny_mce_popup.js'; - $output .= '' . "\n"; - } - $editor_js = base_path() . $path .'/img_assist_'. $editor .'.js'; - $output .= '' . "\n"; - + $output .= drupal_get_js(); $output .= "\n\n"; $output .= '' . "\n"; @@ -550,12 +545,14 @@ function img_assist_loader() { $output .= "\n"; echo $output; + exit; } function img_assist_header($mode) { // Mode may be 'uploading', 'properties' or 'browse'. $output = drupal_get_form('img_assist_header_form', $mode); echo theme('img_assist_page', $output, array('id' => 'img_assist_header', 'onload' => 'parent.initHeader();', 'class' => 'img_assist')); + exit; } function img_assist_header_form($mode) { @@ -692,6 +689,7 @@ function img_assist_upload() { } } echo theme('img_assist_page', $output, array('id' => 'img_assist_upload', 'class' => 'img_assist')); + exit; } /** @@ -788,6 +786,7 @@ function img_assist_thumbs() { $output = t('The image module must be enabled to use Image assist.'); } echo theme('img_assist_page', $output, array('id' => 'img_assist_thumbs', 'onload' => 'parent.initThumbs();', 'class' => 'img_assist')); + exit; } /** @@ -806,6 +805,7 @@ function img_assist_properties() { } echo theme('img_assist_page', $output, array('id' => 'img_assist_properties', 'onload' => 'parent.initProperties();', 'class' => 'img_assist')); + exit; } /** @@ -1466,6 +1466,7 @@ function img_assist_popup() { $attributes = array('id' => 'img_assist_popup'); echo theme('img_assist_popup', $content, $attributes); + exit; } /** @@ -1794,7 +1795,7 @@ function theme_img_assist_page($content, $output .= drupal_get_js(); $output .= "\n