[OFBiz] SVN: r7080 - in trunk/specialized/opentravelsystem/webapp/hotelbackend: WEB-INF html includes screens

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Mon Mar 27 02:33:49 CST 2006


Author: hansbak
Date: 2006-03-27 02:33:20 -0600 (Mon, 27 Mar 2006)
New Revision: 7080

Modified:
   trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/html/whizzywig.js
   trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/appbar.ftl
   trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/header.ftl
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml
Log:
OTS: added possibility to edit webpages with the new HTML editor

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -155,16 +155,26 @@
         <response name="error" type="view" value="help"/>
     </request-map>
     
+    <request-map uri="editHelpPage">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="EditHelpText"/>
+    </request-map>
+
     <request-map uri="editPage">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditElectronicText"/>
-        <response name="error" type="view" value="EditElectronicText"/>
     </request-map>
-
+    
+    <request-map uri="updateHelpText">
+        <security auth="true" https="true"/>
+        <event invoke="updateElectronicText" type="service"/>
+        <response name="success" type="view" value="help"/>
+        <response name="error" type="view" value="EditHelpText"/>
+    </request-map>
     <request-map uri="updateElectronicText">
         <security auth="true" https="true"/>
         <event invoke="updateElectronicText" type="service"/>
-        <response name="success" type="view" value="help"/>
+        <response name="success" type="view" value="EditElectronicText"/>
         <response name="error" type="view" value="EditElectronicText"/>
     </request-map>
     
@@ -3017,6 +3027,13 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ViewGlReconciliation"/>
     </request-map>
+    
+    <!-- electronic text -->
+    <request-map uri="findElectronicTexts">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="findElectronicTexts"/>
+    </request-map>
+    
 
     <!-- pdf processes  -->
     <request-map uri="invoice.pdf">
@@ -3040,6 +3057,7 @@
     <view-map name="noAccess" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml#noAccess"/>
     <view-map name="login" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml#login"/>
     <view-map name="help" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml#help"/>
+    <view-map name="EditHelpText"  page="component://opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml#EditHelpText" type="screen"/>
     <view-map name="EditElectronicText"  page="component://opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml#EditElectronicText" type="screen"/>
     <view-map name="EditSecurityGroupUserLogins" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml#EditSecurityGroupUserLogins"/>
     <!-- Accounting screens-->
@@ -3237,6 +3255,8 @@
     <view-map name="ReconcileAccounts" type="screen" page="component://accounting/widget/AccountingScreens.xml#ReconcileAccounts"/>
     <view-map name="ViewGlAccountBalance" type="screen" page="component://accounting/widget/AccountingScreens.xml#ViewGlAccountBalance"/>
     <view-map name="ViewGlReconciliation" type="screen" page="component://accounting/widget/AccountingScreens.xml#ViewGlReconciliation"/>
+    <!-- electronic texts -->
+    <view-map name="findElectronicTexts" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml#findElectronicTexts"/>
     <!-- PDFs  -->
     <view-map name="InvoicePDF" type="screenfop" page="component://accounting/widget/AccountingPrintForms.xml#InvoicePDF" content-type="application/pdf" encoding="none"/>
     

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/html/whizzywig.js
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/html/whizzywig.js	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/html/whizzywig.js	2006-03-27 08:33:20 UTC (rev 7080)
@@ -1,21 +1,21 @@
-var whizzywig_version = 'Whizzywig v50'; 
-//Copyright � 2005, John Goodman - john.goodman(at)unverse.net  *date 060201
-//This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-//This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-//A copy of the GNU General Public License can be obtained at: http://www.gnu.org/licenses/gpl.html
-//CONFIG VARIABLES (please set outside script)
+var whizzywig_version = 'Whizzywig v50k'; // Office XML; x <code>; sync on clean; extend sels,buts[ ]; whizzy in table/div; monospace; cols ex; MIT license;x Enter on forms;http/mailto; no font for color; gentleClean true; IE anchor bug; designmode x-browser; x 404 text buts;
+//Copyright  2005, John Goodman - john.goodman(at)unverse.net  *date 060323
+//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
 var buttonPath;  //path to toolbar button images;  unset or "textbuttons" means don't use images
 var cssFile;     //url of CSS stylesheet to attach to edit area
 var imageBrowse; //path to page for image browser
 var linkBrowse;  //path to page for link browser
 var idTa;        //id of the textarea to whizzywig (param to makeWhizzyWig)
-var gentleClean;  //if true, cleanUp removes spans, inline styles and classes
+var gentleClean = true;  //if true, cleanUp preserves spans, inline styles and classes
 //OTHER GLOBALS
-var oWhizzy; //object of Whizzy
-var rng;  //range at current selection
-var sel;  //current selection
-var papa; //parent of current selection IE only
-var trail = ''; //DOM tree path IE only
+var oW, sel, rng, papa, trail ; //object of Whizzy,  current sel, range, parent, DOM path (IE)
+var sels = '';
+var buts = ''; 
+var vals = new Array();
+var opts = new Array();
+var dobut = new Array();
 
 function makeWhizzyWig(txtArea, controls){ // make a WhizzyWig from the textarea
  if ((navigator.userAgent.indexOf('Safari') != -1 ) || !document.getElementById || !document.designMode ) {//no designMode
@@ -24,48 +24,48 @@
  }
  idTa = txtArea;
  var taContent = o(idTa).defaultValue ? o(idTa).defaultValue : o(idTa).innerHTML ? o(idTa).innerHTML: ''; //anything in the textarea?
- taWidth = o(idTa).style.width ? o(idTa).style.width : o(idTa).cols + "em";  //grab the width and...
+ taWidth = o(idTa).style.width ? o(idTa).style.width : o(idTa).cols + "ex";  //grab the width and...
  taHeight = o(idTa).style.height ? o(idTa).style.height : o(idTa).rows + "em";  //...height from the textarea
  o(idTa).style.color = '#060';
  o(idTa).style.zIndex = '2';
- if (!o(idTa).rows) o(idTa).rows='15';//IE won't use %
+ if (!o(idTa).rows) o(idTa).rows='15';//IE won't use % from style
  h(idTa);
- var frm=document.EditElectronicText;
+ var frm=o(idTa).parentNode;
+ while (frm.nodeName != 'FORM') frm=frm.parentNode;//if not form, keep trying
  if (frm.addEventListener) frm.addEventListener("submit", syncTextarea, false);
   else frm.attachEvent("onsubmit", syncTextarea);
-
  w('<style type="text/css">button {vertical-align:middle;padding:0;margin:1px 0} button img{vertical-align:middle;margin:-1px} select{vertical-align:middle;margin:1px}  .ctrl {background:ButtonFace; border:2px outset ButtonShadow; padding:5px;width:'+taWidth+'} #sourceTa{color:#060;font-family:mono;}</style>');
- var sels = 'formatblock fontname fontsize';
- var buts = ' bold italic underline | left center right | number bullet indent outdent | undo redo  | color hilite rule | link image table | clean html spellcheck';
+ sels += 'fontname fontsize formatblock';
+ buts += ' bold italic underline | left center right | number bullet indent outdent | undo redo  | color hilite rule | link image table | clean html spellcheck ';
  var tbuts = ' tstart add_row_above add_row_below delete_row | add_column_before add_column_after delete_column | table_in_cell';
  var t_end = ''; //table controls end, if needed
  buts += tbuts;
  controls = controls.toLowerCase();
- if (!controls || controls == "all") controls = sels +' newline '+ buts +' source';
+ if (!controls || controls == "all")  controls = sels +' newline '+ buts;
  else controls += tbuts;
- w('<div id="CONTROLS" class="ctrl">');
+ w('<div id="CONTROLS" class="ctrl" unselectable="on">');
  gizmos = controls.split(' ');
  for (var i = 0; i < gizmos.length; i++) {
-   if (gizmos[i]){ //make buttons and selects for toolbar, in order requested
-      if (gizmos[i] == 'tstart') {
-        w('<div id="TABLE_CONTROLS" style="display:none" unselectable="on">');
-        t_end = '</div>';
-      }
-      else if (gizmos[i] == '|') w(' <big style="padding-bottom:2em">|</big> ');
-      else if (gizmos[i] == 'newline') w('<br>');
-    else if (sels.indexOf(gizmos[i]) != -1) makeSelect(gizmos[i])
-    else if (buts.indexOf(gizmos[i]) != -1) makeButton(gizmos[i]);
+  if (gizmos[i]){ //make buttons and selects for toolbar, in order requested
+   if (gizmos[i] == 'tstart') {
+    w('<div id="TABLE_CONTROLS" style="display:none" unselectable="on">');
+    t_end = '</div>';
    }
+   else if (gizmos[i] == '|') w('&nbsp;<big style="padding-bottom:2em">|</big>&nbsp;');
+   else if (gizmos[i] == 'newline') w('<br>');
+   else if (sels.indexOf(gizmos[i]) != -1) makeSelect(gizmos[i])
+   else if (buts.indexOf(gizmos[i]) != -1) makeButton(gizmos[i]);
+  }
  }
  w(t_end) //table controls end
  w(fGo('LINK'));
  if (linkBrowse) w('<input type="button" onclick=doWin("'+linkBrowse+'"); value="'+t("Browse")+'"> ');
- w(t('Link address (URL)')+': <input type="text" id="lf_url" size="60"><br><input type="checkbox" id="lf_new">'+t("Open link in new window")+fNo(t("OK"),"insertLink()")+'</div>');//LINK_FORM end
+ w(t('Link address (URL)')+': <input type="text" id="lf_url" size="60"><br><input type="button" value="http://" onclick="o(\'lf_url\').value=\'http://\'+o(\'lf_url\').value"> <input type="button" value="mailto:" onclick="o(\'lf_url\').value=\'mailto:\'+o(\'lf_url\').value"><input type="checkbox" id="lf_new">'+t("Open link in new window")+fNo(t("OK"),"insertLink()"));//LINK_FORM end
  w(fGo('IMAGE'));
  if (imageBrowse) w('<input type="button" onclick=doWin("'+imageBrowse+'"); value="'+t("Browse")+'"> ');
- w(t('Image address (URL)')+': <input type="text" id="if_url" size="50"> <label title='+t("to display if image unavailable")+'><br>'+t("Alternate text")+':<input id="if_alt" type="text" size="50"></label><br>'+t("Align")+':<select id="if_side"><option value="none">'+t("normal")+'</option><option value="left">'+t("left")+'</option><option value="right">'+t("right")+'</option></select> '+t("Border")+':<input type="text" id="if_border" size="20" value="none" title="'+t("number or CSS e.g. 3px maroon outset")+'"> '+t("Margin")+':<input type="text" id="if_margin" size="20" value="0" title="'+t("number or CSS e.g. 5px 1em")+'">'+fNo(t("Insert Image"),"insertImage()")+'</div>');//IMAGE_FORM end
+ w(t('Image address (URL)')+': <input type="text" id="if_url" size="50"> <label title='+t("to display if image unavailable")+'><br>'+t("Alternate text")+':<input id="if_alt" type="text" size="50"></label><br>'+t("Align")+':<select id="if_side"><option value="none">'+t("normal")+'</option><option value="left">'+t("left")+'</option><option value="right">'+t("right")+'</option></select> '+t("Border")+':<input type="text" id="if_border" size="20" value="none" title="'+t("number or CSS e.g. 3px maroon outset")+'"> '+t("Margin")+':<input type="text" id="if_margin" size="20" value="0" title="'+t("number or CSS e.g. 5px 1em")+'">'+fNo(t("Insert Image"),"insertImage()"));//IMAGE_FORM end
  w(fGo('TABLE')+t("Rows")+':<input type="text" id="tf_rows" size="2" value="3"> <select id="tf_head"><option value="0">'+t("No header row")+'</option><option value="1">'+t("Include header row")+'</option></select> '+t("Columns")+':<input type="text" id="tf_cols" size="2" value="3"> '+t("Border width")+':<input type="text" id="tf_border" size="2" value="1"> '+fNo(t("Insert Table"),"makeTable()")+'</div>');//TABLE_FORM end
- w(fGo('COLOR')+'<input type="hidden" id="cf_cmd"><div style="background:#000;padding:1px;height:22px;width:125px;float:left"><div id="cPrvw" style="background-color:red; height:100%; width:100%"></div></div> <input type=text id="cf_color" value="red" size=17 onpaste=vC(value) onblur=vC(value)> <button type="button" onmouseover=vC() onclick=sC()>'+t("OK")+'</button>  <button type="button" onclick="hideDialogs();">'+t("Cancel")+' </button><br> '+t("click below or enter a")+' <a href="http://www.unverse.net/colortable.htm" target="_blank">'+t("color name")+'</a><br clear=all> <table border=0 cellspacing=1 cellpadding=0 width=480 bgcolor="#000000">');
+ w(fGo('COLOR')+'<input type="hidden" id="cf_cmd"><div style="background:#000;padding:1px;height:22px;width:125px;float:left"><div id="cPrvw" style="background-color:red; height:100%; width:100%"></div></div> <input type=text id="cf_color" value="red" size=17 onpaste=vC(value) onblur=vC(value)> <input type="button" onmouseover=vC() onclick=sC() value="'+t("OK")+'">  <input type="button" onclick="hideDialogs();" value="'+t("Cancel")+'"><br> '+t("click below or enter a")+' <a href="http://www.unverse.net/colortable.htm" target="_blank">'+t("color name")+'</a><br clear=all> <table border=0 cellspacing=1 cellpadding=0 width=480 bgcolor="#000000">');
  var wC = new Array("00","33","66","99","CC","FF")  //color table
  for (i=0; i<wC.length; i++){
   w("<tr>");
@@ -79,7 +79,7 @@
  }
  w('</table></div>'); //end color table,COLOR_FORM
  w('</div>'); //controls end
- w('<div class="ctrl" id="showWYSIWYG" style="display:none"><button type="button" onclick="showDesign();">'+t("Hide HTML")+'</button></div>');
+ w('<div class="ctrl" id="showWYSIWYG" style="display:none"><input type="button" onclick="showDesign();" value="'+t("Hide HTML")+'"></div>');
  
  w('<iframe style="width:'+taWidth+';height:'+taHeight+'" src="javascript:;" id="whizzyWig"></iframe><br>');
 
@@ -94,52 +94,53 @@
  startHTML += tidyD(taContent);
  startHTML += "</body>\n";
  startHTML += "</html>";
- if (document.frames) { //IE
-  oWhizzy = frames['whizzyWig'];
- } else { //Moz
-  oWhizzy = o("whizzyWig").contentWindow;
-  try {
-    o("whizzyWig").contentDocument.designMode = "on";
-  } catch (e) { //not set? try again
-    setTimeout('o("whizzyWig").contentDocument.designMode = "on";', 100);
-  }
-  oWhizzy.addEventListener("keypress", kb_handler, true); //make keyboard shortcuts work for Moz
+ oW = o("whizzyWig").contentWindow;
+ try {
+	 oW.document.designMode = "on";
+ } catch (e) { //not set? try again
+  setTimeout('oW.designMode = "on";', 100);
  }
- oWhizzy.document.open();
- oWhizzy.document.write(startHTML);
- oWhizzy.document.close();
- if (document.frames) oWhizzy.document.designMode = "On";
- oWhizzy.focus();
+ if (oW.addEventListener)oW.addEventListener("keypress", kb_handler, true); //keyboard shortcuts for Moz
+ oW.document.open();
+ oW.document.write(startHTML);
+ oW.document.close();
+ if (document.frames) oW.document.designMode = "On";
+ oW.focus();
  whereAmI();
 } //end makeWhizzyWig
 
 
-function makeButton(button){  // assemble the button requested NEW
+function makeButton(button){  // assemble the button requested
  var ucBut = button.substring(0,1).toUpperCase();
  ucBut += button.substring(1);
  ucBut = t(ucBut.replace(/_/g,' '));
-   var butHTML = '<button type=button onClick=makeSo("'+button+'")><img src="'+buttonPath+button+'.gif"  alt="'+ucBut+'" title="'+ucBut+'" onError="this.parentNode.innerHTML=this.alt") ></button>';
+ if (!buttonPath || buttonPath == "textbuttons")
+  var butHTML = '<button type=button onClick=makeSo("'+button+'")>'+ucBut+'</button>';
+ else var butHTML = '<button type=button onClick=makeSo("'+button+'")><img src="'+buttonPath+button+'.gif"  alt="'+ucBut+'" title="'+ucBut+'" onError="this.parentNode.innerHTML=this.alt"></button>';
  w(butHTML);
 }
 
-function fGo(id){ return '<div id="'+id+'_FORM" style="display:none"><hr> '; }//new form
+function fGo(id){ return '<div id="'+id+'_FORM" style="display:none" onkeypress="if(event.keyCode==13) return false;"><hr> '; }//new form
 
 function fNo(txt,go){ //form do it/cancel buttons
- return ' <input type="button" onclick="'+go+'" value="'+txt+'"> <input type="button" onclick="hideDialogs();" value='+t("Cancel")+'>';
+ return ' <input type="button" onclick="'+go+'" value="'+txt+'"> <input type="button" onclick="hideDialogs();" value='+t("Cancel")+'></div>';
 }
 
 function makeSelect(select){ // assemble the <select> requested
  if (select == 'formatblock') {
   var h = "Heading";
- var values = ["<p>", "<p>", "<h1>", "<h2>", "<h3>", "<h4>", "<h5>", "<h6>", "<address>", "insHTML<big>",  "insHTML<small>", "insHTML<code>", "<pre>"];
- var options = [t("Choose style")+":", t("Paragraph"), t(h)+" 1 ", t(h)+" 2 ", t(h)+" 3 ", t(h)+" 4 ", t(h)+" 5 ", t(h)+" 6", t("Address"), t("Big"), t("Small"), t("Computer code"), t("Fixed width<pre>")];
+ var values = ["<p>", "<p>", "<h1>", "<h2>", "<h3>", "<h4>", "<h5>", "<h6>", "<address>",  "<pre>"];
+ var options = [t("Choose style")+":", t("Paragraph"), t(h)+" 1 ", t(h)+" 2 ", t(h)+" 3 ", t(h)+" 4 ", t(h)+" 5 ", t(h)+" 6", t("Address"), t("Fixed width<pre>")];
  } else if (select == 'fontname') {
- var values = ["Verdana, Arial, Helvetica, sans-serif", "Arial, Helvetica, sans-serif", "Comic Sans MS, fantasy", "Courier New, Courier, mono", "Georgia, serif", "Times New Roman, Times, serif", "Verdana, Arial, Helvetica, sans-serif"];
+ var values = ["Verdana, Arial, Helvetica, sans-serif", "Arial, Helvetica, sans-serif", "Comic Sans MS, fantasy", "Courier New, Courier, monospace", "Georgia, serif", "Times New Roman, Times, serif", "Verdana, Arial, Helvetica, sans-serif"];
  var options = [t("Font")+":", "Arial", "Comic", "Courier New", "Georgia", "Times New Roman", "Verdana"];
  } else if (select == 'fontsize') {
   var values = ["3", "1", "2", "3", "4", "5", "6", "7"];
   var options = [t("Font size")+":", "1 "+t("Small"), "2", "3", "4", "5", "6", "7 "+t("Big")];
- } else { return }
+ } else { 
+	 var values = vals[select];
+	 var options = opts[select];
+	}
  w('<select id="' + select + '" onchange="doSelect(this.id);">');
  for (var i = 0; i < values.length; i++) {
   w('<option value="' + values[i] + '">' + options[i] + '</option>');
@@ -150,7 +151,7 @@
 function makeSo(command, option) {  //format selected text or line in the whizzy
  whereAmI();
  hideDialogs();
- if (!document.all) oWhizzy.document.execCommand('useCSS',false, true); //no spans for bold, italic
+ if (!document.all) oW.document.execCommand('useCSS',false, true); //no spans for bold, italic
  if ("leftrightcenterjustify".indexOf(command) !=-1) command = "justify" + command;
  else if (command == "number") command = "insertorderedlist";
  else if (command == "bullet") command = "insertunorderedlist";
@@ -171,24 +172,23 @@
   case "table_in_cell" : hideDialogs(); s('TABLE_FORM'); break;
   case "clean" : cleanUp(); break;
   case "spellcheck" : spellCheck(); break;
-  default: oWhizzy.document.execCommand(command, false, option);
+  default: oW.document.execCommand(command, false, option);
  }
- oWhizzy.focus;
+ oW.focus;
 }
 
 function doSelect(selectname) {  //select on toolbar used - do it
  whereAmI();
  var idx = o(selectname).selectedIndex;
  var selected = o(selectname).options[idx].value;
-
- if ((selected.indexOf('insHTML') === 0)) {
-  if (textSel()) insHTML(selected.replace(/insHTML/,''));
+ if (" _formatblock_fontname_fontsize".indexOf('_'+selectname) > 0) {
+  var cmd = selectname;
+  oW.document.execCommand(cmd, false, selected);
  } else {
- var cmd = selectname;
- oWhizzy.document.execCommand(cmd, false, selected);
- }
+  insHTML(selected);//insHTML(selected.replace(/insHTML/,''));
+ }  
  o(selectname).selectedIndex = 0;
- oWhizzy.focus();
+ oW.focus();
 }
 
 function vC(colour) { // view Colour
@@ -202,9 +202,9 @@
  var cmd = o('cf_cmd').value;
  if  (!color) color = o('cf_color').value;
  if (document.selection) rng.select(); //else IE gets lost
- if ((cmd == "backcolor") && (!document.all)) insHTML('<span style="background-color:'+color+'">');
- else oWhizzy.document.execCommand(cmd, false, color);
- oWhizzy.focus();
+ if (cmd == "backcolor")  insHTML('<span style="background-color:'+color+'">');
+ else insHTML('<span style="color:'+color+'">');
+ oW.focus();
 }
 
 function insertLink(URL) {
@@ -212,9 +212,10 @@
  if (!URL) URL = o("lf_url").value;
  cmd = URL ? "createlink" : "unlink";
  if (document.selection) rng.select(); //else IE gets lost
- if (URL && o("lf_new").checked) insHTML('<a href="'+URL+'" target="_blank">');
- else oWhizzy.document.execCommand(cmd, false, URL);
- oWhizzy.focus();
+ var tgt = "";
+ if (o("lf_new").checked) tgt= 'target="_blank"';
+ if (URL) insHTML('<a href="'+URL+'" '+tgt+'>');
+ oW.focus();
 }
 
 function insertImage(URL, side, border, margin, alt) { // insert image as specified
@@ -321,29 +322,23 @@
 }
 
 function cleanUp(){  //clean up crud inserted by Micro$oft Orifice
- oWhizzy.document.execCommand("removeformat",false,null);
+ oW.document.execCommand("removeformat",false,null);
  whereAmI();
- var h = oWhizzy.document.body.innerHTML;
+ var h = oW.document.body.innerHTML;
  if (!gentleClean) {
-	h = h.replace(/<\/?SPAN[^>]*>/gi, "");
-	h = h.replace(/<\/?DEL[^>]*>/gi, "");
-	h = h.replace(/<\/?INS[^>]*>/gi, "");
-  h = h.replace(/ CLASS=\"?[^\"]*\"?/gi, "");
-  h = h.replace(/ STYLE=\"?[^\"]*\"?/gi, "");
+	h = h.replace(/<\/?(SPAN|DEL|INS|DIR)[^>]*>/gi, "");
+  h = h.replace(/\b(CLASS|STYLE)=\"?[^\"]*\"?/gi, "");
  }
- h = h.replace(/<\/?PMARGIN[^>]*>/gi, "");
- h = h.replace(/<\/?DIR>/gi, "");
- h = h.replace(/<\/?FONT[^>]*>/gi, "");
- h = h.replace(/ class=\"?Mso[A-Za-z]*\"?/gi, "");
- h = h.replace(/<\/?o:[^>]*>/gi, "");
- h = h.replace(/<\/?st1:[^>]*>/gi, "");
- h = h.replace(/�/g,'-'); //long -
- h = h.replace(/[��]/g, "'"); //single smartquotes �� 
- h = h.replace(/[��]/g, '"'); //double smartquotes ��
+ h = h.replace(/<\/?(FONT|SHAPE|V:|O:|F:|F |PATH|LOCK|IMAGEDATA|STROKE|FORMULAS)[^>]*>/gi, "");
+ h = h.replace(/\bCLASS=\"?MSO\w*\"?/gi, "");
+// h = h.replace(//g,'-'); //long -
+ h = h.replace(/[]/g, "'"); //single smartquotes  
+ h = h.replace(/[]/g, '"'); //double smartquotes 
  h = h.replace(/align="?justify"?/gi, ""); //justify sends some browsers mad
  h = h.replace(/<(TABLE|TD)(.*)WIDTH[^A-Za-z>]*/gi, "<$1$2"); //no fixed width tables
- h = h.replace(/<([^>]+)><\/\1>/gi, ""); //empty tag
- oWhizzy.document.body.innerHTML = h;
+ h = h.replace(/<([^>]+)>\s*<\/\1>/gi, ""); //empty tag
+ oW.document.body.innerHTML = h;
+ syncTextarea();
 }
 
 function hideDialogs() {
@@ -355,17 +350,17 @@
 }
 
 function showDesign() {
- oWhizzy.document.body.innerHTML = tidyD(o(idTa).value);
+ oW.document.body.innerHTML = tidyD(o(idTa).value);
  h(idTa);
  h('showWYSIWYG');
  s('CONTROLS');
  s('whizzyWig');
  if(o("whizzyWig").contentDocument) o("whizzyWig").contentDocument.designMode = "on"; //FF loses it on hide
- oWhizzy.focus();
+ oW.focus();
 }
 
 function showHTML() { 
- var t = (window.get_xhtml) ? get_xhtml(oWhizzy.document.body) : oWhizzy.document.body.innerHTML;
+ var t = (window.get_xhtml) ? get_xhtml(oW.document.body) : oW.document.body.innerHTML;
  o(idTa).value = tidyH(t);
  h('CONTROLS');
  h('whizzyWig');
@@ -375,22 +370,26 @@
 }
 
 function syncTextarea() { //tidy up before we go-go
- var b = oWhizzy.document.body;
+ var b = oW.document.body;
  if (o(idTa).style.display == 'block') b.innerHTML = o(idTa).value;
  b.innerHTML = tidyH(b.innerHTML);
  o(idTa).value = (window.get_xhtml) ? get_xhtml(b) : b.innerHTML;
 }
 
 function tidyD(h){ //FF designmode likes <B>,<I>...
- h = h.replace(/<(\/?)strong>/gi, "<$1B>"); 
- h = h.replace(/<(\/?)em>/gi, "<$1I>");
+ h = h.replace(/<(\/?)strong([^>]*)>/gi, "<$1B$2>"); 
+ h = h.replace(/<(\/?)em([^>]*)>/gi, "<$1I$2>");
  return h;
 }
 
 function tidyH(h){ //...but <B>,<I> deprecated
- h = h.replace(/<([A-Za-z1-6]+)><\/\1>/g, ""); //empty tag
+ h = h.replace(/<([^>]+)>\s*<\/\1>/gi, ""); //empty tag
  h = h.replace(/(<\/?)[Bb]>/g, "$1strong>");
  h = h.replace(/(<\/?)[Ii]>/g, "$1em>");
+ h = h.replace(/(<\/?)[Bb](\s+[^>]*)>/g, "$1strong$2>");
+ h = h.replace(/(<\/?)[Ii](\s+[^>]*)>/g, "$1em$2>");
+ var me = 'href="'+location.href+'#'; //IE anchor bug
+ h = h.replace(me,'href="#');
  return h;
 }
 
@@ -415,18 +414,22 @@
 }
 
 function insHTML(html) { // insert arbitrary HTML at current selection
+if (html.indexOf('js:') == 0) {
+  eval(html.replace(/^js:/,''));
+  return;
+}
 whereAmI();
  if (!html) html = prompt("Enter some HTML to insert:", "");
  if (!html) return;
  if (document.selection) {
   rng.select(); //else IE gets lost
   html = html + rng.htmlText;
-  try { oWhizzy.document.selection.createRange().pasteHTML(html); } //
+  try { oW.document.selection.createRange().pasteHTML(html); } //
   catch (e) { }// catch error if range is bad for IE
  } else { //Moz
   if (sel) html = html + sel;
-  var fragment = oWhizzy.document.createDocumentFragment();
-  var div = oWhizzy.document.createElement("div");
+  var fragment = oW.document.createDocumentFragment();
+  var div = oW.document.createElement("div");
   div.innerHTML = html;
   while (div.firstChild) {
    fragment.appendChild(div.firstChild);
@@ -455,13 +458,13 @@
   }
   sel.addRange(rng);
  }
- oWhizzy.focus();
+ oW.focus();
 }
 
 function whereAmI() {//get current selected range if available 
- oWhizzy.focus();
+ oW.focus();
  if (document.all) { //IE
-  sel = oWhizzy.document.selection;
+  sel = oW.document.selection;
   if (sel != null) {
    rng = sel.createRange();
    switch (sel.type) {
@@ -481,7 +484,7 @@
    window.status = trail;
   }
  } else { //Moz
-  sel = oWhizzy.getSelection();
+  sel = oW.getSelection();
   if (sel != null) rng = sel.getRangeAt(sel.rangeCount - 1).cloneRange();
  }
 }

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/appbar.ftl
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/appbar.ftl	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/appbar.ftl	2006-03-27 08:33:20 UTC (rev 7080)
@@ -39,7 +39,7 @@
 		,{"title":"OrdersReservations",	"url":"findorders"}
 		,{"title":"Parties",			"url":"findParties?statusId=PARTYREL-ACTIVE"}
 		,{"title":"Accounting",			"url":"mainAccounting"}
-		,{"title":"Website", 			"url":"/${parameters.userLogin.partyId}"}
+		,{"title":"Website", 			"url":"findElectronicTexts"}
 		,{"title":"Logout", 			"url":"logout"}
 		]>
 <#else>
@@ -67,7 +67,7 @@
 	            <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	              <tr>
 	                <td class="${class.left}"><a href="<@ofbizUrl>${display.url}</@ofbizUrl>" title="" class="${class.link}"><img src="<@ofbizContentUrl>/images/spacer.gif</@ofbizContentUrl>" alt="" width="10" height="15" border="0"></a></td>
-	                <td nowrap="nowrap" class="${class.center}"><a href=<#if display.title == "Website">"${display.url}" target="newwindow"<#else>"<@ofbizUrl>${display.url}</@ofbizUrl>"</#if> title="" class="${class.link}">${"uiLabelMap.opentravelsystem${display.title}"?eval}</a></td>
+	                <td nowrap="nowrap" class="${class.center}"><a href="<@ofbizUrl>${display.url}</@ofbizUrl>" title="" class="${class.link}">${"uiLabelMap.opentravelsystem${display.title}"?eval}</a></td>
 	                <td class="${class.right}"><a href="<@ofbizUrl>${display.url}</@ofbizUrl>" title="" class="${class.link}"><img src="<@ofbizContentUrl>/images/spacer.gif</@ofbizContentUrl>"alt="" width="10" height="15" border="0"></a></td></tr>
 				  <#if thisAppOpt != display.title>
 	                <tr><td colspan="3" class="blackarea"><img src="<@ofbizContentUrl>/images/spacer.gif</@ofbizContentUrl>" alt="" height="1"></td></tr>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/header.ftl
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/header.ftl	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/includes/header.ftl	2006-03-27 08:33:20 UTC (rev 7080)
@@ -39,7 +39,6 @@
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <title>${layoutSettings.companyName?if_exists}: <#if (page.titleProperty)?has_content>${uiLabelMap[page.titleProperty]}<#else>${(page.title)?if_exists}</#if></title>
     <script language='javascript' src='<@ofbizContentUrl>/images/calendar1.js</@ofbizContentUrl>' type='text/javascript'></script>
-    <script language='javascript' src='<@ofbizContentUrl>/images/calendar1.js</@ofbizContentUrl>' type='text/javascript'></script>
     <script language='javascript' src='<@ofbizContentUrl>/images/selectall.js</@ofbizContentUrl>' type='text/javascript'></script>
     <script language="javascript" src="<@ofbizContentUrl>/images/fieldlookup.js</@ofbizContentUrl>" type="text/javascript"></script>
     <link rel='stylesheet' href='<@ofbizContentUrl>/images/maincss.css</@ofbizContentUrl>' type='text/css'>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -105,7 +105,34 @@
             </widgets>
         </section>
     </screen>
-
+    <screen name="WebsiteDecorator">
+        <section>
+            <actions>
+                <set field="page.appTabButtonItem" value="Website"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator">
+                    <decorator-section name="body">
+                        
+                        <container style="centerarea">
+                            <label style="apptitle" text="Website text pages."/>
+                            <include-menu location="component://opentravelsystem/webapp/hotelbackend/screens/Menus.xml" name="WebsiteAppBar"/>
+                            <container style="contentarea">
+                                <container style="${MainColumnStyle}">
+                                    <platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
+                                    <decorator-section-include name="body"/>
+                                </container>
+                                <container style="endcolumns"><label text="&amp;nbsp;"/></container>
+                                <!--/container-->
+                            </container>
+                        </container>
+                        
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    
     <screen name="CommonPartyDecorator">
         <section>
             <condition>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -37,17 +37,51 @@
             </service>
         </actions>
         <auto-fields-service service-name="updateElectronicText"/>
-        <field name="textData" title=" " id-name="textData"><textarea cols="90" rows="38"/></field>
-        <field name=""><display description="&lt;script type=&quot;text/javascript&quot;>makeWhizzyWig(&quot;textData&quot;, &quot;all&quot;);&lt;/script&gt;"/></field>
+        <field name="textData"><textarea cols="90" rows="20" editor="true"/></field>
         <field name="dataResourceId"><hidden/></field>
         <field name="contentId"><hidden/></field>
         <field name="skipPermissionCheck"><hidden/></field>
         <field name="submitButton" title="Update" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    
+    <form name="EditHelpText" 
+        default-title-style="tableheadtext"
+        default-tooltip-style="tabletext"
+        target="updateHelpText" title="" type="single">
+        <actions>
+            <service service-name="getElectronicText">
+                <field-map field-name="contentId" value="${parameters.contentId}"/>
+            </service>
+        </actions>
+        <auto-fields-service service-name="updateElectronicText"/>
+        <field name="textData"><textarea cols="90" rows="20" editor="true"/></field>
+        <field name="dataResourceId"><hidden/></field>
+        <field name="contentId"><hidden/></field>
+        <field name="skipPermissionCheck"><hidden/></field>
+        <field name="submitButton" title="Update" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    
+    
+    <form name="ListElectronicTexts" type="list" separate-columns="true" 
+        title="ElectronicText List"  default-title-style="tableheadtext" list-name="newElectronicTexts" target=""
+        default-widget-style="tabletext" default-tooltip-style="tabletext"
+        paginate-target="findElectronicTexts" list-iterator-name="listIt" default-entity-name="ElectronicText">
+        <actions>
+            <service service-name="performFind" result-map-name="result" result-map-list-iterator-name="listIt">
+                <field-map field-name="inputFields" env-name="parameters"/>
+                <field-map field-name="entityName" value="ElectronicText"/>
+                <field-map field-name="orderBy" value="dataResourceId"/>
+            </service>
+        </actions>
+        <field name="DataResourceId" widget-style="buttontext">
+            <hyperlink description="${dataResourceId}" target="editPage?contentId=${dataResourceId}"/>
+        </field>
+        <field name="dataResourceName"><display-entity entity-name="DataResource" key-field-name="dataResourceId" description="${dataResourceName}"></display-entity></field>
+        <field name="createdStamp" ><display/></field>
+        <field name="lastUpdatedStamp"><display/></field>
+    </form>
+    
  
  
- 
- 
- 
     
 </forms>
\ No newline at end of file

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ContentScreens.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -27,8 +27,30 @@
     <screen name="EditElectronicText">
         <section>
             <actions>
-                <set field="htmlEdit" value="Y"/>
+                <service service-name="getElectronicText" result-map-name="electronicText">
+                    <field-map field-name="contentId" value="${parameters.contentId}"/>
+                </service>
+            </actions>
+            <widgets>
+                <decorator-screen name="WebsiteDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                            <container style="${MainColumnStyle}">
+                                <platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
+                                <include-form name="EditElectronicText" location="component://opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml"/>
+                            </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    
+    <screen name="EditHelpText">
+        <section>
+            <actions>
                 <set field="parameters.popup" value="Y"/>
+                <service service-name="getElectronicText" result-map-name="electronicText">
+                    <field-map field-name="contentId" value="${parameters.contentId}"/>
+                </service>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -36,7 +58,7 @@
                         <container style="contentarea">
                             <container style="${MainColumnStyle}">
                                 <platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
-                                <include-form name="EditElectronicText" location="component://opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml"/>
+                                <include-form name="EditHelpText" location="component://opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml"/>
                             </container>
                         </container>
                     </decorator-section>
@@ -45,5 +67,26 @@
         </section>
     </screen>
     
+    <screen name="findElectronicTexts">
+        <section>
+            <actions>
+                <set field="title" value="Find an Electronic Text"/>
+                <set field="headerItem" value="websites"/>
+                <set field="titleProperty" value="PageTitleFindInvoice"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="WebsiteDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container><label style="head1">List website pages</label></container>
+                        <!--include-form name="FindInvoices" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/>
+                        <container><link target="editInvoice" text="${uiLabelMap.CommonCreateNew} ${uiLabelMap.AccountingInvoice}" style="buttontext"/></container-->
+                        <include-form name="ListElectronicTexts"  location="component://opentravelsystem/webapp/hotelbackend/screens/ContentForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
     
 </screens>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -77,10 +77,17 @@
                         <container style="contentarea">
                             <container style="${MainColumnStyle}">
                                 <!--platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific-->
-                                <link target="javascript:close()" text="close this screen" url-mode="plain"/>
-                                <content content-id="${parameters.contentId}"/>
-                                <link target="editPage?dataResourceId=${parameters.dataResourceId}&amp;contentId=${parameters.contentId}" text="update this help screen"/>
-                                <!--content content-id="helpIndexTemplate"/-->
+                                <!--link style="col-right" target="javascript:close()" text="close this screen" url-mode="plain"/-->
+                                <container style="screenlet">
+                                    <container style="screenlet-header">
+                                        <label style="boxhead" text="Help screen for application: ${parameters.app}, function: ${parameters.function} and tab: ${parameters.tab}"/>
+                                        <link style="submenutext" text="&lt;span align=right&gt;close window&lt;/span&gt;" target="javascript:window.close()"  url-mode="plain"/>
+                                    </container>    
+                                    <container style="screenlet-body">
+                                        <content content-id="${parameters.contentId}"/>
+                                    </container>
+                                </container>
+                                <link target="editHelpPage?dataResourceId=${parameters.dataResourceId}&amp;contentId=${parameters.contentId}" text="update this help screen"/>
                             </container>
                         </container>
                     </decorator-section>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml	2006-03-27 07:47:32 UTC (rev 7079)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml	2006-03-27 08:33:20 UTC (rev 7080)
@@ -24,6 +24,11 @@
 -->
 <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-menu.xsd">
     
+    <menu name="WebsiteAppBar" default-menu-item-name="main" default-selected-style="headerButtonLeftSelected" selected-menuitem-context-field-name="headerItem"
+        default-title-style="tabButton" default-tooltip-style="tabletext" default-widget-style="headerButtonLeft" 
+        default-align-style="col" menu-container-style="row" fill-style="col-fill" orientation="horizontal" type="simple">
+    </menu>
+
     <menu name="PartyAppBar" default-menu-item-name="main" default-selected-style="headerButtonLeftSelected" selected-menuitem-context-field-name="headerItem"
         default-title-style="tabButton" default-tooltip-style="tabletext" default-widget-style="headerButtonLeft" 
         default-align-style="col" menu-container-style="row" fill-style="col-fill" orientation="horizontal" type="simple">



More information about the Svn mailing list