From: <se...@us...> - 2008-05-02 09:54:54
|
Revision: 71 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=71&view=rev Author: sem62 Date: 2008-05-02 02:54:59 -0700 (Fri, 02 May 2008) Log Message: ----------- Initial import of template Added Paths: ----------- WebEditor/src/template/ WebEditor/src/template/LectureModel.conf WebEditor/src/template/LectureModel.html WebEditor/src/template/SimpleQuestionModel.conf WebEditor/src/template/SimpleQuestionModel.html WebEditor/src/template/SummaryPageModel.html WebEditor/src/template/global/ WebEditor/src/template/global/APIWrapper.js WebEditor/src/template/global/SummaryPage.js WebEditor/src/template/global/main.css WebEditor/src/template/global/simpleQ.js Added: WebEditor/src/template/LectureModel.conf =================================================================== --- WebEditor/src/template/LectureModel.conf (rev 0) +++ WebEditor/src/template/LectureModel.conf 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,5 @@ +<?xml version = "1.0" ?> +<LectureModel> + <caption>New caption</caption> + <content>New content.</content> +</LectureModel> Added: WebEditor/src/template/LectureModel.html =================================================================== --- WebEditor/src/template/LectureModel.html (rev 0) +++ WebEditor/src/template/LectureModel.html 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,16 @@ +<html> +<head> + <title>title</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <script type="text/javascript" src="global/APIWrapper.js"></script> +</head> + +<body onload="Initialize();" onunload="Terminate();"> + <div id="lecture_caption"> + <!--caption start-->New caption<!--caption end--> + </div> + <div id="lecture_content"> + <!--content start--><!--content end--> + </div> +</body> +</html> \ No newline at end of file Added: WebEditor/src/template/SimpleQuestionModel.conf =================================================================== --- WebEditor/src/template/SimpleQuestionModel.conf (rev 0) +++ WebEditor/src/template/SimpleQuestionModel.conf 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,9 @@ +<?xml version = "1.0" ?> +<SimpleQuestionModel> + <caption>New caption</caption> + <question>Answer "Yes" to question, please.</question> + <answers singleVariant="false"> + <answer point="0">Yes</answer> + <answer point="1">No</answer> + </answers> +</SimpleQuestionModel> Added: WebEditor/src/template/SimpleQuestionModel.html =================================================================== --- WebEditor/src/template/SimpleQuestionModel.html (rev 0) +++ WebEditor/src/template/SimpleQuestionModel.html 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,27 @@ +<html> +<head> + <title>title</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <script type="text/javascript" src="global/APIWrapper.js"></script> + <script type="text/javascript" src="global/simpleQ.js"></script> +</head> + +<body onload="Initialize();" onunload="Terminate();"> + <div id="simpleQ_caption"> + <!--caption start-->New caption<!--caption end--> + </div> + <div id="simpleQ_question"> + <!--question start-->Answer "Yes" to question, please.<!--question end--> + </div> + <form onsubmit="return checkAnswer(this);"> + <div id="simpleQ_answers"> + <script language="javascript"> + <!--answers start--> + <!--answers end--> + show(); + </script> + </div> + <input type=submit value="Next"> + </form> +</body> +</html> \ No newline at end of file Added: WebEditor/src/template/SummaryPageModel.html =================================================================== --- WebEditor/src/template/SummaryPageModel.html (rev 0) +++ WebEditor/src/template/SummaryPageModel.html 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,17 @@ +<html> +<head> + <title>title</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> + <script type="text/javascript" src="global/APIWrapper.js"></script> + <script type="text/javascript" src="global/SummaryPage.js"></script> +</head> + +<body onload="Initialize();" onunload="Terminate();"> + <div id="page_content"> + <script type="text/javascript"> + <!--content start--> + <!--content end--> + </script> + </div> +</body> +</html> \ No newline at end of file Added: WebEditor/src/template/global/APIWrapper.js =================================================================== --- WebEditor/src/template/global/APIWrapper.js (rev 0) +++ WebEditor/src/template/global/APIWrapper.js 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,458 @@ +/******************************************************************************* +** +** Advanced Distributed Learning Co-Laboratory (ADL Co-Lab) grants you +** ("Licensee") a non-exclusive, royalty free, license to use and redistribute +** this software in source and binary code form, provided that i) this copyright +** notice and license appear on all copies of the software; and ii) Licensee +** does not utilize the software in a manner which is disparaging to ADL Co-Lab. +** +** This software is provided "AS IS," without a warranty of any kind. ALL +** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY +** IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +** NON-INFRINGEMENT, ARE HEREBY EXCLUDED. ADL Co-Lab AND ITS LICENSORS SHALL +** NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, +** MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +** ADL Co-Lab OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +** OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE +** DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING +** OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF ADL Co-Lab HAS BEEN +** ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +** +*******************************************************************************/ + +/******************************************************************************* +** +** This file is being presented to Content Developers, Content Programmers and +** Instructional Designers to demonstrate one way to abstract API calls from the +** actual content to allow for uniformity and reuse of content fragments. +** +** The purpose in wrapping the calls to the API is to (1) provide a +** consistent means of finding the LMS API adapter within the window +** hierarchy, (2) to ensure that the method calls are called correctly by the +** SCO and (3) to make possible changes to the actual API Specifications and +** Standards easier to implement/change quickly. +** +** This is just one possible example for implementing the API guidelines for +** runtime communication between an LMS and executable content components. +** There are many other possible implementations. +** +*******************************************************************************/ + +// local variable definitions used for finding the API +var apiHandle = null; +var findAPITries = 0; +var noAPIFound = "false"; + +// local variable used to keep from calling Terminate() more than once +var terminated = "false"; + +// local variable used by the content developer to debug +// This should be set to true during development to find errors. However, +// This should be set to false prior to deployment. +var _debug = false; + +/******************************************************************************* +** +** This function looks for an object named API in parent and opener windows +** +** Inputs: Object - The Window Object +** +** Return: Object - If the API object is found, it's returned, otherwise null +** is returned +** +*******************************************************************************/ +function findAPI( win ) +{ + while ( (win.API_1484_11 == null) && + (win.parent != null) && + (win.parent != win) ) + { + findAPITries++; + + if ( findAPITries > 500 ) + { + alert( "Error finding API -- too deeply nested." ); + return null; + } + + win = win.parent; + } + + return win.API_1484_11; +} + +/******************************************************************************* +** +** This function looks for an object named API, first in the current window's +** frame hierarchy and then, if necessary, in the current window's opener window +** hierarchy (if there is an opener window). +** +** Inputs: none +** +** Return: Object - If the API object is found, it's returned, otherwise null +** is returned +** +*******************************************************************************/ +function getAPI() +{ + var theAPI = findAPI( window ); + + if ( (theAPI == null) && + (window.opener != null) && + (typeof(window.opener) != "undefined") ) + { + theAPI = findAPI( window.opener ); + } + + if (theAPI == null) + { + alert( "Unable to locate the LMS's API Implementation.\n" + + "Communication with the LMS will not occur." ); + + noAPIFound = "true"; + } + + return theAPI +} + +/******************************************************************************* +** +** Returns the handle to API object if it was previously set, otherwise it +** returns null +** +** Inputs: None +** +** Return: Object - The value contained by the apiHandle variable. +** +*******************************************************************************/ +function getAPIHandle() +{ + if ( apiHandle == null ) + { + if ( noAPIFound == "false" ) + { + apiHandle = getAPI(); + } + } + + return apiHandle; +} + +/******************************************************************************* +** +** This function is used to tell the LMS to initiate the communication session. +** +** Inputs: None +** +** Return: String - "true" if the initialization was successful, or +** "false" if the initialization failed. +** +*******************************************************************************/ +function initializeCommunication() +{ + var api = getAPIHandle(); + + if ( api == null ) + { + return "false"; + } + else + { + var result = api.Initialize(""); + + if ( result != "true" ) + { + var errCode = retrieveLastErrorCode(); + + displayErrorInfo( errCode ); + + // may want to do some error handling + } + } + + return result; +} + +/******************************************************************************* +** +** This function is used to tell the LMS to terminate the communication session +** +** Inputs: None +** +** Return: String - "true" if successful or +** "false" if failed. +** +*******************************************************************************/ +function terminateCommunication() +{ + var api = getAPIHandle(); + + if ( api == null ) + { + return "false"; + } + else + { + // call Terminate only if it was not previously called + if ( terminated != "true" ) + { + // call the Terminate function that should be implemented by + // the API + var result = api.Terminate(""); + + if ( result != "true" ) + { + var errCode = retrieveLastErrorCode(); + + displayErrorInfo( errCode ); + + // may want to do some error handling + } + else // terminate was successful + { + terminated = "true"; + } + } + } + + return result; +} + +/******************************************************************************* +** +** This function requests information from the LMS. +** +** Inputs: String - Name of the data model defined category or element +** (e.g. cmi.core.learner_id) +** +** Return: String - The value presently assigned to the specified data model +** element. +** +*******************************************************************************/ +function retrieveDataValue( name ) +{ + // do not call a set after finish was called + if ( terminated != "true" ) + { + var api = getAPIHandle(); + + if ( api == null ) + { + return ""; + } + else + { + var value = api.GetValue( name ); + + var errCode = api.GetLastError(); + + if ( errCode != "0" ) + { + var errCode = retrieveLastErrorCode(); + + displayErrorInfo( errCode ); + } + else + { + return value; + } + } + } + + return; +} + +/******************************************************************************* +** +** This function is used to tell the LMS to assign the value to the named data +** model element. +** +** Inputs: String - Name of the data model defined category or element value +** +** String - The value that the named element or category will be +** assigned +** +** Return: String - "true" if successful or +** "false" if failed. +** +*******************************************************************************/ +function storeDataValue( name, value ) +{ + // do not call a set after finish was called + if ( terminated != "true" ) + { + var api = getAPIHandle(); + + if ( api == null ) + { + return; + } + else + { + var result = api.SetValue( name, value ); + + if ( result != "true" ) + { + var errCode = retrieveLastErrorCode(); + + displayErrorInfo( errCode ); + + // may want to do some error handling + } + } + } + + return; +} + +/******************************************************************************* +** +** This function requests the error code for the current error state from the +** LMS. +** +** Inputs: None +** +** Return: String - The last error code. +** +*******************************************************************************/ +function retrieveLastErrorCode() +{ + // It is permitted to call GetLastError() after Terminate() + + var api = getAPIHandle(); + + if ( api == null ) + { + return ""; + } + else + { + return api.GetLastError(); + } +} + +/******************************************************************************* +** +** This function requests a textual description of the current error state from +** the LMS +** +** Inputs: String - The error code. +** +** Return: String - Textual description of the given error state. +** +*******************************************************************************/ +function retrieveErrorInfo( errCode ) +{ + // It is permitted to call GetLastError() after Terminate() + + var api = getAPIHandle(); + + if ( api == null ) + { + return ""; + } + else + { + + return api.GetErrorString( errCode ); + } +} + +/******************************************************************************* +** +** This function requests additional diagnostic information about the given +** error code. This information is LMS specific, but can help a developer find +** errors in the SCO. +** +** Inputs: String - The error code. +** +** Return: String - Additional diagnostic information about the given error +** code +** +*******************************************************************************/ +function retrieveDiagnosticInfo( error ) +{ + // It is permitted to call GetLastError() after Terminate() + + var api = getAPIHandle(); + + if ( api == null ) + { + return ""; + } + else + { + return api.GetDiagnostic( error ); + } +} + +/******************************************************************************* +** +** This function requests that the LMS persist all data to this point in the +** session. +** +** Inputs: None +** +** Return: None +** +*******************************************************************************/ +function persistData() +{ + // do not call a set after Terminate() was called + if ( terminated != "true" ) + { + var api = getAPIHandle(); + + if ( api == null ) + { + return ""; + } + else + { + return api.Commit(); + } + } + else + { + return ""; + } +} + +/******************************************************************************* +** +** Display the last error code, error description and diagnostic information. +** +** Inputs: String - The error code +** +** Return: None +** +*******************************************************************************/ +function displayErrorInfo( errCode ) +{ + if ( _debug ) + { + var errString = retrieveErrorInfo( errCode ); + var errDiagnostic = retrieveDiagnosticInfo( errCode ); + + alert( "ERROR: " + errCode + " - " + errString + "\n" + + "DIAGNOSTIC: " + errDiagnostic ); + } +} + +function Terminate() +{ + terminateCommunication(); +} + +function Initialize() +{ + initializeCommunication(); +} + +function SetValue(p1, p2){ + storeDataValue(p1, p2); +} + +function GetValue(p1){ + return retrieveDataValue(p1); +} Added: WebEditor/src/template/global/SummaryPage.js =================================================================== Added: WebEditor/src/template/global/main.css =================================================================== --- WebEditor/src/template/global/main.css (rev 0) +++ WebEditor/src/template/global/main.css 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,18 @@ +body { + font-family:Verdana,Tahoma,Arial,Sans-Serif; + font-size:11px; + background-color: #DAF3FF; + padding:10px 20px 20px 10px; + scrollbar-3dlight-color:#C4C4B8; + scrollbar-arrow-color:#6A6A53; + scrollbar-darkshadow-color:#8A8A73; + scrollbar-face-color:#D9D9D0; + scrollbar-highlight-color:#FFFFFF; + scrollbar-shadow-color:#8A8A73; + scrollbar-track-color:#EFEFEF +} + +.head{ + font-size: 36px; + text-decoration: bold, underline; +} Added: WebEditor/src/template/global/simpleQ.js =================================================================== --- WebEditor/src/template/global/simpleQ.js (rev 0) +++ WebEditor/src/template/global/simpleQ.js 2008-05-02 09:54:59 UTC (rev 71) @@ -0,0 +1,142 @@ +var singleAnswer=false; +var answers=new Array(); +function setSingleVariant(singleVariant){ + singleAnswer = singleVariant; +} +function addAnswer(_text, _point){ + var answer = { + point: _point, + text: _text, + id: "answer" + answers.length + }; + answers.push(answer); +}; +function show(){ + var i; + var interactions = GetValue("cmi.interactions._count"); + var pref = "cmi.interactions." + interactions + "."; + if (singleAnswer){ + SetValue(pref + "type", "choice"); + } else { + SetValue(pref + "type", "other"); + } + + for (i=0; i < answers.length; i++){ + if (singleAnswer){ + document.write("<input type='radio' name='answer' id='" + answers[i].id + "' value='" + answers[i].id + "'>"); + } else { + document.write("<input type='checkbox' id='" + answers[i].id + "'>"); + } + document.write(answers[i].text); + document.write("<BR>"); + + SetValue(pref + "correct_responses." + i + ".pattern", "\"" + answers[i].id + "\""); + SetValue(pref + "correct_responses." + i + ".weighting", "\"" + answers[i].point + "\""); + } +} +function getMaxScore(){ + if (singleAnswer){ + var i; + var max = answers[0].point; + for (i=1; i < answers.length; i++){ + if (answers[i].point > max){ + max = answers[i].point; + } + } + } else { + var i; + var max = 0; + for (i=0; i < answers.length; i++){ + if (answers[i].point > 0){ + max += answers[i].point; + } + } + } + return max; +} +function getMinScore(){ + if (singleAnswer){ + var i; + var min = answers[0].point; + for (i=1; i < answers.length; i++){ + if (answers[i].point < min){ + min = answers[i].point; + } + } + } else { + var i; + var min = 0; + for (i=0; i < answers.length; i++){ + if (answers[i].point < 0){ + min += answers[i].point; + } + } + } + return min; +} +function getRawScore(){ + var i; + var res=0; + for (i=0; i < answers.length; i++){ + var ans = document.getElementById(answers[i].id); + if (ans.checked){ + res += answers[i].point; + } + } + + return res; +} +function checkAnswer(frm){ + SetValue("cmi.complation_status", "complated"); + SetValue("cmi.exit", "normal"); + + var max = getMaxScore(); + var min = getMinScore(); + var raw = getRawScore() + var scaled = ((raw - min)/(max - min))*2 - 1; + + SetValue("cmi.score.min", min); + SetValue("cmi.score.max", max); + SetValue("cmi.score.raw", raw); + SetValue("cmi.score.scaled", scaled); + SetValue("cmi.success_status", (raw==max)?"complate":"incomplate"); + + SetValue("cmi.objectives.0.score.min", min); + SetValue("cmi.objectives.0.score.max", max); + SetValue("cmi.objectives.0.score.raw", raw); + SetValue("cmi.objectives.0.score.scaled", scaled); + + var pref = "cmi.interactions." + (GetValue("cmi.interactions._count") - 1); + if (singleAnswer){ + var i; + for (i=0; i < answers.length; i++){ + var ans = document.getElementById(answers[i].id); + if (ans.checked){ + SetValue(pref + ".learner_response", "\"" + answers[i].id + "\""); + + break; + } + } + } else { + var i; + var checkedCount = 0; + var res = ""; + for (i=0; i < answers.length; i++){ + var ans = document.getElementById(answers[i].id); + if (ans.checked){ + checkedCount++; + if (checkedCount > 1){ + res += "[,]"; + } + res += answers[i].id; + } + } + SetValue(pref + ".learner_response", "\"" + res + "\""); + } + + SetValue(pref + ".result", "\"" + scaled + "\""); + + Terminate(); + + return false; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-02 16:15:54
|
Revision: 73 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=73&view=rev Author: sem62 Date: 2008-05-02 09:15:52 -0700 (Fri, 02 May 2008) Log Message: ----------- Summary page mechanism working now. Need design summary page (SummaryPage.js). Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/src/template/SummaryPageModel.html WebEditor/src/template/global/SummaryPage.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-02 11:23:52 UTC (rev 72) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ResourcedItemModel.java 2008-05-02 16:15:52 UTC (rev 73) @@ -29,6 +29,7 @@ return; } + synchronizeItemWithResource(item); updateItemResource(item, true); ConfigureItem(item); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-02 11:23:52 UTC (rev 72) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SimpleQuestion/SimpleQuestionData.java 2008-05-02 16:15:52 UTC (rev 73) @@ -4,8 +4,8 @@ public class SimpleQuestionData extends ItemData { private SimpleQuestionAnswersDataModel answers = new SimpleQuestionAnswersDataModel(); - private String caption; - private String question; + private String caption = ""; + private String question = ""; public SimpleQuestionAnswersDataModel getAnswers() { return answers; Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-02 11:23:52 UTC (rev 72) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-02 16:15:52 UTC (rev 73) @@ -50,7 +50,9 @@ Template template = new Template(resource.getFullHref(), this); - String content = getSummaryPageContent(anItem.getParent()); + String content = "<script type=\"text/javascript\">" + + getSummaryPageContent(anItem.getParent()) + + "</script>"; template.setProperty("content", content); @@ -95,7 +97,7 @@ if (model.getClass() == SimpleQuestionModel.class || model.getClass() == LectureModel.class) { - return "add(\"" + model.getModelName() + "\", \"" + return "add(\"" + anItem.getTitle() + "\", \"" + model.getModelName() + "\", \"" + ((Item) anItem).identifier + "\");\n"; } Modified: WebEditor/src/template/SummaryPageModel.html =================================================================== --- WebEditor/src/template/SummaryPageModel.html 2008-05-02 11:23:52 UTC (rev 72) +++ WebEditor/src/template/SummaryPageModel.html 2008-05-02 16:15:52 UTC (rev 73) @@ -8,10 +8,8 @@ <body onload="Initialize();" onunload="Terminate();"> <div id="page_content"> - <script type="text/javascript"> <!--content start--> <!--content end--> - </script> </div> </body> </html> \ No newline at end of file Modified: WebEditor/src/template/global/SummaryPage.js =================================================================== --- WebEditor/src/template/global/SummaryPage.js 2008-05-02 11:23:52 UTC (rev 72) +++ WebEditor/src/template/global/SummaryPage.js 2008-05-02 16:15:52 UTC (rev 73) @@ -0,0 +1,33 @@ +function out(s){ + document.write(s); +} + +function openBlock(title){ + out("Opened block with title = "+title+"<br>\n"); +} + +function closeBlock(title){ + out("Closed block with title = "+title+"<br>\n"); +} + + +function add(title, modelName, id){ + out(title + ". item id = " + id + "(" + modelName + ")<br>\n"); + out("score is: "); + out(getScore(id)); + out("<br>\n"); +} + +function getObjectiveIndex(id){ + var count = GetValue("cmi.objectives._count"); + for (i = 0; i < count; i++) + if (GetValue("cmi.objectives." + i + ".id") == id) + return i; + return -1; +} + +function getScore(objectiveID){ + var index = getObjectiveIndex(objectiveID); + var res = GetValue("cmi.objectives." + index + ".score.scaled"); + return res != null ? res : 0; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-02 16:39:59
|
Revision: 74 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=74&view=rev Author: sem62 Date: 2008-05-02 09:39:58 -0700 (Fri, 02 May 2008) Log Message: ----------- Initial commit of resources. Added Paths: ----------- WebEditor/src/resources/ WebEditor/src/resources/attemptCountLimit.html WebEditor/src/resources/chooseMsg.html WebEditor/src/resources/empty.html WebEditor/src/resources/index.html WebEditor/src/resources/terminateSCO.html WebEditor/src/resources/welcome.html Added: WebEditor/src/resources/attemptCountLimit.html =================================================================== --- WebEditor/src/resources/attemptCountLimit.html (rev 0) +++ WebEditor/src/resources/attemptCountLimit.html 2008-05-02 16:39:58 UTC (rev 74) @@ -0,0 +1,9 @@ +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel='stylesheet' href='main.css' type='text/css'> +</head> +<body> +Кількість спроб обмежена і Ви уже їх використали. +</body> +</html> Added: WebEditor/src/resources/chooseMsg.html =================================================================== --- WebEditor/src/resources/chooseMsg.html (rev 0) +++ WebEditor/src/resources/chooseMsg.html 2008-05-02 16:39:58 UTC (rev 74) @@ -0,0 +1,9 @@ +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel='stylesheet' href='main.css' type='text/css'> +</head> +<body> +Виберіть один із підпунктів в дереві ліворуч. +</body> +</html> \ No newline at end of file Added: WebEditor/src/resources/empty.html =================================================================== Added: WebEditor/src/resources/index.html =================================================================== --- WebEditor/src/resources/index.html (rev 0) +++ WebEditor/src/resources/index.html 2008-05-02 16:39:58 UTC (rev 74) @@ -0,0 +1,53 @@ +<html><head> + + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel="stylesheet" href="main.css" type="text/css"> + + <title>FireFly SCORM 2004 Course Player</title> +<script type="text/javascript" src="api.js"></script> +<script type="text/javascript" src="navigation.js"></script> + +</head> +<body topmargin="0" leftmargin="0" onUnload="exit_clicked(false);" bgcolor="#EBFAFE" link="#ff0000" marginheight="0" marginwidth="0" text="#ffffff" vlink="#505050"> + +<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> + <tbody><tr height="20"> + <td><img src="images/left_elipse.jpg"/></td><td bgcolor=#6A9AE2> <img src="images/FireFly.gif"><div class="header">Education System</div> </td> + <td colspan="5" align="right" bgcolor=#6A9AE2 valign="bottom"> + <img src="images/close.jpg" onClick="exit_clicked(true);" alt="Close"> + </td> + <td><image src="images/right_elipse.jpg"/></td> + </tr><tr height="*"> + <td></td> + <td width="150"> + <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + </applet> + </td> + <td colspan="5" style="padding-left: 5px; padding-right: 3px; width: 100%;" width="*"> + <iframe name="ContentFrame" marginwidth="0" marginheight="0" frameborder="1" height="100%" scrolling="auto" width="100%"></iframe> + </td> + <td></td> + </tr><tr height="30" valign="center"> + <td><image src="images/left_elipse.jpg"/></td> + <td width="150" bgcolor=#6A9AE2> </td> + <td width="100" bgcolor=#6A9AE2></td> + <form name="navForm" action=""></form> + <td width="50" bgcolor=#6A9AE2> + <input style="display: none;" name="prevBtn" src="images/prev.jpg" onClick="previous()" type="image"> + <input name="prevBtn_disabled" style="display: block;" src="images/prev_disabled.jpg" onClick="return false;" type="image"></td> + <td bgcolor=#6A9AE2 style="padding-left: 10px; padding-right: 10px;" width="70"> + <td bgcolor=#6A9AE2 width="50"> + <input style="display: none;" name="nextBtn" src="images/next.jpg" onClick="next()" type="image"> + <input name="nextBtn_disabled" style="display: block;" src="images/next_disabled.jpg" onClick="return false;" type="image"> + </td> + <td bgcolor=#6A9AE2 width="100%"> <span id=TimeLeft name=TimeLeft> </span></td> + <td><image src="images/right_elipse.jpg"/></td> + + </tr> + + + +</tbody> +</table> +</body> +</html> \ No newline at end of file Added: WebEditor/src/resources/terminateSCO.html =================================================================== --- WebEditor/src/resources/terminateSCO.html (rev 0) +++ WebEditor/src/resources/terminateSCO.html 2008-05-02 16:39:58 UTC (rev 74) @@ -0,0 +1,14 @@ +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel='stylesheet' href='main.css' type='text/css'> +</head> +<body onload="javascript:run();"> +<script language="JScript"> + function run(){ + window.parent.document.player.showCurrentItem(); + } +</script> + +</body> +</html> \ No newline at end of file Added: WebEditor/src/resources/welcome.html =================================================================== --- WebEditor/src/resources/welcome.html (rev 0) +++ WebEditor/src/resources/welcome.html 2008-05-02 16:39:58 UTC (rev 74) @@ -0,0 +1,9 @@ +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel='stylesheet' href='main.css' type='text/css'> +</head> +<center>Вітаємо.<BR> +Представляємо Вам революційну систему!!!.<BR> +Ви можете набути нових знань та перевірити старі.</center> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-02 23:10:07
|
Revision: 78 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=78&view=rev Author: sem62 Date: 2008-05-02 16:09:45 -0700 (Fri, 02 May 2008) Log Message: ----------- Fixed bug: objectives list in Summary page was not correct. Summary page is ready for 90 %. Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java WebEditor/src/template/SummaryPageModel.html WebEditor/src/template/global/SummaryPage.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-02 22:35:58 UTC (rev 77) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Data/SummaryPageManager.java 2008-05-02 23:09:45 UTC (rev 78) @@ -114,6 +114,7 @@ ItemModel childModel = ItemModels.getModelFromItem(child); if (childModel.getShowOnSummaryPage(child)) { + result.add(getItemId(child)); result.addAll(getShowingItemsIds(child)); } } Modified: WebEditor/src/template/SummaryPageModel.html =================================================================== --- WebEditor/src/template/SummaryPageModel.html 2008-05-02 22:35:58 UTC (rev 77) +++ WebEditor/src/template/SummaryPageModel.html 2008-05-02 23:09:45 UTC (rev 78) @@ -4,12 +4,50 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> <script type="text/javascript" src="global/APIWrapper.js"></script> <script type="text/javascript" src="global/SummaryPage.js"></script> + +<style> +.tbl-border { + color: #555; + background-color: #bbb; +} + +.tbl { + font-size: 11px; + color: #555; + background-color: #fdfced; + padding: 4px; +} + +.tbl1 { + font-size: 11px; + background-color: #fdfced; + padding: 4px; +} + +.tbl2 { + font-size: 11px; + background-color: #fbf8ca; + padding: 4px; +} + +</style> </head> <body onload="Initialize();" onunload="Terminate();"> <div id="page_content"> + <table align='center' cellpadding='0' cellspacing='1' width='85%' class='tbl-border'> + <tr> + <td align='center' width='35' class='tbl2' style='white-space:nowrap'><b>#</b></td> + <td align='center' width='*' class='tbl2' style='white-space:nowrap'><b>Item title</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Min</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Max</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>Raw score</b></td> + <td align='center' width='70' class='tbl2' style='white-space:nowrap'><b>%</b></td> + </tr> + <!--content start--> <!--content end--> + </table> </div> </body> </html> \ No newline at end of file Modified: WebEditor/src/template/global/SummaryPage.js =================================================================== --- WebEditor/src/template/global/SummaryPage.js 2008-05-02 22:35:58 UTC (rev 77) +++ WebEditor/src/template/global/SummaryPage.js 2008-05-02 23:09:45 UTC (rev 78) @@ -1,3 +1,6 @@ +var deep = 0; +var rowNum = 0; + function out(s){ document.write(s); } @@ -2,29 +5,49 @@ +function ins(title, min, max, raw){ + var percents = 100*(raw-min)/(max-min) + " %"; + rowNum++; + + var td = "<td class='tbl"; + td += 1 - (rowNum % 2) + 1; + td += "'>"; + + document.write("<TR>" + td + rowNum); + document.write(td + title); + document.write(td + min); + document.write(td + max); + document.write(td + raw); + document.write(td + percents); +} + function openBlock(title){ - out("Opened block with title = "+title+"<br>\n"); + deep++; } function closeBlock(title){ - out("Closed block with title = "+title+"<br>\n"); + deep--; } function add(title, modelName, id){ - out(title + ". item id = " + id + "(" + modelName + ")<br>\n"); - out("score is: "); - out(getScore(id)); - out("<br>\n"); + for (i=0; i < deep; i++){ + title = " " + title; + } + + ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw")); } function getObjectiveIndex(id){ var count = GetValue("cmi.objectives._count"); - for (i = 0; i < count; i++) - if (GetValue("cmi.objectives." + i + ".id") == id) + for (i = 0; i < count; i++){ + var curr = GetValue("cmi.objectives." + i + ".id"); + if (curr == id){ return i; + } + } return -1; } -function getScore(objectiveID){ - var index = getObjectiveIndex(objectiveID); - var res = GetValue("cmi.objectives." + index + ".score.scaled"); +function getScore(objectiveID, field){ + var index = getObjectiveIndex(objectiveID); + var res = GetValue("cmi.objectives." + index + ".score." + field); return res != null ? res : 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-03 08:54:02
|
Revision: 79 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=79&view=rev Author: sem62 Date: 2008-05-03 01:54:06 -0700 (Sat, 03 May 2008) Log Message: ----------- Summary page working properly. Need do some modification into SummaryPage.js Modified Paths: -------------- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java WebEditor/src/template/SummaryPageModel.html WebEditor/src/template/global/SummaryPage.js Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-02 23:09:45 UTC (rev 78) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/ItemModel.java 2008-05-03 08:54:06 UTC (rev 79) @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.UUID; +import edu.lnu.FireFly.FFManifest.Organization; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; @@ -148,4 +149,16 @@ public abstract boolean getShowOnSummaryPageMenuVisible(); public abstract boolean getShowSummaryPageMenuVisible(); + + public final String getIdentifier(TreeItem anItem) { + if (anItem.getClass() == Item.class){ + return ((Item)anItem).identifier; + } + + if (anItem.getClass() == Organization.class){ + return ((Organization)anItem).identifier; + } + + return null; + } } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-02 23:09:45 UTC (rev 78) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/SummaryPageModel/SummaryPageModel.java 2008-05-03 08:54:06 UTC (rev 79) @@ -44,17 +44,18 @@ } @Override - public boolean updateItemResource(TreeItem anItem, boolean updateSummaryPages) { + public boolean updateItemResource(TreeItem anItem, + boolean updateSummaryPages) { Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(((Item) anItem).identifierref); Template template = new Template(resource.getFullHref(), this); String content = "<script type=\"text/javascript\">" - + getSummaryPageContent(anItem.getParent()) - + "</script>"; + + getSummaryPageContent(anItem.getParent()) + "</script>"; template.setProperty("content", content); + template.setProperty("title", anItem.getTitle()); template.updateResource(); @@ -72,11 +73,14 @@ private String getSummaryPageContent(TreeItem parent) { int childsCount = parent.getChildCount(); - String res = "openBlock(\"" + parent.getTitle() + "\");\n"; + ItemModel model = ItemModels.getModelFromItem(parent); + String res = "openBlock(\"" + parent.getTitle() + "\", \"" + + model.getModelName() + "\", \"" + + model.getIdentifier(parent) + "\");\n"; for (int i = 0; i < childsCount; i++) { TreeItem item = parent.getChild(i); - ItemModel model = ItemModels.getModelFromItem(item); + model = ItemModels.getModelFromItem(item); if (model.getShowOnSummaryPage(item)) { res += getSummaryPageContentItem(item); @@ -97,7 +101,8 @@ if (model.getClass() == SimpleQuestionModel.class || model.getClass() == LectureModel.class) { - return "add(\"" + anItem.getTitle() + "\", \"" + model.getModelName() + "\", \"" + return "add(\"" + anItem.getTitle() + "\", \"" + + model.getModelName() + "\", \"" + ((Item) anItem).identifier + "\");\n"; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java 2008-05-02 23:09:45 UTC (rev 78) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/ItemModels/Template.java 2008-05-03 08:54:06 UTC (rev 79) @@ -20,8 +20,9 @@ public void setProperty(String name, String value) { propertiests.put(name, value); } - - protected String insertPropertyIntoResource(String res, String name, String value){ + + protected String insertPropertyIntoResource(String res, String name, + String value) { try { String startTag = ("<!--" + name + " start-->").toLowerCase(); String endTag = ("<!--" + name + " end-->").toLowerCase(); @@ -50,14 +51,27 @@ } public boolean updateResource() { + boolean copied = WebEditorServiceClient.copyFromTemplate(model + .getClass().getSimpleName() + + ".html", fileName); + + if (!copied){ + return false; + } + String res = WebEditorServiceClient.getFileContent(fileName); - + Iterator<String> iter = propertiests.keySet().iterator(); - while (iter.hasNext()){ + while (iter.hasNext()) { String name = iter.next(); res = insertPropertyIntoResource(res, name, propertiests.get(name)); + + if (res == null){ + System.out.print("Property \"" + name + "\" isn't present.\n"); + return false; + } } - + WebEditorServiceClient.setFileContent(fileName, res); return true; Modified: WebEditor/src/template/SummaryPageModel.html =================================================================== --- WebEditor/src/template/SummaryPageModel.html 2008-05-02 23:09:45 UTC (rev 78) +++ WebEditor/src/template/SummaryPageModel.html 2008-05-03 08:54:06 UTC (rev 79) @@ -35,6 +35,9 @@ <body onload="Initialize();" onunload="Terminate();"> <div id="page_content"> + <Center><h1><!--title start--> + <!--title end--></Center></h1> + <table align='center' cellpadding='0' cellspacing='1' width='85%' class='tbl-border'> <tr> <td align='center' width='35' class='tbl2' style='white-space:nowrap'><b>#</b></td> Modified: WebEditor/src/template/global/SummaryPage.js =================================================================== --- WebEditor/src/template/global/SummaryPage.js 2008-05-02 23:09:45 UTC (rev 78) +++ WebEditor/src/template/global/SummaryPage.js 2008-05-03 08:54:06 UTC (rev 79) @@ -21,7 +21,9 @@ document.write(td + percents); } -function openBlock(title){ +function openBlock(title, model, id){ + title = "<b>" + title + "</b>"; + add(title, model, id); deep++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-06 09:39:00
|
Revision: 89 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=89&view=rev Author: sem62 Date: 2008-05-06 02:39:02 -0700 (Tue, 06 May 2008) Log Message: ----------- * Added php service * Added Settings class. It will collect all settings information. * initalize settings value with applet's params tags. * delete some not needed resource files. Modified Paths: -------------- WebEditor/src/deploy.jardesc WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java WebEditor/src/resources/index.html Added Paths: ----------- WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java WebEditor/src/service/ WebEditor/src/service/config.inc.php WebEditor/src/service/copyFromTemplate.php WebEditor/src/service/getFileContent.php WebEditor/src/service/setFileContent.php Modified: WebEditor/src/deploy.jardesc =================================================================== --- WebEditor/src/deploy.jardesc 2008-05-05 15:58:05 UTC (rev 88) +++ WebEditor/src/deploy.jardesc 2008-05-06 09:39:02 UTC (rev 89) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="WINDOWS-1251" standalone="no"?> <jardesc> - <jar path="E:/ACMContester/out/web/WebEditor/webeditor.jar"/> + <jar path="s:/WebEditor/webeditor.jar"/> <options buildIfNeeded="true" compress="true" descriptionLocation="/webEditor/src/deploy.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/> <storedRefactorings deprecationInfo="true" structuralOnly="false"/> <selectedProjects/> Added: WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java (rev 0) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/Settings.java 2008-05-06 09:39:02 UTC (rev 89) @@ -0,0 +1,42 @@ +package edu.lnu.FireFly.WebEditor; + +public class Settings { + private String courseLocation = ""; + private String templateLocation = ""; + private String serviceLocation = ""; + + public static Settings obj = null; + + public static Settings getInstance(){ + + if (obj == null){ + obj = new Settings(); + } + + return obj; + } + + public String getCourseLocation() { + return courseLocation; + } + + public void setCourseLocation(String courseLocation) { + this.courseLocation = courseLocation; + } + + public String getTemplateLocation() { + return templateLocation; + } + + public void setTemplateLocation(String templateLocation) { + this.templateLocation = templateLocation; + } + + public String getServiceLocation() { + return serviceLocation; + } + + public void setServiceLocation(String serviceLocation) { + this.serviceLocation = serviceLocation; + } +} Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-05 15:58:05 UTC (rev 88) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WSClients/WebEditorServiceClient.java 2008-05-06 09:39:02 UTC (rev 89) @@ -1,51 +1,129 @@ package edu.lnu.FireFly.WebEditor.WSClients; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import edu.lnu.FireFly.WebEditor.Settings; + public class WebEditorServiceClient { - public static String getFileContent(String fName){ - try{ - WSConnection conn = new WSConnection(); - conn.setServiceURL(new URL ("http://localhost:8080/WebEditor/WebEditorServiceService")); - conn.setServiseNameSpace("http://WebEditorServer.FireFly.lnu.edu/"); - String value = GetFileContentWSResponse.getValue(conn.invoke(new GetFileContentWSRequest(fName))); + public static String getFileContent(String fName) { + String result = ""; + try { + // Construct data + String data = URLEncoder.encode("fName", "UTF-8") + "=" + + URLEncoder.encode(fName, "UTF-8"); + + // Send data + URL url = new URL(Settings.getInstance().getServiceLocation() + + "getFileContent.php"); -// value = new String(new sun.misc.BASE64Decoder().decodeBuffer(value)); + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); - return value; - } - catch (Exception e) { + OutputStreamWriter wr = new OutputStreamWriter(conn + .getOutputStream()); + + wr.write(data); + wr.flush(); + + // Get the response + BufferedReader rd = new BufferedReader(new InputStreamReader(conn + .getInputStream())); + String line; + while ((line = rd.readLine()) != null) { + result += line + "\n"; + } + wr.close(); + rd.close(); + } catch (Exception e) { e.printStackTrace(); - return null; } + + return result; } public static void setFileContent(String fName, String content) { - try{ - WSConnection conn = new WSConnection(); - conn.setServiceURL(new URL ("http://localhost:8080/WebEditor/WebEditorServiceService")); - conn.setServiseNameSpace("http://WebEditorServer.FireFly.lnu.edu/"); + String result = ""; + try { + // Construct data + String data = URLEncoder.encode("fName", "UTF-8") + "=" + + URLEncoder.encode(fName, "UTF-8"); + data += "&" + URLEncoder.encode("content", "UTF-8") + "=" + + URLEncoder.encode(content, "UTF-8"); + + // Send data + URL url = new URL(Settings.getInstance().getServiceLocation() + + "setFileContent.php"); - conn.invoke(new SetFileContentWSRequest(fName, content)); -// conn.invoke(new SetFileContentWSRequest(fName, new BASE64Encoder().encode(content.getBytes()))); - } - catch (Exception e) { + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); + + OutputStreamWriter wr = new OutputStreamWriter(conn + .getOutputStream()); + + wr.write(data); + wr.flush(); + + // Get the response + BufferedReader rd = new BufferedReader(new InputStreamReader(conn + .getInputStream())); + String line; + while ((line = rd.readLine()) != null) { + result += line + "\n"; + } + wr.close(); + rd.close(); + } catch (Exception e) { e.printStackTrace(); } + + System.out.println("setFileContent(). result is:"); + System.out.println(result); } - public static boolean copyFromTemplate(String fNameInTemplate, String fNameInCourse){ - try{ - WSConnection conn = new WSConnection(); - conn.setServiceURL(new URL ("http://localhost:8080/WebEditor/WebEditorServiceService")); - conn.setServiseNameSpace("http://WebEditorServer.FireFly.lnu.edu/"); + public static boolean copyFromTemplate(String fNameInTemplate, + String fNameInCourse) { + String result = ""; + try { + // Construct data + String data = URLEncoder.encode("fNameInTemplate", "UTF-8") + "=" + + URLEncoder.encode(fNameInTemplate, "UTF-8"); + data += "&" + URLEncoder.encode("fNameInCourse", "UTF-8") + "=" + + URLEncoder.encode(fNameInCourse, "UTF-8"); + + // Send data + URL url = new URL(Settings.getInstance().getServiceLocation() + + "copyFromTemplate.php"); - return CopyFromTemplateWSResponse.getValue(conn.invoke(new CopyFromTemplateWSRequest(fNameInTemplate, fNameInCourse))); - } - catch (Exception e) { + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); + + OutputStreamWriter wr = new OutputStreamWriter(conn + .getOutputStream()); + + wr.write(data); + wr.flush(); + + // Get the response + BufferedReader rd = new BufferedReader(new InputStreamReader(conn + .getInputStream())); + String line; + while ((line = rd.readLine()) != null) { + result += line + "\n"; + } + wr.close(); + rd.close(); + } catch (Exception e) { e.printStackTrace(); - return false; } + + System.out.println("copyFromTemplate(). result is:"); + System.out.println(result); + + return true; } - } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-05 15:58:05 UTC (rev 88) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-06 09:39:02 UTC (rev 89) @@ -84,6 +84,11 @@ @Override public void init() { + + Settings.getInstance().setCourseLocation(getParameter("courseLocation")); + Settings.getInstance().setServiceLocation(getParameter("serviceLocation")); + Settings.getInstance().setTemplateLocation(getParameter("templateLocation")); + instance = this; initMenu(); @@ -168,7 +173,7 @@ .findResourceByIdentifier(item.identifierref); if (resource != null) { getAppletContext().showDocument( - new URL("http://localhost:8080/WebEditor/course/" + new URL(Settings.getInstance().getCourseLocation() + resource.getFullHref()), "ContentFrame"); System.out.print("redirected\n"); } Modified: WebEditor/src/resources/index.html =================================================================== --- WebEditor/src/resources/index.html 2008-05-05 15:58:05 UTC (rev 88) +++ WebEditor/src/resources/index.html 2008-05-06 09:39:02 UTC (rev 89) @@ -3,7 +3,7 @@ <title>Learning system :: Editor of courses</title> <script type="text/javascript" src="api.js"></script> <script type="text/javascript" src="navigation.js"></script> - + <style> .left-corn { width: 20px; @@ -57,7 +57,7 @@ padding: 4px; } </style> - + </head> <body onUnload="exit_clicked(false);" bgcolor='#215E21'> @@ -86,6 +86,9 @@ <tr height='*'> <td class='side-body'> <applet mayscript="" name="player" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> + <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> + <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template"> </applet> </td> </tr> @@ -113,7 +116,7 @@ </table> </table> </td> - </tr> + </tr> </tbody> </table> </table> Added: WebEditor/src/service/config.inc.php =================================================================== --- WebEditor/src/service/config.inc.php (rev 0) +++ WebEditor/src/service/config.inc.php 2008-05-06 09:39:02 UTC (rev 89) @@ -0,0 +1,6 @@ +<? + $base_dir = "../../"; + + $course_location = $base_dir . "course/"; + $template_location = $base_dir . "WebEditor/template/"; +?> \ No newline at end of file Added: WebEditor/src/service/copyFromTemplate.php =================================================================== --- WebEditor/src/service/copyFromTemplate.php (rev 0) +++ WebEditor/src/service/copyFromTemplate.php 2008-05-06 09:39:02 UTC (rev 89) @@ -0,0 +1,10 @@ +<? + require_once("config.inc.php"); + + if (isset($_POST['fNameInTemplate']) && isset($_POST['fNameInCourse'])){ + $log = fopen('service.txt', 'a'); + $source = $template_location . $_POST['fNameInTemplate']; + $dest = $course_location . $_POST['fNameInCourse']; + echo copy($source, $dest); + } +?> \ No newline at end of file Added: WebEditor/src/service/getFileContent.php =================================================================== --- WebEditor/src/service/getFileContent.php (rev 0) +++ WebEditor/src/service/getFileContent.php 2008-05-06 09:39:02 UTC (rev 89) @@ -0,0 +1,7 @@ +<? + require_once("config.inc.php"); + + if (isset($_POST['fName'])){ + readfile ($course_location . $_POST['fName']); + } +?> \ No newline at end of file Added: WebEditor/src/service/setFileContent.php =================================================================== --- WebEditor/src/service/setFileContent.php (rev 0) +++ WebEditor/src/service/setFileContent.php 2008-05-06 09:39:02 UTC (rev 89) @@ -0,0 +1,9 @@ +<? + require_once("config.inc.php"); + + if (isset($_POST['fName']) && isset($_POST['content'])){ + $fp = fopen($course_location . $_POST['fName'], 'w'); + fwrite($fp, $_POST['content']); + fclose($fp); + } +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |