From: mka Date: Thu, 30 May 2013 07:48:27 +0000 (+0000) Subject: Comment's functionality is improved (correct validation, small code refactoring) X-Git-Tag: Delivery_V1_0_2013_07_12~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5ca19ad3a0cae67f7976ab818127623a3b615582;p=tools%2Fsiman.git Comment's functionality is improved (correct validation, small code refactoring) --- diff --git a/Workspace/Siman-Common/src/test/labels.properties b/Workspace/Siman-Common/src/test/labels.properties index 8611df4..e2970a8 100644 --- a/Workspace/Siman-Common/src/test/labels.properties +++ b/Workspace/Siman-Common/src/test/labels.properties @@ -191,6 +191,8 @@ field.context.value = Valeur field.fromStudy = Source study field.fromScenario = Source scenario field.finalStep = Up to the step +field.description = Description value +field.commentTitle = Title of the comment criterion.study = Les études diff --git a/Workspace/Siman-Common/src/test/labels_en.properties b/Workspace/Siman-Common/src/test/labels_en.properties index 1acbfa6..c06256e 100644 --- a/Workspace/Siman-Common/src/test/labels_en.properties +++ b/Workspace/Siman-Common/src/test/labels_en.properties @@ -192,6 +192,8 @@ field.context.value = Value field.fromStudy = Source study field.fromScenario = Source scenario field.finalStep = Up to the step +field.description = Description value +field.commentTitle = Title of the comment criterion.study = All studies diff --git a/Workspace/Siman/WebContent/jsp/commentPane.jsp b/Workspace/Siman/WebContent/jsp/commentPane.jsp index b3360b4..ef18bd5 100644 --- a/Workspace/Siman/WebContent/jsp/commentPane.jsp +++ b/Workspace/Siman/WebContent/jsp/commentPane.jsp @@ -11,6 +11,11 @@ \ No newline at end of file diff --git a/Workspace/Siman/WebContent/jsp/descriptionPane.jsp b/Workspace/Siman/WebContent/jsp/descriptionPane.jsp index 7ec7c31..44bebab 100644 --- a/Workspace/Siman/WebContent/jsp/descriptionPane.jsp +++ b/Workspace/Siman/WebContent/jsp/descriptionPane.jsp @@ -18,7 +18,8 @@ diff --git a/Workspace/Siman/WebContent/jsp/editKnowledge.jsp b/Workspace/Siman/WebContent/jsp/editKnowledge.jsp index 80979a2..78451f5 100644 --- a/Workspace/Siman/WebContent/jsp/editKnowledge.jsp +++ b/Workspace/Siman/WebContent/jsp/editKnowledge.jsp @@ -9,21 +9,6 @@ <%@ page import="org.splat.simer.AbstractOpenObject"%> <%@ page import="org.splat.simer.OpenStudy"%> <%@ page import="org.splat.simer.KnowledgeElementFacade"%> - - - <%! private enum Action { addKnowledge, renameKnowledge, editKnowledge }; %><% @@ -51,13 +36,6 @@ List knowelms = type.getKnowledgeElements(); for (Iterator iterator = knowelms.iterator(); iterator.hasNext(); ) { KnowledgeElementFacade kelm = iterator.next(); - if (kelm.getIndex().equals(typenumber)) { -%> - - - - -<% } %> @@ -97,7 +75,8 @@ if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) { %> <% } else { @@ -121,11 +100,6 @@ } if (todo == Action.addKnowledge && type.getIndex().equals(typenumber)) { %> - - - - - " border="none" title="" /> @@ -133,7 +107,8 @@ diff --git a/Workspace/Siman/WebContent/jsp/readComment.jsp b/Workspace/Siman/WebContent/jsp/readComment.jsp index 1e603c0..e14037a 100644 --- a/Workspace/Siman/WebContent/jsp/readComment.jsp +++ b/Workspace/Siman/WebContent/jsp/readComment.jsp @@ -19,9 +19,11 @@ onmouseover="javascript:_mouseOverContext=true;" onmouseout="javascript:_mouseOverContext=false;"> +
" width=14 height=14 border="none" title=""/> +
diff --git a/Workspace/Siman/WebContent/jsp/readDescription.jsp b/Workspace/Siman/WebContent/jsp/readDescription.jsp index f1beace..deb66ce 100644 --- a/Workspace/Siman/WebContent/jsp/readDescription.jsp +++ b/Workspace/Siman/WebContent/jsp/readDescription.jsp @@ -9,14 +9,12 @@ function showDescriptionEditor() { document.getElementById("descriptionValue").contentDocument.body.innerHTML = document.getElementById("description_value_div").innerHTML; - //document.getElementById("display_description_div").style.display = 'none'; document.getElementById("description_div").style.display = 'none'; document.getElementById("description_editor_div").style.display = 'block'; document.getElementById("descriptionValue").focus(); } function hideDescriptionEditor() { - //document.getElementById("display_description_div").style.display = 'block'; document.getElementById("description_div").style.display = 'block'; document.getElementById("description_editor_div").style.display = 'none'; } @@ -76,4 +74,9 @@ } - \ No newline at end of file + + +
+ +
+
\ No newline at end of file diff --git a/Workspace/Siman/WebContent/rtef/richtext.js b/Workspace/Siman/WebContent/rtef/richtext.js index 3f5671c..b666b5b 100644 --- a/Workspace/Siman/WebContent/rtef/richtext.js +++ b/Workspace/Siman/WebContent/rtef/richtext.js @@ -35,7 +35,7 @@ // Constants var ctxpath = "/siman/"; -var minWidth = 450; // minumum width +var minWidth = 400; // minumum width var wrapWidth = 1245; //width at which all icons will appear on one bar var maxchar = 64000; // maximum number of characters per save var lang = "en"; //xhtml language @@ -269,7 +269,7 @@ function writeRichText(rte, html, css, width, height, buttons, readOnly, fullscr document.writeln(''); insertBar(); if(fullscreen || activeCommand.get("save") != null){ - document.writeln(''); + document.writeln(''); nbcommand += 1; } if(!isSafari && !isKonqueror) { @@ -282,13 +282,11 @@ function writeRichText(rte, html, css, width, height, buttons, readOnly, fullscr // insertImg(lblUnformat,"unformat.gif","rteCommand('"+rte+"','removeformat')"); insertSep(); } - if(isIE || isSafari || isKonqueror) { + if(false) { addCommand("cut","rteCommand('"+rte+"','cut')"); // insertImg(lblCut,"cut.gif","rteCommand('"+rte+"','cut')"); addCommand("copy","rteCommand('"+rte+"','copy')"); // insertImg(lblCopy,"copy.gif","rteCommand('"+rte+"','copy')"); - } - if(isSafari || isKonqueror) { addCommand("paste","rteCommand('"+rte+"','InsertText')"); // insertImg(lblPaste,"paste.gif","rteCommand('"+rte+"','InsertText')"); } @@ -348,16 +346,15 @@ function writeRichText(rte, html, css, width, height, buttons, readOnly, fullscr // insertImg(lblAlgnRight,"right_just.gif","rteCommand('"+rte+"','justifyright')"); addCommand("justifyfull","rteCommand('"+rte+"','justifyfull')"); // insertImg(lblJustifyFull,"justifyfull.gif","rteCommand('"+rte+"','justifyfull')"); - if(!isSafari && !isKonqueror) { + insertSep(); + addCommand("numbered_list","rteCommand('"+rte+"','insertorderedlist')"); +// insertImg(lblOL,"numbered_list.gif","rteCommand('"+rte+"','insertorderedlist')"); + addCommand("list","rteCommand('"+rte+"','insertunorderedlist')"); +// insertImg(lblUL,"list.gif","rteCommand('"+rte+"','insertunorderedlist')"); + addCommand("hyperlink","dlgLaunch('"+rte+"','link')"); +// insertImg(lblInsertLink,"hyperlink.gif","dlgLaunch('"+rte+"','link')"); + if(false) { insertSep(); - addCommand("numbered_list","rteCommand('"+rte+"','insertorderedlist')"); -// insertImg(lblOL,"numbered_list.gif","rteCommand('"+rte+"','insertorderedlist')"); - addCommand("list","rteCommand('"+rte+"','insertunorderedlist')"); -// insertImg(lblUL,"list.gif","rteCommand('"+rte+"','insertunorderedlist')"); - addCommand("outdent","rteCommand('"+rte+"','outdent')"); -// insertImg(lblOutdent,"outdent.gif","rteCommand('"+rte+"','outdent')"); - addCommand("indent","rteCommand('"+rte+"','indent')"); -// insertImg(lblIndent,"indent.gif","rteCommand('"+rte+"','indent')"); insertSep(); addCommand("textcolor","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte); // insertImg(lblTextColor,"textcolor.gif","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte); @@ -369,15 +366,17 @@ function writeRichText(rte, html, css, width, height, buttons, readOnly, fullscr insertSep(); addCommand("special_char","dlgLaunch('"+rte+"','char')"); // insertImg(lblInsertChar,"special_char.gif","dlgLaunch('"+rte+"','char')"); - addCommand("hyperlink","dlgLaunch('"+rte+"','link')"); -// insertImg(lblInsertLink,"hyperlink.gif","dlgLaunch('"+rte+"','link')"); addCommand("image","dlgLaunch('"+rte+"','image')"); // insertImg(lblAddImage,"image.gif","dlgLaunch('"+rte+"','image')"); addCommand("insert_table","dlgLaunch('"+rte+"','table')"); // insertImg(lblInsertTable,"insert_table.gif","dlgLaunch('"+rte+"','table')"); } + addCommand("outdent","rteCommand('"+rte+"','outdent')"); +// insertImg(lblOutdent,"outdent.gif","rteCommand('"+rte+"','outdent')"); + addCommand("indent","rteCommand('"+rte+"','indent')"); +// insertImg(lblIndent,"indent.gif","rteCommand('"+rte+"','indent')"); insertSep(); - if(!isSafari && !isKonqueror) { + if(false) { addCommand("replace","dlgLaunch('"+rte+"','replace')"); // insertImg(lblSearch,"replace.gif","dlgLaunch('"+rte+"','replace')"); } @@ -438,7 +437,7 @@ function insertImg(name, image, command, id){ if(id!=null){ td = ""; } - document.writeln(td+''+name+''); + document.writeln(td+''+name+''); } function enableDesignMode(rte, html, css, readOnly) { @@ -482,7 +481,6 @@ function enableDesignMode(rte, html, css, readOnly) { if(isGecko && !readOnly) { //attach a keyboard handler for gecko browsers to make keyboard shortcuts work oRTE.addEventListener("keypress", geckoKeyPress, true); - oRTE.addEventListener("focus", function (){dlgCleanUp();}, false); } } catch(e) { alert(lblErrorPreload); @@ -491,7 +489,12 @@ function enableDesignMode(rte, html, css, readOnly) { //gecko may take some time to enable design mode. //Keep looping until able to set. if(isGecko){ - setTimeout("enableDesignMode('"+rte+"', '"+html+"', '"+css+"', "+readOnly+");", 200); + if(!timeLeft) { + timeLeft = 5000; + } + if(timeLeft > 0) { + setTimeout("enableDesignMode('"+rte+"', '"+html+"', '"+css+"', "+readOnly+ "','"+(timeLeft-200)+"');", 200); + } }else{ return false; } @@ -818,7 +821,7 @@ function getText(rte) { return rtn; } -function setFormText(popup, content){ +function setFormText(popup, content, timeLeft){ //set link text value in dialog windows if(content != "undefined") { @@ -830,8 +833,13 @@ function setFormText(popup, content){ }catch(e){ //may take some time to create dialog window. //Keep looping until able to set. - setTimeout("setFormText('"+popup+"','" + content + "');", 10); - } + if(!timeLeft) { + timeLeft = 5000; + } + if(timeLeft > 0) { + setTimeout("setFormText('"+popup+"','" + content + "','"+(timeLeft-200)+"');", 200); + } + } } } @@ -1038,14 +1046,18 @@ function setRange(rte){ //function to store range of current selection var oRTE = returnRTE(rte); var selection; - if(document.all){ + if(document.all){ //IE selection = oRTE.document.selection; if(selection != null){ rng = selection.createRange(); } }else{ selection = oRTE.getSelection(); - rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); + if(selection.rangeCount > 0) { + rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); + } else { + rng = oRTE.document.createRange(); + } } return rng; } @@ -1319,3 +1331,17 @@ function checkspell() { } } } + +//***************** +//Validation +//***************** +function enableRTEvalidation(rteName) { + document.getElementById(rteName+'SaveButton').onclick = function(event){ + updateRTEs(); + field = document.getElementById('hdn'+rteName); + if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) { + event.preventDefault(); + } + }; +} + \ No newline at end of file diff --git a/Workspace/Siman/src/labels.properties b/Workspace/Siman/src/labels.properties index 8611df4..e2970a8 100644 --- a/Workspace/Siman/src/labels.properties +++ b/Workspace/Siman/src/labels.properties @@ -191,6 +191,8 @@ field.context.value = Valeur field.fromStudy = Source study field.fromScenario = Source scenario field.finalStep = Up to the step +field.description = Description value +field.commentTitle = Title of the comment criterion.study = Les études diff --git a/Workspace/Siman/src/labels_en.properties b/Workspace/Siman/src/labels_en.properties index 1acbfa6..c06256e 100644 --- a/Workspace/Siman/src/labels_en.properties +++ b/Workspace/Siman/src/labels_en.properties @@ -192,6 +192,8 @@ field.context.value = Value field.fromStudy = Source study field.fromScenario = Source scenario field.finalStep = Up to the step +field.description = Description value +field.commentTitle = Title of the comment criterion.study = All studies