: |
@@ -53,13 +55,13 @@
|
@@ -79,13 +81,13 @@
" style="visibility: hidden; display: none;">
- ')">Open Richtext Editor
+ ')">Open Richtext Editor
.text">
">
- ')">Open Richtext Editor
+ '); doWYSWYGEdit(' ')">Open Richtext Editor
" id="tx.textarea">
Index: lams_tool_laqa/web/InstructionsContent.jsp
===================================================================
diff -u -r8f70defb200e6e719ee8056bc1561d6313fe99fe -r170973684b9669d1651fc94d030976de0f28f415
--- lams_tool_laqa/web/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 8f70defb200e6e719ee8056bc1561d6313fe99fe)
+++ lams_tool_laqa/web/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 170973684b9669d1651fc94d030976de0f28f415)
@@ -17,13 +17,13 @@
|
@@ -61,13 +61,13 @@
|
Index: lams_tool_laqa/web/author_page.jsp
===================================================================
diff -u -rc655c8bba3a1f9b0580d143811493cb17a0b4e8e -r170973684b9669d1651fc94d030976de0f28f415
--- lams_tool_laqa/web/author_page.jsp (.../author_page.jsp) (revision c655c8bba3a1f9b0580d143811493cb17a0b4e8e)
+++ lams_tool_laqa/web/author_page.jsp (.../author_page.jsp) (revision 170973684b9669d1651fc94d030976de0f28f415)
@@ -80,15 +80,19 @@
else{
selectTab(1); //select the default tab;
}
-
- //showElementById("tx1");
- //showElementById("tx2");
- //showElementById("tx3");
-
- //hideElementById("preview1");
- //hideElementById("preview2");
- //hideElementById("preview3");
+ initEditor("Title");
+ initEditor("Instructions");
+ initEditor("Question0");
+ initEditor("OnlineInstructions");
+ initEditor("OfflineInstructions");
+
+
+
+
+ initEditor("");
+
+
}
@@ -112,7 +116,7 @@
-
+
Index: lams_tool_laqa/web/author_page/css/fckeditor_style.css
===================================================================
diff -u -r8f70defb200e6e719ee8056bc1561d6313fe99fe -r170973684b9669d1651fc94d030976de0f28f415
--- lams_tool_laqa/web/author_page/css/fckeditor_style.css (.../fckeditor_style.css) (revision 8f70defb200e6e719ee8056bc1561d6313fe99fe)
+++ lams_tool_laqa/web/author_page/css/fckeditor_style.css (.../fckeditor_style.css) (revision 170973684b9669d1651fc94d030976de0f28f415)
@@ -4,13 +4,29 @@
border-style: none;
border-width: 1px;
padding: 5px;
+
+ overflow: auto;
}
.textareaPanel{
width: 700px;
height: 220px;
}
+
+.smallPreviewPanel{
+ width: 700px;
+ height: 120px;
+ border-style: none;
+ border-width: 1px;
+ padding: 5px;
+}
+
+.smallTextareaPanel{
+ width: 700px;
+ height: 120px;
+}
+
#wyswygEditor{
/*position the wyswygEditor in the centre*/
position: absolute;
@@ -35,4 +51,5 @@
padding: 0px;
margin: 0px;
-}
\ No newline at end of file
+}
+
Index: lams_tool_laqa/web/author_page/js/fckcontroller.js
===================================================================
diff -u -r8f70defb200e6e719ee8056bc1561d6313fe99fe -r170973684b9669d1651fc94d030976de0f28f415
--- lams_tool_laqa/web/author_page/js/fckcontroller.js (.../fckcontroller.js) (revision 8f70defb200e6e719ee8056bc1561d6313fe99fe)
+++ lams_tool_laqa/web/author_page/js/fckcontroller.js (.../fckcontroller.js) (revision 170973684b9669d1651fc94d030976de0f28f415)
@@ -1,8 +1,26 @@
var activeEditorIndex = 0;
-var commentFlag = "";
-var commentFlagLength = 13;
var oFCKeditor;
+//whether to initialise the editor in textarea mode or preview mode
+function initEditor(index){
+ var textareaElement = document.getElementById("tx" + index + ".textarea")
+ if(textareaElement == null)
+ return;
+ var text = textareaElement.value;
+
+ if(containsHTML(text)){
+ var previewTextElement = document.getElementById("preview" + index + ".text");
+ var previewText = document.getElementById("tx" + index + ".textarea").value;
+ previewTextElement.innerHTML = previewText;
+
+ hideElementById("tx"+index);
+ showElementById("preview"+index);
+ }
+ else{
+ hideElementById("preview"+index);
+ showElementById("tx"+index);
+ }
+}
// FCKeditor_OnComplete is a special function that is called when an editor
// instance is loaded ad available to the API. It must be named exactly in
@@ -22,9 +40,9 @@
oEditor.SetHTML(content) ;
}
+
+function doWYSWYGEdit(index, size){
-function doWYSWYGEdit(index){
-
var oEditor;
try {
oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
@@ -57,22 +75,32 @@
wyswygEditorScreenElement.style.top = posY + "px";
wyswygEditorScreenElement.style.left = posX + "px";
+ //resize the fck editor
+ fckFrameElement = document.getElementById("FCKeditor1___Frame");
+ if (size == "small") {
+ fckFrameElement.style.height = "100px";
+ } else {
+ fckFrameElement.style.height = "200px";
+ }
+
+ showElementById("wyswygEditorScreen");
+
showElementById("wyswygEditorScreen");
}
+//convert the text to HTML first,
+function doTextToHTML(index){
+ var textareaElement = document.getElementById("tx" + index + ".textarea");
+ var text = covertTextToHTML(textareaElement.value);
+ textareaElement.value = text;
+}
function saveWYSWYGEdittedText(index){
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
var text = oEditor.GetXHTML( true )
- // add in to indicate that we have used the wyswyg editor
- var testText = text.substring(0,commentFlagLength);
- if ( commentFlag != testText ) {
- text = commentFlag + text;
- }
-
var htmlEditorElement = document.getElementById("tx" + index + ".textarea");
htmlEditorElement.value = text;
@@ -95,8 +123,7 @@
}
-
-
+/*** show/hide Elements ***/
function showElement(element) {
element.style.visibility = 'visible';
element.style.display = "block";
@@ -117,6 +144,7 @@
}
+/*** findPosX and findPoxY functions are use to locate the x,y location of an element ***/
function findPosX(obj) {
var curleft = 0;
if(obj.offsetParent)
@@ -147,7 +175,34 @@
return curtop;
}
+/**** Using the regular expressions defined below to convert Text to HTML ****/
+var NEWLINE = " ";
+var GREATER = ">";
+var LESSER = "<";
+//var SPACE = " ";
+var RE_ESCAPE_NEWLINE = new RegExp("\n", "g");
+var RE_ESCAPE_GREATER = new RegExp(">", "g");
+var RE_ESCAPE_LESSER = new RegExp("<", "g");
+//var RE_ESCAPE_SPACE = new RegExp(" ", "g");
+
+var RE_HTML_TAG = new RegExp("<.*>|" + LESSER + "|" + GREATER);
+
+function covertTextToHTML(str){
+ return str.replace(RE_ESCAPE_GREATER, GREATER)
+ .replace(RE_ESCAPE_LESSER, LESSER)
+ .replace(RE_ESCAPE_NEWLINE, NEWLINE);
+
+ //.replace(RE_ESCAPE_SPACE, SPACE)
+}
+
+/**** Detect whether HTML was used */
+function containsHTML(str){
+ return (str.match(RE_HTML_TAG) != null)? true:false;
+}
+
+
+
/*** implement the event onSelectTab() which gets trigger when tabs is changed ***/
function onSelectTab(tabID){
//hide all active editors
|