Index: lams_central/web/lams_authoring.swf =================================================================== diff -u -rca5d6a85e553398cbfbb1b05a41b5c50de33fcd3 -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c Binary files differ Index: lams_central/web/lams_authoring_library.swf =================================================================== diff -u -rca5d6a85e553398cbfbb1b05a41b5c50de33fcd3 -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c Binary files differ Index: lams_flash/src/central/flash/lams_authoring.fla =================================================================== diff -u -r17c7416b68abe17d68e7b58439d1b1a878f1b39c -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c Binary files differ Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/AlertDialog.as =================================================================== diff -u --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/AlertDialog.as (revision 0) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/AlertDialog.as (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -0,0 +1,307 @@ +/*************************************************************************** + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ************************************************************************ + */ + +import mx.controls.* +import mx.utils.* +import mx.managers.* +import mx.events.* + +import mx.transitions.Tween +import mx.transitions.easing.* + +import org.lamsfoundation.lams.common.* +import org.lamsfoundation.lams.common.ui.* +import org.lamsfoundation.lams.common.util.* +import org.lamsfoundation.lams.common.style.* +import org.lamsfoundation.lams.common.dict.* + +/* +* Dialogue to collect a string form the user, adn call some specified action on OK +* @author DC +*/ +class org.lamsfoundation.lams.common.ui.AlertDialog extends MovieClip { + + public static var ALERT:Number = 0; + public static var CONFIRM:Number = 1; + + private var _bgpanel:MovieClip; + + private var ok_btn:Button; //OK+Cancel buttons + private var cancel_btn:Button; + + private var _title:TextArea; + private var _message:TextArea; // Alert message text + + private var _okHandler:Function; + private var _cancelHandler:Function; + + private var _type:Number; + + private var fm:FocusManager; //Reference to focus manager + private var themeManager:ThemeManager; //Theme manager + + + //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 + */ + function AlertDialog(){ + //Set up this class to use the Flash event delegation model + EventDispatcher.initialize(this); + + this._visible = false; + + //set the reference to the StyleManager + themeManager = ThemeManager.getInstance(); + + //Create a clip that will wait a frame before dispatching init to give components time to setup + this.onEnterFrame = init; + } + + /** + * Called a frame after movie attached to allow components to initialise + */ + private function init():Void{ + //Delete the enterframe dispatcher + delete this.onEnterFrame; + + ok_btn.visible = false; + cancel_btn.visible = false; + + ok_btn.addEventListener('click', Delegate.create(this, onOkPress)); + cancel_btn.addEventListener('click', Delegate.create(this, onCancelPress)); + + //get focus manager + set focus to OK button, focus manager is available to all components through getFocusManager + fm = _parent.getFocusManager(); + fm.enabled = true; + + setStyles(); + + setSize(200, 200); + + if(_parent == ApplicationParent.root) + setPosition(Stage.width/2, Stage.height/2); + else + setPosition(Stage.width/2 - _parent._x, Stage.height/2 - _parent._y); + + contentLoaded(); + + } + + /** + * method called by content when it is loaded + */ + public function contentLoaded() { + this._visible = true; + + //dispatch an onContentLoaded event to listeners + dispatchEvent({type:'contentLoaded',target:this}); + } + + public function setOKButton(lbl:String,fn:Function){ + if(lbl != null) { + ok_btn.label = lbl; + ok_btn.visible = true; + } + + _okHandler = fn; + var w = StringUtils.getButtonWidthForStr(lbl); + Debugger.log("width: " + w, Debugger.CRITICAL, "setCancelButton", "AlertDialog"); + + if(w > ok_btn.width) + ok_btn.setSize(w, ok_btn.height); + } + + public function setCancelButton(lbl:String,fn:Function){ + if(lbl != null) { + cancel_btn.label = lbl; + cancel_btn.visible = true; + } + + _cancelHandler = fn; + var w = StringUtils.getButtonWidthForStr(lbl); + Debugger.log("width: " + w, Debugger.CRITICAL, "setCancelButton", "AlertDialog"); + + if(w > cancel_btn.width) + cancel_btn.setSize(w, cancel_btn.height); + + } + + public function set title(__title:String) { + modTextArea(_title); + _title.text = __title; + + _title._y = _bgpanel._y + 10; + _title._x = -_title._width/2; + } + + public function set message(msg:String) { + modTextArea(_message); + _message.text = "
" + msg + "
"; + + _message._x = -_message._width/2; + _message._y = _title._y + _title._height; + setMessageHeight(); + } + + private function modTextArea(_obj:TextArea) { + _obj._alpha = 0; + _obj.enabled = false; + _obj.html = true; + } + + private function setMessageHeight() { + + this.createTextField("message", this.getNextHighestDepth(), -1000, -1000, 0, 0); + + var msg_text = this["message"]; + + msg_text.html = true; + msg_text.htmlText = _message.text; + msg_text.wordWrap = true; + msg_text.autoSize = true; + msg_text._width = _message.width; + + Debugger.log('textHeight: ' + msg_text.textHeight, Debugger.CRITICAL, 'setMessageHeight', 'org.lamsfoundation.lams.Alertialog'); + _message.setSize(_message.width, msg_text.textHeight); + + } + + public function set type(a:Number) { + _type = a; + + if(_type == AlertDialog.ALERT) { + // centre OK button + ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width/2; + ok_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10; + + } else { + + cancel_btn._x = _bgpanel._x + _bgpanel._width/2 - cancel_btn._width/2; + cancel_btn._y = _bgpanel._y + _bgpanel._height - ok_btn._height - 10; + + ok_btn._x = _bgpanel._x + _bgpanel._width/2 - ok_btn._width/2; + ok_btn._y = cancel_btn._y - ok_btn._height - 5; + + } + + Debugger.log("bg width: " + _bgpanel._width + " setting height: " + Math.round(Math.abs(_bgpanel._y) + Math.abs(ok_btn._y) + ok_btn._height), Debugger.CRITICAL, "type", "AlertDialog"); + + } + + /** + * Event fired by StyleManager class to notify listeners that Theme has changed + * it is up to listeners to then query Style Manager for relevant style info + */ + public function themeChanged(event:Object):Void{ + if(event.type=='themeChanged') { + //Theme has changed so update objects to reflect new styles + setStyles(); + }else { + Debugger.log('themeChanged event broadcast with an object.type not equal to "themeChanged"',Debugger.CRITICAL,'themeChanged','org.lamsfoundation.lams.WorkspaceDialog'); + } + } + + /** + * Called on initialisation and themeChanged event handler + */ + private function setStyles(){ + + //Get the button style from the style manager and apply to both buttons + var styleObj = themeManager.getStyleObject('button'); + ok_btn.setStyle('styleName',styleObj); + cancel_btn.setStyle('styleName',styleObj); + + styleObj = themeManager.getStyleObject('textarea'); + _message.setStyle("styleName", styleObj); + _message.setStyle("disabledColor", "0xFFFFFF"); + + _title.setStyle("styleName", styleObj); + _title.setStyle("disabledColor", "0xFFFFFF"); + + } + + /** Fade out on click if normal Alert (not Confirm)*/ + private function onOkPress(evt:Object) { + + var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true); + tween_obj_handler.onMotionFinished = Delegate.create(this, ok); + } + + /** Fade out on click if normal Alert (not Confirm)*/ + private function onCancelPress(evt:Object) { + + var tween_obj_handler:Object = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0.25, true); + tween_obj_handler.onMotionFinished = Delegate.create(this, cancel); + + } + + /** + * Called by the cancel button + */ + private function cancel(){ + Debugger.log('cancel click',Debugger.GEN,'cancel','org.lamsfoundation.lams.common.ui.InputDialog'); + + this.removeMovieClip(); + _cancelHandler(); + } + + /** + * Called by the OK button + */ + public function ok(){ + Debugger.log('ok click',Debugger.GEN,'ok','org.lamsfoundation.lams.common.ui.InputDialog'); + + _okHandler(); + this.removeMovieClip(); + } + + /** + * If an alert was spawned by this dialog this method is called when it's closed + */ + private function alertClosed(){ + this.removeMovieClip(); + } + + /** + * Main resize method, called by scrollpane container/parent + */ + public function setSize(w:Number,h:Number):Void{ + _bgpanel._width = w; + _bgpanel._height = h; + } + + public function setPosition(x:Number, y:Number):Void { + _x = x; + _y = y; + + _bgpanel._x = -_bgpanel._width/2; + _bgpanel._Y = -_bgpanel._height/2; + } + +} \ No newline at end of file Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as (.../Dialog.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/Dialog.as (.../Dialog.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -40,49 +40,52 @@ class org.lamsfoundation.lams.common.ui.Dialog { private static var _inputDialog:MovieClip; - private static var _inputInstructions:String; + private static var _inputInstructions:String; + private static var _inputTitle:String; + private static var _inputMessage:String; + private static var _inputType:Number; private static var _inputOkButtonLabel:String; private static var _inputCancelButtonLabel:String; private static var _inputOkHandler:Function; private static var _inputCancelHandler:Function; - -// - //private static var _dialogInstances:Array; - //private static var _currentIndex:Number; -// - ///** - //* This will return a reference to the Dialog that is currently in focus. If there are none in focus is will return null - //*/ - //public static function getDialogWithFocus():Object{ - //_dialogInstances = []; - //_currentIndex = null; - //return null; - //} -// -// - ///** - //* Constuctor - //* @param target The target movieclip in which - //*/ - //function Dialog(target:MovieClip,linkageId:String,x:Number,y:Number,w:Number,h:Number){ - ////Create a new window for the dialog - //trace('Dialog'); - ////componentInstance.createClassObject(linkageName, instanceName, depth, initObject); - //} -// static function createPopUp(path:MovieClip,cls:Object, initobj:Object):MovieClip{ - trace('Dialog.createPopUp'); return path.createClassChildAtDepth(cls, DepthManager.kTopmost, initobj); } + static function createAlertDialog(title:String, msg:String, okButtonLabel:String, cancelButtonLabel:String, okHandler:Function, cancelHandler:Function, type:Number) { + _inputTitle = title; + _inputMessage = msg; + _inputOkButtonLabel = okButtonLabel; + _inputCancelButtonLabel = cancelButtonLabel; + _inputOkHandler = okHandler; + _inputCancelHandler = cancelHandler; + + if(type != null) _inputType = type; + + var target:MovieClip; + + if(ApplicationParent.getInstance().getWorkspace().getWV().isOpen) { + target = ApplicationParent.getInstance().getWorkspace().getWV().workspaceDialog; + } else { + target = ApplicationParent.root; + } + + _inputDialog = target.attachMovie('alertDialog', 'alertDialog', DepthManager.kTopmost, {_x:0, _y:0}); + + //Assign dialog load handler + _inputDialog.addEventListener('contentLoaded', Proxy.create(org.lamsfoundation.lams.common.ui.Dialog,alertDialogLoaded)); + + } + static function createInputDialog(instructions:String, okButtonLabel:String, cancelButtonLabel:String, okHandler:Function, cancelHandler:Function){ _inputInstructions = instructions; _inputOkButtonLabel = okButtonLabel; _inputCancelButtonLabel = cancelButtonLabel; _inputOkHandler = okHandler; _inputCancelHandler = cancelHandler; _inputDialog = PopUpManager.createPopUp(ApplicationParent.root, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'InputDialog'}); + //Assign dialog load handler _inputDialog.addEventListener('contentLoaded',Proxy.create(org.lamsfoundation.lams.common.ui.Dialog,inputDialogLoaded)); } @@ -97,7 +100,22 @@ evt.target.scrollContent.setOKButton(_inputOkButtonLabel,_inputOkHandler); evt.target.scrollContent.setCancelButton(_inputCancelButtonLabel,_inputCancelButtonLabel); + } + + static function alertDialogLoaded(evt:Object) { + + Debugger.log('!evt.type:'+evt.type,Debugger.GEN,'alertDialogLoaded','org.lamsfoundation.lams.common.ui.Dialog'); + //Set up handlers and labels + Debugger.log('!evt.target:'+evt.target,Debugger.GEN,'inputDialogLoaded','org.lamsfoundation.lams.common.ui.Dialog'); + + evt.target.title = _inputTitle; + evt.target.message = _inputMessage; + evt.target.setOKButton(_inputOkButtonLabel,_inputOkHandler); + evt.target.setCancelButton(_inputCancelButtonLabel,_inputCancelHandler); + + evt.target.type = (_inputType != null) ? _inputType : AlertDialog.ALERT; + } } \ No newline at end of file Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as =================================================================== diff -u -r9d3bd5bd2814fd52c12c81266be61f30b522ec01 -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as (.../LFMessage.as) (revision 9d3bd5bd2814fd52c12c81266be61f30b522ec01) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFMessage.as (.../LFMessage.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -21,12 +21,15 @@ * ************************************************************************ */ + +import org.lamsfoundation.lams.common.ApplicationParent import org.lamsfoundation.lams.common.ui.* import org.lamsfoundation.lams.common.util.* import org.lamsfoundation.lams.common.dict.* + import mx.controls.Alert; +import mx.managers.* - /** * LFMessage * @@ -35,51 +38,84 @@ class LFMessage{ //Declarations - private var _ref:Object; - private var _fn:String; - private var title:String; + private var _ref:Object; + private var _fn:String; + private var title:String; - //Constructor - function LFMessage() { - //enable accesibility for the Alert - mx.accessibility.AlertAccImpl.enableAccessibility(); - title = Dictionary.getValue('al_alert') - } + //Constructor + function LFMessage() { + //enable accesibility for the Alert + mx.accessibility.AlertAccImpl.enableAccessibility(); + title = Dictionary.getValue('al_alert') + } -/** + /** * Shows an alert dialogue. specify the OK Handler and icon. * @usage * @param msg Message to display * @param okHandler TO execute on click - use the proxy function * @param icon string linkage name of icon in library - */ + public static function showMessageAlert(msg ,okHandler, icon){ var alt:Alert; //TODO: increase line breaks to account for stoopid bug in MMs alert. // if an icon is being used then the width of the icon is not taken into account //msg += "\n \n \n \n "; - Alert.okLabel = Dictionary.getValue('al_ok'); + Alert.okLabel = Dictionary.getValue('al_ok'); + if(okHandler != undefined){ - alt = Alert.show(msg,Dictionary.getValue('al_alert'),Alert.OK,null,okHandler,null,Alert.OK); + alt = Alert.show(msg + newline + "\n ", Dictionary.getValue('al_alert') + "\t\t\t\t\t", Alert.OK, null, okHandler, null, Alert.OK); }else{ - alt = Alert.show(msg,Dictionary.getValue('al_alert'),Alert.OK,null,null,null,Alert.OK); - } + alt = Alert.show(msg + newline + "\n ", Dictionary.getValue('al_alert') + "\t\t\t\t\t", Alert.OK, null, null, null, Alert.OK); + } + + alt.buttonWidth = 50; } + */ -/** + public static function showMessageAlert(msg, okHandler){ + var title:String = "" + Dictionary.getValue('al_alert') + "\n"; + + if(okHandler != undefined){ + Dialog.createAlertDialog(title, msg, Dictionary.getValue('al_ok'), null, okHandler, null, AlertDialog.ALERT); + }else{ + Dialog.createAlertDialog(title, msg, Dictionary.getValue('al_ok'), null, null, null, AlertDialog.ALERT); + } + } + + public static function showMessageConfirm(msg:String, okHandler:Function, cancelHandler:Function, okLabel:String, cancelLabel:String, msgTitle:String){ + if(msgTitle == null){ + msgTitle = Dictionary.getValue('al_confirm'); + } + + var title:String = "" + msgTitle + "\n"; + + if(!okLabel){ + okLabel = Dictionary.getValue('al_ok'); + } + + if(!cancelLabel){ + cancelLabel = Dictionary.getValue('al_cancel'); + } + + Dialog.createAlertDialog(title, msg, okLabel, cancelLabel, okHandler, cancelHandler, AlertDialog.CONFIRM); + } + + /** * Shows an alert confirm dialogue. It is centred in the root time line and diplays the standard LAMS alert icon * @usage * @param msg The message to display * @param handler A handler for the click events broadcast when the buttons are clicked. In addition to the standard click event object properties, there is an additional detail property, which contains the flag value of the button that was clicked (Alert.OK, Alert.CANCEL, Alert.YES, Alert.NO). This handler can be a function or an object * @return - */ + / public static function showMessageConfirm(msg:String,okHandler:Function, cancelHandler:Function, okLabel:String, cancelLabel:String, msgTitle:String){ var alt:Alert; if(msgTitle == null){ msgTitle = Dictionary.getValue('al_confirm'); } + var handlerObj = new Object(); handlerObj.click = function(e){ if(e.detail == Alert.OK){ @@ -90,6 +126,7 @@ Debugger.log('Unknown event detail form confirm:'+e.detail,Debugger.CRITICAL,"showMessageConfirm",'LFMessage'); } } + if(okLabel){ Alert.okLabel = okLabel; }else{ @@ -100,8 +137,9 @@ }else{ Alert.cancelLabel= Dictionary.getValue('al_cancel'); } - alt = Alert.show(msg,msgTitle,Alert.OK | Alert.CANCEL, null, handlerObj, null, Alert.OK); - } + alt = Alert.show(msg, msgTitle, Alert.OK | Alert.CANCEL, null, handlerObj, null, Alert.OK); + } + */ public function get reference():Object{ return _ref; @@ -111,62 +149,4 @@ return _fn; } - - /** - * this function is in mx.controls.alertClasses.AlertForm and i think it has a bug in getting a size with an icon - * -* @private -* get size according to contents of form - - function getSize(Void):Object - { - trace("DAVES OVERRIDE"); - var s:Object = new Object(); - s.height = buttons[0].height + (3 * 8); - var tf2:Object = _parent.back_mc.title_mc._getTextFormat(); - extent = tf2.getTextExtent2(_parent.title) ; - s.width = Math.max( Math.max(2, buttons.length) * (buttons[0].width + 8),(extent.width) + 4 + 8); - var tf:Object = text_mc._getTextFormat(); - extent = tf.getTextExtent2(_parent.text); - - // stick the text in the measuring TextField and let it flow baby - textMeasure_mc._width = 2*s.width; - textMeasure_mc.setNewTextFormat(text_mc._getTextFormat()); - textMeasure_mc.text = _parent.text; - - // now the TextField height should have been adjusted since its' autoFlow - s.height += textMeasure_mc.textHeight + 8; - var numlines:Number = Math.ceil(textMeasure_mc.textHeight / extent.height); - - if (numlines > 1) - { - extent.width = 2* s.width; - text_mc.wordWrap = true; - } - - -//width is larger of buttons or text but not more than twice as wide as buttons -// add extra 8 to extent.width for the 8 pixel galley on the right side - - var width:Number = Math.min(extent.width + 4 + 8, 2 * s.width); - var bWidth = s.width; - s.width = Math.max(width, s.width) + 8 ; - if (icon_mc != undefined) - { - -//calculate the additional width if we add the icon - - extent.width += icon_mc.width + 8; - width = Math.min(extent.width + 4 + 8, 2 * bWidth); - s.width = Math.max(width, s.width) + 8 ; - -//increase size if bigger - - var i:Number = icon_mc.height - (numlines * (extent.height + 4)); - if (i > 0) - s.height += i; - } - return s; - } - */ } \ No newline at end of file Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as (.../LFWindow.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ui/LFWindow.as (.../LFWindow.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -38,7 +38,6 @@ //Declarations //Static vars public static var symbolOwner:Object = Window; - //public static var symbolName:String = 'LFWindow'; private static var MIN_WIDTH = 160; //Minimum window dimensions private static var MIN_HEIGHT = 120; @@ -67,10 +66,8 @@ } public function init():Void { - //trace('init'); super.init(); - //LFWindow contains a scroll pane which contains the content. contentPath = 'ScrollPane'; @@ -92,7 +89,7 @@ //Assign scroll pane content content.contentPath = _scrollContentPath; - if (_scrollContentPath == "AboutLams"){ + if (_scrollContentPath == "AboutLams" || _scrollContentPath == "AlertDialog"){ resize_mc._visible = false } @@ -105,18 +102,17 @@ centre(); this._visible = true; setUpFinished = true; + this.removeEventListener('complete',scrollLoaded); } - public function createChildren(Void):Void { - //trace('createChildren'); + public function createChildren(Void):Void { super.createChildren(); //TODO DI-13/05/05 add the code to handle dynamic button addition //Add extra buttons as required - //Attach resize and set up resize handling - //resize_mc._visible = viewResize + //Attach resize and set up resize handling resize_mc = this.createChildAtDepth('resize',DepthManager.kTop); resize_mc.resize_btn.useHandCursor = false; @@ -136,6 +132,7 @@ } this.startDrag(); } + //On release / releaseOutside stop the drag and kill onEnterFrame handler resize_mc.resize_btn.onRelease = resize_mc.resize_btn.onReleaseOutside = function (){ this.stopDrag(); @@ -144,7 +141,6 @@ } public function draw(Void):Void { - //trace('draw'); //Call the super methods and size after a draw. super.draw(); size(); @@ -154,7 +150,6 @@ * called when object is sized, e.g. draw, setSize etc. */ public function size(Void):Void { - //trace('size') super.size(); //If the content is too small then put in scroll bars @@ -170,8 +165,12 @@ content.vScrollPolicy = 'off'; } - //content.setSize(width,height); - if(setUpFinished){ + if(_scrollContentPath = "AlertDialog") { + content.vScrollPolicy = 'off'; + content.hScrollPolicy = 'off'; + } + + if(setUpFinished){ content.content.setSize(width-MARGIN_WIDTH,height-MARGIN_HEIGHT); } @@ -191,7 +190,6 @@ * Centres the window on the stage */ public function centre() { - //trace('centre'); //Calculate centre this._x = Stage.width/2 - this.width/2; this._y = Stage.height/2 - this.height/2; @@ -201,7 +199,6 @@ * overrides UIObject.setStyle to provide custom style setting */ public function setStyle(styleName:String,styleObj:Object){ - //trace('setstyle'); //Pass it up the inheritance chain to set any inherited styles or non-custom/LAMS style properties super.setStyle(styleName,styleObj); //Pass on to the scrollpane as the theme color doesn't seem to inherit correctly from the Window parent Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as =================================================================== diff -u -r9d3bd5bd2814fd52c12c81266be61f30b522ec01 -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as (.../LFError.as) (revision 9d3bd5bd2814fd52c12c81266be61f30b522ec01) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/LFError.as (.../LFError.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -21,6 +21,7 @@ * ************************************************************************ */ +import org.lamsfoundation.lams.common.ui.* import org.lamsfoundation.lams.common.util.* import org.lamsfoundation.lams.common.dict.* import mx.controls.Alert; @@ -53,7 +54,7 @@ } public function showErrorAlert(okHandler){ - title = Dictionary.getValue('al_alert') + /**title = Dictionary.getValue('al_alert') var a:Alert; Alert.okLabel = Dictionary.getValue('al_ok'); @@ -65,7 +66,9 @@ }else{ a = Alert.show(message,title,Alert.OK,null,null,null,Alert.OK); } + */ + LFMessage.showMessageAlert(message, okHandler); } /** * Shows an alert confirm dialogue. It is centred in the root time line and diplays the standard LAMS alert icon @@ -75,6 +78,7 @@ * @return */ public static function showSendErrorRequest(msg:String, msgTitle:String, okHandler:Function, cancelHandler:Function){ + /** var alt:Alert; var customTitle = Dictionary.getValue(msgTitle) var handlerObj = new Object(); @@ -93,8 +97,11 @@ } alt = Alert.show(msg, customTitle ,Alert.OK | Alert.CANCEL, null, handlerObj, null, Alert.OK); + */ - //alt.setSize(250, 600); + var customTitle = Dictionary.getValue(msgTitle); + LFMessage.showMessageConfirm(msg, okHandler, cancelHandler, Dictionary.getValue('al_send'), Dictionary.getValue('al_cancel'), customTitle); + } public function get reference():Object{ Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -282,6 +282,19 @@ return false; } + } + + public static function getButtonWidthForStr(s:String):Number { + var spacing:Number = 10; + if(s != null) { + var container = ApplicationParent.root; + container.createTextField("str", container.getNextHighestDepth(), -1000, -1000, 0, 0); + var str:TextField = container["str"]; + str.text = s; + return str.textWidth + spacing; + } else { + return 0; + } } } \ No newline at end of file Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceDialog.as (.../WorkspaceDialog.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -1014,6 +1014,8 @@ ddm.prevLearningDesignID = null; } + workspaceView.isOpen = false; + //close parent window if(container != null) { container.deletePopUp(); } else { _container.deletePopUp(); } Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as =================================================================== diff -u -rd7823922f404944822957e6c051bc0f1335a76de -r8ad16270f3ad03c45a8aa73353d6485bd2631a1c --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as (.../WorkspaceView.as) (revision d7823922f404944822957e6c051bc0f1335a76de) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/ws/WorkspaceView.as (.../WorkspaceView.as) (revision 8ad16270f3ad03c45a8aa73353d6485bd2631a1c) @@ -45,6 +45,9 @@ private var _workspaceController:WorkspaceController; private var dialog:MovieClip; private var cursorContainer:MovieClip; + + private var _isOpen:Boolean; + /* * Constructor */ @@ -64,11 +67,11 @@ public function viewUpdate(event:Object):Void{ Debugger.log('Recived an Event dispather UPDATE!, updateType:'+event.updateType+', target'+event.target,4,'viewUpdate','WorkspaceView'); //Update view from info object - //Debugger.log('Recived an UPDATE!, updateType:'+infoObj.updateType,4,'update','CanvasView'); - var wm:WorkspaceModel = event.target; - //set a ref to the controller for ease (sorry mvc guru) - _workspaceController = getController(); - switch (event.updateType){ + var wm:WorkspaceModel = event.target; + + //set a ref to the controller for ease (sorry mvc guru) + _workspaceController = getController(); + switch (event.updateType){ case 'CREATE_DIALOG' : createWorkspaceDialog(event.data.pos,event.data.tabToSelect); break; @@ -90,17 +93,14 @@ var m:WorkspaceModel = WorkspaceModel(getModel()); var mode:String = m.currentMode - trace('mode returned: ' + mode); var classRoot:MovieClip; + if(mode == Workspace.MODE_READONLY){ classRoot = org.lamsfoundation.lams.monitoring.Application.root; } else { classRoot = org.lamsfoundation.lams.authoring.Application.root; } - - trace('root output: ' + classRoot); - //Check to see whether this should be a centered or positioned dialog if(typeof(pos)=='string'){ dialog = PopUpManager.createPopUp(classRoot, LFWindow, true,{title:Dictionary.getValue('ws_dlg_title'),closeButton:true,scrollContentPath:'workspaceDialog'}); @@ -113,7 +113,7 @@ //Assign dialog load handler dialog.addEventListener('contentLoaded',Delegate.create(_workspaceController,_workspaceController.openDialogLoaded)); - + isOpen = true; } /** @@ -141,16 +141,25 @@ * @usage * @return */ - public function get workspaceDialog ():MovieClip { + public function get workspaceDialog():MovieClip { return dialog; } + + public function get isOpen():Boolean { + return _isOpen; + } + + public function set isOpen(a:Boolean):Void { + _isOpen = a; + } public function get workspaceCursor():MovieClip { return cursorContainer; } public function clearDialog():Void { dialog.deletePopUp(); + isOpen = false; } /** * Overrides method in abstract view to ensure cortect type of controller is returned