Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r824971b0cf569d491a0c79688bb10bf8f3a4fecb -r28cb89c7a2c83239db0370b3911eee3195de4f23 Binary files differ Index: lams_central/src/flash/lams_learner.fla =================================================================== diff -u -r7ce8611afc044c14b82e79210ed2ff09417d0708 -r28cb89c7a2c83239db0370b3911eee3195de4f23 Binary files differ Index: lams_central/src/flash/org/lamsfoundation/lams/learner/Application.as =================================================================== diff -u -re086f5d90ca62afa48cc8399e1d0afe735ca542d -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_central/src/flash/org/lamsfoundation/lams/learner/Application.as (.../Application.as) (revision e086f5d90ca62afa48cc8399e1d0afe735ca542d) +++ lams_central/src/flash/org/lamsfoundation/lams/learner/Application.as (.../Application.as) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -27,20 +27,21 @@ import org.lamsfoundation.lams.common.util.*; // utilities import org.lamsfoundation.lams.common.ui.*; // ui import org.lamsfoundation.lams.common.*; -import org.lamsfoundation.lams.learner.Header; +import org.lamsfoundation.lams.learner.*; import org.lamsfoundation.lams.learner.ls.*; import mx.managers.* import mx.utils.* /** * Application - LAMS Learner Application * @author Mitchell Seaton */ -class org.lamsfoundation.lams.learner.Application extends ApplicationParent { +class Application extends ApplicationParent { // private constants //private var _comms:Communication; private var _lesson:Lesson; private var _header_mc:MovieClip; + private var _scratchpad_mc:MovieClip; private static var SHOW_DEBUGGER:Boolean = false; private static var MODULE:String = "learner"; @@ -51,6 +52,8 @@ public static var HEADER_Y:Number = 0; public static var LESSON_X:Number = 0; public static var LESSON_Y:Number = 82; + public static var SPAD_X:Number = 0; + public static var SPAD_H:Number = 200; private static var APP_ROOT_DEPTH:Number = 10; //depth of the application root @@ -78,7 +81,7 @@ private var _lessonLoaded:Boolean; //Lesson loaded flag private var _headerLoaded:Boolean; - + private var _scratchpadLoaded:Boolean; //Application instance is stored as a static in the application class @@ -96,6 +99,7 @@ _lessonLoaded = false; _headerLoaded = false; + _scratchpadLoaded = false; _module = Application.MODULE; @@ -208,6 +212,8 @@ _lesson = new Lesson(_appRoot_mc,LESSON_X,LESSON_Y); _lesson.addEventListener('load',Proxy.create(this,UIElementLoaded)); + _scratchpad_mc = _appRoot_mc.createChildAtDepth('LScratchPad', DepthManager.kTop, {_x:SPAD_X, _y:Stage.height-SPAD_H}); + _scratchpad_mc.addEventListener('load', Proxy.create(this, UIElementLoaded)); } /** @@ -254,11 +260,15 @@ trace('Header loaded...'); _headerLoaded = true; break; + case 'Scratchpad' : + trace('Scratchpad loaded...'); + _scratchpadLoaded = true; + break; default: } //If all of them are loaded set UILoad accordingly - if(_lessonLoaded && _headerLoaded){ + if(_lessonLoaded && _headerLoaded && _scratchpadLoaded){ _UILoaded=true; } @@ -298,7 +308,8 @@ } Header(_header_mc).resize(w); - _lesson.setSize(w,h-LESSON_Y); + Scratchpad(_scratchpad_mc).resize(w); + _lesson.setSize(w,h-LESSON_Y-SPAD_H); } @@ -372,6 +383,10 @@ return Header(_header_mc); } + public function getScratchpad():Scratchpad{ + return Scratchpad(_scratchpad_mc); + } + public function showDebugger():Void{ _debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'}); } Index: lams_central/src/flash/org/lamsfoundation/lams/learner/Scratchpad.as =================================================================== diff -u --- lams_central/src/flash/org/lamsfoundation/lams/learner/Scratchpad.as (revision 0) +++ lams_central/src/flash/org/lamsfoundation/lams/learner/Scratchpad.as (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -0,0 +1,208 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ************************************************************************ + */ + +import mx.controls.* +import mx.utils.* +import mx.managers.* +import mx.events.* + +import org.lamsfoundation.lams.learner.*; +import org.lamsfoundation.lams.common.Sequence; +import org.lamsfoundation.lams.common.ToolTip; +import org.lamsfoundation.lams.common.util.*; +import org.lamsfoundation.lams.common.dict.*; +import org.lamsfoundation.lams.common.style.*; + +class Scratchpad extends MovieClip { + + private var _scratchpad_mc:MovieClip; + private var _container:MovieClip; // Holding Container + private var view_btn:MovieClip; // buttons + private var save_btn:MovieClip; + private var view_lbl:TextField; + private var save_lbl:TextField; + private var _tip:ToolTip; + + public static var SCRATCHPAD_ID:Number = 3; + + // notebook data entry fields + private var _title:Label; + private var title_txi:TextInput; + private var entry_txa:TextArea; + + private var panel:MovieClip; //The underlaying panel base + + private var _tm:ThemeManager; + private var _dictionary:Dictionary; + + //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher + private var dispatchEvent:Function; + public var addEventListener:Function; + public var removeEventListener:Function; + + + /** + * constructor + */ + public function Scratchpad() { + //Set up this class to use the Flash event delegation model + EventDispatcher.initialize(this); + + _tm = ThemeManager.getInstance(); + _tip = new ToolTip(); + _dictionary = Dictionary.getInstance(); + _dictionary.addEventListener('init',Proxy.create(this,setLabels)); + + //let it wait one frame to set up the components. + MovieClipUtils.doLater(Proxy.create(this,init)); + + } + + /** + * Called a frame after movie attached to allow components to initialise + */ + public function init(){ + trace('initialing header..'); + + //Delete the enterframe dispatcher + delete this.onEnterFrame; + + _scratchpad_mc = this; + + setLabels(); + resize(Stage.width); + + + //Add event listeners for resume and exit buttons + + view_btn.onRelease = function(){ + trace('on releasing view all button..'); + Application.getInstance().getScratchpad().viewNotebookEntries(); + } + + save_btn.onRelease = function(){ + trace('on releasing save button..'); + + Application.getInstance().getScratchpad().saveEntry(); + } + + view_btn.onRollOver = Proxy.create(this,this['showToolTip'], view_btn, "sp_view_tooltip"); + view_btn.onRollOut = Proxy.create(this,this['hideToolTip']); + + save_btn.onRollOver = Proxy.create(this,this['showToolTip'], save_btn, "sp_save_tooltip"); + save_btn.onRollOut = Proxy.create(this,this['hideToolTip']); + + this.onEnterFrame = setLabels; + + } + + public function showToolTip(btnObj, btnTT:String):Void{ + + var Xpos = Application.HEADER_X+ 5; + var Ypos = Application.HEADER_Y+( btnObj._y+btnObj._height)+2; + var ttHolder = Application.tooltip; + var ttMessage = Dictionary.getValue(btnTT); + var ttWidth = 150 + _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth); + + } + + public function hideToolTip():Void{ + _tip.CloseToolTip(); + } + + private function setStyles(){ + var styleObj = _tm.getStyleObject('smallLabel'); + _title.setStyle('styleName', styleObj); + + styleObj = _tm.getStyleObject('textarea'); + title_txi.setStyle('styleName', styleObj); + entry_txa.setStyle('styleName', styleObj); + + } + + private function setLabels(){ + //Set the text for buttons + view_lbl.text = Dictionary.getValue('sp_view_lbl'); + save_lbl.text = Dictionary.getValue('sp_save_lbl'); + _title.text = Dictionary.getValue('sp_title_lbl'); + + setStyles(); + + delete this.onEnterFrame; + + dispatchEvent({type:'load',target:this}); + + } + + public function saveEntry(){ + // TODO: validate entry fields + + var dto:Object = getDataForSaving(); + + var callback:Function = Proxy.create(this,onStoreEntryResponse); + + Application.getInstance().getComms().sendAndReceive(dto,"notebook/storeNotebookEntry",callback,false); + + } + + public function getDataForSaving():Object { + var dto:Object = new Object(); + dto.externalID = Number(_root.lessonID); + dto.externalIDType = SCRATCHPAD_ID; + dto.externalSignature = "SCRATCHPAD"; + dto.userID = Number(_root.userID); + dto.title = title_txi.text; + dto.entry = entry_txa.text; + + return dto; + } + + public function onStoreEntryResponse(r):Void { + if(r instanceof LFError){ + r.showErrorAlert(); + }else{ + // TODO: SUCCESS MESSAGE/CLEAR FIELDS + title_txi.text = ""; + entry_txa.text = ""; + } + } + + public function viewNotebookEntries(){ + // TODO: Pop-up for Notebook Entries + + var notebook_url:String = _root.serverURL + 'notebook/notebook.jsp?userID=' + _root.userID + '&lessonID='+_root.lessonID; + + JsPopup.getInstance().launchPopupWindow(notebook_url, 'Notebook', 410, 640, true, true, false, false, false); + + } + + public function resize(width:Number){ + panel._width = width; + + } + + function get className():String { + return 'Scratchpad'; + } +} \ No newline at end of file Index: lams_central/web/flashxml/learner/en_AU_dictionary.xml =================================================================== diff -u -rc03fcd31d64907620a3be76e65f3bb632ffc9dd9 -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_central/web/flashxml/learner/en_AU_dictionary.xml (.../en_AU_dictionary.xml) (revision c03fcd31d64907620a3be76e65f3bb632ffc9dd9) +++ lams_central/web/flashxml/learner/en_AU_dictionary.xml (.../en_AU_dictionary.xml) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -1 +1 @@ -
getDictionary3hd_resume_lblResumeLabel for Resume buttonhd_exit_lblExitLabel for Exit buttonln_export_btnExportLabel for Export buttonsys_error_msg_startA following system error has occurred:Common System error message starting linesys_error_msg_finishYou may need to re-start this browser window to continue. Do you want to save the following information about this error to help fix this problem?Common System error message finish paragraphsys_errorSystem ErrorSystem Error alert window titleal_alertAlertGeneric title for Alert windowal_cancelCancelCancel on alert dialogal_confirmConfirmTo Confirm title for LFErroral_okOKOK on alert dialogal_validation_act_unreachedYou can't open the Activity as yu haven't reached it yet.Alert message when clicking on an unreached activity in the progess bar.hd_resume_tooltipJump to your current activitytool tip message for resume buttonhd_exit_tooltipExit the Learner Environment and close the browser windowtool tip message for exit buttonln_export_tooltipExport your contributions to this lessontool tip message for export buttoncompleted_act_tooltipDouble click to review this completed activitytool tip message for completed activity iconcurrent_act_tooltipDouble click to participate in the current activitytool tip message for current activity iconal_doubleclick_todoactivitySorry, you have not reached this activity yetalert message when user double click on the todo activity in the sequence in learner progress \ No newline at end of file +
getDictionary3Label for Resume buttonResumehd_resume_lblLabel for Exit buttonExithd_exit_lblLabel for Export buttonExportln_export_btnCommon System error message starting lineA following system error has occurred:sys_error_msg_startCommon System error message finish paragraphYou may need to re-start this browser window to continue. Do you want to save the following information about this error to help fix this problem?sys_error_msg_finishSystem Error alert window titleSystem Errorsys_errorGeneric title for Alert windowAlertal_alertCancel on alert dialogCancelal_cancelTo Confirm title for LFErrorConfirmal_confirmOK on alert dialogOKal_okAlert message when clicking on an unreached activity in the progess bar.You can't open the Activity as you haven't reached it yet.al_validation_act_unreachedtool tip message for resume buttonJump to your current activityhd_resume_tooltiptool tip message for exit buttonExit the Learner Environment and close the browser windowhd_exit_tooltiptool tip message for export buttonExport your contributions to this lessonln_export_tooltiptool tip message for completed activity iconDouble click to review this completed activitycompleted_act_tooltiptool tip message for current activity iconDouble click to participate in the current activitycurrent_act_tooltipalert message when user double click on the todo activity in the sequence in learner progressSorry, you have not reached this activity yetal_doubleclick_todoactivitysp_view_lblView AllLabel for View All buttonsp_save_lblSaveLabel for Save buttonsp_view_tooltipView all notebook entriestool tip message for view all buttonsp_save_tooltipSave your notebook entrytool tip message for save buttonsp_title_lblTitleLabel for title field of scratchpad (notebook) \ No newline at end of file Index: lams_central/web/flashxml/learner/en_dictionary.xml =================================================================== diff -u -rc03fcd31d64907620a3be76e65f3bb632ffc9dd9 -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_central/web/flashxml/learner/en_dictionary.xml (.../en_dictionary.xml) (revision c03fcd31d64907620a3be76e65f3bb632ffc9dd9) +++ lams_central/web/flashxml/learner/en_dictionary.xml (.../en_dictionary.xml) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -1 +1 @@ -
getDictionary3hd_resume_lblResumeLabel for Resume buttonhd_exit_lblExitLabel for Exit buttonln_export_btnExportLabel for Export buttonsys_error_msg_startA following system error has occurred:Common System error message starting linesys_error_msg_finishYou may need to re-start this browser window to continue. Do you want to save the following information about this error to help fix this problem?Common System error message finish paragraphsys_errorSystem ErrorSystem Error alert window titleal_alertAlertGeneric title for Alert windowal_cancelCancelCancel on alert dialogal_confirmConfirmTo Confirm title for LFErroral_okOKOK on alert dialogal_validation_act_unreachedYou can't open the Activity as yu haven't reached it yet.Alert message when clicking on an unreached activity in the progess bar.hd_resume_tooltipJump to your current activitytool tip message for resume buttonhd_exit_tooltipExit the Learner Environment and close the browser windowtool tip message for exit buttonln_export_tooltipExport your contributions to this lessontool tip message for export buttoncompleted_act_tooltipDouble click to review this completed activitytool tip message for completed activity iconcurrent_act_tooltipDouble click to participate in the current activitytool tip message for current activity iconal_doubleclick_todoactivitySorry, you have not reached this activity yetalert message when user double click on the todo activity in the sequence in learner progress \ No newline at end of file +
getDictionary3Label for Resume buttonResumehd_resume_lblLabel for Exit buttonExithd_exit_lblLabel for Export buttonExportln_export_btnCommon System error message starting lineA following system error has occurred:sys_error_msg_startCommon System error message finish paragraphYou may need to re-start this browser window to continue. Do you want to save the following information about this error to help fix this problem?sys_error_msg_finishSystem Error alert window titleSystem Errorsys_errorGeneric title for Alert windowAlertal_alertCancel on alert dialogCancelal_cancelTo Confirm title for LFErrorConfirmal_confirmOK on alert dialogOKal_okAlert message when clicking on an unreached activity in the progess bar.You can't open the Activity as you haven't reached it yet.al_validation_act_unreachedtool tip message for resume buttonJump to your current activityhd_resume_tooltiptool tip message for exit buttonExit the Learner Environment and close the browser windowhd_exit_tooltiptool tip message for export buttonExport your contributions to this lessonln_export_tooltiptool tip message for completed activity iconDouble click to review this completed activitycompleted_act_tooltiptool tip message for current activity iconDouble click to participate in the current activitycurrent_act_tooltipalert message when user double click on the todo activity in the sequence in learner progressSorry, you have not reached this activity yetal_doubleclick_todoactivitysp_view_lblView AllLabel for View All buttonsp_save_lblSaveLabel for Save buttonsp_view_tooltipView all notebook entriestool tip message for view all buttonsp_save_tooltipSave your notebook entrytool tip message for save buttonsp_title_lblTitleLabel for title field of scratchpad (notebook) \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml =================================================================== diff -u -r03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87 -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87) +++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -184,6 +184,7 @@ + Index: lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java =================================================================== diff -u -r03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87 -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision 03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87) +++ lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -26,19 +26,27 @@ package org.lamsfoundation.lams.notebook.service; import java.util.ArrayList; +import java.util.Hashtable; import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import org.lamsfoundation.lams.notebook.dao.INotebookEntryDAO; import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.wddx.FlashMessage; +import org.lamsfoundation.lams.util.wddx.WDDXProcessor; +import org.lamsfoundation.lams.util.wddx.WDDXTAGS; + public class CoreNotebookService implements ICoreNotebookService { private static Logger log = Logger.getLogger(CoreNotebookService.class); private INotebookEntryDAO notebookEntryDAO; - + + protected MessageService messageService; + public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String title, String entry) { @@ -77,9 +85,7 @@ saveOrUpdateNotebookEntry(notebookEntry); } - /* Private methods */ - - private void saveOrUpdateNotebookEntry(NotebookEntry notebookEntry) { + public void saveOrUpdateNotebookEntry(NotebookEntry notebookEntry) { notebookEntryDAO.saveOrUpdate(notebookEntry); } @@ -88,4 +94,18 @@ public void setNotebookEntryDAO(INotebookEntryDAO notebookEntryDAO) { this.notebookEntryDAO = notebookEntryDAO; } + + /** + * Set i18n MessageService + */ + public void setMessageService(MessageService messageService) { + this.messageService = messageService; + } + + /** + * Get i18n MessageService + */ + public MessageService getMessageService() { + return this.messageService; + } } Index: lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java =================================================================== diff -u -r03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87 -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java (.../ICoreNotebookService.java) (revision 03abda6aa87eacaaab4f2ffa4fdd2daa98bebf87) +++ lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java (.../ICoreNotebookService.java) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -28,6 +28,7 @@ import java.util.List; import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.util.MessageService; public interface ICoreNotebookService { @@ -41,4 +42,8 @@ void updateEntry(Long uid, String title, String entry); void updateEntry(NotebookEntry notebookEntry); + + void saveOrUpdateNotebookEntry(NotebookEntry notebookEntry); + + MessageService getMessageService(); } Index: lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java =================================================================== diff -u -ref1856fa9aad85d21a7a72900bb93040c821032b -r28cb89c7a2c83239db0370b3911eee3195de4f23 --- lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision ef1856fa9aad85d21a7a72900bb93040c821032b) +++ lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision 28cb89c7a2c83239db0370b3911eee3195de4f23) @@ -176,4 +176,9 @@ /** Crash Dump Specific Tags */ public static final String CRASH_DUMP_BATCH="crashDataBatch"; + /** Notebook Specific Tags */ + public static final String EXTERNAL_ID = "externalID"; + public static final String EXTERNAL_ID_TYPE = "externalIDType"; + public static final String EXTERNAL_SIG = "externalSignature"; + public static final String ENTRY = "entry"; }