|
From: <se...@us...> - 2008-05-08 19:02:54
|
Revision: 104
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=104&view=rev
Author: sem62
Date: 2008-05-08 12:02:32 -0700 (Thu, 08 May 2008)
Log Message:
-----------
Inserting already existing text into WYSIWYG editor at opening.
Modified Paths:
--------------
WebEditor/resources/HTMLedit.php
WebEditor/resources/HTMLeditor.js
WebEditor/resources/api.js
WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java
Added Paths:
-----------
WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java
Modified: WebEditor/resources/HTMLedit.php
===================================================================
--- WebEditor/resources/HTMLedit.php 2008-05-08 17:25:04 UTC (rev 103)
+++ WebEditor/resources/HTMLedit.php 2008-05-08 19:02:32 UTC (rev 104)
@@ -6,20 +6,28 @@
var s=document.getElementById("spaw_edit_field").value;
opener.document.webeditor.setEditedHTML(s);
close();
+ return false;
}
</script>
</head>
<body>
-
+<form name='editFrm' onSubmit='javascript:save();'>
<?
include("spaw2/spaw.inc.php");
-$spaw = new SpawEditor('spaw_edit_field');
+$spaw = new SpawEditor('spaw_edit_field', "123");
$spaw->show();
?>
-<input type='button' value='save' onClick='javascript:save();'>
+<input type='submit' value='save' onClick='javascript:save();'>
+</form>
+ <script type="text/javascript">
+ var s = opener.document.webeditor.getEditedHTML();
+ document.getElementById("spaw_edit_field").value = s;
+ alert(s, false);
+
+ </script>
</body>
</html>
\ No newline at end of file
Modified: WebEditor/resources/HTMLeditor.js
===================================================================
--- WebEditor/resources/HTMLeditor.js 2008-05-08 17:25:04 UTC (rev 103)
+++ WebEditor/resources/HTMLeditor.js 2008-05-08 19:02:32 UTC (rev 104)
@@ -1,3 +1,3 @@
-function showEditor(){
+function showEditor(currentText){
myWin=window.open("HTMLedit.php", "wind1", "width=800,height=350");
}
Modified: WebEditor/resources/api.js
===================================================================
--- WebEditor/resources/api.js 2008-05-08 17:25:04 UTC (rev 103)
+++ WebEditor/resources/api.js 2008-05-08 19:02:32 UTC (rev 104)
@@ -1,24 +1,24 @@
function Initialize(param)
{
- return document.player.Initialize(param);
+ return document.webeditor.Initialize(param);
}
function Terminate(param)
{
- return document.player.Terminate(param);
+ return document.webeditor.Terminate(param);
}
function SetValue(name,value)
{
- return document.player.SetValue(name, value);
+ return document.webeditor.SetValue(name, value);
}
function GetValue(name)
{
- return document.player.GetValue(name);
+ return document.webeditor.GetValue(name);
}
function Commit(param)
{
- var returnVal = document.player.Commit(param);
+ var returnVal = document.webeditor.Commit(param);
var status = GetValue("cmi.core.lesson_status");
if (status=="passed" || status=="failed")
navigation.location.reload();
@@ -26,15 +26,15 @@
}
function GetLastError()
{
- return document.player.GetLastError();
+ return document.webeditor.GetLastError();
}
function GetErrorString(code)
{
- return document.player.GetErrorString(code);
+ return document.webeditor.GetErrorString(code);
}
function GetDiagnostic(param)
{
- return document.player.GetDiagnostic(param);
+ return document.webeditor.GetDiagnostic(param);
}
function GetVersion()
{
Added: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java
===================================================================
--- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java (rev 0)
+++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithWYSIWYGEditor.java 2008-05-08 19:02:32 UTC (rev 104)
@@ -0,0 +1,46 @@
+package edu.lnu.FireFly.WebEditor;
+
+import javax.swing.JTextField;
+
+import netscape.javascript.JSObject;
+import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg;
+
+public class AppletWithWYSIWYGEditor extends AppletWithApiHandle{
+ private boolean htmlEditing = false;
+ private JTextField textField = null;
+
+ public void htmlEdit(JTextField captionTextField2, PropertyDlg dlg) {
+ JSObject win = JSObject.getWindow(this);
+ Object[] params = new String[1];
+ params[0] = captionTextField2.getText();
+
+ dlg.setModal(false);
+
+ htmlEditing = true;
+ textField = captionTextField2;
+
+ win.call("showEditor", params);
+ }
+
+ public String getEditedHTML(){
+ return textField.getText();
+ }
+
+ public void setEditedHTML(String newHTML){
+ if (!htmlEditing){
+ return;
+ }
+ textField.setText(newHTML);
+
+ htmlEditing = false;
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public boolean isHtmlEditing() {
+ return htmlEditing;
+ }
+}
Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java
===================================================================
--- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-08 17:25:04 UTC (rev 103)
+++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-08 19:02:32 UTC (rev 104)
@@ -8,12 +8,10 @@
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
-import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
-import netscape.javascript.JSObject;
import edu.lnu.FireFly.FFManifest.Manifest;
import edu.lnu.FireFly.FFManifest.TreeItem;
import edu.lnu.FireFly.FFManifest.item.Item;
@@ -24,7 +22,6 @@
import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager;
import edu.lnu.FireFly.WebEditor.GUI.CourseTreePopupMenu;
import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel;
-import edu.lnu.FireFly.WebEditor.GUI.Dialogs.PropertyDlg;
import edu.lnu.FireFly.WebEditor.ItemModels.ChapterModel;
import edu.lnu.FireFly.WebEditor.ItemModels.ItemModels;
import edu.lnu.FireFly.WebEditor.ItemModels.OrganizationModel;
@@ -33,7 +30,7 @@
import edu.lnu.FireFly.WebEditor.ItemModels.SummaryPageModel.SummaryPageModel;
import edu.lnu.FireFly.WebEditor.WSClients.WebEditorServiceClient;
-public class WebEditor extends AppletWithApiHandle implements ActionListener,
+public class WebEditor extends AppletWithWYSIWYGEditor implements ActionListener,
TreeSelectionListener {
/**
@@ -190,29 +187,4 @@
}
}
}
-
- private boolean htmlEditing = false;
- private JTextField textField = null;
-
- public void htmlEdit(JTextField captionTextField2, PropertyDlg dlg) {
- JSObject win = JSObject.getWindow(instance);
- Object[] params = new String[0];
-
- dlg.setModal(false);
-
- htmlEditing = true;
- textField = captionTextField2;
-
- win.call("showEditor", params);
- }
-
- public void setEditedHTML(String newHTML){
- if (!htmlEditing){
- return;
- }
-
- textField.setText(newHTML);
-
- htmlEditing = false;
- }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|