Changeset 121 for branches/unified_backend
- Timestamp:
- 05/07/05 21:19:31 (15 years ago)
- Location:
- branches/unified_backend
- Files:
-
- 9 added
- 2 deleted
- 26 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/unified_backend/Configure.php
r72 r121 1 1 <?php 2 2 3 // [ COPY3 // [NOSTRIP 4 4 // ----------------------------------------------------------------- 5 5 // Copyright (C) DTLink, LLC. … … 17 17 // OR NON-INFRINGEMENT. 18 18 // ------------------------------------------------------------------ 19 // COPY]19 // NOSTRIP] 20 20 21 21 /** … … 35 35 // . ported from formVista. 36 36 // . this version relicensed under HTMLArea license. 37 // 38 // 2005-05-01 YmL: 39 // . now generates a backend config file containing install root. 37 40 // --------------------------------------------------------------- 38 41 … … 100 103 } 101 104 105 // path to perl (used by makedocs.pl script) 106 102 107 while ( true ) 103 108 { … … 129 134 } 130 135 } 136 137 // URL to Xinha install 138 139 while ( true ) 140 { 141 142 print "\n"; 143 print "---------------------------------------------------------\n"; 144 print "Xinha needs to know what URL it's installed under.\n"; 145 print "(e.g. /xinha or maybe http://some_site.com/somedir/xinha)\n"; 146 print "\nURL of Xinha install:\n"; 147 print "[" . @$dataExport["XINHA_INSTALL_URL"] . "]:"; 148 149 $response = fgets( $stdin, 256 ); 150 151 if ( preg_match( "/\S/", $response ) ) 152 { 153 $response = trim($response); 154 155 $dataExport[ "XINHA_INSTALL_URL" ] = $response; 156 157 break; 158 } 159 else 160 { 161 162 // it's possible we've already looped through this 163 164 if ( preg_match( "/\S/", @$dataExport[ "XINHA_INSTALL_URL" ] )) 165 break; 166 167 print( "\nPlease enter the url of your Xinha install.\n" ); 168 } 169 } 170 171 // We assume the current directory is the root of the Xinha install. 172 173 $dataExport[ "XINHA_INSTALL_ROOT"] = getcwd(); 131 174 132 175 // --------------------------------------------------------------- -
branches/unified_backend/INSTALL.txt
r72 r121 3 3 4 4 To set up the software to run please run Configure.php with the full path 5 to your command line PHP inte preter as in:5 to your command line PHP interpreter as in: 6 6 7 7 /usr/local/bin/php Configure.php … … 9 9 Configure.php will ask for the completely path to PHP and Perl. 10 10 11 Configure will do some variable expansion in devutils/* and set permissions on12 the plugins/ImageManager/demo_images directory.11 Configure will do some variable expansion in devutils/* and backends/*. It will 12 also set permissions on the examples directory. 13 13 14 14 For more information please see the README.txt and README_DEVELOPERS.txt files. -
branches/unified_backend/RELEASE_NOTES.txt
r85 r121 3 3 by: Yermo Lamers of DTLink, LLC 4 4 http://www.formvista.com/contact.html 5 6 --------------------------------------------------------------------- 7 2005-05-06: dev snapshot change summary 8 9 htmlarea.js 10 11 . more debugging messages added. 12 . added HTMLArea.Config.linkReplacementMode which can be either 13 fullyqualified (the old default behavior) or absolute. 14 15 When set to fullyqualified all absolute links (e.g. /somepath) will be changed 16 to fullyqualified URLS (e.g. http://yoursite/somepth). 17 18 When set to absolute, all fullyqualified urls back to the current site 19 will be changed to absolute (e.g. http//yoursite/somepath to /somepath) 20 making the Xinha generated content portable between sites. 21 22 ( see HTMLArea.prototype.outwardHtml() ) 23 24 . bugfix - if plugin .js file has a parse error htmlarea will only try to load 25 it a configurable number of times before popping up an error message. 26 27 backends/backend.php 28 29 . initial unified backend created. Requests to this backend are routed 30 to the corresponding plugin specific backend.php file. 31 32 backends/backend_conf.php 33 34 . a central server side configuration file has been created for the use 35 of plugin serverside code. 36 . all backends hooked into this scheme must include the central config file. 37 38 ImageManager 39 40 . modified the config to allow overriding default values. 41 . default image directory is now xinha/examples/images 42 . added debugging trace messages which are tagged with the ImageManager name. 43 . now uses unified backend. 44 45 Linker 46 47 . includes central config. 48 . default directory is now the xinha/examples directory (to avoid scan.php security 49 problem) 50 . added debugging trace messages which are tagged with the Linker name. 51 . links selected from the tree are now displayed in absolute instead of fully qualified 52 fashion. 53 . on edit the link that was previously selected is highlighted. 54 . on edit the selected link is scrolled to if it's outside the viewable area. 55 . if scan.php returns some kind of error or invalid javascript Linker now pops up 56 a nice descriptive error message. 57 58 . bugfix - same pattern as in loading plugins. If there is some error in loading 59 the directory listing Linker will only attempt it a few times before giving up and 60 displaying a nice error. 61 62 dTree.js 63 64 . added clear_s() method to clear the selection 65 . added getNodeElement() method to return the <a ..> element for a given node. 5 66 6 67 --------------------------------------------------------------------- -
branches/unified_backend/TODO.txt
r84 r121 3 3 by: Yermo Lamers of DTLink, LLC 4 4 http://www.formvista.com/contact.html 5 6 --------------------------------------------- 7 8 2005-05-07 - in the order things will be done: 9 10 . fix EnterParagraphs to include style fix to <p> tags. 11 12 . route rest of client/server communications through a single backend script. 13 ImageManager and Linker are done. SpellChecker is next. 14 15 . make_runtime.php script needs to be written to generate a debug message and 16 comment free "runtime" versions. (For the moment just comment out the 17 _ddtOn() calls to turn off debug messages). 18 19 . rework ImageManager and add a permissions system for edit/delete functions. 5 20 6 21 --------------------------------------------- -
branches/unified_backend/conf/infile_list.txt
r72 r121 3 3 ./devutils/buildruntime.php.in 0755 4 4 ./devutils/ddtpreproc.php.in 0755 5 ./backends/backend_conf.php.in 0644 -
branches/unified_backend/conf/perms_list.txt
r72 r121 9 9 ?> 10 10 11 ./plugins/ImageManager/demo_images 644 nobody 11 ./examples/images 755 nobody 12 ./examples/images/linux 755 nobody -
branches/unified_backend/ddt/ddt.js
r85 r121 221 221 { 222 222 223 this._ddt( "ddt.js","208", file, line, msg ); 223 this._ddt( 224 file, line, msg ); 225 226 if ( typeof obj == 'undefined' ) 227 { 228 this._ddt( 229 file, line, "Object is undefined!" ); 230 } 224 231 225 232 for (var x in obj) -
branches/unified_backend/dialog.js
r20 r121 12 12 // $Id$ 13 13 14 // -------------------------------------------------------------------------- 14 15 // Though "Dialog" looks like an object, it isn't really an object. Instead 15 16 // it's just namespace for protecting global symbols. 17 // 18 // Something to note, the ImageManager plugin (and possibly others) has it's 19 // own version of this file 20 // -------------------------------------------------------------------------- 16 21 17 function Dialog(url, action, init) { 18 if (typeof init == "undefined") { 19 init = window; // pass this window object by default 20 } 21 Dialog._geckoOpenModal(url, action, init); 22 }; 22 /** 23 * should be a function, the return handler of the currently opened dialog. 24 */ 23 25 24 Dialog._parentEvent = function(ev) {25 setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50);26 if (Dialog._modal && !Dialog._modal.closed) {27 HTMLArea._stopEvent(ev);28 }29 };30 31 32 // should be a function, the return handler of the currently opened dialog.33 26 Dialog._return = null; 34 27 35 // constant, the currently opened dialog 28 /** 29 * constant, the currently opened dialog 30 */ 31 36 32 Dialog._modal = null; 37 33 38 // the dialog will read it's args from this variable 34 /** 35 * the dialog will read it's args from this variable 36 */ 37 39 38 Dialog._arguments = null; 40 39 41 Dialog._geckoOpenModal = function(url, action, init) { 40 /** 41 * Dialog() 42 * 43 * Added an option "editor" parameter to pass-through the editor object 44 * to the dialog. 45 */ 46 47 function Dialog(url, action, init) 48 { 49 50 if (typeof init == "undefined") 51 { 52 init = window; // pass this window object by default 53 } 54 55 // optional editor instance parameter that can be propagated through to 56 // dialogs. 57 58 if (typeof Dialog.arguments[3] != "undefined") 59 { 60 Dialog._editor = Dialog.arguments[3]; 61 } 62 63 Dialog._geckoOpenModal(url, action, init); 64 65 }; 66 67 // ----------------------------------------- 68 69 /** 70 * Dialog._parentEvent() 71 */ 72 73 Dialog._parentEvent = function(ev) 74 { 75 76 setTimeout( function() 77 { 78 if (Dialog._modal && !Dialog._modal.closed) 79 { 80 Dialog._modal.focus() 81 } 82 }, 50); 83 84 if (Dialog._modal && !Dialog._modal.closed) 85 { 86 HTMLArea._stopEvent(ev); 87 } 88 }; // end of Dialog._parentEvent() 89 90 // ------------------------------------------- 91 92 /** 93 * Dialog._geckoOpenModal() 94 */ 95 96 Dialog._geckoOpenModal = function(url, action, init) 97 { 98 42 99 var dlg = window.open(url, "hadialog", 43 100 "toolbar=no,menubar=no,personalbar=no,width=10,height=10," + 44 101 "scrollbars=no,resizable=yes,modal=yes,dependable=yes"); 102 45 103 Dialog._modal = dlg; 46 104 Dialog._arguments = init; 47 105 48 106 // capture some window's events 49 function capwin(w) { 107 function capwin(w) 108 { 50 109 HTMLArea._addEvent(w, "click", Dialog._parentEvent); 51 110 HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); 52 111 HTMLArea._addEvent(w, "focus", Dialog._parentEvent); 53 }; 112 }; 113 54 114 // release the captured events 55 function relwin(w) { 115 116 function relwin(w) 117 { 56 118 HTMLArea._removeEvent(w, "click", Dialog._parentEvent); 57 119 HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); 58 120 HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); 59 }; 121 }; 122 60 123 capwin(window); 124 61 125 // capture other frames 126 62 127 for (var i = 0; i < window.frames.length; capwin(window.frames[i++])); 63 // make up a function to be called when the Dialog ends. 64 Dialog._return = function (val) { 65 if (val && action) { 128 129 // make up a function to be called when the Dialog ends. This will call 130 // the function passed to us above. (i.e. action) 131 132 Dialog._return = function (val) 133 { 134 if (val && action) 135 { 66 136 action(val); 67 } 137 } 138 68 139 relwin(window); 140 69 141 // capture other frames 142 70 143 for (var i = 0; i < window.frames.length; relwin(window.frames[i++])); 144 71 145 Dialog._modal = null; 72 }; 73 }; 146 }; 147 148 }; // end of Dialog._geckoOpenModal() 149 150 // END -
branches/unified_backend/examples/full_example-body.php
r84 r121 1 <html> 1 <?php 2 3 // [NOSTRIP 4 // ----------------------------------------------------------------- 5 // Copyright (C) Gogo Code. 6 // http://code.gogo.co.nz 7 // 8 // Unified backend modifications by DTLink, LLC. 9 // http://www.dtlink.com and http://www.formvista.com 10 // ----------------------------------------------------------------- 11 // This code is distributed under the the sames terms as Xinha 12 // itself. (HTMLArea license based on the BSD license) 13 // 14 // Please read license.txt in this package for details. 15 // 16 // All software distributed under the Licenses is provided strictly on 17 // an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR 18 // IMPLIED, AND DTLINK LLC HEREBY DISCLAIMS ALL SUCH 19 // WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF 20 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT, 21 // OR NON-INFRINGEMENT. 22 // ------------------------------------------------------------------ 23 // NOSTRIP] 24 25 /** 26 * Modified version of full_example-body.html for use with the PHP unified backend. 27 * 28 * To use the unified backend you must first include the backend_conf.php file which 29 * is generated by Configure.php. 30 */ 31 32 /** 33 * Configure.php generated config file for PHP unified backend. 34 */ 35 36 include_once( "../backends/backend_conf.php" ); 37 38 ?><html> 2 39 <head> 3 40 … … 18 55 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 19 56 <title>Example of Xinha</title> 20 <link rel="stylesheet" href=" full_example.css" />57 <link rel="stylesheet" href="<? echo XINHA_INSTALL_URL; ?>/examples/full_example.css" /> 21 58 22 59 <script type="text/javascript"> 23 // You must set _editor_url to the URL (including trailing slash) where 24 // where xinha is installed, it's highly recommended to use an absolute URL 25 // eg: _editor_url = "/path/to/xinha/"; 26 // You may try a relative URL if you wish] 27 // eg: _editor_url = "../"; 28 // in this example we do a little regular expression to find the absolute path. 29 _editor_url = document.location.href.replace(/examples\/full_example-body\.html.*/, '') 60 // You must set _editor_url to the URL (including trailing slash) where Xinha 61 // is installed. 62 // 63 // Before we had the central config, this is the way it was done. 64 // 65 // _editor_url = document.location.href.replace(/examples\/full_example-body\.html.*/, '') 66 67 _editor_url = "<? echo XINHA_INSTALL_URL; ?>"; 30 68 _editor_lang = "en"; // And the language we need to use in the editor. 31 69 </script> … … 33 71 <!-- load in debug trace message class --> 34 72 35 <script type="text/javascript" src=" ../ddt.js"></script>73 <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/ddt/ddt.js"></script> 36 74 37 75 <!-- create a global trace message object --> … … 40 78 var startupDDT = new DDT( "startup" ); 41 79 startupDDT._ddtOn(); 80 81 startupDDT._ddt( "full_example-body.php", "81", "ddt object created on calling page" ); 42 82 </script> 43 83 44 84 <!-- Load up the actual editor core --> 45 <script type="text/javascript" src=" ../htmlarea.js"></script>85 <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/htmlarea.js"></script> 46 86 47 87 <script type="text/javascript"> … … 71 111 'TableOperations' 72 112 ]; 73 // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :) 74 if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; 113 114 // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :) 115 if (!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) 116 return; 75 117 76 118 /** STEP 2 *************************************************************** … … 163 205 164 206 <div id="lipsum" style="display:none"> 165 <p>This is an example of a Xinha editor. The two extra 166 <b><></b> buttons on the right of the toolbar 167 turn on debugging trace messages.</p> 207 <p>This is an example of a Xinha editor with extensive trace messages 208 turned on. To turn off trace messages, assuming you have the source, just 209 comment out the _ddtOn() calls. Eventually we'll have a script that 210 strips out the trace messages and comments to produce a "runtime' version.</p> 168 211 169 212 <p>This branch of Xinha development is called the Unified … … 177 220 <li> Configure.php script to generate server side scripts and permissions. </li> 178 221 <li> makedocs.pl script to generate documentation.</li> 222 <li> unified PHP backend script in backends/backend.php through which all 223 plugin to server communications are routed (ImageManager and Linker are 224 done, SpellChecker is next). 179 225 </ul> 180 226 -
branches/unified_backend/examples/full_example-menu.html
r72 r121 33 33 </p> 34 34 35 <form action="full_example-body. html" target="body">35 <form action="full_example-body.php" target="body"> 36 36 <fieldset> 37 37 <legend>Plugins</legend> -
branches/unified_backend/examples/full_example.html
r20 r121 12 12 <frameset cols="200,*"> 13 13 <frame src="full_example-menu.html" name="menu"> 14 <frame src="full_example-body. html" name="body">14 <frame src="full_example-body.php" name="body"> 15 15 </frameset> 16 16 </html> -
branches/unified_backend/examples/full_example.js
r20 r121 48 48 // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL 49 49 // otherwise it won't work! 50 config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\. html/, 'stylist.css'));50 config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.php/, 'stylist.css')); 51 51 52 52 // Or we can load styles directly -
branches/unified_backend/examples/simple_example.php
r85 r121 36 36 <!-- load in debug trace message class --> 37 37 38 <script type="text/javascript" src="../ddt .js"></script>38 <script type="text/javascript" src="../ddt/ddt.js"></script> 39 39 40 40 <script type="text/javascript"> -
branches/unified_backend/htmlarea.js
r85 r121 1 // --------------------------------------:noTabs=true:tabSize=2:indentSize=2:--2 3 1 /** 4 2 * @fileoverview Xinha (is not htmlArea) {@link http://xinha.gogo.co.nz/ Xinha.org} … … 58 56 { 59 57 _editor_lang = "en"; 58 } 59 60 // if no backend_url is defined, set a default. We'll default to the 61 // PHP backend. This can be overridden on the calling page. 62 63 if (typeof _editor_backend != "string") 64 { 65 _editor_backend = _editor_url + "/backends/backend.php"; 60 66 } 61 67 … … 139 145 HTMLArea._scripts = []; 140 146 147 /** 148 * list of plugin load attempts 149 * 150 * used to avoid endless loops when trying to load plugins with syntax errors. 151 * 152 * @see loadPlugin 153 */ 154 155 HTMLArea.plugin_loadattempts = []; 156 157 /** 158 * number of times to attempt loading something from the server 159 */ 160 161 HTMLArea.maxloadattempts = 10; 162 141 163 // --------------------------------------------------- 142 164 … … 227 249 228 250 /** 229 * lcBackend - what's this used for?251 * lcBackend - localization backend. 230 252 */ 231 253 … … 304 326 305 327 this.pageStyleSheets = [ ]; 328 329 /** 330 * type of URL replacements in the document - fullyqualified or absolute 331 * 332 * in inwardHtml() and outwardHtml() regex's are applied to the document 333 * to fix up links in the document. The previous version always modified 334 * links to be fully qualified links (i.e. http://somesite/ ..) making 335 * content generated by Xinha non-portable between sites. 336 * 337 * This setting determines whether or not links in the document will 338 * be fully qualified (http://thissite/..) or absolute (/...). 339 * 340 * The default is absolute. 341 * 342 * @see HTML.prototype.outwardHTML 343 * @todo support leaving links relative. 344 */ 345 346 this.linkReplacementMode = 'absolute'; 306 347 307 348 /** … … 724 765 // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 725 766 726 HTMLArea._ddt( "htmlarea.js","7 26", "registerButton(): WARNING [HTMLArea.Config::registerDropdown]: A dropdown with the same ID already exists." );767 HTMLArea._ddt( "htmlarea.js","767", "registerButton(): WARNING [HTMLArea.Config::registerDropdown]: A dropdown with the same ID already exists." ); 727 768 } 728 769 … … 730 771 { 731 772 // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists."); 732 HTMLArea._ddt( "htmlarea.js","7 32", "registerbutton(): WARNING [HTMLArea.Config::registerDropdown]:A button with the same ID already exists." );773 HTMLArea._ddt( "htmlarea.js","773", "registerbutton(): WARNING [HTMLArea.Config::registerDropdown]:A button with the same ID already exists." ); 733 774 } 734 775 … … 760 801 { 761 802 // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists."); 762 HTMLArea._ddt( "htmlarea.js"," 762", "registerDropdown(): WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists." );803 HTMLArea._ddt( "htmlarea.js","803", "registerDropdown(): WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists." ); 763 804 } 764 805 … … 766 807 { 767 808 // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists."); 768 HTMLArea._ddt( "htmlarea.js"," 768", "registerDropdown(): WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists." );809 HTMLArea._ddt( "htmlarea.js","809", "registerDropdown(): WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists." ); 769 810 } 770 811 … … 826 867 { 827 868 828 HTMLArea._ddt( "htmlarea.js","8 28", "loadScript(): Top with url '" + url + "' and plugin '" + plugin + "'" );869 HTMLArea._ddt( "htmlarea.js","869", "loadScript(): Top with url '" + url + "' and plugin '" + plugin + "'" ); 829 870 830 871 if (plugin) … … 870 911 { 871 912 872 HTMLArea._ddt( "htmlarea.js"," 872", "init(): top" );913 HTMLArea._ddt( "htmlarea.js","913", "init(): top" ); 873 914 874 915 var head = document.getElementsByTagName("head")[0]; … … 896 937 // MSIE is not ready. 897 938 898 HTMLArea._ddt( "htmlarea.js"," 898", "init(): MSIE ready state not ready '" + window.event.srcElement.readyState + "'" );939 HTMLArea._ddt( "htmlarea.js","939", "init(): MSIE ready state not ready '" + window.event.srcElement.readyState + "'" ); 899 940 900 941 return; … … 914 955 script.src = url; 915 956 916 HTMLArea._ddt( "htmlarea.js","9 16", "loadNextScript(): loading '" + url + "'" );957 HTMLArea._ddt( "htmlarea.js","957", "loadNextScript(): loading '" + url + "'" ); 917 958 918 959 // the magic step. evt depends on the browser (See above) … … 925 966 document.title = savetitle; 926 967 927 HTMLArea._ddt( "htmlarea.js","9 27", "loadNextScript(): end of list reached. Firing HTMLAreaonLoad handler which is '" + HTMLArea.onLoad + "'" );968 HTMLArea._ddt( "htmlarea.js","968", "loadNextScript(): end of list reached. Firing HTMLAreaonLoad handler which is '" + HTMLArea.onLoad + "'" ); 928 969 929 970 // fire the onLoad handler. See HTMLArea.onload() up top. … … 935 976 }; // end of in-line loadNextScript() function. 936 977 937 HTMLArea._ddt( "htmlarea.js","9 37", "init(): calling first loadNextScript()" );978 HTMLArea._ddt( "htmlarea.js","978", "init(): calling first loadNextScript()" ); 938 979 939 980 // start the chain of script loading. … … 952 993 { 953 994 954 HTMLArea._ddt( "htmlarea.js","9 54", "replaceAll(): top" );995 HTMLArea._ddt( "htmlarea.js","995", "replaceAll(): top" ); 955 996 956 997 var tas = document.getElementsByTagName("textarea"); … … 967 1008 { 968 1009 969 HTMLArea._ddt( "htmlarea.js"," 969", "replace(): top with id '" + id + "'" );1010 HTMLArea._ddt( "htmlarea.js","1010", "replace(): top with id '" + id + "'" ); 970 1011 971 1012 var ta = HTMLArea.getElementById("textarea", id); … … 997 1038 { 998 1039 999 HTMLArea._ddt( "htmlarea.js"," 999", "makeBtnImg(): top" );1040 HTMLArea._ddt( "htmlarea.js","1040", "makeBtnImg(): top" ); 1000 1041 1001 1042 if(!doc) doc = document; … … 1065 1106 i_contain.appendChild(img); 1066 1107 1067 HTMLArea._ddt( "htmlarea.js","1 067", "makeBtnImg(): bottom" );1108 HTMLArea._ddt( "htmlarea.js","1108", "makeBtnImg(): bottom" ); 1068 1109 1069 1110 return i_contain; … … 1099 1140 { 1100 1141 1101 HTMLArea._ddt( "htmlarea.js","11 01", "loadPlugin(): loading plugin '" + pluginName + "'" );1142 HTMLArea._ddt( "htmlarea.js","1142", "loadPlugin(): loading plugin '" + pluginName + "'" ); 1102 1143 1103 1144 // Might already be loaded … … 1106 1147 { 1107 1148 1108 HTMLArea._ddt( "htmlarea.js","11 08", "loadPlugin(): plugin '" + pluginName + "' already loaded" );1149 HTMLArea._ddt( "htmlarea.js","1149", "loadPlugin(): plugin '" + pluginName + "' already loaded" ); 1109 1150 1110 1151 if (callback) 1111 1152 { 1112 1153 1113 HTMLArea._ddt( "htmlarea.js","11 13", "loadPlugin(): calling plugin '" + pluginName + "' callback" );1154 HTMLArea._ddt( "htmlarea.js","1154", "loadPlugin(): calling plugin '" + pluginName + "' callback" ); 1114 1155 1115 1156 callback(); … … 1122 1163 var plugin = pluginName.replace(/([a-z])([A-Z])([a-z])/g, 1123 1164 function (str, l1, l2, l3) 1124 {1165 { 1125 1166 return l1 + "-" + l2.toLowerCase() + l3; 1126 1167 }).toLowerCase() + ".js"; … … 1128 1169 var plugin_file = dir + "/" + plugin; 1129 1170 1171 // if the plugin file contains an error we can get into an endless loop which will 1172 // eventually crash the browser. To prevent that fate we limit the number of times 1173 // we'll try to load any given plugin. Note that a plugin is loaded once per page, 1174 // not once we editor on the page. 1175 // 1176 // Actually, because of the implementation of _loadback() we should only ever try 1177 // to load the plugin once since the callback isn't invoked until the file is loaded. 1178 // We can always adjust HTMLArea.maxloadattempts to 1 later. 1179 // 1180 // we keep an array of plugin load attempt counts in HTMLArea. 1181 1182 if ( typeof HTMLArea.plugin_loadattempts[ pluginName ] == 'undefined' ) 1183 { 1184 HTMLArea.plugin_loadattempts[ pluginName ] = 1; 1185 } 1186 else 1187 { 1188 HTMLArea.plugin_loadattempts[ pluginName ]++; 1189 } 1190 1191 HTMLArea._ddt( "htmlarea.js","1191", "loadPlugin(): Attempt #" + HTMLArea.plugin_loadattempts[pluginName] + " for plugin '" + pluginName + "'" ); 1192 1193 if ( HTMLArea.plugin_loadattempts[ pluginName ] > HTMLArea.maxloadattempts ) 1194 { 1195 alert( "ERROR unsuccessfully attempted to load plugin '" + pluginName + "' '" + HTMLArea.maxloadattempts + "' times. It probably contains an error. Please check your javascript console for details" ); 1196 return false; 1197 } 1198 1130 1199 if ( callback ) 1131 1200 { 1132 HTMLArea._ddt( "htmlarea.js","1132", "loadPlugin(): callback defined. Using _loadback() to load plugin" );1201 HTMLArea._ddt( "htmlarea.js","1201", "loadPlugin(): callback defined. Using _loadback() to load plugin" ); 1133 1202 1134 1203 HTMLArea._loadback(plugin_file, callback); 1135 1204 } 1136 1205 else 1137 1138 HTMLArea._ddt( "htmlarea.js","1 138", "loadPlugin(): callback not defined. writing javascript include line to document." );1206 { 1207 HTMLArea._ddt( "htmlarea.js","1207", "loadPlugin(): callback not defined. writing javascript include line to document." ); 1139 1208 1140 1209 document.write("<script type='text/javascript' src='" + plugin_file + "'></script>"); 1141 1210 } 1142 1211 1143 1212 }; // end of loadPlugin() … … 1158 1227 { 1159 1228 1160 HTMLArea._ddt( "htmlarea.js","1 160", "loadPlugins(): top - cloning plugins array." );1229 HTMLArea._ddt( "htmlarea.js","1229", "loadPlugins(): top - cloning plugins array." ); 1161 1230 1162 1231 // make a copy of the plugins array that we'll chip away at. … … 1175 1244 var poppedPlugin = nuPlugins.pop(); 1176 1245 1177 HTMLArea._ddt( "htmlarea.js","1 177", "loadPlugins(): plugin '" + poppedPlugin + "' was already loaded" );1246 HTMLArea._ddt( "htmlarea.js","1246", "loadPlugins(): plugin '" + poppedPlugin + "' was already loaded" ); 1178 1247 1179 1248 } … … 1190 1259 { 1191 1260 1192 HTMLArea._ddt( "htmlarea.js","1 192", "loadPlugins(): no plugins left to load" );1261 HTMLArea._ddt( "htmlarea.js","1261", "loadPlugins(): no plugins left to load" ); 1193 1262 1194 1263 return true; … … 1208 1277 HTMLArea.loadPlugin( nuPlugins.pop(), 1209 1278 function() 1210 {1279 { 1211 1280 if(HTMLArea.loadPlugins(nuPlugins, callbackIfNotReady)) 1212 {1281 { 1213 1282 if(typeof callbackIfNotReady == 'function') 1214 {1283 { 1215 1284 callbackIfNotReady(); 1216 }1217 }1218 }1219 ); // this is the end of the HTMLArea.loadPlugin() recursive call.1220 1221 HTMLArea._ddt( "htmlarea.js","12 21", "loadPlugins(): end" );1285 } 1286 } 1287 } 1288 ); // this is the end of the HTMLArea.loadPlugin() recursive call. 1289 1290 HTMLArea._ddt( "htmlarea.js","1290", "loadPlugins(): end" ); 1222 1291 1223 1292 return false; … … 1234 1303 { 1235 1304 1236 HTMLArea._ddt( "htmlarea.js","1 236", "refreshPlugin(): top" );1305 HTMLArea._ddt( "htmlarea.js","1305", "refreshPlugin(): top" ); 1237 1306 1238 1307 if (typeof plugin.onGenerate == "function") 1239 1308 { 1240 HTMLArea._ddt( "htmlarea.js","1 240", "refreshPlugin(): onGenerate is a function. calling onGenerate for '" + plugin + "'" );1309 HTMLArea._ddt( "htmlarea.js","1309", "refreshPlugin(): onGenerate is a function. calling onGenerate for '" + plugin + "'" ); 1241 1310 plugin.onGenerate(); 1242 1311 } … … 1244 1313 if (typeof plugin.onGenerateOnce == "function") 1245 1314 { 1246 HTMLArea._ddt( "htmlarea.js","1 246", "refreshPlugin(): onGenerateOnce is a function. calling onGenerateOnce for '" + plugin + "'" );1315 HTMLArea._ddt( "htmlarea.js","1315", "refreshPlugin(): onGenerateOnce is a function. calling onGenerateOnce for '" + plugin + "'" ); 1247 1316 plugin.onGenerateOnce(); 1248 1317 plugin.onGenerateOnce = null; … … 1261 1330 var url = _editor_url || ''; 1262 1331 1263 HTMLArea._ddt( "htmlarea.js","1 263", "loadStyle(): top with style '" + style + "' and plugin '" + plugin + "'" );1332 HTMLArea._ddt( "htmlarea.js","1332", "loadStyle(): top with style '" + style + "' and plugin '" + plugin + "'" ); 1264 1333 1265 1334 if (typeof plugin != "undefined") … … 1279 1348 head.appendChild(link); 1280 1349 1281 HTMLArea._ddt( "htmlarea.js","1 281", "loadStyle(): appending '" + link.href + "' to document" );1350 HTMLArea._ddt( "htmlarea.js","1350", "loadStyle(): appending '" + link.href + "' to document" ); 1282 1351 1283 1352 //document.write("<style type='text/css'>@import url(" + url + ");</style>"); … … 1312 1381 { 1313 1382 1314 HTMLArea._ddt( "htmlarea.js","13 14", "getInnerText(): top" );1383 HTMLArea._ddt( "htmlarea.js","1383", "getInnerText(): top" ); 1315 1384 1316 1385 var txt = '', i; … … 1340 1409 { 1341 1410 1342 HTMLArea._ddt( "htmlarea.js","1 342", "cloneObject(): top" );1411 HTMLArea._ddt( "htmlarea.js","1411", "cloneObject(): top" ); 1343 1412 1344 1413 if (!obj) return null; … … 1351 1420 { 1352 1421 1353 HTMLArea._ddt( "htmlarea.js","1 353", "cloneObject(): contructing an array object." );1422 HTMLArea._ddt( "htmlarea.js","1422", "cloneObject(): contructing an array object." ); 1354 1423 1355 1424 newObj = obj.constructor(); … … 1360 1429 { 1361 1430 1362 HTMLArea._ddt( "htmlarea.js","1 362", "cloneObject(): cloning an function object." );1431 HTMLArea._ddt( "htmlarea.js","1431", "cloneObject(): cloning an function object." ); 1363 1432 1364 1433 newObj = obj; // just copy reference to it … … 1367 1436 { 1368 1437 1369 HTMLArea._ddt( "htmlarea.js","1 369", "cloneObject(): copying object members." );1438 HTMLArea._ddt( "htmlarea.js","1438", "cloneObject(): copying object members." ); 1370 1439 1371 1440 for (var n in obj) … … 1400 1469 { 1401 1470 1402 HTMLArea._ddt( "htmlarea.js","14 02", "checkSupportedBrowser(): top" );1471 HTMLArea._ddt( "htmlarea.js","1471", "checkSupportedBrowser(): top" ); 1403 1472 1404 1473 if (HTMLArea.is_gecko) … … 1436 1505 { 1437 1506 1438 HTMLArea._ddt( "htmlarea.js","1 438", "getElementById(): top with tag '" + tag + "' id '" + id + "'" );1507 HTMLArea._ddt( "htmlarea.js","1507", "getElementById(): top with tag '" + tag + "' id '" + id + "'" ); 1439 1508 1440 1509 var el, i, objs = document.getElementsByTagName(tag); … … 1458 1527 { 1459 1528 1460 HTMLArea._ddt( "htmlarea.js","1 460", "_postback() : top with url '" + url + "'" );1529 HTMLArea._ddt( "htmlarea.js","1529", "_postback() : top with url '" + url + "'" ); 1461 1530 1462 1531 var req = null; … … 1510 1579 { 1511 1580 1512 HTMLArea._ddt( "htmlarea.js","15 12", "_getback(): top" );1581 HTMLArea._ddt( "htmlarea.js","1581", "_getback(): top" ); 1513 1582 1514 1583 var req = null; … … 1552 1621 { 1553 1622 1554 HTMLArea._ddt( "htmlarea.js","1 554", "_geturlcontent(): top with url '" + url + "'" );1623 HTMLArea._ddt( "htmlarea.js","1623", "_geturlcontent(): top with url '" + url + "'" ); 1555 1624 1556 1625 var req = null; … … 1587 1656 { 1588 1657 1589 HTMLArea._ddt( "htmlarea.js","1 589", "arrayContainsArray(): top" );1658 HTMLArea._ddt( "htmlarea.js","1658", "arrayContainsArray(): top" ); 1590 1659 1591 1660 var all_found = true; … … 1622 1691 { 1623 1692 1624 HTMLArea._ddt( "htmlarea.js","16 24", "arrayFilter(): top" );1693 HTMLArea._ddt( "htmlarea.js","1693", "arrayFilter(): top" ); 1625 1694 1626 1695 var new_a = [ ]; … … 1659 1728 { 1660 1729 1661 HTMLArea._ddt( "htmlarea.js","1 661", "_loadlang(): top" );1730 HTMLArea._ddt( "htmlarea.js","1730", "_loadlang(): top" ); 1662 1731 1663 1732 if(typeof _editor_lcbackend == "string") … … 1716 1785 { 1717 1786 1718 HTMLArea._ddt( "htmlarea.js","17 18", "_lc: top with string '" + string + "'" );1787 HTMLArea._ddt( "htmlarea.js","1787", "_lc: top with string '" + string + "'" ); 1719 1788 1720 1789 if(_editor_lang == "en") … … 1758 1827 { 1759 1828 1760 HTMLArea._ddt( "htmlarea.js","1 760", "hasDisplayedChildren(): top" );1829 HTMLArea._ddt( "htmlarea.js","1829", "hasDisplayedChildren(): top" ); 1761 1830 1762 1831 var children = el.childNodes; … … 1788 1857 { 1789 1858 1790 HTMLArea._ddt( "htmlarea.js","1 790", "_loadback(): top with src '" + src + "'" );1859 HTMLArea._ddt( "htmlarea.js","1859", "_loadback(): top with src '" + src + "'" ); 1791 1860 1792 1861 var head = document.getElementsByTagName("head")[0]; … … 1810 1879 head.appendChild(script); 1811 1880 1812 HTMLArea._ddt( "htmlarea.js","18 12", "_loadback(): script tag to load javascript file appended to head section." );1881 HTMLArea._ddt( "htmlarea.js","1881", "_loadback(): script tag to load javascript file appended to head section." ); 1813 1882 1814 1883 }; // end of _loadback() … … 1823 1892 { 1824 1893 1825 HTMLArea._ddt( "htmlarea.js","18 25", "collectionToArray(): top" );1894 HTMLArea._ddt( "htmlarea.js","1894", "collectionToArray(): top" ); 1826 1895 1827 1896 var array = [ ]; … … 1843 1912 { 1844 1913 1845 HTMLArea._ddt( "htmlarea.js","1 845", "makeEditors(): top" );1914 HTMLArea._ddt( "htmlarea.js","1914", "makeEditors(): top" ); 1846 1915 1847 1916 if ( typeof default_config == 'function') 1848 1917 { 1849 1918 1850 HTMLArea._ddt( "htmlarea.js","1850", "makeEditors(): default config is a function" );1919 HTMLArea._ddt( "htmlarea.js","1919", "makeEditors(): default config is a function" ); 1851 1920 default_config = default_config(); 1852 1921 } … … 1856 1925 { 1857 1926 1858 HTMLArea._ddt( "htmlarea.js","1858", "makeEditors(): making editor '" + editor_names[x] + "' and copying in cloned default_config" );1927 HTMLArea._ddt( "htmlarea.js","1927", "makeEditors(): making editor '" + editor_names[x] + "' and copying in cloned default_config" ); 1859 1928 1860 1929 editors[editor_names[x]] = new HTMLArea(editor_names[x], HTMLArea.cloneObject(default_config)); … … 1865 1934 { 1866 1935 1867 HTMLArea._ddt( "htmlarea.js","1867", "makeEditors(): registering plugin '" + plugin_names[i] + "' for editor '" + editor_names[x] + "'" );1936 HTMLArea._ddt( "htmlarea.js","1936", "makeEditors(): registering plugin '" + plugin_names[i] + "' for editor '" + editor_names[x] + "'" ); 1868 1937 1869 1938 editors[editor_names[x]].registerPlugin(eval(plugin_names[i])); … … 1871 1940 } 1872 1941 } 1942 1873 1943 return editors; 1874 1944 … … 1886 1956 { 1887 1957 1888 HTMLArea._ddt( "htmlarea.js","1 888", "startEditors(): top" );1958 HTMLArea._ddt( "htmlarea.js","1958", "startEditors(): top" ); 1889 1959 1890 1960 for(var i in editors) … … 1905 1975 { 1906 1976 1907 HTMLArea._ddt( "htmlarea.js","19 07", "_makeColor(): top" );1977 HTMLArea._ddt( "htmlarea.js","1977", "_makeColor(): top" ); 1908 1978 1909 1979 if (typeof v != "number") … … 2051 2121 { 2052 2122 2053 HTMLArea._ddt( "htmlarea.js","2 073", "getHTML(): top" );2123 HTMLArea._ddt( "htmlarea.js","2123", "getHTML(): top" ); 2054 2124 2055 2125 try … … 2074 2144 { 2075 2145 2076 HTMLArea._ddt( "htmlarea.js","2 073", "getHTMLWrapper(): top" );2146 HTMLArea._ddt( "htmlarea.js","2146", "getHTMLWrapper(): top" ); 2077 2147 2078 2148 var html = ""; … … 2272 2342 { 2273 2343 2274 HTMLArea._ddt( "htmlarea.js","2 271", "addClasses(): top" );2344 HTMLArea._ddt( "htmlarea.js","2344", "addClasses(): top" ); 2275 2345 2276 2346 if(el != null) … … 2306 2376 { 2307 2377 2308 HTMLArea._ddt( "htmlarea.js","23 05", "removeClasses(): top" );2378 HTMLArea._ddt( "htmlarea.js","2378", "removeClasses(): top" ); 2309 2379 2310 2380 var existing = el.className.trim().split(); … … 2419 2489 { 2420 2490 2421 HTMLArea._ddt( "htmlarea.js","24 18", "_addEvent(): adding event for '" + evname + "' func '" + func.toString().substring(0,100) + "'" );2491 HTMLArea._ddt( "htmlarea.js","2491", "_addEvent(): adding event for '" + evname + "' func '" + func.toString().substring(0,100) + "'" ); 2422 2492 2423 2493 if (HTMLArea.is_ie) … … 2544 2614 // STRIP] 2545 2615 2546 this.ddt._ddt( "htmlarea.js","2 543", "HTMLArea(): DDT Trace System Initialized." );2616 this.ddt._ddt( "htmlarea.js","2616", "HTMLArea(): DDT Trace System Initialized." ); 2547 2617 2548 2618 this._htmlArea = null; … … 2598 2668 } // end of if we are a supported browser. 2599 2669 2600 this.ddt._ddt( "htmlarea.js","2 597", "HTMLArea(): end" );2670 this.ddt._ddt( "htmlarea.js","2670", "HTMLArea(): end" ); 2601 2671 2602 2672 }; // end of HTMLArea() constructor … … 2611 2681 { 2612 2682 2613 this.ddt._ddt( "htmlarea.js","26 10", "_createToolbar(): top" );2683 this.ddt._ddt( "htmlarea.js","2683", "_createToolbar(): top" ); 2614 2684 2615 2685 var editor = this; // to access this in nested functions … … 2638 2708 { 2639 2709 2640 this.ddt._ddt( "htmlarea.js","2 637", "registerPanel(): top with side '" + side + "'" );2710 this.ddt._ddt( "htmlarea.js","2710", "registerPanel(): top with side '" + side + "'" ); 2641 2711 2642 2712 if(!side) side = 'right'; … … 2681 2751 { 2682 2752 2683 this.ddt._ddt( "htmlarea.js","2 680", "_createToolbar1(): top" );2753 this.ddt._ddt( "htmlarea.js","2753", "_createToolbar1(): top" ); 2684 2754 2685 2755 // creates a new line in the toolbar … … 2688 2758 { 2689 2759 2690 editor.ddt._ddt( "htmlarea.js","2 687", "newLine(): top" );2760 editor.ddt._ddt( "htmlarea.js","2760", "newLine(): top" ); 2691 2761 2692 2762 var table = document.createElement("table"); … … 2724 2794 { 2725 2795 2726 HTMLArea._ddt( "htmlarea.js","27 23", "setButtonStatus() : top with id '" + id + "' value '" + newval + '"' );2796 HTMLArea._ddt( "htmlarea.js","2796", "setButtonStatus() : top with id '" + id + "' value '" + newval + '"' ); 2727 2797 2728 2798 var oldval = this[id]; … … 2780 2850 { 2781 2851 2782 HTMLArea._ddt( "htmlarea.js","2 779", "createSelect(): top with text '" + txt + "'" );2852 HTMLArea._ddt( "htmlarea.js","2852", "createSelect(): top with text '" + txt + "'" ); 2783 2853 2784 2854 var options = null; … … 2858 2928 2859 2929 HTMLArea._addEvent(el, "change", 2860 2861 2862 2863 2864 } 2865 2866 HTMLArea._ddt( "htmlarea.js","2 863", "createSelect(): end" );2930 function () 2931 { 2932 editor._comboSelected(el, txt); 2933 }); 2934 } 2935 2936 HTMLArea._ddt( "htmlarea.js","2936", "createSelect(): end" ); 2867 2937 2868 2938 return el; … … 2879 2949 { 2880 2950 2881 editor.ddt._ddt( "htmlarea.js","2 878", "createButton(): top with text '" + txt + "'" );2951 editor.ddt._ddt( "htmlarea.js","2951", "createButton(): top with text '" + txt + "'" ); 2882 2952 2883 2953 // the element that will be created … … 2956 3026 2957 3027 HTMLArea._addEvent(el, "mouseout", 2958 function () 2959 { 2960 if (obj.enabled) with (HTMLArea) 2961 { 3028 function () 3029 { 3030 if (obj.enabled) with (HTMLArea) 3031 { 3032 3033 HTMLArea._ddt( "htmlarea.js","3033", "mouseout event: top" ); 3034 2962 3035 //_removeClass(el, "buttonHover"); 2963 2964 2965 }2966 });3036 _removeClass(el, "buttonActive"); 3037 (obj.active) && _addClass(el, "buttonPressed"); 3038 } 3039 }); 2967 3040 2968 3041 HTMLArea._addEvent(el, "mousedown", 2969 function (ev) 2970 { 2971 if (obj.enabled) with (HTMLArea) 2972 { 2973 _addClass(el, "buttonActive"); 2974 _removeClass(el, "buttonPressed"); 2975 _stopEvent(is_ie ? window.event : ev); 2976 } 2977 }); 3042 function (ev) 3043 { 3044 if (obj.enabled) with (HTMLArea) 3045 { 3046 3047 HTMLArea._ddt( "htmlarea.js","3047", "mousedown event top" ); 3048 3049 _addClass(el, "buttonActive"); 3050 _removeClass(el, "buttonPressed"); 3051 _stopEvent(is_ie ? window.event : ev); 3052 } 3053 }); 2978 3054 2979 3055 // when clicked, do the following: 2980 3056 2981 3057 HTMLArea._addEvent(el, "click", 2982 function (ev) 2983 { 2984 if (obj.enabled) with (HTMLArea) 2985 { 3058 function (ev) 3059 { 3060 if (obj.enabled) with (HTMLArea) 3061 { 3062 3063 HTMLArea._ddt( "htmlarea.js","3063", "click event top" ); 3064 2986 3065 _removeClass(el, "buttonActive"); 2987 3066 //_removeClass(el, "buttonHover"); … … 3099 3178 { 3100 3179 3101 this.ddt._ddt( "htmlarea.js","3 098", "_createStatusBar(): top" );3180 this.ddt._ddt( "htmlarea.js","3180", "_createStatusBar(): top" ); 3102 3181 3103 3182 var statusbar = document.createElement("div"); … … 3133 3212 { 3134 3213 3135 this.ddt._ddt( "htmlarea.js","3 132", "generate(): top" );3214 this.ddt._ddt( "htmlarea.js","3214", "generate(): top" ); 3136 3215 3137 3216 var editor = this; // we'll need "this" in some nested functions … … 3148 3227 { 3149 3228 3150 this.ddt._ddt( "htmlarea.js","3 147", "generate(): mozParaHandler config set to 'best'. Loading EnterParagraphs" );3229 this.ddt._ddt( "htmlarea.js","3229", "generate(): mozParaHandler config set to 'best'. Loading EnterParagraphs" ); 3151 3230 3152 3231 EnterParagraphs = 'null'; … … 3200 3279 textarea.parentNode.insertBefore(htmlarea, textarea); 3201 3280 3202 this.ddt._ddt( "htmlarea.js","3 199", "generate(): creating toolbar" );3281 this.ddt._ddt( "htmlarea.js","3281", "generate(): creating toolbar" ); 3203 3282 3204 3283 // creates & appends the toolbar … … 3228 3307 // } 3229 3308 3230 this.ddt._ddt( "htmlarea.js","3 227", "generate(): adding panels" );3309 this.ddt._ddt( "htmlarea.js","3309", "generate(): adding panels" ); 3231 3310 3232 3311 // Add the panels … … 3236 3315 } 3237 3316 3238 this.ddt._ddt( "htmlarea.js","3 235", "generate(): creating Status Bar" );3317 this.ddt._ddt( "htmlarea.js","3317", "generate(): creating Status Bar" ); 3239 3318 3240 3319 // creates & appends the status bar … … 3263 3342 { 3264 3343 3265 this.ddt._ddt( "htmlarea.js","3 262", "generate(): f.onsubmit(): top" );3344 this.ddt._ddt( "htmlarea.js","3344", "generate(): f.onsubmit(): top" ); 3266 3345 3267 3346 var a = this.__msh_prevOnSubmit; … … 3302 3381 { 3303 3382 3304 this.ddt._ddt( "htmlarea.js","33 01", "generate(): f.onreset(): top" );3383 this.ddt._ddt( "htmlarea.js","3383", "generate(): f.onreset(): top" ); 3305 3384 3306 3385 var a = this.__msh_prevOnReset; … … 3330 3409 try 3331 3410 { 3332 HTMLArea._addEvent(window, 'unload', function() {textarea.value = editor.outwardHtml(editor.getHTML());} ); 3411 HTMLArea._addEvent(window, 'unload', 3412 function() 3413 { 3414 HTMLArea._ddt( "htmlarea.js","3414", "unload event top" ); 3415 textarea.value = editor.outwardHtml(editor.getHTML()); 3416 } ); 3333 3417 } catch(e) {}; 3334 3418 … … 3337 3421 textarea.style.display = "none"; 3338 3422 3339 this.ddt._ddt( "htmlarea.js","3 336", "generate(): calculating starting size" );3423 this.ddt._ddt( "htmlarea.js","3423", "generate(): calculating starting size" ); 3340 3424 3341 3425 // Calculate the starting size, EXCLUDING THE TOOLBAR & STATUS BAR (always) … … 3375 3459 this.notifyOn('panel_change',function(){editor.setInnerSize();}); 3376 3460 3377 this.ddt._ddt( "htmlarea.js","3 374", "generate(): bottom before timeout call to initIframe()" );3461 this.ddt._ddt( "htmlarea.js","3461", "generate(): bottom before timeout call to initIframe()" ); 3378 3462 3379 3463 // IMPORTANT: we have to allow Mozilla a short time to recognize the … … 3397 3481 var editor = this; 3398 3482 3399 this.ddt._ddt( "htmlarea.js","3 396", "initFrame(): top" );3483 this.ddt._ddt( "htmlarea.js","3483", "initFrame(): top" ); 3400 3484 3401 3485 try … … 3488 3572 ["mousedown"], 3489 3573 function() 3490 {3491 3492 editor.ddt._ddt( "htmlarea.js","3489", "_iframe.contentWindow mouse down event. activating editor" );3493 3494 3574 { 3575 HTMLArea._ddt( "htmlarea.js","3575", "mousedown iframe event top" ); 3576 editor.ddt._ddt( "htmlarea.js","3576", "_iframe.contentWindow mouse down event. activating editor" ); 3577 editor.activateEditor(); 3578 } 3495 3579 ); 3496 3580 } … … 3505 3589 HTMLArea._addEvents( doc, 3506 3590 ["keydown", "keypress", "mousedown", "mouseup", "drag"], 3507 function (event) 3508 { 3509 return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event); 3510 }); 3591 function (event) 3592 { 3593 HTMLArea._ddt( "htmlarea.js","3593", "event '" + event + "' top" ); 3594 return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event); 3595 }); 3511 3596 3512 3597 // check if any plugins have registered refresh handlers … … 3557 3642 { 3558 3643 3559 this.ddt._ddt( "htmlarea.js","3 556", "setInnerSize(): top with width '" + width + "' height '" + height + "'" );3644 this.ddt._ddt( "htmlarea.js","3644", "setInnerSize(): top with width '" + width + "' height '" + height + "'" ); 3560 3645 3561 3646 if (typeof width == 'undefined' || width == null) … … 3686 3771 { 3687 3772 3688 this.ddt._ddt( "htmlarea.js","3 685", "addPanel() : top with side '" + side + "'" );3773 this.ddt._ddt( "htmlarea.js","3773", "addPanel() : top with side '" + side + "'" ); 3689 3774 3690 3775 var div = document.createElement('div'); … … 3706 3791 { 3707 3792 3708 this.ddt._ddt( "htmlarea.js","37 05", "removePanel() : top" );3793 this.ddt._ddt( "htmlarea.js","3793", "removePanel() : top" ); 3709 3794 3710 3795 this._panels[panel.side].div.removeChild(panel); … … 3730 3815 { 3731 3816 3732 this.ddt._ddt( "htmlarea.js","3 729", "hidePanel() : top" );3817 this.ddt._ddt( "htmlarea.js","3817", "hidePanel() : top" ); 3733 3818 3734 3819 if (panel) … … 3746 3831 { 3747 3832 3748 this.ddt._ddt( "htmlarea.js","3 745", "showPanel() : top" );3833 this.ddt._ddt( "htmlarea.js","3833", "showPanel() : top" ); 3749 3834 3750 3835 if ( panel ) … … 3762 3847 { 3763 3848 3764 this.ddt._ddt( "htmlarea.js","3 761", "hidePanels() : top" );3849 this.ddt._ddt( "htmlarea.js","3849", "hidePanels() : top" ); 3765 3850 3766 3851 if(typeof sides == 'undefined') … … 3789 3874 { 3790 3875 3791 this.ddt._ddt( "htmlarea.js","3 788", "showPanels() : top" );3876 this.ddt._ddt( "htmlarea.js","3876", "showPanels() : top" ); 3792 3877 3793 3878 if(typeof sides == 'undefined') … … 3817 3902 { 3818 3903 3819 this.ddt._ddt( "htmlarea.js","3 816", "activateEditor(): top - called by '" + HTMLArea.prototype.activateEditor.caller.toString().substring(0,100) + "'" );3904 this.ddt._ddt( "htmlarea.js","3904", "activateEditor(): top - called by '" + HTMLArea.prototype.activateEditor.caller.toString().substring(0,100) + "'" ); 3820 3905 3821 3906 if (HTMLArea.is_gecko && this._doc.designMode != 'on') … … 3824 3909 try{HTMLArea.last_on.designMode = 'off';} catch(e) { } 3825 3910 3826 this.ddt._ddt( "htmlarea.js","3 823", "activateEditor(): _iframe.style.display is '" + this._iframe.style.display + "'" );3911 this.ddt._ddt( "htmlarea.js","3911", "activateEditor(): _iframe.style.display is '" + this._iframe.style.display + "'" ); 3827 3912 3828 3913 if(this._iframe.style.display == 'none') … … 3835 3920 { 3836 3921 3837 this.ddt._ddt( "htmlarea.js","3 834", "activateEditor(): setting designMode to on" );3922 this.ddt._ddt( "htmlarea.js","3922", "activateEditor(): setting designMode to on" ); 3838 3923 3839 3924 this._doc.designMode = 'on'; … … 3843 3928 { 3844 3929 3845 this.ddt._ddt( "htmlarea.js","3 842", "activateEditor(): Setting contentEditable to true" );3930 this.ddt._ddt( "htmlarea.js","3930", "activateEditor(): Setting contentEditable to true" ); 3846 3931 3847 3932 this._doc.body.contentEditable = true; … … 3850 3935 HTMLArea.last_on = this._doc; 3851 3936 3852 this.ddt._ddt( "htmlarea.js","3 849", "activateEditor(): end" );3937 this.ddt._ddt( "htmlarea.js","3937", "activateEditor(): end" ); 3853 3938 3854 3939 } // end of activateEditor() … … 3863 3948 { 3864 3949 3865 this.ddt._ddt( "htmlarea.js","3 862", "deactivateEditor(): top" );3950 this.ddt._ddt( "htmlarea.js","3950", "deactivateEditor(): top" ); 3866 3951 3867 3952 if (HTMLArea.is_gecko && this._doc.designMode == 'on') … … 3888 3973 { 3889 3974 3890 this.ddt._ddt( "htmlarea.js","3 887", "setMode(): setting mode to '" + mode + "'" );3975 this.ddt._ddt( "htmlarea.js","3975", "setMode(): setting mode to '" + mode + "'" ); 3891 3976 3892 3977 if (typeof mode == "undefined") … … 3967 4052 { 3968 4053 3969 this.ddt._ddt( "htmlarea.js"," 3966", "setFullHTML(): top" );4054 this.ddt._ddt( "htmlarea.js","4054", "setFullHTML(): top" ); 3970 4055 3971 4056 var save_multiline = RegExp.multiline; … … 4014 4099 { 4015 4100 4016 this.ddt._ddt( "htmlarea.js","4 013", "registerPlugin(): top" );4101 this.ddt._ddt( "htmlarea.js","4101", "registerPlugin(): top" ); 4017 4102 4018 4103 var plugin = arguments[0]; … … 4036 4121 { 4037 4122 4038 this.ddt._ddt( "htmlarea.js","4 035", "registerPlugin2(): top" );4123 this.ddt._ddt( "htmlarea.js","4123", "registerPlugin2(): top" ); 4039 4124 4040 4125 if (typeof plugin == "string") … … 4044 4129 { 4045 4130 4046 this.ddt._ddt( "htmlarea.js","4 043", "registerPlugin2(): INTERNAL ERROR: plugin is undefined. " );4131 this.ddt._ddt( "htmlarea.js","4131", "registerPlugin2(): INTERNAL ERROR: plugin is undefined. " ); 4047 4132 4048 4133 /* FIXME: This should never happen. But why does it do? */ … … 4118 4203 var editor = this; 4119 4204 4120 this.ddt._ddt( "htmlarea.js","4 117", "_wordClean(): top" );4205 this.ddt._ddt( "htmlarea.js","4205", "_wordClean(): top" ); 4121 4206 4122 4207 var stats = … … 4235 4320 // this.forceRedraw(); 4236 4321 4237 this.ddt._ddt( "htmlarea.js","4 234", "_wordClean(): bottom" );4322 this.ddt._ddt( "htmlarea.js","4322", "_wordClean(): bottom" ); 4238 4323 4239 4324 this.updateToolbar(); … … 4250 4335 { 4251 4336 4252 this.ddt._ddt( "htmlarea.js","4 249", "_clearFonts(): top" );4337 this.ddt._ddt( "htmlarea.js","4337", "_clearFonts(): top" ); 4253 4338 4254 4339 var D = this.getInnerHTML(); … … 4288 4373 { 4289 4374 4290 this.ddt._ddt( "htmlarea.js","4 287", "_splitBlock(): top" );4375 this.ddt._ddt( "htmlarea.js","4375", "_splitBlock(): top" ); 4291 4376 4292 4377 this._doc.execCommand('formatblock', false, '<div>'); … … 4302 4387 { 4303 4388 4304 this.ddt._ddt( "htmlarea.js","43 01", "forceRedraw(): top" );4389 this.ddt._ddt( "htmlarea.js","4389", "forceRedraw(): top" ); 4305 4390 4306 4391 this._doc.body.style.visibility = "hidden"; … … 4320 4405 { 4321 4406 4322 this.ddt._ddt( "htmlarea.js","4 319", "focusEditor(): top _editMode is '" + this._editMode + "'" );4407 this.ddt._ddt( "htmlarea.js","4407", "focusEditor(): top _editMode is '" + this._editMode + "'" ); 4323 4408 4324 4409 switch (this._editMode) … … 4368 4453 { 4369 4454 4370 this.ddt._ddt( "htmlarea.js","4 367", "_undoTakeSnapshot(): top" );4455 this.ddt._ddt( "htmlarea.js","4455", "_undoTakeSnapshot(): top" ); 4371 4456 4372 4457 ++this._undoPos; … … 4405 4490 { 4406 4491 4407 this.ddt._ddt( "htmlarea.js","44 04", "undo(): top" );4492 this.ddt._ddt( "htmlarea.js","4492", "undo(): top" ); 4408 4493 4409 4494 if (this._undoPos > 0) … … 4424 4509 { 4425 4510 4426 this.ddt._ddt( "htmlarea.js","4 423", "redo(): top" );4511 this.ddt._ddt( "htmlarea.js","4511", "redo(): top" ); 4427 4512 4428 4513 if (this._undoPos < this._undoQueue.length - 1) … … 4443 4528 { 4444 4529 4445 this.ddt._ddt( "htmlarea.js","4 442", "disableToolbar(): top" );4530 this.ddt._ddt( "htmlarea.js","4530", "disableToolbar(): top" ); 4446 4531 4447 4532 if(typeof except == 'undefined') … … 4475 4560 { 4476 4561 4477 this.ddt._ddt( "htmlarea.js","4 474", "enableToolbar(): top" );4562 this.ddt._ddt( "htmlarea.js","4562", "enableToolbar(): top" ); 4478 4563 4479 4564 this.updateToolbar(); … … 4492 4577 var ancestors = null; 4493 4578 4494 this.ddt._ddt( "htmlarea.js","4 491", "updateToolbar(): top" );4579 this.ddt._ddt( "htmlarea.js","4579", "updateToolbar(): top" ); 4495 4580 4496 4581 if (!text) … … 4506 4591 { 4507 4592 4508 this.ddt._ddt( "htmlarea.js","45 05", "updateToolbar(): INTERNAL ERROR" );4593 this.ddt._ddt( "htmlarea.js","4593", "updateToolbar(): INTERNAL ERROR" ); 4509 4594 4510 4595 // hell knows why we get here; this … … 4588 4673 { 4589 4674 4590 this.ddt._ddt( "htmlarea.js","4 587", "updateToolbar(): INTERNAL ERROR" );4675 this.ddt._ddt( "htmlarea.js","4675", "updateToolbar(): INTERNAL ERROR" ); 4591 4676 4592 4677 // the impossible really happens. … … 4807 4892 } 4808 4893 4809 this.ddt._ddt( "htmlarea.js","48 06", "updateToolbar(): end" );4894 this.ddt._ddt( "htmlarea.js","4894", "updateToolbar(): end" ); 4810 4895 4811 4896 } // end of updateToolbar() … … 4823 4908 { 4824 4909 4825 this.ddt._ddt( "htmlarea.js","4 822", "insertNodeAtSelection(): top" );4910 this.ddt._ddt( "htmlarea.js","4910", "insertNodeAtSelection(): top" ); 4826 4911 4827 4912 if (!HTMLArea.is_ie) … … 4896 4981 { 4897 4982 4898 this.ddt._ddt( "htmlarea.js","4 895", "getParentElement(): top" );4983 this.ddt._ddt( "htmlarea.js","4983", "getParentElement(): top" ); 4899 4984 4900 4985 if (typeof sel == 'undefined') … … 4963 5048 { 4964 5049 4965 this.ddt._ddt( "htmlarea.js"," 4962", "getAllAncestors(): top" );5050 this.ddt._ddt( "htmlarea.js","5050", "getAllAncestors(): top" ); 4966 5051 4967 5052 var p = this.getParentElement(); … … 4989 5074 { 4990 5075 4991 this.ddt._ddt( "htmlarea.js"," 4988", "_getFirstAncestor(): top" );5076 this.ddt._ddt( "htmlarea.js","5076", "_getFirstAncestor(): top" ); 4992 5077 4993 5078 var prnt = this._activeElement(sel); … … 5044 5129 { 5045 5130 5046 this.ddt._ddt( "htmlarea.js","5 043", "_activeElement(): top" );5131 this.ddt._ddt( "htmlarea.js","5131", "_activeElement(): top" ); 5047 5132 5048 5133 if(sel == null) return null; 5049 5134 if ( this._selectionEmpty(sel) ) 5050 5135 { 5051 this.ddt._ddt( "htmlarea.js","5 048", "_activeElement(): _selectionEmpty returned true. Returning null" );5136 this.ddt._ddt( "htmlarea.js","5136", "_activeElement(): _selectionEmpty returned true. Returning null" ); 5052 5137 return null; 5053 5138 } … … 5107 5192 { 5108 5193 5109 this.ddt._ddt( "htmlarea.js","51 06", "_activeElement(): selection is not collapsed" );5194 this.ddt._ddt( "htmlarea.js","5194", "_activeElement(): selection is not collapsed" ); 5110 5195 5111 5196 if(sel.anchorNode.nodeType == 1) 5112 5197 { 5113 this.ddt._ddt( "htmlarea.js","51 10", "_activeElement(): nodeType is 1. Returning sel.anchorNode" );5198 this.ddt._ddt( "htmlarea.js","5198", "_activeElement(): nodeType is 1. Returning sel.anchorNode" ); 5114 5199 5115 5200 return sel.anchorNode; … … 5117 5202 } 5118 5203 5119 this.ddt._ddt( "htmlarea.js","5 116", "_activeElement(): bottom" );5204 this.ddt._ddt( "htmlarea.js","5204", "_activeElement(): bottom" ); 5120 5205 5121 5206 return null; … … 5133 5218 { 5134 5219 5135 this.ddt._ddt( "htmlarea.js","5 132", "_selectionEmpty(): top" );5220 this.ddt._ddt( "htmlarea.js","5220", "_selectionEmpty(): top" ); 5136 5221 5137 5222 if (!sel) 5138 5223 { 5139 this.ddt._ddt( "htmlarea.js","5 136", "_selectionEmpty(): no selection" );5224 this.ddt._ddt( "htmlarea.js","5224", "_selectionEmpty(): no selection" ); 5140 5225 return true; 5141 5226 } … … 5147 5232 else if(typeof sel.isCollapsed != 'undefined') 5148 5233 { 5149 this.ddt._ddt( "htmlarea.js","5 146", "_selectionEmpty(): isCollapsed" );5234 this.ddt._ddt( "htmlarea.js","5234", "_selectionEmpty(): isCollapsed" ); 5150 5235 return sel.isCollapsed; 5151 5236 } 5152 5237 5153 this.ddt._ddt( "htmlarea.js","5 150", "_selectionEmpty(): bottom. returning true." );5238 this.ddt._ddt( "htmlarea.js","5238", "_selectionEmpty(): bottom. returning true." ); 5154 5239 5155 5240 return true; … … 5166 5251 { 5167 5252 5168 this.ddt._ddt( "htmlarea.js","5 165", "_getAncestorBlock(): top" );5253 this.ddt._ddt( "htmlarea.js","5253", "_getAncestorBlock(): top" ); 5169 5254 5170 5255 // Scan upwards to find a block level element that we can change or apply to … … 5223 5308 { 5224 5309 5225 this.ddt._ddt( "htmlarea.js","5 222", "_createImplicitBlock(): top" );5310 this.ddt._ddt( "htmlarea.js","5310", "_createImplicitBlock(): top" ); 5226 5311 5227 5312 // expand it until we reach a block element in either direction … … 5369 5454 { 5370 5455 5371 this.ddt._ddt( "htmlarea.js","5 368", "selectNodeContents(): top" );5456 this.ddt._ddt( "htmlarea.js","5456", "selectNodeContents(): top" ); 5372 5457 5373 5458 this.focusEditor(); … … 5430 5515 { 5431 5516 5432 this.ddt._ddt( "htmlarea.js","5 429", "insertHTML(): top" );5517 this.ddt._ddt( "htmlarea.js","5517", "insertHTML(): top" ); 5433 5518 5434 5519 var sel = this._getSelection(); … … 5467 5552 { 5468 5553 5469 this.ddt._ddt( "htmlarea.js","5 466", "surroundHTML(): top" );5554 this.ddt._ddt( "htmlarea.js","5554", "surroundHTML(): top" ); 5470 5555 5471 5556 var html = this.getSelectedHTML(); … … 5484 5569 { 5485 5570 5486 this.ddt._ddt( "htmlarea.js","5 483", "getSelectedHTML(): top" );5571 this.ddt._ddt( "htmlarea.js","5571", "getSelectedHTML(): top" ); 5487 5572 5488 5573 var sel = this._getSelection(); … … 5644 5729 { 5645 5730 5646 this.ddt._ddt( "htmlarea.js","5 643", "_insertImage(): top" );5731 this.ddt._ddt( "htmlarea.js","5731", "_insertImage(): top" ); 5647 5732 5648 5733 var editor = this; // for nested functions … … 5727 5812 { 5728 5813 5729 this.ddt._ddt( "htmlarea.js","5 726", "_insertTable(): top" );5814 this.ddt._ddt( "htmlarea.js","5814", "_insertTable(): top" ); 5730 5815 5731 5816 var sel = this._getSelection(); … … 5819 5904 { 5820 5905 5821 this.ddt._ddt( "htmlarea.js","5 818", "_comboSelected(): top" );5906 this.ddt._ddt( "htmlarea.js","5906", "_comboSelected(): top" ); 5822 5907 5823 5908 this.focusEditor(); … … 5859 5944 { 5860 5945 5861 this.ddt._ddt( "htmlarea.js","5 858", "execCommand(): top with cmdId '" + cmdID + "'" );5946 this.ddt._ddt( "htmlarea.js","5946", "execCommand(): top with cmdId '" + cmdID + "'" ); 5862 5947 5863 5948 var editor = this; // for nested functions … … 5990 6075 { 5991 6076 5992 this.ddt._ddt( "htmlarea.js"," 5989", "_editorEvent(): top with event type '" + ev.type + "'" );6077 this.ddt._ddt( "htmlarea.js","6077", "_editorEvent(): top with event type '" + ev.type + "'" ); 5993 6078 5994 6079 var editor = this; … … 6015 6100 { 6016 6101 6017 this.ddt._ddt( "htmlarea.js","6 014", "_editorEvent(): keyEvent" );6102 this.ddt._ddt( "htmlarea.js","6102", "_editorEvent(): keyEvent" ); 6018 6103 6019 6104 // loop over all the plugins and pass this event to any that have … … 6033 6118 { 6034 6119 6035 this.ddt._ddt( "htmlarea.js","6 032", "_editorEvent(): keyEvent - invoking onKeyPress method in plugin '" + ( plugin.name ? plugin.name : "unknown" ) + "'" );6120 this.ddt._ddt( "htmlarea.js","6120", "_editorEvent(): keyEvent - invoking onKeyPress method in plugin '" + ( plugin.name ? plugin.name : "unknown" ) + "'" ); 6036 6121 6037 6122 if (plugin.onKeyPress(ev)) 6038 6123 { 6039 6124 6040 this.ddt._ddt( "htmlarea.js","6 037", "_editorEvent(): keyEvent - onKeyPress() returned false. Returning false" );6125 this.ddt._ddt( "htmlarea.js","6125", "_editorEvent(): keyEvent - onKeyPress() returned false. Returning false" ); 6041 6126 return false; 6042 6127 } … … 6050 6135 { 6051 6136 6052 this.ddt._ddt( "htmlarea.js","6 049", "_editorEvent(): control key key event" );6137 this.ddt._ddt( "htmlarea.js","6137", "_editorEvent(): control key key event" ); 6053 6138 6054 6139 var sel = null; … … 6061 6146 case 'a': 6062 6147 6063 this.ddt._ddt( "htmlarea.js","6 060", "_editorEvent(): cntrl-a select all" );6148 this.ddt._ddt( "htmlarea.js","6148", "_editorEvent(): cntrl-a select all" ); 6064 6149 6065 6150 if (!HTMLArea.is_ie) … … 6080 6165 case 'b': 6081 6166 6082 this.ddt._ddt( "htmlarea.js","6 079", "_editorEvent(): cntrl-b bold" );6167 this.ddt._ddt( "htmlarea.js","6167", "_editorEvent(): cntrl-b bold" ); 6083 6168 cmd = "bold"; 6084 6169 break; … … 6086 6171 case 'i': 6087 6172 6088 this.ddt._ddt( "htmlarea.js","6 085", "_editorEvent(): cntrl-i italics" );6173 this.ddt._ddt( "htmlarea.js","6173", "_editorEvent(): cntrl-i italics" ); 6089 6174 cmd = "italic"; 6090 6175 break; … … 6092 6177 case 'u': 6093 6178 6094 this.ddt._ddt( "htmlarea.js","6 091", "_editorEvent(): cntrl-u underline" );6179 this.ddt._ddt( "htmlarea.js","6179", "_editorEvent(): cntrl-u underline" ); 6095 6180 cmd = "underline"; 6096 6181 break; … … 6098 6183 case 's': 6099 6184 6100 this.ddt._ddt( "htmlarea.js","6 097", "_editorEvent(): cntrl-s strikethrough" );6185 this.ddt._ddt( "htmlarea.js","6185", "_editorEvent(): cntrl-s strikethrough" ); 6101 6186 cmd = "strikethrough"; 6102 6187 break; … … 6104 6189 case 'l': 6105 6190 6106 this.ddt._ddt( "htmlarea.js","61 03", "_editorEvent(): cntrl-l justify left" );6191 this.ddt._ddt( "htmlarea.js","6191", "_editorEvent(): cntrl-l justify left" ); 6107 6192 cmd = "justifyleft"; 6108 6193 break; … … 6110 6195 case 'e': 6111 6196 6112 this.ddt._ddt( "htmlarea.js","61 09", "_editorEvent(): cntrl-e justify center" );6197 this.ddt._ddt( "htmlarea.js","6197", "_editorEvent(): cntrl-e justify center" ); 6113 6198 cmd = "justifycenter"; 6114 6199 break; … … 6116 6201 case 'r': 6117 6202 6118 this.ddt._ddt( "htmlarea.js","6 115", "_editorEvent(): cntrl-r justify right" );6203 this.ddt._ddt( "htmlarea.js","6203", "_editorEvent(): cntrl-r justify right" ); 6119 6204 cmd = "justifyright"; 6120 6205 break; … … 6122 6207 case 'j': 6123 6208 6124 this.ddt._ddt( "htmlarea.js","6 121", "_editorEvent(): cntrl-j justify full" );6209 this.ddt._ddt( "htmlarea.js","6209", "_editorEvent(): cntrl-j justify full" ); 6125 6210 cmd = "justifyfull"; 6126 6211 break; … … 6128 6213 case 'z': 6129 6214 6130 this.ddt._ddt( "htmlarea.js","6 127", "_editorEvent(): cntrl-z undo" );6215 this.ddt._ddt( "htmlarea.js","6215", "_editorEvent(): cntrl-z undo" ); 6131 6216 cmd = "undo"; 6132 6217 break; … … 6134 6219 case 'y': 6135 6220 6136 this.ddt._ddt( "htmlarea.js","6 133", "_editorEvent(): cntrl-y redo" );6221 this.ddt._ddt( "htmlarea.js","6221", "_editorEvent(): cntrl-y redo" ); 6137 6222 cmd = "redo"; 6138 6223 break; … … 6140 6225 case 'v': 6141 6226 6142 this.ddt._ddt( "htmlarea.js","6 139", "_editorEvent(): cntrl-v paste" );6227 this.ddt._ddt( "htmlarea.js","6227", "_editorEvent(): cntrl-v paste" ); 6143 6228 if (HTMLArea.is_ie || editor.config.htmlareaPaste) 6144 6229 { … … 6150 6235 6151 6236 6152 this.ddt._ddt( "htmlarea.js","6 149", "_editorEvent(): cntrl-n format block" );6237 this.ddt._ddt( "htmlarea.js","6237", "_editorEvent(): cntrl-n format block" ); 6153 6238 cmd = "formatblock"; 6154 6239 value = HTMLArea.is_ie ? "<p>" : "p"; … … 6157 6242 case '0': 6158 6243 6159 this.ddt._ddt( "htmlarea.js","6 156", "_editorEvent(): cntrl-O kill word" );6244 this.ddt._ddt( "htmlarea.js","6244", "_editorEvent(): cntrl-O kill word" ); 6160 6245 cmd = "killword"; 6161 6246 break; … … 6169 6254 case '6': 6170 6255 6171 this.ddt._ddt( "htmlarea.js","6 168", "_editorEvent(): cntrl-[1-6] heading" );6256 this.ddt._ddt( "htmlarea.js","6256", "_editorEvent(): cntrl-[1-6] heading" ); 6172 6257 cmd = "formatblock"; 6173 6258 value = "h" + key; … … 6180 6265 if (cmd) 6181 6266 { 6182 this.ddt._ddt( "htmlarea.js","6 179", "_editorEvent(): executing simple command '" + cmd + "'" );6267 this.ddt._ddt( "htmlarea.js","6267", "_editorEvent(): executing simple command '" + cmd + "'" ); 6183 6268 // execute simple command 6184 6269 this.execCommand(cmd, false, value); … … 6243 6328 { 6244 6329 6245 this.ddt._ddt( "htmlarea.js","6 242", "_editorEvent(): entered a space" );6330 this.ddt._ddt( "htmlarea.js","6330", "_editorEvent(): entered a space" ); 6246 6331 6247 6332 if(s && s.isCollapsed && s.anchorNode.nodeType == 3 && s.anchorNode.data.length > 3 && s.anchorNode.data.indexOf('.') >= 0) … … 6286 6371 { 6287 6372 6288 this.ddt._ddt( "htmlarea.js","6 285", "_editorEvent(): keycode is '" + ev.keyCode + "' which (normal key) is '" + ev.which + "'" );6373 this.ddt._ddt( "htmlarea.js","6373", "_editorEvent(): keycode is '" + ev.keyCode + "' which (normal key) is '" + ev.which + "'" ); 6289 6374 6290 6375 // is it an escape character or ... … … 6304 6389 // backspace or period? 6305 6390 6306 this.ddt._ddt( "htmlarea.js","63 03", "_editorEvent(): normal key or backspace or period" );6391 this.ddt._ddt( "htmlarea.js","6391", "_editorEvent(): normal key or backspace or period" ); 6307 6392 6308 6393 this._unlinkOnUndo = false; … … 6315 6400 if (!a) 6316 6401 { 6317 this.ddt._ddt( "htmlarea.js","6 314", "_editorEvent(): not an anchor" );6402 this.ddt._ddt( "htmlarea.js","6402", "_editorEvent(): not an anchor" ); 6318 6403 break; // not an anchor 6319 6404 } … … 6365 6450 case 13: // KEY enter 6366 6451 6367 this.ddt._ddt( "htmlarea.js","6 364", "_editorEvent(): enter key handling" );6452 this.ddt._ddt( "htmlarea.js","6452", "_editorEvent(): enter key handling" ); 6368 6453 6369 6454 if (HTMLArea.is_gecko && !ev.shiftKey && this.config.mozParaHandler == 'dirty' ) … … 6377 6462 case 46: // KEY delete 6378 6463 6379 this.ddt._ddt( "htmlarea.js","6 376", "_editorEvent(): delete or backspace handling" );6464 this.ddt._ddt( "htmlarea.js","6464", "_editorEvent(): delete or backspace handling" ); 6380 6465 6381 6466 if (HTMLArea.is_gecko && !ev.shiftKey) … … 6405 6490 }, 100); 6406 6491 6407 this.ddt._ddt( "htmlarea.js","64 04", "_editorEvent(): bottom" );6492 this.ddt._ddt( "htmlarea.js","6492", "_editorEvent(): bottom" ); 6408 6493 6409 6494 }; // end of _editorEvent() … … 6417 6502 HTMLArea.prototype.convertNode = function(el, newTagName) 6418 6503 { 6419 this.ddt._ddt( "htmlarea.js","6 416", "convertNode(): top" );6504 this.ddt._ddt( "htmlarea.js","6504", "convertNode(): top" ); 6420 6505 6421 6506 var newel = this._doc.createElement(newTagName); … … 6463 6548 { 6464 6549 6465 this.ddt._ddt( "htmlarea.js","6 462", "dom_checkBackspace(): top" );6550 this.ddt._ddt( "htmlarea.js","6550", "dom_checkBackspace(): top" ); 6466 6551 6467 6552 var self = this; … … 6730 6815 { 6731 6816 6732 this.ddt._ddt( "htmlarea.js","6 729", "scrollToElement(): top" );6817 this.ddt._ddt( "htmlarea.js","6817", "scrollToElement(): top" ); 6733 6818 6734 6819 if(HTMLArea.is_gecko) … … 6766 6851 { 6767 6852 6768 this.ddt._ddt( "htmlarea.js", "6768", "getHTML() - prototype version - top" );6853 this.ddt._ddt( "htmlarea.js","6853", "getHTML() - prototype version - top" ); 6769 6854 6770 6855 var html = ''; … … 6801 6886 /** 6802 6887 * outwardHTML() 6888 * 6889 * based on HTML.config.linkReplacementMode setting. fullyqualified or absolute. 6803 6890 */ 6804 6891 … … 6806 6893 { 6807 6894 6808 this.ddt._ddt( "htmlarea.js","68 02", "outwardHtml(): top" );6895 this.ddt._ddt( "htmlarea.js","6895", "outwardHtml(): top" ); 6809 6896 6810 6897 html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2"); 6811 6898 html = html.replace(/<(\/?)i(\s|>|\/)/ig, "<$1em$2"); 6812 6899 6813 // Figure out what our server name is, and how it's referenced 6814 var serverBase = location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/'; 6815 6816 // IE puts this in can't figure out why 6817 html = html.replace(/https?:\/\/null\//g, serverBase); 6818 6819 // Make semi-absolute links to be truely absolute 6820 // we do this just to standardize so that special replacements knows what 6821 // to expect 6822 html = html.replace(/((href|src|background)=[\'\"])\/+/ig, '$1' + serverBase); 6900 // either turn all links to absolute or fully qualified depending 6901 // on config.linkReplacementMode 6902 6903 if ( this.config.linkReplacementMode == 'fullyqualified' ) 6904 { 6905 6906 var serverBase = location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/'; 6907 6908 this.ddt._ddt( "htmlarea.js","6908", "outwardHtml(): replacing links with fully qualified versions - serverBase is '" + serverBase + "'." ); 6909 6910 // IE bug tacks on http://null/ to links 6911 6912 html = html.replace(/https?:\/\/null\//g, serverBase); 6913 6914 // Make semi-absolute links to be truely absolute 6915 // we do this just to standardize so that special replacements knows what 6916 // to expect 6917 6918 html = html.replace(/((href|src|background)=[\'\"])\/+/ig, '$1' + serverBase); 6919 6920 } // end of doing fullyqualified replacements. 6921 else 6922 { 6923 6924 var serverBase = location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1'); 6925 6926 this.ddt._ddt( "htmlarea.js","6926", "outwardHtml(): stripping serverBase from links '" + serverBase + "'." ); 6927 6928 // remove the protocol and host from any links back to the current site. Using the 6929 // serverBase we figured out above create a regular expression that will match any 6930 // href= src= background= starting with http://<current_site and the protocol 6931 // and site part. The RegExp() class allows you to create a regular expression from 6932 // a string. 6933 6934 var linkBackRE = new RegExp( "((href|src|background)=['\"])" + serverBase , "ig" ); 6935 6936 this.ddt._ddt( "htmlarea.js","6936", "outwardHtml(): regex is '" + linkBackRE + "'" ); 6937 6938 html = html.replace( linkBackRE, '$1' ); 6939 6940 // IE puts this in can't figure out why 6941 6942 html = html.replace(/https?:\/\/null/g, ""); 6943 6944 } 6823 6945 6824 6946 html = this.outwardSpecialReplacements(html); … … 6834 6956 /** 6835 6957 * inwardHtml() 6958 * 6959 * process HTML links and other special replacements. 6960 * 6961 * @todo check modifying links to fully qualified. We probably don't want to do this in all cases. 6836 6962 */ 6837 6963 … … 6839 6965 { 6840 6966 6841 this.ddt._ddt( "htmlarea.js","6 835", "inwardHtml(): top" );6967 this.ddt._ddt( "htmlarea.js","6967", "inwardHtml(): top" ); 6842 6968 6843 6969 // Midas uses b and i instead of strong and em, um, hello, … … 6853 6979 6854 6980 // For IE's sake, make any URLs that are semi-absolute (="/....") to be 6855 // truely absolute6981 // fully qualified. (http://foo.com/..) 6856 6982 6857 6983 var nullRE = new RegExp('((href|src|background)=[\'"])/+', 'gi'); 6984 6985 // the first $1 applies to href=" src=" or background=" 6986 // 6987 // the second one is getting the hostname and protocol out of the location object 6988 // referring to the URL of the current document. 6989 // 6990 // so the effect is we regex through the document replacing in the http[s]://location/ 6991 // into every link .. making every link in the document fully qualified. This is 6992 // an implicit work around for the MSIE tendency to introduce http://null/'s into 6993 // links when the host and protocol are not defined. 6994 6858 6995 html = html.replace(nullRE, '$1' + location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/'); 6859 6996 … … 6873 7010 { 6874 7011 6875 this.ddt._ddt( "htmlarea.js"," 6869", "outwardSpecialReplacements(): top" );7012 this.ddt._ddt( "htmlarea.js","7012", "outwardSpecialReplacements(): top" ); 6876 7013 6877 7014 for(var i in this.config.specialReplacements) … … 6897 7034 HTMLArea.prototype.inwardSpecialReplacements = function(html) 6898 7035 { 6899 this.ddt._ddt( "htmlarea.js"," 6893", "inwardSpecialReplacements(): top" );7036 this.ddt._ddt( "htmlarea.js","7036", "inwardSpecialReplacements(): top" ); 6900 7037 6901 7038 // alert("inward"); … … 6920 7057 /** 6921 7058 * fixRelativeLinks() 7059 * 7060 * applies some optional regex's to html source. 7061 * @see HTML.Config 7062 * 6922 7063 */ 6923 7064 … … 6925 7066 { 6926 7067 6927 this.ddt._ddt( "htmlarea.js"," 6921", "fixRelativeLinks(): top" );7068 this.ddt._ddt( "htmlarea.js","7068", "fixRelativeLinks(): top" ); 6928 7069 6929 7070 if (typeof this.config.stripSelfNamedAnchors != 'undefined' && this.config.stripSelfNamedAnchors) 6930 7071 { 7072 7073 this.ddt._ddt( "htmlarea.js","7073", "fixRelativeLinks(): handling stripSelfNamedAnchors()" ); 7074 6931 7075 var stripRe = new RegExp(document.location.href.replace(HTMLArea.RE_Specials, '\\$1') + '(#.*)', 'g'); 6932 7076 html = html.replace(stripRe, '$1'); … … 6935 7079 if(typeof this.config.stripBaseHref != 'undefined' && this.config.stipBaseHref) 6936 7080 { 7081 7082 this.ddt._ddt( "htmlarea.js","7082", "fixRelativeLinks(): handling stripBaseHref()" ); 7083 6937 7084 var baseRe = null 6938 7085 if(typeof this.config.baseHref != 'undefined' && this.config.baseHref != null) … … 6971 7118 { 6972 7119 6973 this.ddt._ddt( "htmlarea.js"," 6967", "stripBaseURL(): top" );7120 this.ddt._ddt( "htmlarea.js","7120", "stripBaseURL(): top" ); 6974 7121 6975 7122 var baseurl = this.config.baseURL; … … 6999 7146 { 7000 7147 7001 this.ddt._ddt( "htmlarea.js"," 6995", "getInnerHTML(): top" );7148 this.ddt._ddt( "htmlarea.js","7148", "getInnerHTML(): top" ); 7002 7149 7003 7150 if(!this._doc.body) return ''; … … 7036 7183 { 7037 7184 7038 this.ddt._ddt( "htmlarea.js","7 032", "setHTML(): top" );7185 this.ddt._ddt( "htmlarea.js","7185", "setHTML(): top" ); 7039 7186 7040 7187 switch (this._editMode) … … 7108 7255 { 7109 7256 7110 this.ddt._ddt( "htmlarea.js","7 104", "_createRange(): top" );7257 this.ddt._ddt( "htmlarea.js","7257", "_createRange(): top" ); 7111 7258 7112 7259 if (HTMLArea.is_ie) … … 7144 7291 { 7145 7292 7146 this.ddt._ddt( "htmlarea.js","7 140", "notifyOn(): top" );7293 this.ddt._ddt( "htmlarea.js","7293", "notifyOn(): top" ); 7147 7294 7148 7295 if(typeof this._notifyListeners[ev] == 'undefined') … … 7164 7311 { 7165 7312 7166 this.ddt._ddt( "htmlarea.js","7 160", "notifyOf(): top" );7313 this.ddt._ddt( "htmlarea.js","7313", "notifyOf(): top" ); 7167 7314 7168 7315 if(this._notifyListeners[ev]) … … 7191 7338 { 7192 7339 7193 this.ddt._ddt( "htmlarea.js","7 187", "_popupDialog(): top with url '" + url + "' action '" + action + "'" );7340 this.ddt._ddt( "htmlarea.js","7340", "_popupDialog(): top with url '" + url + "' action '" + action + "'" ); 7194 7341 7195 7342 Dialog(this.popupURL(url), action, init); … … 7284 7431 { 7285 7432 7286 this.ddt._ddt( "htmlarea.js","7 280", "registerPlugins(): top" );7433 this.ddt._ddt( "htmlarea.js","7433", "registerPlugins(): top" ); 7287 7434 7288 7435 if(plugin_names) -
branches/unified_backend/inline-dialog.js
r20 r121 1 /** 2 * @fileoverview inline dialog support 3 */ 4 5 /** 6 * @class Dialog 7 * 8 * constructor 9 */ 1 10 2 11 HTMLArea.Dialog = function(editor, html, localizer) 3 {12 { 4 13 this.id = { }; 5 14 this.r_id = { }; // reverse lookup id … … 17 26 var dialog = this; 18 27 if(typeof localizer == 'function') 19 {28 { 20 29 this._lc = localizer; 21 }30 } 22 31 else if(localizer) 23 { 32 { 33 this._lc = 34 function(string) 35 { 36 return HTMLArea._lc(string,localizer); 37 } 38 } 39 else 40 { 24 41 this._lc = function(string) 25 { 26 return HTMLArea._lc(string,localizer); 27 } 28 } 29 else 30 { 31 this._lc = function(string) 32 { 42 { 33 43 return string; 34 } 35 } 44 } 45 } 46 47 // ok, this is just bloody ugly. Four parameters, the last three 48 // are in-line functions. 36 49 37 50 html = html.replace(/\[([a-z0-9_]+)\]/ig, 38 function(fullString, id) 39 { 40 if(typeof dialog.id[id] == 'undefined') 41 { 42 dialog.id[id] = HTMLArea.uniq('Dialog'); 43 dialog.r_id[dialog.id[id]] = id; 44 } 45 return dialog.id[id]; 46 } 47 ).replace(/<l10n>(.*?)<\/l10n>/ig, 48 function(fullString,translate) 49 { 50 return dialog._lc(translate) ; 51 } 52 ).replace(/="_\((.*?)\)"/g, 53 function(fullString, translate) 54 { 55 return '="' + dialog._lc(translate) + '"'; 56 } 57 ); 51 function(fullString, id) 52 { 53 if(typeof dialog.id[id] == 'undefined') 54 { 55 dialog.id[id] = HTMLArea.uniq('Dialog'); 56 dialog.r_id[dialog.id[id]] = id; 57 } 58 return dialog.id[id]; 59 } ).replace(/<l10n>(.*?)<\/l10n>/ig, 60 function(fullString,translate) 61 { 62 return dialog._lc(translate) ; 63 } ).replace(/="_\((.*?)\)"/g, 64 function(fullString, translate) 65 { 66 return '="' + dialog._lc(translate) + '"'; 67 }); // end of html.replace() call. 58 68 59 69 this.rootElem.innerHTML = html; … … 61 71 this.editor.innerEditor.appendChild(this.rootElem); 62 72 63 64 this.editor.notifyOn 65 ('resize', 73 this.editor.notifyOn('resize', 66 74 function(e, args) 67 {75 { 68 76 dialog.width = parseInt(dialog.rootElem.style.width = args.editorWidth + 'px'); 69 77 dialog.height = parseInt(dialog.rootElem.style.height = args.editorHeight + 'px'); 70 78 dialog.onresize(); 71 } 72 ); 73 } 79 }); 80 81 } // end of HTMLArea.Dialog() 82 83 // -------------------------------------------------------------------------------- 84 85 /** 86 * onresize() 87 */ 88 74 89 75 90 HTMLArea.Dialog.prototype.onresize = function() … … 78 93 } 79 94 95 // -------------------------------------------------------------------------------- 96 97 /** 98 * show() 99 */ 100 80 101 HTMLArea.Dialog.prototype.show = function(values) 81 { 102 { 103 82 104 // We need to preserve the selection for IE 105 83 106 if(HTMLArea.is_ie) 84 {107 { 85 108 this._lastRange = this.editor._createRange(this.editor._getSelection()); 86 }109 } 87 110 88 111 if(typeof values != 'undefined') 89 {112 { 90 113 this.setValues(values); 91 } 114 } 115 92 116 this._restoreTo = [this.editor._textArea.style.display, this.editor._iframe.style.visibility, this.editor.hidePanels()]; 93 117 … … 95 119 this.editor._iframe.style.visibility = 'hidden'; 96 120 this.rootElem.style.display = ''; 97 } 121 122 } // end of show() 123 124 // -------------------------------------------------------------------------------- 125 126 /** 127 * hide() 128 */ 98 129 99 130 HTMLArea.Dialog.prototype.hide = function() 100 { 131 { 132 101 133 this.rootElem.style.display = 'none'; 102 134 this.editor._textArea.style.display = this._restoreTo[0]; 103 135 this.editor._iframe.style.visibility = this._restoreTo[1]; 104 136 this.editor.showPanels(this._restoreTo[2]); 137 105 138 // Restore the selection 106 139 if(HTMLArea.is_ie) 107 {140 { 108 141 this._lastRange.select(); 109 } 142 } 143 110 144 return this.getValues(); 111 } 145 146 } // end of hide() 147 148 // -------------------------------------------------------------------------------- 149 150 /** 151 * toggle() 152 */ 112 153 113 154 HTMLArea.Dialog.prototype.toggle = function() 114 {155 { 115 156 if(this.rootElem.style.display == 'none') 116 {157 { 117 158 this.show(); 118 }159 } 119 160 else 120 {161 { 121 162 this.hide(); 122 } 123 } 124 163 } 164 } 165 166 // -------------------------------------------------------------------------------- 167 168 /** 169 * setValues() 170 */ 171 125 172 HTMLArea.Dialog.prototype.setValues = function(values) 126 { 173 { 174 127 175 for(var i in values) 128 { 176 { 177 178 129 179 var elems = this.getElementsByName(i); 180 181 // loop over all the elements in the current dialog. 182 // (essentially this is a client-side html template consisting of a form 183 // that has it's values set using the values array passed to us. 184 130 185 for(var x = 0; x < elems.length; x++) 131 {186 { 132 187 var e = elems[x]; 188 189 // for the current element, if it's a select list, input, or textarea set 190 // it's value ... 191 133 192 switch(e.tagName.toLowerCase()) 134 { 193 { 194 135 195 case 'select' : 136 {196 { 137 197 for(var j = 0; j < e.options.length; j++) 138 {198 { 139 199 if(typeof values[i] == 'object') 140 {200 { 141 201 for(var k = 0; k < values[i].length; k++) 142 {202 { 143 203 if(values[i][k] == e.options[j].value) 144 {204 { 145 205 e.options[j].selected = true; 146 }147 }148 }206 } 207 } 208 } 149 209 else if(values[i] == e.options[j].value) 150 {210 { 151 211 e.options[j].selected = true; 152 }153 }212 } 213 } 154 214 break; 155 } 215 216 } // end of select case 156 217 157 218 158 219 case 'textarea': 159 220 case 'input' : 160 {221 { 161 222 switch(e.getAttribute('type')) 162 { 223 { 224 163 225 case 'radio' : 164 {226 { 165 227 if(e.value == values[i]) 166 {228 { 167 229 e.checked = true; 168 }230 } 169 231 break; 170 }232 } 171 233 172 234 case 'checkbox': 173 {235 { 174 236 if(typeof values[i] == 'object') 175 {237 { 176 238 for(var j in values[i]) 177 {239 { 178 240 if(values[i][j] == e.value) 179 {241 { 180 242 e.checked = true; 181 }182 }183 }243 } 244 } 245 } 184 246 else 185 {247 { 186 248 if(values[i] == e.value) 187 {249 { 188 250 e.checked = true; 189 }190 }191 192 }251 } 252 } 253 break; 254 } // end of checkbox case. 193 255 194 256 default : 195 {257 { 196 258 e.value = values[i]; 197 }198 }259 } 260 } 199 261 break; 200 }262 } // end of textarea/input case. 201 263 202 264 default : 203 break; 204 } 205 } 206 } 207 } 265 break; 266 } 267 } 268 } 269 270 } // end of setValues() 271 272 // ------------------------------------------------------------------ 273 274 /** 275 * getValues() 276 * 277 * return the values of all named inputs, textareas and select lists in the dialog. 278 */ 208 279 209 280 HTMLArea.Dialog.prototype.getValues = function() 210 {281 { 211 282 var values = [ ]; 283 212 284 var inputs = HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('input')) 213 285 .append(HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('textarea'))) … … 215 287 216 288 for(var x = 0; x < inputs.length; x++) 217 {289 { 218 290 var i = inputs[x]; 219 if(!(i.name && this.r_id[i.name])) continue; 291 292 if(!(i.name && this.r_id[i.name])) 293 continue; 220 294 221 295 if(typeof values[this.r_id[i.name]] == 'undefined') 222 {296 { 223 297 values[this.r_id[i.name]] = null; 224 } 298 } 299 225 300 var v = values[this.r_id[i.name]]; 226 301 227 302 switch(i.tagName.toLowerCase()) 228 {303 { 229 304 case 'select': 230 {305 { 231 306 if(i.multiple) 232 {307 { 233 308 if(!v.push) 234 {309 { 235 310 if(v != null) 236 {311 { 237 312 v = [v]; 238 }313 } 239 314 else 240 {315 { 241 316 v = new Array(); 242 } 243 } 317 } 318 } 319 244 320 for(var j = 0; j < i.options.length; j++) 245 {321 { 246 322 if(i.options[j].selected) 247 {323 { 248 324 v.push(i.options[j].value); 249 }250 }251 }325 } 326 } 327 } 252 328 else 253 {329 { 254 330 if(i.selectedIndex) 255 {331 { 256 332 v = i.options[i.selectedIndex]; 257 }258 }333 } 334 } 259 335 break; 260 }336 } 261 337 262 338 case 'textarea': 263 339 case 'input' : 264 340 default : 265 {341 { 266 342 switch(i.type.toLowerCase()) 267 {343 { 268 344 case 'radio': 269 {345 { 270 346 if(i.checked) 271 {347 { 272 348 v = i.value; 273 349 break; 274 }275 }350 } 351 } 276 352 277 353 case 'checkbox': 278 {354 { 279 355 if(v == null) 280 {281 282 {356 { 357 if(this.getElementsByName(this.r_id[i.name]).length > 1) 358 { 283 359 v = new Array(); 284 }285 }360 } 361 } 286 362 287 363 if(i.checked) 288 {364 { 289 365 if(v.push) 290 {366 { 291 367 v.push(i.value); 292 }368 } 293 369 else 294 {370 { 295 371 v = i.value; 296 }297 }372 } 373 } 298 374 break; 299 }375 } 300 376 301 377 default : 302 {378 { 303 379 v = i.value; 304 380 break; 305 }306 }307 }308 309 }381 } 382 } 383 } 384 385 } 310 386 311 387 values[this.r_id[i.name]] = v; 312 } 388 } 389 313 390 return values; 314 } 391 392 } // end of getValues() 393 394 // --------------------------------------------------------------------------- 395 396 /** 397 * getElementById() 398 */ 315 399 316 400 HTMLArea.Dialog.prototype.getElementById = function(id) 317 {401 { 318 402 return this.document.getElementById(this.id[id] ? this.id[id] : id); 319 } 403 } 404 405 // --------------------------------------------------------------------------- 406 407 /** 408 * getElementsByName() 409 */ 320 410 321 411 HTMLArea.Dialog.prototype.getElementsByName = function(name) 322 {412 { 323 413 return this.document.getElementsByName(this.id[name] ? this.id[name] : name); 324 }414 } -
branches/unified_backend/plugins/ImageManager/assets/dialog.js
r43 r121 12 12 // $Id: dialog.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 13 13 14 // ------------------------------------------------------------------ 15 // 16 // this is a modified duplicate of the /dialog.js in the Xinha root. 17 // the code seems to make the assumption that only one of these dialogs 18 // can be open at once (modal). 19 // 20 // REVISION HISTORY: 21 // 22 // 2005-05-01 YmL: 23 // . added optional editor parameter to Dialog() "constructor". 24 // 25 // ------------------------------------------------------------------ 26 // should be a function, the return handler of the currently opened dialog. 27 Dialog._return = null; 28 29 // constant, the currently opened dialog 30 Dialog._modal = null; 31 32 // the dialog will read it's args from this variable 33 Dialog._arguments = null; 34 35 Dialog.agt = navigator.userAgent.toLowerCase(); 36 37 Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1)); 38 39 // ------------------------------------------------------------------ 40 14 41 // Though "Dialog" looks like an object, it isn't really an object. Instead 15 42 // it's just namespace for protecting global symbols. 16 43 17 function Dialog(url, action, init) { 18 if (typeof init == "undefined") { 44 function Dialog(url, action, init) 45 { 46 if (typeof init == "undefined") 47 { 19 48 init = window; // pass this window object by default 20 } 49 } 50 51 // optional editor instance parameter that can be propagated through to 52 // dialogs. 53 54 if (typeof Dialog.arguments[3] != "undefined") 55 { 56 Dialog._editor = Dialog.arguments[3]; 57 } 58 21 59 Dialog._geckoOpenModal(url, action, init); 22 }; 23 24 Dialog._parentEvent = function(ev) { 25 setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50); 26 if (Dialog._modal && !Dialog._modal.closed) { 60 61 }; // end of Dialog() 62 63 // ---------------------------------------------------------- 64 65 /** 66 * Dialog._parentEvent() 67 */ 68 69 Dialog._parentEvent = function(ev) 70 { 71 setTimeout( 72 function() 73 { 74 if (Dialog._modal && !Dialog._modal.closed) 75 { 76 Dialog._modal.focus() 77 } 78 }, 50); // end of setTimeout() call. 79 80 if (Dialog._modal && !Dialog._modal.closed) 81 { 27 82 Dialog._stopEvent(ev); 28 } 29 }; 30 31 32 // should be a function, the return handler of the currently opened dialog. 33 Dialog._return = null; 34 35 // constant, the currently opened dialog 36 Dialog._modal = null; 37 38 // the dialog will read it's args from this variable 39 Dialog._arguments = null; 40 41 Dialog._geckoOpenModal = function(url, action, init) { 83 } 84 85 }; // end of _parentEvent(); 86 87 // ---------------------------------------------------------- 88 89 /** 90 * Dialog._geckoOpenModal() 91 */ 92 93 Dialog._geckoOpenModal = function(url, action, init) 94 { 42 95 //var urlLink = "hadialog"+url.toString(); 96 43 97 var myURL = "hadialog"+url; 44 98 var regObj = /\W/g; 99 45 100 myURL = myURL.replace(regObj,'_'); 101 46 102 var dlg = window.open(url, myURL, 47 103 "toolbar=no,menubar=no,personalbar=no,width=10,height=10," + 48 104 "scrollbars=no,resizable=yes,modal=yes,dependable=yes"); 105 49 106 Dialog._modal = dlg; 50 107 Dialog._arguments = init; 51 108 52 109 // capture some window's events 53 function capwin(w) { 110 function capwin(w) 111 { 54 112 Dialog._addEvent(w, "click", Dialog._parentEvent); 55 113 Dialog._addEvent(w, "mousedown", Dialog._parentEvent); 56 114 Dialog._addEvent(w, "focus", Dialog._parentEvent); 57 }; 115 }; 116 58 117 // release the captured events 59 function relwin(w) { 118 function relwin(w) 119 { 60 120 Dialog._removeEvent(w, "click", Dialog._parentEvent); 61 121 Dialog._removeEvent(w, "mousedown", Dialog._parentEvent); 62 122 Dialog._removeEvent(w, "focus", Dialog._parentEvent); 63 }; 123 }; 124 64 125 capwin(window); 126 65 127 // capture other frames 66 128 for (var i = 0; i < window.frames.length; capwin(window.frames[i++])); 67 // make up a function to be called when the Dialog ends. 68 Dialog._return = function (val) { 69 if (val && action) { 129 130 // make up a function to be called when the Dialog ends, using the function 131 // passed to us. 132 133 Dialog._return = function (val) 134 { 135 if (val && action) 136 { 70 137 action(val); 71 } 138 } 139 72 140 relwin(window); 73 141 // capture other frames 142 74 143 for (var i = 0; i < window.frames.length; relwin(window.frames[i++])); 144 75 145 Dialog._modal = null; 76 }; 77 }; 78 79 80 // event handling 81 82 Dialog._addEvent = function(el, evname, func) { 83 if (Dialog.is_ie) { 146 147 }; 148 }; // end of Dialog._geckoOpenModal 149 150 /** 151 * event handling 152 */ 153 154 Dialog._addEvent = function(el, evname, func) 155 { 156 if (Dialog.is_ie) 157 { 84 158 el.attachEvent("on" + evname, func); 85 } else { 159 } 160 else 161 { 86 162 el.addEventListener(evname, func, true); 87 } 88 }; 89 90 91 Dialog._removeEvent = function(el, evname, func) { 92 if (Dialog.is_ie) { 163 } 164 }; 165 166 /** 167 * _removeEvent() 168 */ 169 170 Dialog._removeEvent = function(el, evname, func) 171 { 172 if (Dialog.is_ie) 173 { 93 174 el.detachEvent("on" + evname, func); 94 } else { 175 } 176 else 177 { 95 178 el.removeEventListener(evname, func, true); 96 } 97 }; 98 99 100 Dialog._stopEvent = function(ev) { 101 if (Dialog.is_ie) { 179 } 180 }; 181 182 /** 183 * _stopEvent() 184 */ 185 186 Dialog._stopEvent = function(ev) 187 { 188 if (Dialog.is_ie) 189 { 102 190 ev.cancelBubble = true; 103 191 ev.returnValue = false; 104 } else { 192 } 193 else 194 { 105 195 ev.preventDefault(); 106 196 ev.stopPropagation(); 107 } 108 }; 109 110 Dialog.agt = navigator.userAgent.toLowerCase(); 111 Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1)); 197 } 198 }; 199 200 Dialog.hello = function() 201 { 202 alert( "HELLO" ); 203 } 204 205 // END -
branches/unified_backend/plugins/ImageManager/assets/editor.js
r60 r121 1 1 /** 2 * Functions for the ImageEditor interface, used by editor.php only 3 * @author $Author: Wei Zhuo $ 4 * @version $Id: editor.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 5 * @package ImageManager 6 */ 7 8 var current_action = null; 9 var actions = ['crop', 'scale', 'rotate', 'measure', 'save']; 10 var orginal_width = null, orginal_height=null; 11 function toggle(action) 12 { 13 if(current_action != action) 14 { 15 16 for (var i in actions) 17 { 18 if(actions[i] != action) 2 * @fileoverview Functions for the ImageEditor interface, used by editor.php only 3 * 4 * Note "editor" in this file refers to the image editor, not the Xinha editor. 5 * 6 * @author $Author: Wei Zhuo $ 7 * @version $Id: editor.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 8 * @package ImageManager 9 */ 10 11 var current_action = null; 12 var actions = ['crop', 'scale', 'rotate', 'measure', 'save']; 13 var orginal_width = null, orginal_height=null; 14 15 // ------------------------------------------------------------------ 16 17 /** 18 * toggle() 19 */ 20 21 function toggle(action) 22 { 23 24 _imgManager.ddt._ddt( "editor.js","24", "toggle(): top with action '" + action + "'" ); 25 26 if(current_action != action) 27 { 28 29 for (var i in actions) 30 { 31 if(actions[i] != action) 19 32 { 20 21 22 23 33 var tools = document.getElementById('tools_'+actions[i]); 34 tools.style.display = 'none'; 35 var icon = document.getElementById('icon_'+actions[i]); 36 icon.className = ''; 24 37 } 25 38 } 26 39 27 40 current_action = action; 28 41 29 var tools = document.getElementById('tools_'+action); 30 tools.style.display = 'block'; 31 var icon = document.getElementById('icon_'+action); 32 icon.className = 'iconActive'; 33 34 var indicator = document.getElementById('indicator_image'); 35 indicator.src = 'img/'+action+'.gif'; 36 37 editor.setMode(current_action); 38 39 //constraints on the scale, 40 //code by Frédéric Klee <fklee@isuisse.com> 41 if(action == 'scale') 42 { 43 var theImage = editor.window.document.getElementById('theImage'); 44 orginal_width = theImage.width ; 45 orginal_height = theImage.height; 46 47 var w = document.getElementById('sw'); 48 w.value = orginal_width ; 49 var h = document.getElementById('sh') ; 50 h.value = orginal_height ; 51 } 52 53 } 54 } 55 56 function toggleMarker() 57 { 58 var marker = document.getElementById("markerImg"); 59 60 if(marker != null && marker.src != null) { 61 if(marker.src.indexOf("t_black.gif") >= 0) 62 marker.src = "img/t_white.gif"; 63 else 64 marker.src = "img/t_black.gif"; 65 66 editor.toggleMarker(); 67 } 68 } 69 70 //Togggle constraints, by Frédéric Klee <fklee@isuisse.com> 71 function toggleConstraints() 72 { 73 var lock = document.getElementById("scaleConstImg"); 74 var checkbox = document.getElementById("constProp"); 75 76 if(lock != null && lock.src != null) { 77 if(lock.src.indexOf("unlocked2.gif") >= 0) 78 { 79 lock.src = "img/islocked2.gif"; 80 checkbox.checked = true; 81 checkConstrains('width'); 82 83 } 84 else 85 { 86 lock.src = "img/unlocked2.gif"; 87 checkbox.checked = false; 88 } 89 } 90 } 42 var tools = document.getElementById('tools_'+action); 43 tools.style.display = 'block'; 44 var icon = document.getElementById('icon_'+action); 45 icon.className = 'iconActive'; 46 47 var indicator = document.getElementById('indicator_image'); 48 indicator.src = 'img/'+action+'.gif'; 49 50 editor.setMode(current_action); 51 52 //constraints on the scale, 53 //code by Frédéric Klee <fklee@isuisse.com> 54 55 if(action == 'scale') 56 { 57 var theImage = editor.window.document.getElementById('theImage'); 58 orginal_width = theImage.width ; 59 orginal_height = theImage.height; 60 61 var w = document.getElementById('sw'); 62 w.value = orginal_width ; 63 var h = document.getElementById('sh') ; 64 h.value = orginal_height ; 65 } 66 67 } 68 69 } // end of toggle() 70 71 // ------------------------------------------------------------- 72 73 /** 74 * toggleMarker() 75 */ 76 77 function toggleMarker() 78 { 79 80 _imgManager.ddt._ddt( "editor.js","80", "toggleMarker(): top" ); 81 82 var marker = document.getElementById("markerImg"); 83 84 if(marker != null && marker.src != null) 85 { 86 if(marker.src.indexOf("t_black.gif") >= 0) 87 marker.src = "img/t_white.gif"; 88 else 89 marker.src = "img/t_black.gif"; 90 91 editor.toggleMarker(); 92 } 93 } 94 95 // ----------------------------------------------------------------- 96 97 /** 98 * Togggle constraints, by Frédéric Klee <fklee@isuisse.com> 99 */ 100 101 function toggleConstraints() 102 { 103 104 _imgManager.ddt._ddt( "editor.js","104", "toggleConstraints(): top" ); 105 106 var lock = document.getElementById("scaleConstImg"); 107 var checkbox = document.getElementById("constProp"); 108 109 if(lock != null && lock.src != null) 110 { 111 if(lock.src.indexOf("unlocked2.gif") >= 0) 112 { 113 lock.src = "img/islocked2.gif"; 114 checkbox.checked = true; 115 checkConstrains('width'); 116 } 117 else 118 { 119 lock.src = "img/unlocked2.gif"; 120 checkbox.checked = false; 121 } 122 } 123 } // end of toggleContraints() 124 125 // --------------------------------------------------------------------- 91 126 92 //check the constraints, by Frédéric Klee <fklee@isuisse.com> 93 function checkConstrains(changed) 94 { 95 var constrained = document.getElementById('constProp'); 96 if(constrained.checked) 97 { 98 var w = document.getElementById('sw') ; 99 var width = w.value ; 100 var h = document.getElementById('sh') ; 101 var height = h.value ; 127 /** 128 * check the constraints, by Frédéric Klee <fklee@isuisse.com> 129 */ 130 131 function checkConstrains(changed) 132 { 133 134 _imgManager.ddt._ddt( "editor.js","134", "checkConstrains(): top" ); 135 136 var constrained = document.getElementById('constProp'); 137 if(constrained.checked) 138 { 139 var w = document.getElementById('sw') ; 140 var width = w.value ; 141 var h = document.getElementById('sh') ; 142 var height = h.value ; 102 143 103 if(orginal_width > 0 && orginal_height > 0) 104 { 105 if(changed == 'width' && width > 0) 106 h.value = parseInt((width/orginal_width)*orginal_height); 107 else if(changed == 'height' && height > 0) 108 w.value = parseInt((height/orginal_height)*orginal_width); 109 } 110 } 111 112 updateMarker('scale') ; 113 } 114 115 116 function updateMarker(mode) 117 { 118 if (mode == 'crop') 119 { 120 var t_cx = document.getElementById('cx'); 121 var t_cy = document.getElementById('cy'); 122 var t_cw = document.getElementById('cw'); 123 var t_ch = document.getElementById('ch'); 124 125 editor.setMarker(parseInt(t_cx.value), parseInt(t_cy.value), parseInt(t_cw.value), parseInt(t_ch.value)); 126 } 127 else if(mode == 'scale') { 128 var s_sw = document.getElementById('sw'); 129 var s_sh = document.getElementById('sh'); 130 editor.setMarker(0, 0, parseInt(s_sw.value), parseInt(s_sh.value)); 131 } 132 } 133 144 if(orginal_width > 0 && orginal_height > 0) 145 { 146 if(changed == 'width' && width > 0) 147 h.value = parseInt((width/orginal_width)*orginal_height); 148 else if(changed == 'height' && height > 0) 149 w.value = parseInt((height/orginal_height)*orginal_width); 150 } 151 } 152 153 updateMarker('scale') ; 154 155 } // end of checkContrains() 156 157 // -------------------------------------------------------------------- 158 159 /** 160 * updateMarker() 161 */ 162 163 function updateMarker(mode) 164 { 165 166 _imgManager.ddt._ddt( "editor.js","166", "updateMarker(): top with mode '" + mode + "'" ); 167 168 if (mode == 'crop') 169 { 170 var t_cx = document.getElementById('cx'); 171 var t_cy = document.getElementById('cy'); 172 var t_cw = document.getElementById('cw'); 173 var t_ch = document.getElementById('ch'); 174 175 editor.setMarker(parseInt(t_cx.value), parseInt(t_cy.value), parseInt(t_cw.value), parseInt(t_ch.value)); 176 } 177 else if(mode == 'scale') 178 { 179 var s_sw = document.getElementById('sw'); 180 var s_sh = document.getElementById('sh'); 181 editor.setMarker(0, 0, parseInt(s_sw.value), parseInt(s_sh.value)); 182 } 183 184 } // end of updateMarker() 185 186 // --------------------------------------------------------------------- 187 188 /** 189 * rotatePresent() 190 */ 134 191 135 function rotatePreset(selection) 136 { 137 var value = selection.options[selection.selectedIndex].value; 138 139 if(value.length > 0 && parseInt(value) != 0) { 140 var ra = document.getElementById('ra'); 141 ra.value = parseInt(value); 142 } 143 } 144 145 function updateFormat(selection) 146 { 147 var selected = selection.options[selection.selectedIndex].value; 148 149 var values = selected.split(","); 150 if(values.length >1) { 151 updateSlider(parseInt(values[1])); 152 } 153 154 } 155 function addEvent(obj, evType, fn) 192 function rotatePreset(selection) 193 { 194 195 _imgManager.ddt._ddt( "editor.js","195", "rotatePresent(): top" ); 196 197 var value = selection.options[selection.selectedIndex].value; 198 199 if(value.length > 0 && parseInt(value) != 0) 200 { 201 var ra = document.getElementById('ra'); 202 ra.value = parseInt(value); 203 } 204 } 205 206 // --------------------------------------------------------------------- 207 208 /** 209 * updateFormat() 210 */ 211 212 function updateFormat(selection) 213 { 214 215 _imgManager.ddt._ddt( "editor.js","215", "updateFormat(): top" ); 216 217 var selected = selection.options[selection.selectedIndex].value; 218 219 var values = selected.split(","); 220 if(values.length >1) 221 { 222 updateSlider(parseInt(values[1])); 223 } 224 225 } 226 227 // --------------------------------------------------------------------- 228 229 /** 230 * addEvent() 231 */ 232 233 function addEvent(obj, evType, fn) 156 234 { 157 if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 158 else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } 159 else { return false; } 160 } 161 162 init = function() 163 { 164 var bottom = document.getElementById('bottom'); 165 if(window.opener) 166 { 167 __dlg_init(bottom); 168 __dlg_translate('ImageManager'); 169 } 170 } 171 172 addEvent(window, 'load', init); 235 236 _imgManager.ddt._ddt( "editor.js","236", "addEvent(): top" ); 237 238 if (obj.addEventListener) 239 { 240 obj.addEventListener(evType, fn, true); 241 return true; 242 } 243 else if (obj.attachEvent) 244 { 245 var r = obj.attachEvent("on"+evType, fn); 246 return r; 247 } 248 else 249 { 250 return false; 251 } 252 253 } // end of addEvent() 254 255 // ------------------------------------------------------ 256 257 /** 258 * init() 259 */ 260 261 init = function() 262 { 263 264 _imgManager.ddt._ddt( "editor.js","264", "init(): top" ); 265 266 var bottom = document.getElementById('bottom'); 267 if(window.opener) 268 { 269 __dlg_init(bottom); 270 __dlg_translate('ImageManager'); 271 } 272 } 273 274 // -------------------------------------------------------- 275 276 _imgManager.ddt._ddt( "editor.js","276", "bottom: hooking onLoad event" ); 277 278 addEvent(window, 'load', init); 279 280 // END -
branches/unified_backend/plugins/ImageManager/assets/images.js
r60 r121 1 1 /** 2 3 4 5 6 2 * Functions for the image listing, used by images.php only 3 * @author $Author: Wei Zhuo $ 4 * @version $Id: images.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 5 * @package ImageManager 6 */ 7 7 8 function i18n(str) { 9 return HTMLArea._lc(str, 'ImageManager'); 8 // the _imgManager reference must be set before this file is included. 9 10 // -------------------------------------------- 11 12 /** 13 * i18n() 14 */ 15 16 function i18n(str) 17 { 18 19 _imgManager.ddt._ddt( "images.js","19", "i18n(): top with string '" + str + "'" ); 20 21 return HTMLArea._lc(str, 'ImageManager'); 10 22 }; 11 23 12 function changeDir(newDir) 24 // -------------------------------------------- 25 26 function changeDir(newDir) 13 27 { 14 showMessage('Loading');15 28 16 // backend_url is defined in the calling page. For now we 17 // assume it has a trailing & 29 _imgManager.ddt._ddt( "images.js","29", "changeDir(): top with newDir '" + newDir + "'" ); 18 30 19 location.href = _backend_url + "__function=images&dir="+newDir; 31 showMessage('Loading'); 32 33 // backend_url is defined in the calling page. For now we 34 // assume it has a trailing & 35 36 location.href = _backend_url + "__function=images&dir="+newDir; 20 37 } 21 38 39 // ------------------------------------------------ 22 40 23 function newFolder(dir, newDir) 41 /** 42 * newFolder() 43 */ 44 45 function newFolder(dir, newDir) 24 46 { 25 location.href = _backend_url + "__function=images&dir="+dir+"&newDir="+newDir; 47 48 _imgManager.ddt._ddt( "images.js","48", "newFolder(): top with dir '" + dir + "' and newDir '" + newDir + "'" ); 49 50 location.href = _backend_url + "__function=images&dir="+dir+"&newDir="+newDir; 26 51 } 27 52 28 //update the dir list in the parent window. 29 function updateDir(newDir) 53 // ---------------------------------------------------------------------- 54 55 /** 56 * update the dir list in the parent window. 57 */ 58 59 function updateDir(newDir) 30 60 { 31 var selection = window.top.document.getElementById('dirPath'); 32 if(selection) 61 _imgManager.ddt._ddt( "images.js","61", "updatDir(): top with string '" + newDir + "'" ); 62 63 var selection = window.top.document.getElementById('dirPath'); 64 if(selection) 33 65 { 34 66 for(var i = 0; i < selection.length; i++) 35 67 { 36 37 68 var thisDir = selection.options[i].text; 69 if(thisDir == newDir) 38 70 { 39 40 41 71 selection.selectedIndex = i; 72 showMessage('Loading'); 73 break; 42 74 } 43 75 } … … 45 77 } 46 78 47 function selectImage(filename, alt, width, height) 79 // ------------------------------------------------------------------------- 80 81 /** 82 * selectImage() 83 */ 84 85 function selectImage(filename, alt, width, height) 48 86 { 49 var topDoc = window.top.document; 87 88 _imgManager.ddt._ddt( "images.js","88", "selectImage(): top with filename '" + filename + "'" ); 89 90 var topDoc = window.top.document; 50 91 51 52 53 54 55 56 57 92 var obj = topDoc.getElementById('f_url'); obj.value = filename; 93 var obj = topDoc.getElementById('f_width'); obj.value = width; 94 var obj = topDoc.getElementById('f_width'); obj.value = width; 95 var obj = topDoc.getElementById('f_height'); obj.value = height; 96 var obj = topDoc.getElementById('f_alt'); obj.value = alt; 97 var obj = topDoc.getElementById('orginal_width'); obj.value = width; 98 var obj = topDoc.getElementById('orginal_height'); obj.value = height; 58 99 } 59 100 60 function showMessage(newMessage) 101 // -------------------------------------------------------------------------- 102 103 /** 104 * showMessage() 105 */ 106 107 function showMessage(newMessage) 61 108 { 62 var topDoc = window.top.document;63 109 64 var message = topDoc.getElementById('message'); 65 var messages = topDoc.getElementById('messages'); 66 if(message && messages) 110 _imgManager.ddt._ddt( "images.js","110", "showMessage(): top with newMessage '" + newMessage + "'" ); 111 112 var topDoc = window.top.document; 113 114 var message = topDoc.getElementById('message'); 115 var messages = topDoc.getElementById('messages'); 116 117 if(message && messages) 67 118 { 68 119 if(message.firstChild) 69 120 message.removeChild(message.firstChild); 70 121 71 122 message.appendChild(topDoc.createTextNode(i18n(newMessage))); 72 123 73 124 messages.style.display = "block"; 74 125 } 126 75 127 } 76 128 77 function addEvent(obj, evType, fn) 129 // ------------------------------------------------------------ 130 131 /** 132 * addEvent() 133 */ 134 135 function addEvent(obj, evType, fn) 78 136 { 79 if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 80 else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } 81 else { return false; } 137 138 _imgManager.ddt._ddt( "images.js","138", "addEvent(): top" ); 139 140 if (obj.addEventListener) 141 { 142 obj.addEventListener(evType, fn, true); 143 return true; 144 } 145 else if (obj.attachEvent) 146 { 147 var r = obj.attachEvent("on"+evType, fn); return r; 148 } 149 else { return false; } 150 82 151 } 83 152 84 function confirmDeleteFile(file) 153 // -------------------------------------------------------- 154 155 /** 156 * confirmDeleteFile() 157 */ 158 159 function confirmDeleteFile(file) 85 160 { 86 if(confirm(i18n("Delete file?"))) 87 return true; 88 89 return false; 161 162 _imgManager.ddt._ddt( "images.js","162", "confirmDeleteFile(): top with file '" + file + "'" ); 163 164 if(confirm(i18n("Delete file?"))) 165 return true; 166 167 return false; 90 168 } 91 169 92 function confirmDeleteDir(dir, count) 170 // ---------------------------------------------------------- 171 172 /** 173 * confirmDeleteDir() 174 */ 175 176 function confirmDeleteDir(dir, count) 93 177 { 94 if(count > 0) 178 179 _imgManager.ddt._ddt( "images.js","179", "confirmDeleteDir(): top with dir '" + dir + "' count '" + count + "'" ); 180 181 if(count > 0) 95 182 { 96 97 183 alert(i18n("Please delete all files/folders inside the folder you wish to delete first.")); 184 return; 98 185 } 99 186 100 187 if(confirm(i18n("Delete folder?"))) 101 188 return true; 102 189 103 190 return false; 104 191 } 105 192 106 addEvent(window, 'load', init); 193 // ---------------------------------------- 194 195 _imgManager.ddt._ddt( "images.js","195", "bottom: hooking onload event" ); 196 197 addEvent(window, 'load', init); 198 199 // END -
branches/unified_backend/plugins/ImageManager/assets/manager.js
r60 r121 1 1 /** 2 * Functions for the ImageManager, used by manager.php only 3 * @author $Author: Wei Zhuo $ 4 * @version $Id: manager.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 5 * @package ImageManager 6 */ 2 * @fileoverview Functions for the ImageManager, used by manager.php only 3 * 4 * The _imgManager object must be present before this file can be included. 5 * 6 * @see manager.php 7 * 8 * @author $Author: Wei Zhuo $ 9 * @version $Id: manager.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 10 * @package ImageManager 11 * 12 * @todo this should be turned into a class, possibly made part of ImageManager. 13 */ 14 15 // ---------------------------------------------------- 7 16 8 //Translation 9 function i18n(str) { 10 return HTMLArea._lc(str, 'ImageManager'); 17 /** 18 * Translation 19 * 20 function i18n(str) 21 { 22 23 _imgManager.ddt._ddt( "manager.js","23", "i18n(): top with string '" + str + "'" ); 24 25 return HTMLArea._lc(str, 'ImageManager'); 26 11 27 }; 12 28 13 14 //set the alignment options 15 function setAlign(align) 16 { 17 var selection = document.getElementById('f_align'); 18 for(var i = 0; i < selection.length; i++) 19 { 20 if(selection.options[i].value == align) 21 { 22 selection.selectedIndex = i; 23 break; 29 // ---------------------------------------------------- 30 31 /** 32 * set the alignment options 33 */ 34 35 function setAlign(align) 36 { 37 38 _imgManager.ddt._ddt( "manager.js","38", "setAlign(): top with align '" + align + "'" ); 39 40 var selection = document.getElementById('f_align'); 41 42 for(var i = 0; i < selection.length; i++) 43 { 44 if (selection.options[i].value == align) 45 { 46 selection.selectedIndex = i; 47 break; 24 48 } 25 49 } 50 } // end of setAlign() 51 52 // -------------------------------------------- 53 54 /** 55 * initialise the form 56 */ 57 58 init = function () 59 { 60 61 _imgManager.ddt._ddt( "manager.js","61", "init(): top." ); 62 63 __dlg_init(); 64 65 __dlg_translate('ImageManager'); 66 67 var uploadForm = document.getElementById('uploadForm'); 68 69 if(uploadForm) uploadForm.target = 'imgManager'; 70 71 var param = window.dialogArguments; 72 73 if (param) 74 { 75 document.getElementById("f_url").value = param["f_url"]; 76 document.getElementById("f_alt").value = param["f_alt"]; 77 document.getElementById("f_border").value = param["f_border"]; 78 document.getElementById("f_vert").value = param["f_vert"]; 79 document.getElementById("f_horiz").value = param["f_horiz"]; 80 document.getElementById("f_width").value = param["f_width"]; 81 document.getElementById("f_height").value = param["f_height"]; 82 setAlign(param["f_align"]); 83 } 84 85 _imgManager.ddt._ddt( "manager.js","85", "init(): setting focus" ); 86 87 document.getElementById("f_url").focus(); 88 89 } // end of init. 90 91 // ----------------------------------------------------------------- 92 93 /** 94 * onCancel() 95 */ 96 97 function onCancel() 98 { 99 100 _imgManager.ddt._ddt( "manager.js","100", "onCancel(): top" ); 101 102 __dlg_close(null); 103 return false; 104 }; 105 106 // ------------------------------------------------------------------ 107 108 /** 109 * onOK() 110 */ 111 112 function onOK() 113 { 114 115 _imgManager.ddt._ddt( "manager.js","115", "onOK(): top" ); 116 117 // pass data back to the calling window 118 119 var fields = ["f_url", "f_alt", "f_align", "f_border", "f_horiz", "f_vert", "f_height", "f_width"]; 120 var param = new Object(); 121 122 for (var i in fields) 123 { 124 var id = fields[i]; 125 var el = document.getElementById(id); 126 if (id == "f_url" && el.value.indexOf('://') < 0 ) 127 { 128 129 if ( el.value == "" ) 130 { 131 alert( "No Image selected." ); 132 return( false ); 133 } 134 135 param[id] = makeURL(base_url,el.value); 136 } 137 else 138 { 139 param[id] = el.value; 140 } 141 } 142 143 _imgManager.ddt._ddt( "manager.js","143", "onOK(): closing dialog" ); 144 145 __dlg_close(param); 146 return false; 147 148 }; // end of onOK() 149 150 // --------------------------------------------------- 151 152 /** 153 * makeURL() 154 * 155 * similar to the Files::makeFile() in Files.php 156 */ 157 158 function makeURL(pathA, pathB) 159 { 160 161 _imgManager.ddt._ddt( "manager.js","161", "makeURL(): pathA '" + pathA + "' pathB '" + pathB + "'" ); 162 163 if (pathA.substring(pathA.length-1) != '/') 164 pathA += '/'; 165 166 if (pathB.charAt(0) == '/'); 167 pathB = pathB.substring(1); 168 169 return pathA+pathB; 170 171 } // end of makeURL() 172 173 // --------------------------------------------- 174 175 /** 176 * updateDir() 177 */ 178 179 function updateDir(selection) 180 { 181 182 var newDir = selection.options[selection.selectedIndex].value; 183 184 _imgManager.ddt._ddt( "manager.js","184", "updateDir(): newDir is '" + newDir + "'" ); 185 186 changeDir(newDir); 26 187 } 27 188 28 //initialise the form 29 init = function () 30 { 31 __dlg_init(); 32 33 __dlg_translate('ImageManager'); 34 35 var uploadForm = document.getElementById('uploadForm'); 36 if(uploadForm) uploadForm.target = 'imgManager'; 37 38 var param = window.dialogArguments; 39 if (param) 40 { 41 document.getElementById("f_url").value = param["f_url"]; 42 document.getElementById("f_alt").value = param["f_alt"]; 43 document.getElementById("f_border").value = param["f_border"]; 44 document.getElementById("f_vert").value = param["f_vert"]; 45 document.getElementById("f_horiz").value = param["f_horiz"]; 46 document.getElementById("f_width").value = param["f_width"]; 47 document.getElementById("f_height").value = param["f_height"]; 48 setAlign(param["f_align"]); 49 } 50 51 document.getElementById("f_url").focus(); 189 // --------------------------------------------- 190 191 /** 192 * goUpDir() 193 */ 194 195 function goUpDir() 196 { 197 198 _imgManager.ddt._ddt( "manager.js","198", "goUpDir(): top" ); 199 200 var selection = document.getElementById('dirPath'); 201 var currentDir = selection.options[selection.selectedIndex].text; 202 203 if(currentDir.length < 2) 204 return false; 205 206 var dirs = currentDir.split('/'); 207 208 var search = ''; 209 210 for(var i = 0; i < dirs.length - 2; i++) 211 { 212 search += dirs[i]+'/'; 213 } 214 215 for(var i = 0; i < selection.length; i++) 216 { 217 var thisDir = selection.options[i].text; 218 if(thisDir == search) 219 { 220 selection.selectedIndex = i; 221 var newDir = selection.options[i].value; 222 changeDir(newDir); 223 break; 224 } 225 } 226 } // end of goUpDir() 227 228 // ---------------------------------------------- 229 230 /** 231 * changeDir() 232 */ 233 234 function changeDir(newDir) 235 { 236 237 _imgManager.ddt._ddt( "manager.js","237", "changeDir(): newDir is '" + newDir + "'" ); 238 239 if (typeof imgManager != 'undefined') 240 { 241 242 _imgManager.ddt._ddt( "manager.js","242", "changeDir(): imgManager is defined" ); 243 244 imgManager.changeDir(newDir); 245 } 52 246 } 53 247 54 55 function onCancel() 56 { 57 __dlg_close(null); 58 return false; 59 }; 60 61 function onOK() 62 { 63 // pass data back to the calling window 64 var fields = ["f_url", "f_alt", "f_align", "f_border", "f_horiz", "f_vert", "f_height", "f_width"]; 65 var param = new Object(); 66 for (var i in fields) 67 { 68 var id = fields[i]; 69 var el = document.getElementById(id); 70 if(id == "f_url" && el.value.indexOf('://') < 0 ) 71 { 72 73 if ( el.value == "" ) 74 { 75 alert( "No Image selected." ); 76 return( false ); 77 } 78 79 param[id] = makeURL(base_url,el.value); 80 } 81 else 82 param[id] = el.value; 83 } 84 __dlg_close(param); 85 return false; 86 }; 87 88 //similar to the Files::makeFile() in Files.php 89 function makeURL(pathA, pathB) 90 { 91 if(pathA.substring(pathA.length-1) != '/') 92 pathA += '/'; 93 94 if(pathB.charAt(0) == '/'); 95 pathB = pathB.substring(1); 96 97 return pathA+pathB; 98 } 99 100 101 function updateDir(selection) 102 { 103 var newDir = selection.options[selection.selectedIndex].value; 104 changeDir(newDir); 105 } 106 107 function goUpDir() 108 { 109 var selection = document.getElementById('dirPath'); 110 var currentDir = selection.options[selection.selectedIndex].text; 111 if(currentDir.length < 2) 112 return false; 113 var dirs = currentDir.split('/'); 248 // ----------------------------------------------- 249 250 /** 251 * toggleContrains() 252 */ 253 254 function toggleConstrains(constrains) 255 { 256 257 _imgManager.ddt._ddt( "manager.js","257", "toggleConstrains(): top" ); 258 259 var lockImage = document.getElementById('imgLock'); 260 var constrains = document.getElementById('constrain_prop'); 261 262 if(constrains.checked) 263 { 264 lockImage.src = "img/locked.gif"; 265 checkConstrains('width') 266 } 267 else 268 { 269 lockImage.src = "img/unlocked.gif"; 270 } 271 } // end of toggleConstrains() 272 273 // --------------------------------------------------- 274 275 /** 276 * checkConstrains() 277 */ 278 279 function checkConstrains(changed) 280 { 281 282 _imgManager.ddt._ddt( "manager.js","282", "checkConstrains(): top" ); 283 284 //alert(document.form1.constrain_prop); 285 286 var constrains = document.getElementById('constrain_prop'); 114 287 115 var search = ''; 116 117 for(var i = 0; i < dirs.length - 2; i++) 118 { 119 search += dirs[i]+'/'; 120 } 121 122 for(var i = 0; i < selection.length; i++) 123 { 124 var thisDir = selection.options[i].text; 125 if(thisDir == search) 126 { 127 selection.selectedIndex = i; 128 var newDir = selection.options[i].value; 129 changeDir(newDir); 130 break; 131 } 132 } 133 } 134 135 function changeDir(newDir) 136 { 137 if(typeof imgManager != 'undefined') 138 imgManager.changeDir(newDir); 139 } 140 141 function toggleConstrains(constrains) 142 { 143 var lockImage = document.getElementById('imgLock'); 144 var constrains = document.getElementById('constrain_prop'); 145 146 if(constrains.checked) 147 { 148 lockImage.src = "img/locked.gif"; 149 checkConstrains('width') 150 } 151 else 152 { 153 lockImage.src = "img/unlocked.gif"; 154 } 155 } 156 157 function checkConstrains(changed) 158 { 159 //alert(document.form1.constrain_prop); 160 var constrains = document.getElementById('constrain_prop'); 161 162 if(constrains.checked) 163 { 164 var obj = document.getElementById('orginal_width'); 165 var orginal_width = parseInt(obj.value); 166 var obj = document.getElementById('orginal_height'); 167 var orginal_height = parseInt(obj.value); 168 169 var widthObj = document.getElementById('f_width'); 170 var heightObj = document.getElementById('f_height'); 288 if(constrains.checked) 289 { 290 var obj = document.getElementById('orginal_width'); 291 var orginal_width = parseInt(obj.value); 292 var obj = document.getElementById('orginal_height'); 293 var orginal_height = parseInt(obj.value); 294 295 var widthObj = document.getElementById('f_width'); 296 var heightObj = document.getElementById('f_height'); 171 297 172 var width = parseInt(widthObj.value); 173 var height = parseInt(heightObj.value); 174 175 if(orginal_width > 0 && orginal_height > 0) 176 { 177 if(changed == 'width' && width > 0) { 178 heightObj.value = parseInt((width/orginal_width)*orginal_height); 179 } 180 181 if(changed == 'height' && height > 0) { 182 widthObj.value = parseInt((height/orginal_height)*orginal_width); 298 var width = parseInt(widthObj.value); 299 var height = parseInt(heightObj.value); 300 301 if(orginal_width > 0 && orginal_height > 0) 302 { 303 if(changed == 'width' && width > 0) 304 { 305 heightObj.value = parseInt((width/orginal_width)*orginal_height); 306 } 307 308 if(changed == 'height' && height > 0) 309 { 310 widthObj.value = parseInt((height/orginal_height)*orginal_width); 183 311 } 184 312 } 185 313 } 314 } // end of checkContrains() 315 316 // -------------------------------------------------------------------- 317 318 /** 319 * showMessage() 320 */ 321 322 function showMessage(newMessage) 323 { 324 325 _imgManager.ddt._ddt( "manager.js","325", "showMessage(): top with message '" + newMessage + "'" ); 326 327 var message = document.getElementById('message'); 328 var messages = document.getElementById('messages'); 329 330 if (message.firstChild) 331 message.removeChild(message.firstChild); 332 333 message.appendChild(document.createTextNode(i18n(newMessage))); 334 335 messages.style.display = "block"; 186 336 } 187 337 188 function showMessage(newMessage) 189 { 190 var message = document.getElementById('message'); 191 var messages = document.getElementById('messages'); 192 if(message.firstChild) 193 message.removeChild(message.firstChild); 194 195 message.appendChild(document.createTextNode(i18n(newMessage))); 338 // --------------------------------------------------------------------- 339 340 /** 341 * addEvent() 342 */ 343 344 function addEvent(obj, evType, fn) 345 { 346 347 _imgManager.ddt._ddt( "manager.js","347", "addEvent() : top" ); 348 349 if (obj.addEventListener) 350 { 351 obj.addEventListener(evType, fn, true); 352 return true; 353 } 354 else if (obj.attachEvent) 355 { 356 var r = obj.attachEvent("on"+evType, fn); 357 return r; 358 } 359 else 360 { 361 return false; 362 } 363 } // end of addEvent() 364 365 // ---------------------------------------------- 366 367 /** 368 * doUpload() 369 */ 370 371 function doUpload() 372 { 373 _imgManager.ddt._ddt( "manager.js","373", "doUpload(): top" ); 196 374 197 messages.style.display = "block"; 375 var uploadForm = document.getElementById('uploadForm'); 376 377 if(uploadForm) 378 { 379 showMessage('Uploading'); 380 } 198 381 } 199 382 200 function addEvent(obj, evType, fn) 201 { 202 if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 203 else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } 204 else { return false; } 205 } 206 207 function doUpload() 208 { 209 210 var uploadForm = document.getElementById('uploadForm'); 211 if(uploadForm) 212 showMessage('Uploading'); 383 // ----------------------------------------------------- 384 385 /** 386 * refresh() 387 */ 388 389 function refresh() 390 { 391 _imgManager.ddt._ddt( "manager.js","391", "refresh(): top" ); 392 393 var selection = document.getElementById('dirPath'); 394 updateDir(selection); 213 395 } 214 396 215 function refresh() 216 { 217 var selection = document.getElementById('dirPath'); 218 updateDir(selection); 219 } 220 221 222 function newFolder() 223 { 224 var selection = document.getElementById('dirPath'); 225 var dir = selection.options[selection.selectedIndex].value; 226 227 Dialog("newFolder.html", function(param) 228 { 397 // ---------------------------------------------------- 398 399 /** 400 * newFolder() 401 */ 402 403 function newFolder() 404 { 405 406 _imgManager.ddt._ddt( "manager.js","406", "newFolder(): top" ); 407 408 var selection = document.getElementById('dirPath'); 409 var dir = selection.options[selection.selectedIndex].value; 410 411 // the popup dialog also needs access to the editor instance. See the last 412 // parm. 413 414 Dialog("newFolder.html", 415 function(param) 416 { 417 418 _imgManager.ddt._ddt( "manager.js","418", "Dialog() newFolder function parm: top" ); 419 229 420 if (!param) // user must have pressed Cancel 230 421 return false; 231 422 else 232 {423 { 233 424 var folder = param['f_foldername']; 425 234 426 if(folder == thumbdir) 235 {427 { 236 428 alert(i18n('Invalid folder name, please choose another folder name.')); 237 429 return false; 238 }430 } 239 431 240 432 if (folder && folder != '' && typeof imgManager != 'undefined') 241 433 imgManager.newFolder(dir, encodeURI(folder)); 242 } 243 }, null); 244 } 245 246 addEvent(window, 'load', init); 434 } 435 }, null, _imgManager._editor); // end of Dialog() function parm 436 437 } // end of newFolder() 438 439 // ------------------------------------------------------------- 440 // once the window loads fire the init() function defined above 441 442 _imgManager.ddt._ddt( "manager.js","442", "bottom, adding event to window onload" ); 443 444 addEvent(window, 'load', init); 445 446 // end. -
branches/unified_backend/plugins/ImageManager/backend.php
r48 r121 1 <? 1 <?php 2 2 3 3 /** … … 8 8 * 9 9 * Unified backend sponsored by DTLink Software, http://www.dtlink.com 10 * Implementation by Yermo Lamers, http://www.formvista.com 10 * Implementation by Yermo Lamers, http://www.formvista.com/contact.html 11 11 * 12 12 * (c) DTLink, LLC 2005. … … 41 41 */ 42 42 43 include_once( " ddt.php" );43 include_once( "../ddt/ddt.php" ); 44 44 45 45 // uncomment to turn on debugging 46 46 // _ddtOn(); 47 47 48 // --------------------------------------------------------------- 49 50 /** 51 * ImageManager backend callback 52 * 53 * After including this file, the unified backend.php script 54 * will call this function 55 */ 56 57 function imagemanager_callback( $formVars ) 58 { 59 60 global $IMConfig; 61 48 62 _ddt( __FILE__, __LINE__, "backend.php: top with query '" . $_SERVER["PHP_SELF"] . "' string '" . $_SERVER["QUERY_STRING"] . "'" ); 49 50 $formVars = empty($_POST) ? $_GET : $_POST;51 63 52 64 // make sure the request is for us (this gives us the ability to eventually organize … … 122 134 return false ; 123 135 136 } // end of ImageManager_plugin 137 124 138 // END 125 139 -
branches/unified_backend/plugins/ImageManager/config.inc.php
r60 r121 14 14 // . unified backend. 15 15 // . created a set of defaults that make sense for bundling with Xinha. 16 17 // ------------------------------------------------------------------------- 16 // 17 // 2005-05-01 YmL: 18 // . modified for master unified backend. 19 // . config values can be overridden by the calling page (makes integration 20 // easier. 21 // ------------------------------------------------------------------------- 22 23 /** 24 * Xinha PHP backend config file. 25 * 26 * probably already included. We assume we are in the xinha/plugins/ImageManager 27 * directory 28 */ 29 30 if ( ! defined( "XINHA_INSTALL_ROOT" ) ) 31 { 32 include_once( "../../backends/backend_conf.php" ); 33 } 18 34 19 35 /** … … 25 41 */ 26 42 27 $IMConfig['backend_url'] = "backend.php?__plugin=ImageManager&"; 43 if ( @$IMConfig['backend_url' ] == NULL ) 44 { 45 $IMConfig['backend_url'] = XINHA_INSTALL_URL . "/backends/backend.php?__plugin=ImageManager&"; 46 } 28 47 29 48 /** … … 36 55 */ 37 56 38 $IMConfig['base_dir'] = getcwd(); 39 $IMConfig['base_url'] = ''; 57 if ( @$IMConfig[ 'base_dir' ] == NULL ) 58 { 59 $IMConfig['base_dir'] = XINHA_INSTALL_ROOT . "/plugins/ImageManager/"; 60 $IMConfig['base_url'] = XINHA_INSTALL_URL . "/plugins/ImageManager/"; 61 } 40 62 41 63 // ------------------------------------------------------------ … … 51 73 * Able to create directories is nice, but not necessary. 52 74 * 53 * CHANGE THIS: for out-of-the-box demo purposes we're setting this to ./demo_images54 * which has some graphics in it.75 * For out-of-the-box demo purposes we're setting this to 76 * xinha/examples/images which has some graphics in it. 55 77 */ 56 78 57 79 // $IMConfig['images_dir'] = "/some/path/to/images/directory; 58 80 59 $IMConfig['images_dir'] = "demo_images"; 81 if ( @$IMConfig['images_dir'] == NULL ) 82 { 83 $IMConfig['images_dir'] = XINHA_INSTALL_ROOT . "/examples/images"; 84 } 60 85 61 86 // ------------------------------------------------------------------------- … … 70 95 * for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets 71 96 * in this directory and its subdirectories. 72 * 73 * CHANGE THIS: You need to change this to match the url where you have Xinha 74 * installed. If the images show up blank chances are this is not set correctly. 75 */ 76 77 // $IMConfig['images_url'] = "/url/to/above"; 78 79 // try to figure out the URL of the sample images directory. For your installation 80 // you will probably want to keep images in another directory. 81 82 $IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images"; 97 */ 98 99 if ( @$IMConfig['images_url'] == NULL ) 100 { 101 $IMConfig['images_url'] = XINHA_INSTALL_URL . "/examples/images"; 102 } 83 103 84 104 // ------------------------------------------------------------------------- … … 97 117 */ 98 118 99 $IMConfig['safe_mode'] = false; 119 if ( @$IMConfig['safe_mode'] == NULL ) 120 { 121 $IMConfig['safe_mode'] = false; 122 } 100 123 101 124 // ------------------------------------------------------------------------- … … 155 178 */ 156 179 157 $IMConfig['thumbnail_dir'] = '.thumbs'; 180 if ( @$IMConfig[ 'thumbnail_dir' ] == NULL ) 181 { 182 $IMConfig['thumbnail_dir'] = '.thumbs'; 183 } 158 184 159 185 // ------------------------------------------------------------------------- … … 176 202 */ 177 203 178 $IMConfig['allow_new_dir'] = true; 204 if ( @$IMConfig[ 'allow_new_dir' ] === NULL ) 205 { 206 $IMConfig['allow_new_dir'] = false; 207 } 179 208 180 209 // ------------------------------------------------------------------------- … … 192 221 */ 193 222 194 $IMConfig['allow_upload'] = true; 223 if ( @$IMConfig['allow_upload'] === NULL ) 224 { 225 $IMConfig['allow_upload'] = false; 226 } 195 227 196 228 // ------------------------------------------------------------------------- … … 210 242 */ 211 243 212 $IMConfig['validate_images'] = true; 244 if ( @$IMConfig[ 'validate_images' ] === NULL ) 245 { 246 $IMConfig['validate_images'] = true; 247 } 213 248 214 249 // ------------------------------------------------------------------------- … … 221 256 */ 222 257 223 $IMConfig['default_thumbnail'] = 'img/default.gif'; 258 if ( @$IMConfig['default_thumbnail'] == NULL ) 259 { 260 $IMConfig['default_thumbnail'] = 'img/default.gif'; 261 } 224 262 225 263 // ------------------------------------------------------------------------- … … 229 267 */ 230 268 231 $IMConfig['thumbnail_width'] = 96; 232 $IMConfig['thumbnail_height'] = 96; 269 if ( @$IMConfig['thumbnail_width'] == NULL ) 270 { 271 $IMConfig['thumbnail_width'] = 96; 272 $IMConfig['thumbnail_height'] = 96; 273 } 233 274 234 275 // ------------------------------------------------------------------------- … … 240 281 */ 241 282 242 $IMConfig['tmp_prefix'] = '.editor_'; 243 283 if ( @$IMConfig['tmp_prefix'] == NULL ) 284 { 285 $IMConfig['tmp_prefix'] = '.editor_'; 286 } 287 288 // used to verify that the config has been loaded. 244 289 245 290 define( "IM_CONFIG_LOADED", "yes" ); 246 291 247 // bring in the debugging library 248 249 include_once( "ddt.php" );292 // bring in the debugging library. 293 294 include_once( XINHA_INSTALL_ROOT . "/ddt/ddt.php" ); 250 295 251 296 // uncomment to send debug messages to a local file 252 _setDebugLog( "/tmp/debug_log.txt" );253 254 // turn debugging on everywhere.255 _ddtOn();297 // _setDebugLog( "/tmp/debug_log.txt" ); 298 299 // uncomment to turn on debugging messages. 300 //_ddtOn(); 256 301 257 302 // END -
branches/unified_backend/plugins/ImageManager/editor.php
r60 r121 1 <? 1 <?php 2 2 /** 3 3 * The PHP Image Editor user interface. … … 21 21 <title></title> 22 22 <script type="text/javascript"> 23 _backend_url = "<? print $IMConfig['backend_url']; ?>"; 23 _backend_url = "<?php print $IMConfig['backend_url']; ?>"; 24 25 // This page is opened by a call to Dialog() in ImageManager/images.php in the 26 // editImage() js function. (That Dialog() call is defined in ImageManager/assets/dialog.js 27 // 28 // The Dialog() call accepts an optional fourth parameter, the editor instance 29 // that is raising this dialog. From there we can pull out the ImageManager instance and 30 // get access to the ddt instance. This has an added benefit allowing us to 31 // put all the previously free standing manager functions into the image manager class. 32 33 _imgManager = window.opener.Dialog._editor.plugins[ "ImageManager" ].instance; 34 35 _imgManager.ddt._ddt( "editor.php", "38", "top of editor.php file." ); 36 24 37 </script> 25 <link href="<? print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" />26 <script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/slider.js"></script>27 <script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/popup.js"></script>38 <link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" /> 39 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script> 40 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> 28 41 <script type="text/javascript"> 29 42 /*<![CDATA[*/ … … 34 47 /*]]>*/ 35 48 </script> 36 <script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/editor.js"></script>49 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script> 37 50 </head> 38 51 39 52 <body> 40 53 <div id="indicator"> 41 <img src="<? print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" />54 <img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" /> 42 55 </div> 43 56 <div id="tools"> … … 48 61 <label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/> 49 62 <label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> 50 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />63 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 51 64 </div> 52 <a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<? print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>53 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<? print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>65 <a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 66 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 54 67 </div> 55 68 <div id="tools_scale" style="display:none;"> 56 69 <div id="tool_inputs"> 57 70 <label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/> 58 <a href="javascript:toggleConstraints();" title="Lock"><img src="<? print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label>71 <a href="javascript:toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label> 59 72 <input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/> 60 73 <input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/> 61 74 <label for="constProp">Constrain Proportions</label> 62 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />75 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 63 76 </div> 64 <a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<? print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>65 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<? print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>77 <a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 78 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 66 79 </div> 67 80 <div id="tools_rotate" style="display:none;"> … … 82 95 </select> 83 96 <label for="ra">Angle:</label><input type="text" id="ra" class="textInput" /> 84 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />97 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 85 98 </div> 86 <a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<? print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>87 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<? print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>99 <a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 100 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 88 101 </div> 89 102 <div id="tools_measure" style="display:none;"> … … 91 104 <label>X:</label><input type="text" class="measureStats" id="sx" /> 92 105 <label>Y:</label><input type="text" class="measureStats" id="sy" /> 93 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />106 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 94 107 <label>W:</label><input type="text" class="measureStats" id="mw" /> 95 108 <label>H:</label><input type="text" class="measureStats" id="mh" /> 96 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />109 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 97 110 <label>A:</label><input type="text" class="measureStats" id="ma" /> 98 111 <label>D:</label><input type="text" class="measureStats" id="md" /> 99 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />112 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 100 113 <button type="button" onclick="editor.reset();" >Clear</button> 101 114 </div> … … 103 116 <div id="tools_save" style="display:none;"> 104 117 <div id="tool_inputs"> 105 <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<? echo $editor->getDefaultSaveFile();?>"/>118 <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/> 106 119 <select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)"> 107 120 <option value="" selected>Image Format</option> … … 111 124 <option value="jpeg,35">JPEG Low</option> 112 125 <option value="png">PNG</option> 113 <? if($editor->isGDGIFAble() != -1) { ?>126 <?php if($editor->isGDGIFAble() != -1) { ?> 114 127 <option value="gif">GIF</option> 115 <? } ?>128 <?php } ?> 116 129 </select> 117 130 <label>Quality:</label> … … 120 133 <td> 121 134 <div id="slidercasing"> 122 <div id="slidertrack" style="width:100px"><img src="<? print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div>123 <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<? print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div>135 <div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> 136 <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> 124 137 </div> 125 138 </td> … … 127 140 </table> 128 141 <input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/> 129 <img src="<? print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />142 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 130 143 </div> 131 <a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<? print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>132 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<? print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>144 <a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 145 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 133 146 </div> 134 147 </div> 135 148 <div id="toolbar"> 136 <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<? print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>137 <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<? print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>138 <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<? print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>139 <a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<? print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a>140 <a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<? print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a>141 <a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<? print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a>149 <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a> 150 <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a> 151 <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a> 152 <a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a> 153 <a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a> 154 <a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a> 142 155 </div> 143 156 <div id="contents"> 144 <iframe src="<? print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe>157 <iframe src="<?php print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?php if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe> 145 158 </div> 146 159 <div id="bottom"></div> -
branches/unified_backend/plugins/ImageManager/image-manager.js
r60 r121 1 /** 2 * The ImageManager plugin javascript. 3 * @author $Author: Wei Zhuo $ 4 * @version $Id: image-manager.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 5 * @package ImageManager 6 */ 7 8 /** 9 * To Enable the plug-in add the following line before HTMLArea is initialised. 10 * 11 * HTMLArea.loadPlugin("ImageManager"); 12 * 13 * Then configure the config.inc.php file, that is all. 14 * For up-to-date documentation, please visit http://www.zhuo.org/htmlarea/ 15 */ 16 17 /** 18 * It is pretty simple, this file over rides the HTMLArea.prototype._insertImage 19 * function with our own, only difference is the popupDialog url 20 * point that to the php script. 21 */ 22 23 function ImageManager(editor) 24 { 25 26 }; 27 28 ImageManager._pluginInfo = { 1 2 // tabs: 3 3 4 /** 5 * @fileoverview The ImageManager plugin javascript. 6 * 7 * This plugin implements a client side image manager and editor. 8 * 9 * @version $Id: image-manager.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 10 * @package ImageManager 11 * @author $Author: Wei Zhuo $ 12 * @author Yermo Lamers http://www.formvista.com (unified backend modifications) 13 */ 14 15 /** 16 * To Enable the plug-in add the following line before HTMLArea is initialised. 17 * 18 * HTMLArea.loadPlugin("ImageManager"); 19 * 20 * Then configure the config.inc.php file, that is all. 21 * For up-to-date documentation, please visit http://www.zhuo.org/htmlarea/ 22 */ 23 24 // ----------------------------------------------------------------- 25 26 /** 27 * pluginInfo for about box. 28 */ 29 30 ImageManager._pluginInfo = 31 { 29 32 name : "ImageManager", 30 33 version : "1.0", … … 32 35 developer_url : "http://www.zhuo.org/htmlarea/", 33 36 license : "htmlArea" 34 }; 35 36 // default Xinha layout. plugins are beneath the Xinha directory. 37 // Note the trailing &. Makes forming our URL's easier. 38 // 39 // To change the backend, just set this config variable in the calling page. 40 // The images_url config option is used to strip out the directory info when 41 // images are selected from the document. 37 }; 38 39 /** 40 * ImageManager plugin configuration 41 * 42 * default Xinha layout. plugins are beneath the Xinha directory. 43 * all plugin requests are routed through a single entry point. 44 * 45 * Note the trailing &. Makes forming our URL's easier. 46 * 47 * To change the backend, just set this config variable in the calling page. 48 * The images_url config option is used to strip out the directory info when 49 * images are selected from the document. 50 */ 42 51 43 52 HTMLArea.Config.prototype.ImageManager = 44 { 45 'backend' : _editor_url + 'plugins/ImageManager/backend.php?__plugin=ImageManager&', 46 'images_url' : _editor_url + 'plugins/ImageManager/demo_images' 47 } 48 49 // Over ride the _insertImage function in htmlarea.js. 50 // Open up the ImageManger script instead. 51 52 HTMLArea.prototype._insertImage = function(image) { 53 { 54 55 // the backend URL may already include variables. 56 57 'backend' : _editor_backend + ( _editor_backend.match(/.*\?.*/) ? "&" : "?" ) + '__plugin=ImageManager&', 58 'images_url' : _editor_url + 'examples/images' 59 60 } 61 62 /** 63 * It is pretty simple, this file over rides the HTMLArea.prototype._insertImage 64 * function with our own, only difference is the popupDialog url 65 * point that to the php script. 66 * 67 * @class Image Manager Plugin. 68 */ 69 70 function ImageManager(editor) 71 { 72 73 this.editor = editor; 74 75 // [STRIP 76 // create a ddt debug trace object. There may be multiple editors on 77 // the page each with an ImageManager .. to distinguish which instance 78 // is generating the message we tack on the name of the textarea. 79 80 this.ddt = new DDT( editor._textArea + ":ImageManager Plugin" ); 81 82 // uncomment to turn on debugging messages. 83 84 this.ddt._ddtOn(); 85 86 this.ddt._ddt( "image-manager.js","86", "ImageManager(): constructor" ); 87 88 // STRIP] 89 90 }; 91 92 // ---------------------------------------------------------------- 93 94 /** 95 * Override the _insertImage function in htmlarea.js. 96 * 97 * If no image is selected, the image parameter will be null. If 98 * an image is selected (right click->image properties for instance) 99 * then image will contain the selected image. 100 * 101 * @todo figure out how to get to editor object from Dialog function. 102 */ 103 104 HTMLArea.prototype._insertImage = function(image) 105 { 106 107 this.ddt._ddt( "image-manager.js","107", "_insertImage(): top" ); 53 108 54 109 var editor = this; // for nested functions 55 110 var outparam = null; 56 if (typeof image == "undefined") { 111 112 if (typeof image == "undefined") 113 { 114 this.ddt._ddt( "image-manager.js","114", "_insertImage(): no image." ); 57 115 image = this.getParentElement(); 116 58 117 if (image && !/^img$/i.test(image.tagName)) 59 118 image = null; 60 }119 } 61 120 62 121 // the selection will have the absolute url to the image. … … 81 140 82 141 var images_url = editor.config.ImageManager.images_url.replace( /https?:\/\/[^\/]*/, "" ); 83 84 // alert( "images_url is '" + images_url + "'" );85 86 142 var image_regex = new RegExp( images_url ); 87 88 // alert(" regex is '" + image_regex.source + "'" );89 90 143 image_src = image_src.replace( image_regex, "" ); 91 144 92 // alert( "new source is " + image_src );145 this.ddt._ddt( "image-manager.js","145", "_insertImage(): new source is " + image_src ); 93 146 } 94 147 … … 112 165 // actual config variable in each place .. for now this is good enough. 113 166 114 // alert( "backend is '" + editor.config.ImageManager.backend + "'" );167 this.ddt._ddt( "image-manager.js","167", "_insertImage(): backend is '" + editor.config.ImageManager.backend + "'" ); 115 168 116 169 var manager = editor.config.ImageManager.backend + '__function=manager'; 117 170 118 Dialog(manager, function(param) { 119 if (!param) { // user must have pressed Cancel 120 return false; 121 } 122 var img = image; 123 if (!img) { 124 var sel = editor._getSelection(); 125 var range = editor._createRange(sel); 126 editor._doc.execCommand("insertimage", false, param.f_url); 127 if (HTMLArea.is_ie) { 128 img = range.parentElement(); 129 // wonder if this works... 130 if (img.tagName.toLowerCase() != "img") { 131 img = img.previousSibling; 171 // NOTE the extremely long function as parameter #2 to Dialog() here. 172 // javascript scoping rules seem really messy. editor is available within 173 // this function .. 174 175 Dialog( manager, 176 function(param) 177 { 178 179 // [STRIP 180 // 181 // we want to use the ImageManager DDT instance to output these 182 // debug messages (so we can turn off all ImageManager plugin debug messages 183 // from one spot). To get that object we need to go through the 184 // editor object to the plugins array (see htlarea.js HTMLArea() constructor line 185 // ~2559 as of this writing) to the named plugin (ImageManager), to the plugin 186 // instance to the ddt instance. 187 188 var ddt = editor.plugins[ 'ImageManager'].instance.ddt; 189 190 // STRIP] 191 192 ddt._ddt( "image-manager.js","192", "Dialog() parm: top" ); 193 194 if (!param) 195 { // user must have pressed Cancel 196 return false; 132 197 } 133 } else { 134 img = range.startContainer.previousSibling; 135 } 136 } else { 137 img.src = param.f_url; 138 } 198 199 var img = image; 200 201 if (!img) 202 { 203 var sel = editor._getSelection(); 204 var range = editor._createRange(sel); 205 206 ddt._ddt( "image-manager.js","206", "_insertImage(): execing insertImage" ); 207 208 editor._doc.execCommand("insertimage", false, param.f_url); 209 210 if (HTMLArea.is_ie) 211 { 212 img = range.parentElement(); 213 214 // wonder if this works... 215 216 if (img.tagName.toLowerCase() != "img") 217 { 218 img = img.previousSibling; 219 } 220 } 221 else 222 { 223 img = range.startContainer.previousSibling; 224 } 225 } 226 else 227 { 228 img.src = param.f_url; 229 } 139 230 140 for (field in param) { 141 var value = param[field]; 142 switch (field) { 143 case "f_alt" : img.alt = value; break; 144 case "f_border" : img.border = parseInt(value || "0"); break; 145 case "f_align" : img.align = value; break; 146 case "f_vert" : img.vspace = parseInt(value || "0"); break; 147 case "f_horiz" : img.hspace = parseInt(value || "0"); break; 148 case "f_width" : img.width = parseInt(value || "0"); break; 149 case "f_height" : img.height = parseInt(value || "0"); break; 150 } 151 } 152 153 154 }, outparam); 155 }; 156 157 231 for (field in param) 232 { 233 var value = param[field]; 234 235 switch (field) 236 { 237 case "f_alt" : img.alt = value; break; 238 case "f_border" : img.border = parseInt(value || "0"); break; 239 case "f_align" : img.align = value; break; 240 case "f_vert" : img.vspace = parseInt(value || "0"); break; 241 case "f_horiz" : img.hspace = parseInt(value || "0"); break; 242 case "f_width" : img.width = parseInt(value || "0"); break; 243 case "f_height" : img.height = parseInt(value || "0"); break; 244 } 245 } 246 247 ddt._ddt( "image-manager.js","247", "end of Dialog() parm function" ); 248 249 }, outparam, editor); // end of Dialog() parm. 250 251 }; // end of _insertImage(); 252 253 // END -
branches/unified_backend/plugins/ImageManager/images.php
r60 r121 8 8 9 9 require_once('config.inc.php'); 10 require_once( 'ddt.php');10 require_once(XINHA_INSTALL_ROOT . '/ddt/ddt.php'); 11 11 require_once('Classes/ImageManager.php'); 12 12 … … 42 42 $manager = new ImageManager($IMConfig); 43 43 44 45 44 //get the list of files and directories 46 45 $list = $manager->getFiles($relative); 47 48 46 49 47 /* ================= OUTPUT/DRAW FUNCTIONS ======================= */ … … 62 60 <td> 63 61 64 <? _ddt( __FILE__, __LINE__, "drawFiles(): relative is '" . $file['relative'] . "' thumbnail '" . $manager->getThumbnail($file['relative']) . "'" ); ?>62 <?php _ddt( __FILE__, __LINE__, "drawFiles(): relative is '" . $file['relative'] . "' thumbnail '" . $manager->getThumbnail($file['relative']) . "'" ); ?> 65 63 66 64 <table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> 67 65 68 <a href="javascript:;" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);"title="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"><img src="<? print $manager->getThumbnail($file['relative']); ?>" alt="<? echo $entry; ?> - <?echo Files::formatSize($file['stat']['size']); ?>"/></a>66 <a href="javascript:;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php print $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a> 69 67 </td></tr><tr><td class="edit"> 70 <a href="<? print $IMConfig['backend_url']; ?>__function=images&dir=<? echo $relative; ?>&delf=<? echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="<?print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>71 <? if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>68 <a href="<?php echo $IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 69 <?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> 72 70 </td></tr></table></td> 73 <? 71 <?php 74 72 }//foreach