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
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
<!-- edit comment functionality -->
<form name="edit_comment_form" id="edit_comment_form" action="edit-comment" method="post"
style="display: none; position: absolute; background: white;">
+
+ <div id="commentToEditTiltleErrorMessage" class="errorMessage" style="display: none" align="center">
+ <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.commentTitle"))}'/>
+ </div>
+
<input type="hidden" name="commentId" id="commentToEditId" value="0"/>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
<tr valign="top">
<input type="text" name="commentTitle" id="commentToEditTitle">
<script language='JavaScript'>
displayTextEditor('commentToEditValue', '', 650, 150);
+ enableRTEvalidation('commentToEditValue');
</script>
</td>
</tr>
<script>
$("#edit_comment_form").ajaxForm({
- target: '#display_comments_div'
+ target: '#display_comments_div',
+ beforeSubmit: function(event) {
+ //validation
+ var message = document.getElementById('commentToEditTiltleErrorMessage');
+ message.style.display = 'none';
+ field = document.getElementById('commentToEditTitle');
+ if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
+ message.style.display = 'block';
+ return false;
+ } else {
+ hideEditCommentEditor();
+ }
+ }
});
var commentToEditId;
document.getElementById('commentToEditTitle').focus();
redrawEditor();
window.onresize = redrawEditor;
+ $('.editCommentIcon').hide();
}
function hideEditCommentEditor() {
document.getElementById('edit_comment_form').style.display = 'none';
+ $('.editCommentIcon').show();
}
// Bind the cancel button
$("#cancel_edit_comment_button").click(hideEditCommentEditor);
-
- // Bind the submit event
- $('#edit_comment_form').on('submit', hideEditCommentEditor);
</script>
<!-- remove comment functionality -->
function removeComment(commentId) {
document.getElementById("commentId").value=commentId;
$("#remove_comment_form").ajaxSubmit({
- target: '#display_comments_div'
- });
+ target: '#display_comments_div'
+ });
}
</script>
<!-- add comment functionality -->
<s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
<script type="text/javascript">
- $(document).ready(function(){
- $("#comments_form").ajaxForm({
- target: '#display_comments_div'
- });
+ $(document).ready(function(event){
+ $("#comments_form").ajaxForm({
+ target: '#display_comments_div',
+ beforeSubmit: function(event) {
+ //validation
+ var message = document.getElementById('commentToAddTiltleErrorMessage');
+ message.style.display = 'none';
+ field = document.getElementById('commentTitle');
+ if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
+ message.style.display = 'block';
+ return false;
+ } else {
+ hideCommentEditor();
+ }
+ }
+ });
function showCommentEditor() {
document.getElementById('commentTitle').value='';
document.getElementById('add_comment_button_div').style.display = 'none';
document.getElementById('add_comment_div').style.display = 'block';
document.getElementById('commentTitle').focus();
+ document.getElementById('commentToAddTiltleErrorMessage').style.display = 'none';
+ $('.editCommentIcon').hide();
}
// Bind the add button
function hideCommentEditor() {
document.getElementById("add_comment_button_div").style.display = 'block';
document.getElementById("add_comment_div").style.display = 'none';
+ $('.editCommentIcon').show();
}
// Bind the cancel button
$("#cancel_add_comment_button").click(hideCommentEditor);
-
- // Bind the submit event
- $('#comments_form').on('submit', hideCommentEditor);
});
</script>
</table>
</div>
- <div id="add_comment_div" style="display: none;">
+ <div id="add_comment_div" style="display: none;">
+ <div id="commentToAddTiltleErrorMessage" class="errorMessage" style="display: none" align="center">
+ <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.commentTitle"))}'/>
+ </div>
<form name="comments_form" id="comments_form" action="create-stepComment" method="post">
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
<tr valign="top">
<input type="text" name="commentTitle" id="commentTitle">
<script language='JavaScript'>
displayTextEditor('commentValue', '', 650, 150);
+ enableRTEvalidation('commentValue');
</script>
</td>
</tr>
</table>
</form>
- </div>
+ </div>
</s:if>
\ No newline at end of file
</td>
<td>
<script language='JavaScript'>
- displayTextEditor('descriptionValue', '', 300, 120);
+ displayTextEditor('descriptionValue', '', 360, 120);
+ enableRTEvalidation('descriptionValue');
</script>
</td>
</tr>
<%@ page import="org.splat.simer.AbstractOpenObject"%>
<%@ page import="org.splat.simer.OpenStudy"%>
<%@ page import="org.splat.simer.KnowledgeElementFacade"%>
-
-<script language="JavaScript">
- //Knowledge value validation
- $(document).ready(function() {
- $('#setKnowledge').submit(function(event) {
- field = document.getElementById('hdnknowledgeValue');
- document.getElementById('knowledgeValueErrorMessage').style.display = 'none';
- if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
- event.preventDefault();
- document.getElementById('knowledgeValueErrorMessage').style.display = 'table-row';
- }
- });
- });
-</script>
-
<%!
private enum Action { addKnowledge, renameKnowledge, editKnowledge };
%><%
List<KnowledgeElementFacade> knowelms = type.getKnowledgeElements();
for (Iterator<KnowledgeElementFacade> iterator = knowelms.iterator(); iterator.hasNext(); ) {
KnowledgeElementFacade kelm = iterator.next();
- if (kelm.getIndex().equals(typenumber)) {
-%> <tr id="knowledgeValueErrorMessage" style="display: none">
- <td align="center" colspan="2" class="errorMessage">
- <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.knowledgevalue"))}'/>
- </td>
- </tr>
-<% }
%>
<tr height=20 valign=top>
if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) {
%> <td>
<script language='JavaScript' type='text/javascript'>
-<% out.print("displayTextEditor('knowledgeValue', '" + kelm.getFullValue() + "', 450, 150);");
+<% out.print("displayTextEditor('knowledgeValue', '" + kelm.getFullValue() + "', 450, 150);"
+ + "enableRTEvalidation('knowledgeValue');");
%> </script>
</td>
<% } else {
}
if (todo == Action.addKnowledge && type.getIndex().equals(typenumber)) {
%> <tr height=5><td></td></tr>
- <tr id="knowledgeValueErrorMessage" style="display: none">
- <td align="center" colspan="2" class="errorMessage">
- <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.knowledgevalue"))}'/>
- </td>
- </tr>
<tr valign=top>
<td>
<s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
</td>
<td>
<script language='JavaScript' type='text/javascript'>
-<% out.print("displayTextEditor('knowledgeValue', '<p> </p>', 450, 150);");
+<% out.print("displayTextEditor('knowledgeValue', '<p> </p>', 450, 150);"
+ + "enableRTEvalidation('knowledgeValue');");
%> </script>
</td>
</tr>
onmouseover="javascript:_mouseOverContext=true;" onmouseout="javascript:_mouseOverContext=false;">
<jsp:include page="/jsp/menupopup.jsp" />
</div>
+ <div class="editCommentIcon">
<s:a href="popup%{id}">
<img src="<s:url value="/skin/icon.ed.png"/>" width=14 height=14 border="none" title=""/>
</s:a>
+ </div>
</s:if>
</td>
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';
}
}
</script>
-</s:if>
\ No newline at end of file
+</s:if>
+<s:else>
+ <div id="description_value_div">
+ <s:property value="descriptionValue" escapeHtml="false"/>
+ </div>
+</s:else>
\ No newline at end of file
// 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
document.writeln('<tbody><tr>');
insertBar();
if(fullscreen || activeCommand.get("save") != null){
- document.writeln('<td><input type="image" class="rteImg" src="'+imagesPath+'save.gif" alt="'+lblSave+'" title="'+lblSave+'" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'" onClick="prepareSubmitEdit(currentRTE)"></td>');
+ document.writeln('<td><input type="image" class="rteImg" id="'+rte+'SaveButton" src="'+imagesPath+'save.gif" alt="'+lblSave+'" title="'+lblSave+'" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'" onClick="prepareSubmitEdit(currentRTE)"></td>');
nbcommand += 1;
}
if(!isSafari && !isKonqueror) {
// 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')");
}
// 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);
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')");
}
if(id!=null){
td = "<td id='"+id+"'>";
}
- document.writeln(td+'<img class="rteImg" src="'+imagesPath+image+'" alt="'+name+'" title="'+name+'" onMouseDown="'+command+';return false" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'"></td>');
+ document.writeln(td+'<img class="rteImg" src="'+imagesPath+image+'" alt="'+name+'" title="'+name+'" onClick="'+command+';return false" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'"></td>');
}
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);
//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;
}
return rtn;
}
-function setFormText(popup, content){
+function setFormText(popup, content, timeLeft){
//set link text value in dialog windows
if(content != "undefined")
{
}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);
+ }
+ }
}
}
//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;
}
}
}
}
+
+//*****************
+//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
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
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