Index: openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl 29 Dec 2008 21:53:02 -0000 1.13
+++ openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl 11 May 2009 15:21:43 -0000 1.14
@@ -14,7 +14,7 @@
}
#HAM : ajax sources
-set js_source [ah::js_sources]
+#ah::requires -sources "prototype,scriptaculous"
set f_url ""
@@ -82,6 +82,7 @@
}
} \
-on_submit {
+ ns_log notice "ATTACH FILE ON SUBMIT"
if {$f_href eq ""} {
set f_href $f_url
element set_value upload_form f_href $f_href
@@ -219,6 +220,7 @@
}
}
}
+ ns_log notice "F_HREF= $f_href"
element set_value upload_form f_href $f_href
}
@@ -232,4 +234,139 @@
-parameter "RichTextEditor" \
-default "xinha"]
-set HTML_UploadTitle ""
\ No newline at end of file
+set HTML_UploadTitle ""
+
+
+if {$richtextEditor eq "xinha"} {
+ template::head::add_javascript \
+ -src "/resources/acs-templating/xinha-nightly/popups/popup.js"
+ template::head::add_javascript \
+ -script "
+ var selector_window;
+ // window.resizeTo(450, 300);
+
+ function Init() {
+ __dlg_init();
+
+ var f_href = document.getElementById('f_href');
+ var url = f_href.value;
+ if (url) {
+ onOK();
+ __dlg_close(null);
+ }
+
+ var param = window.dialogArguments;
+ if (param) {
+ if ( typeof param['f_href'] != 'undefined' ) {
+ document.getElementById('f_href').value = param['f_href'];
+ document.getElementById('f_url').value = param['f_href'];
+ document.getElementById('f_title').value = param['f_title'];
+ }
+ }
+ };
+
+ function onOK() {
+ var required = {
+ 'f_href': '#acs-templating.HTMLArea_NoURL#'
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ['f_href','f_title', 'f_target'];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ __dlg_close(param);
+ return false;
+ };
+
+ function onCancel() {
+ if (selector_window) {
+ selector_window.close();
+ }
+ __dlg_close(null);
+ return false;
+ };
+"
+}
+
+if {$richtextEditor eq "tinymce"} {
+ template::head::add_javascript \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/tiny_mce_popup.js" \
+ -order "Z1"
+
+ template::head::add_javascript \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/utils/mctabs.js" \
+ -order "Z2"
+ template::head::add_javascript \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/utils/form_utils.js" \
+ -order "Z3"
+ template::head::add_javascript \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/utils/validate.js" \
+ -order "Z4"
+ template::head::add_javascript \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/plugins/oacslink/js/link.js" \
+ -order "Z5"
+ template::head::add_javascript \
+ -order "Z6" \
+ -script "
+ function attachFileInit() {
+
+ var param = window.dialogArguments;
+ // document.getElementById('f_href').focus();
+ var f_href = document.getElementById('f_href');
+ var url = f_href.value;
+ if (url !='') {
+ insertAction();
+ }
+
+ tinyMCEPopup.executeOnLoad('init();');
+
+ }
+ function onCancel() {
+ tinyMCEPopup.close();
+ }
+"
+ template::head::add_style \
+ -style "
+ html, body {
+ background: ButtonFace;
+ color: ButtonText;
+ font: 11px Tahoma,Verdana,sans-serif;
+ margin: 0px;
+ padding: 0px;
+ }
+ body { padding: 5px; }
+ table {
+ font: 11px Tahoma,Verdana,sans-serif;
+ }
+ form p {
+ margin-top: 5px;
+ margin-bottom: 5px;
+ }
+ .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
+ .fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
+ fieldset { padding: 0px 10px 5px 5px; }
+ select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+ .space { padding: 2px; }
+
+ .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+ border-bottom: 1px solid black; letter-spacing: 2px;
+ }
+ form { padding: 0px; margin: 0px; }
+ .form-error { color : red}
+"
+
+ template::add_body_handler \
+ -event onload \
+ -script "attachFileInit()"
+}
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.adp 29 Aug 2008 18:08:35 -0000 1.8
+++ openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.adp 11 May 2009 15:21:43 -0000 1.9
@@ -1,286 +1,5 @@
-
-
-#acs-templating.HTMLArea_InsertImageTitle#
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@js_source;noquote@
-
-
-
-
-
-
-
@@ -299,8 +18,9 @@
- |
@@ -340,7 +61,7 @@
-
+
Index: openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.tcl 29 Dec 2008 21:53:02 -0000 1.9
+++ openacs-4/packages/acs-templating/www/scripts/xinha/attach-image.tcl 11 May 2009 15:21:43 -0000 1.10
@@ -12,9 +12,6 @@
{selector_type "image"}
}
-#HAM : ajax sources
-set js_source [ah::js_sources]
-
set f_url ""
set user_id [auth::require_login]
@@ -191,3 +188,293 @@
set HTML_Preview "Preview"
set HTML_UploadTitle ""
+
+################################################################################
+
+set ajaxhelper_p [apm_package_installed_p ajaxhelper]
+if {$ajaxhelper_p} {
+ ah::requires -sources "prototype,scriptaculous"
+}
+
+if {$richtextEditor eq "xinha"} {
+
+template::head::add_javascript \
+ -order "Z1" \
+ -script "
+ var selector_window;
+ // window.resizeTo(415, 300);
+
+ function Init() {
+ __dlg_init();
+ var param = window.dialogArguments;
+ if (param) {
+ document.getElementById('f_url').value = param['f_url'];
+ document.getElementById('f_alt').value = param['f_alt'];
+ document.getElementById('f_border').value = param['f_border'];
+ document.getElementById('f_align').value = param['f_align'];
+ document.getElementById('f_vert').value = param['f_vert'];
+ document.getElementById('f_horiz').value = param['f_horiz'];
+
+ window.ipreview.location.replace(param.f_url);
+ }
+ // document.getElementById('f_url').focus();
+ var f_url = document.getElementById('f_url');
+ var url = f_url.value;
+ if (url) {
+ onOK();
+ __dlg_close(null);
+ }
+ };
+
+ function onOK() {
+ var required = {
+ 'f_url': '#acs-templating.HTMLArea_NoURL#'
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var param = new Object();
+ /*
+ var fields = ['f_url'];
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ */
+ param['f_url'] = document.getElementById('f_url').value;
+ if (selector_window) {
+ selector_window.close();
+ }
+ __dlg_close(param);
+ return false;
+ };
+
+ function onCancel() {
+ if (selector_window) {
+ selector_window.close();
+ }
+ __dlg_close(null);
+ return false;
+ };
+
+ function onPreview() {
+ var f_url = document.getElementById('f_url');
+ var url = f_url.value;
+ if (!url) {
+ alert('You have to enter an URL first');
+ f_url.focus();
+ return false;
+ }
+ if (document.getElementById('preview_div').style.display == 'none') {
+ document.getElementById('showpreview').click();
+ }
+ window.ipreview.location.replace(url);
+ return false;
+ };
+
+ function resizeWindow(formname) {
+ var w, h;
+ if (formname == 'url') {
+ w = 415;
+ h = 330;
+ }
+ if (formname == 'upload') {
+ w = 415;
+ h = 310;
+ }
+ if (document.getElementById('showpreview').checked == true) {
+ h = h + 200;
+ }
+ window.resizeTo(w, h);
+ }
+
+ function togglePreview() {
+ var w = window.clientWidth;
+ var h = window.clientHeight;
+ if (document.getElementById('preview_div').style.display == 'none') {
+ document.getElementById('preview_div').style.display='';
+ } else {
+ document.getElementById('preview_div').style.display='none';
+ }
+ if (document.getElementById('insert_image_url').style.display == 'none') {
+ resizeWindow('upload');
+ } else {
+ resizeWindow('url');
+ }
+ }
+
+ "
+
+}
+
+if {$richtextEditor eq "tinymce"} {
+ template::head::add_javascript \
+ -order "Z1" \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/tiny_mce_popup.js"
+ template::head::add_javascript \
+ -order "Z2" \
+ -src "/resources/acs-templating/tinymce/jscripts/tiny_mce/plugins/oacsimage/js/image.js"
+
+template::head::add_style \
+ -style "
+ html, body {
+ background: ButtonFace;
+ color: ButtonText;
+ font: 11px Tahoma,Verdana,sans-serif;
+ margin: 0px;
+ padding: 0px;
+ }
+ body { padding: 5px; }
+ table {
+ font: 11px Tahoma,Verdana,sans-serif;
+ }
+ form p {
+ margin-top: 5px;
+ margin-bottom: 5px;
+ }
+ .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
+ .fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
+ fieldset { padding: 0px 10px 5px 5px; }
+ select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+ .space { padding: 2px; }
+
+ .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+ border-bottom: 1px solid black; letter-spacing: 2px;
+ }
+ form { padding: 0px; margin: 0px; }
+ .form-error { color : red}
+ #html-carousel {
+ background: #f5f4e4;
+ }
+ #html-carousel .carousel-list li {
+ margin:4px 0px 0px 0px;
+ }
+ #html-carousel .carousel-list li {
+ width: 106px;
+ border: 0px solid green;
+ padding: 2px;
+ padding-top: 15px;
+ margin: 0;
+ color: #3F3F3F;
+ }
+ #html-carousel .carousel-list li img {
+ border:1px solid #999;
+ display:block;
+ width:100px;
+ }
+ #html-carousel {
+ margin-bottom: 10px;
+ float: left;
+ width: 330px;;
+ height: 155px;
+ }
+ /* BUTTONS */
+ #prev-arrow-container, #next-arrow-container {
+ float:left;
+ margin: 1px;
+ padding: 0px;
+ }
+ #next-arrow {
+ cursor:pointer;
+ float:right;
+ }
+ #prev-arrow {
+ cursor:pointer;
+ }
+
+ /* Overlay */
+ #overlay {
+ width: 200px;
+ height: 80px;
+ background-color: #FFF;
+ position: absolute;
+ top: 25px;
+ left: 80px;
+ padding-top: 10px;
+ z-index: 100;
+ color: #000;
+ border:1px dotted #000;
+ text-align: center;
+ font-size: 24px;
+ filter:alpha(opacity=80);
+ -moz-opacity: 0.8;
+ opacity: 0.8;
+ }
+"
+ if {$ajaxhelper_p} {
+ template::head::add_css \
+ -href "/resources/ajaxhelper/carousel/carousel.css"
+ template::head::add_javascript \
+ -order "Z4" \
+ -src "/resources/ajaxhelper/carousel/carousel.js"
+
+ template::head::add_javascript \
+ -order "Z5" \
+ -script "
+
+var carousel;
+
+var buttonStateHandler = function (button, enabled) {
+ if (button == 'prev-arrow') {
+ \$('prev-arrow').src = enabled ? '/resources/ajaxhelper/carousel/left-enabled.gif' : '/resources/ajaxhelper/carousel/left-disabled.gif'
+ } else {
+ \$('next-arrow').src = enabled ? '/resources/ajaxhelper/carousel/right-enabled.gif' : '/resources/ajaxhelper/carousel/right-disabled.gif'
+ }
+}
+
+var ajaxHandler = function (carousel, status) {
+ var overlay = \$('overlay');
+ if (status == 'before') {
+ if (overlay) {
+ overlay.setOpacity(0);
+ overlay.show();
+ Effect.Fade(overlay, {from: 0, to: 0.8, duration: 0.2})
+ } else {
+ new Insertion.Top('html-carousel', \"Loading... \");
+ }
+ } else {
+ Effect.Fade(overlay, {from: 0.8, to: 0.0, duration: 0.2})
+ }
+}
+
+function initCarousel_html_carousel() {
+ carousel = new Carousel('html-carousel', {ajaxHandler:ajaxHandler, animParameters:{duration:0.5}, buttonStateHandler:buttonStateHandler, nextElementID:'next-arrow', prevElementID:'prev-arrow', url:'/ajax/xmlhttp/carousel-images'})
+}
+"
+}
+ template::head::add_javascript \
+ -order "Z3" \
+ -script "
+function attachImageInit() {
+ var param = window.dialogArguments;
+
+ var f_url = document.getElementById('f_url');
+ var url = f_url.value;
+
+ if (url) {
+ ImageDialog.insertAndClose();
+ } else {
+ if (${ajaxhelper_p}) {
+ initCarousel_html_carousel();
+ }
+ tinyMCEPopup.executeOnLoad('init();');
+ }
+}
+function onCancel() {
+ tinyMCEPopup.close();
+}
+
+"
+
+}
+
+template::add_body_handler \
+ -event onload \
+ -script "attachImageInit()"
| |