Index: lams_flash/src/central/flex/BranchManager/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u --- lams_flash/src/central/flex/BranchManager/.settings/org.eclipse.core.resources.prefs (revision 0) +++ lams_flash/src/central/flex/BranchManager/.settings/org.eclipse.core.resources.prefs (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,3 @@ +#Wed Nov 05 10:25:30 EST 2008 +eclipse.preferences.version=1 +encoding/=utf-8 Index: lams_flash/src/central/flex/VideoRecorder/.actionScriptProperties =================================================================== diff -u -r9e5810552421069be4735057d56b8ca4dc2464b2 -r251a00158d63f52d7482fa4aa2decb78d6322a8c --- lams_flash/src/central/flex/VideoRecorder/.actionScriptProperties (.../.actionScriptProperties) (revision 9e5810552421069be4735057d56b8ca4dc2464b2) +++ lams_flash/src/central/flex/VideoRecorder/.actionScriptProperties (.../.actionScriptProperties) (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -1,7 +1,9 @@ - + + + Index: lams_flash/src/central/flex/VideoRecorder/.project =================================================================== diff -u -r9e5810552421069be4735057d56b8ca4dc2464b2 -r251a00158d63f52d7482fa4aa2decb78d6322a8c --- lams_flash/src/central/flex/VideoRecorder/.project (.../.project) (revision 9e5810552421069be4735057d56b8ca4dc2464b2) +++ lams_flash/src/central/flex/VideoRecorder/.project (.../.project) (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -17,6 +17,11 @@ + [source path] flex + 2 + D:/LAMS_HEAD/lams_flash/src/common/flex + + bin-release 2 D:/LAMS_HEAD/lams_tool_videorecorder/web/includes/flash Index: lams_flash/src/central/flex/VideoRecorder/src/AddCommentPopUp.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorder/src/AddCommentPopUp.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorder/src/AddCommentPopUp.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + Index: lams_flash/src/central/flex/VideoRecorder/src/GetRecordingDetailsPopUp.mxml =================================================================== diff -u -r9e5810552421069be4735057d56b8ca4dc2464b2 -r251a00158d63f52d7482fa4aa2decb78d6322a8c --- lams_flash/src/central/flex/VideoRecorder/src/GetRecordingDetailsPopUp.mxml (.../GetRecordingDetailsPopUp.mxml) (revision 9e5810552421069be4735057d56b8ca4dc2464b2) +++ lams_flash/src/central/flex/VideoRecorder/src/GetRecordingDetailsPopUp.mxml (.../GetRecordingDetailsPopUp.mxml) (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -1,30 +1,45 @@ - + - - + - + Index: lams_flash/src/central/flex/VideoRecorder/src/HTTPServices.as =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorder/src/HTTPServices.as (revision 0) +++ lams_flash/src/central/flex/VideoRecorder/src/HTTPServices.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,187 @@ +// creates an httpservice and gets video recordings +private function getRecordingsFromServer(sortBy:String, sortDirection:String):void{ + var videoRecorderActions:HTTPService = new HTTPService(); + videoRecorderActions.url = serverUrl; + videoRecorderActions.method = "POST"; + videoRecorderActions.resultFormat = "e4x"; + videoRecorderActions.request.method = "getRecordingsByToolSessionIdAndUserId"; + videoRecorderActions.request.toolSessionId = toolSessionId; + videoRecorderActions.request.userId = userId; + + if(allowLearnerVideoVisibility || mode == "teacher") + videoRecorderActions.request.getAll = true; + else + videoRecorderActions.request.getAll = false; + + videoRecorderActions.request.sortBy = sortBy; + videoRecorderActions.request.sortDirection = sortDirection; + videoRecorderActions.request.allowLearnerVideoVisibility = allowLearnerVideoVisibility; + videoRecorderActions.addEventListener(ResultEvent.RESULT, getRecordingsSuccessHandler); + videoRecorderActions.addEventListener(FaultEvent.FAULT, getRecordingsFaultHandler); + + videoRecorderActions.send(); +} + +// handler for successful get recordings +private function getRecordingsSuccessHandler(e:ResultEvent):void { + // update the rating from the servlet's returned xml + videoRecordings = e.result.recording; +} + +// fault handler for get recordings + private function getRecordingsFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} + +// creates an httpservice and saves a video recording +private function saveRecordingToServer(userId:int, title:String, description:String, filename:String, rating:Number, toolSessionId:int, recordingId:int):void{ + var videoRecorderActions:HTTPService = new HTTPService(); + videoRecorderActions.url = serverUrl; + videoRecorderActions.method = "POST"; + videoRecorderActions.resultFormat = "e4x"; + videoRecorderActions.request.method = "saveRecording"; + videoRecorderActions.request.userId = userId; + videoRecorderActions.request.recordingId = recordingId; + videoRecorderActions.request.title = title; + videoRecorderActions.request.rating = rating; + videoRecorderActions.request.description = description; + videoRecorderActions.request.filename = filename; + + if(!allowUseCamera && allowUseVoice) + videoRecorderActions.request.isJustSound = true; + else + videoRecorderActions.request.isJustSound = false; + + videoRecorderActions.request.toolSessionId = toolSessionId; + videoRecorderActions.addEventListener(ResultEvent.RESULT, saveRecordingSuccessHandler); + videoRecorderActions.addEventListener(FaultEvent.FAULT, saveRecordingFaultHandler); + + videoRecorderActions.send(); +} + +// handler for successful save recording +private function saveRecordingSuccessHandler(e:ResultEvent):void { + // update the video recordings + getRecordingsFromServer(sortButtonGroup.sortBy, sortButtonGroup.sortDirection); +} + +// fault handler for save recording + private function saveRecordingFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} + +// creates an httpservice and saves a comment +private function saveCommentToServer(toolSessionId:int, recordingId:int, userId:int, commentId:int, comment:String):void{ + var videoRecorderActions:HTTPService = new HTTPService(); + videoRecorderActions.url = serverUrl; + videoRecorderActions.method = "POST"; + videoRecorderActions.resultFormat = "e4x"; + videoRecorderActions.request.method = "saveComment"; + videoRecorderActions.request.userId = userId; + videoRecorderActions.request.recordingId = recordingId; + videoRecorderActions.request.comment = comment; + videoRecorderActions.request.commentId = commentId; + videoRecorderActions.request.toolSessionId = toolSessionId; + + videoRecorderActions.addEventListener(ResultEvent.RESULT, saveCommentSuccessHandler); + videoRecorderActions.addEventListener(FaultEvent.FAULT, saveCommentFaultHandler); + + videoRecorderActions.send(); +} + +// handler for successful save recording +private function saveCommentSuccessHandler(e:ResultEvent):void { + // update the comments with the xml sent back from the servlet + videoInformation.printComments(XMLList(e.result)); + + // update the video recordings + getRecordingsFromServer(sortButtonGroup.sortBy, sortButtonGroup.sortDirection); + + // scroll the video information box to the position of the "Comments:" label + videoInformation.verticalScrollPosition = videoInformation.commentsLabel.y; +} + +// fault handler for save recording + private function saveCommentFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} + +// creates an httpservice and saves a rating +private function saveRatingToServer(toolSessionId:int, ratingId:int, userId:int, rating:Number, recordingId:int):void{ + var videoRecorderActions:HTTPService = new HTTPService(); + videoRecorderActions.url = serverUrl; + videoRecorderActions.method = "POST"; + videoRecorderActions.resultFormat = "e4x"; + videoRecorderActions.request.method = "saveRating"; + videoRecorderActions.request.userId = userId; + videoRecorderActions.request.rating = rating; + videoRecorderActions.request.ratingId = ratingId; + videoRecorderActions.request.toolSessionId = toolSessionId; + videoRecorderActions.request.recordingId = recordingId; + + videoRecorderActions.addEventListener(ResultEvent.RESULT, saveRatingSuccessHandler); + videoRecorderActions.addEventListener(FaultEvent.FAULT, saveRatingFaultHandler); + + videoRecorderActions.send(); +} + +// handler for successful save rating +private function saveRatingSuccessHandler(e:ResultEvent):void { + // set the last rating clicked to voted + ratingClicked.voted = true; + + // set its average value + ratingClicked.value = e.result.rating; + + // set the user's voted value + ratingClicked.votedValue = e.result.userRating; + + // update the video recordings + getRecordingsFromServer(sortButtonGroup.sortBy, sortButtonGroup.sortDirection); +} + +// fault handler for save rating + private function saveRatingFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} + +// creates an httpservice and saves a rating +private function deleteRecordingFromServer(recordingId:int):void{ + var videoRecorderActions:HTTPService = new HTTPService(); + videoRecorderActions.url = serverUrl; + videoRecorderActions.method = "POST"; + videoRecorderActions.resultFormat = "e4x"; + videoRecorderActions.request.method = "deleteRecording"; + videoRecorderActions.request.recordingId = recordingId; + + videoRecorderActions.addEventListener(ResultEvent.RESULT, deleteRecordingSuccessHandler); + videoRecorderActions.addEventListener(FaultEvent.FAULT, deleteRecordingFaultHandler); + + videoRecorderActions.send(); +} + +// handler for successful delete recording +private function deleteRecordingSuccessHandler(e:ResultEvent):void { + // update the video recordings + getRecordingsFromServer(sortButtonGroup.sortBy, sortButtonGroup.sortDirection); + + // reset video information + videoInformation.resetInformation(); + + videoDisplay.reset(); +} + +// fault handler for detele recording + private function deleteRecordingFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} + +// handler for successful save preview image +private function savePreviewImageSuccessHandler(e:ResultEvent):void { + Alert.show(e.toString()); +} + +// fault handler for save preview image + private function savePreviewImageFaultHandler(e:FaultEvent):void { + Alert.show(e.toString()); +} \ No newline at end of file Fisheye: Tag 251a00158d63f52d7482fa4aa2decb78d6322a8c refers to a dead (removed) revision in file `lams_flash/src/central/flex/VideoRecorder/src/ResizeableTextArea.mxml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_flash/src/central/flex/VideoRecorder/src/VideoInformation.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorder/src/VideoInformation.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorder/src/VideoInformation.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_flash/src/central/flex/VideoRecorder/src/VideoProfile.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorder/src/VideoProfile.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorder/src/VideoProfile.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + Index: lams_flash/src/central/flex/VideoRecorder/src/VideoRecorder.mxml =================================================================== diff -u -r9e5810552421069be4735057d56b8ca4dc2464b2 -r251a00158d63f52d7482fa4aa2decb78d6322a8c --- lams_flash/src/central/flex/VideoRecorder/src/VideoRecorder.mxml (.../VideoRecorder.mxml) (revision 9e5810552421069be4735057d56b8ca4dc2464b2) +++ lams_flash/src/central/flex/VideoRecorder/src/VideoRecorder.mxml (.../VideoRecorder.mxml) (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -1,95 +1,122 @@ - - + + - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + + + + + + + + - + + + + + + + Index: lams_flash/src/central/flex/VideoRecorder/src/assets/styles/main.css =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorder/src/assets/styles/main.css (revision 0) +++ lams_flash/src/central/flex/VideoRecorder/src/assets/styles/main.css (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,35 @@ +Application { + backgroundColor:#ECECEC; + backgroundGradientColors:#ECECEC,#ECECEC; +} + +Tile { + top: 10; + bottom: 10; + left: 10; + right: 10; +} + +Label { + color: #000000; + fontWeight: bold; + fontSize: 14; +} + +.box { + borderColor: #50B2CB; + cornerRadius: 10; + borderStyle: solid; + borderThickness: 1; + paddingBottom: 10; + paddingTop: 10; + paddingLeft: 10; + paddingRight: 10; + backgroundColor:#ffffff; + backgroundAlpha: 1; +} + +Text { + fontSize: 12; + fontWeight: normal; +} \ No newline at end of file Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/.actionScriptProperties =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/.actionScriptProperties (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/.actionScriptProperties (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/.flexProperties =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/.flexProperties (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/.flexProperties (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,2 @@ + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/.project =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/.project (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/.project (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,30 @@ + + + VideoRecorderFCKEditor + + + + + + com.adobe.flexbuilder.project.flexbuilder + + + + + + com.adobe.flexbuilder.project.flexnature + com.adobe.flexbuilder.project.actionscriptnature + + + + [source path] flex + 2 + D:/LAMS_HEAD/lams_flash/src/common/flex + + + bin-release + 2 + D:/LAMS_HEAD/lams_tool_videorecorder/web/includes/flash + + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/.settings/org.eclipse.core.resources.prefs (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/.settings/org.eclipse.core.resources.prefs (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,3 @@ +#Tue Jan 27 10:24:47 EST 2009 +eclipse.preferences.version=1 +encoding/=utf-8 Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/AC_OETags.js =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/AC_OETags.js (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/AC_OETags.js (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,278 @@ +// Flash Player Version Detection - Rev 1.6 +// Detect Client Browser type +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved. +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } else if (versionRevision[0] == "b") { + versionRevision = versionRevision.substring(1); + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + str += ''; + } else { + str += ' 0 && typeof o[0].SetVariable != "undefined") { + return o[0]; + } + else if (e.length > 0 && typeof e[0].SetVariable != "undefined") { + return e[0]; + } + } + } + else { + var o = document.getElementsByTagName("object"); + var e = document.getElementsByTagName("embed"); + if (e.length > 0 && typeof e[0].SetVariable != "undefined") { + return e[0]; + } + else if (o.length > 0 && typeof o[0].SetVariable != "undefined") { + return o[0]; + } + else if (o.length > 1 && typeof o[1].SetVariable != "undefined") { + return o[1]; + } + } + return undefined; + } + + function getPlayers() { + var players = []; + if (players.length == 0) { + var tmp = document.getElementsByTagName('object'); + players = tmp; + } + + if (players.length == 0 || players[0].object == null) { + var tmp = document.getElementsByTagName('embed'); + players = tmp; + } + return players; + } + + function getIframeHash() { + var doc = getHistoryFrame().contentWindow.document; + var hash = String(doc.location.search); + if (hash.length == 1 && hash.charAt(0) == "?") { + hash = ""; + } + else if (hash.length >= 2 && hash.charAt(0) == "?") { + hash = hash.substring(1); + } + return hash; + } + + /* Get the current location hash excluding the '#' symbol. */ + function getHash() { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + var idx = document.location.href.indexOf('#'); + return (idx >= 0) ? document.location.href.substr(idx+1) : ''; + } + + /* Get the current location hash excluding the '#' symbol. */ + function setHash(hash) { + // It would be nice if we could use document.location.hash here, + // but it's faulty sometimes. + if (hash == '') hash = '#' + document.location.hash = hash; + } + + function createState(baseUrl, newUrl, flexAppUrl) { + return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null }; + } + + /* Add a history entry to the browser. + * baseUrl: the portion of the location prior to the '#' + * newUrl: the entire new URL, including '#' and following fragment + * flexAppUrl: the portion of the location following the '#' only + */ + function addHistoryEntry(baseUrl, newUrl, flexAppUrl) { + + //delete all the history entries + forwardStack = []; + + if (browser.ie) { + //Check to see if we are being asked to do a navigate for the first + //history entry, and if so ignore, because it's coming from the creation + //of the history iframe + if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) { + currentHref = initialHref; + return; + } + if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) { + newUrl = baseUrl + '#' + defaultHash; + flexAppUrl = defaultHash; + } else { + // for IE, tell the history frame to go somewhere without a '#' + // in order to get this entry into the browser history. + getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl; + } + setHash(flexAppUrl); + } else { + + //ADR + if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) { + initialState = createState(baseUrl, newUrl, flexAppUrl); + } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) { + backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl); + } + + if (browser.safari) { + // for Safari, submit a form whose action points to the desired URL + if (browser.version <= 419.3) { + var file = window.location.pathname.toString(); + file = file.substring(file.lastIndexOf("/")+1); + getFormElement().innerHTML = '
'; + //get the current elements and add them to the form + var qs = window.location.search.substring(1); + var qs_arr = qs.split("&"); + for (var i = 0; i < qs_arr.length; i++) { + var tmp = qs_arr[i].split("="); + var elem = document.createElement("input"); + elem.type = "hidden"; + elem.name = tmp[0]; + elem.value = tmp[1]; + document.forms.historyForm.appendChild(elem); + } + document.forms.historyForm.submit(); + } else { + top.location.hash = flexAppUrl; + } + // We also have to maintain the history by hand for Safari + historyHash[history.length] = flexAppUrl; + _storeStates(); + } else { + // Otherwise, write an anchor into the page and tell the browser to go there + addAnchor(flexAppUrl); + setHash(flexAppUrl); + } + } + backStack.push(createState(baseUrl, newUrl, flexAppUrl)); + } + + function _storeStates() { + if (browser.safari) { + getRememberElement().value = historyHash.join(","); + } + } + + function handleBackButton() { + //The "current" page is always at the top of the history stack. + var current = backStack.pop(); + if (!current) { return; } + var last = backStack[backStack.length - 1]; + if (!last && backStack.length == 0){ + last = initialState; + } + forwardStack.push(current); + } + + function handleForwardButton() { + //summary: private method. Do not call this directly. + + var last = forwardStack.pop(); + if (!last) { return; } + backStack.push(last); + } + + function handleArbitraryUrl() { + //delete all the history entries + forwardStack = []; + } + + /* Called periodically to poll to see if we need to detect navigation that has occurred */ + function checkForUrlChange() { + + if (browser.ie) { + if (currentHref != document.location.href && currentHref + '#' != document.location.href) { + //This occurs when the user has navigated to a specific URL + //within the app, and didn't use browser back/forward + //IE seems to have a bug where it stops updating the URL it + //shows the end-user at this point, but programatically it + //appears to be correct. Do a full app reload to get around + //this issue. + if (browser.version < 7) { + currentHref = document.location.href; + document.location.reload(); + } else { + if (getHash() != getIframeHash()) { + // this.iframe.src = this.blankURL + hash; + var sourceToSet = historyFrameSourcePrefix + getHash(); + getHistoryFrame().src = sourceToSet; + } + } + } + } + + if (browser.safari) { + // For Safari, we have to check to see if history.length changed. + if (currentHistoryLength >= 0 && history.length != currentHistoryLength) { + //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|")); + // If it did change, then we have to look the old state up + // in our hand-maintained array since document.location.hash + // won't have changed, then call back into BrowserManager. + currentHistoryLength = history.length; + var flexAppUrl = historyHash[currentHistoryLength]; + if (flexAppUrl == '') { + //flexAppUrl = defaultHash; + } + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + _storeStates(); + } + } + if (browser.firefox) { + if (currentHref != document.location.href) { + var bsl = backStack.length; + + var urlActions = { + back: false, + forward: false, + set: false + } + + if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) { + urlActions.back = true; + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + handleBackButton(); + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if (forwardStack.length > 0) { + if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) { + urlActions.forward = true; + handleForwardButton(); + } + } + + // ok, that didn't work, try someplace back in the history stack + if ((bsl >= 2) && (backStack[bsl - 2])) { + if (backStack[bsl - 2].flexAppUrl == getHash()) { + urlActions.back = true; + handleBackButton(); + } + } + + if (!urlActions.back && !urlActions.forward) { + var foundInStacks = { + back: -1, + forward: -1 + } + + for (var i = 0; i < backStack.length; i++) { + if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.back = i; + } + } + for (var i = 0; i < forwardStack.length; i++) { + if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) { + arbitraryUrl = true; + foundInStacks.forward = i; + } + } + handleArbitraryUrl(); + } + + // Firefox changed; do a callback into BrowserManager to tell it. + currentHref = document.location.href; + var flexAppUrl = getHash(); + if (flexAppUrl == '') { + //flexAppUrl = defaultHash; + } + //ADR: to fix multiple + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + pl[i].browserURLChange(flexAppUrl); + } + } else { + getPlayer().browserURLChange(flexAppUrl); + } + } + } + //setTimeout(checkForUrlChange, 50); + } + + /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */ + function addAnchor(flexAppUrl) + { + if (document.getElementsByName(flexAppUrl).length == 0) { + getAnchorElement().innerHTML += "" + flexAppUrl + ""; + } + } + + var _initialize = function () { + if (browser.ie) + { + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html"); + } + } + historyFrameSourcePrefix = iframe_location + "?"; + var src = historyFrameSourcePrefix; + + var iframe = document.createElement("iframe"); + iframe.id = 'ie_historyFrame'; + iframe.name = 'ie_historyFrame'; + //iframe.src = historyFrameSourcePrefix; + try { + document.body.appendChild(iframe); + } catch(e) { + setTimeout(function() { + document.body.appendChild(iframe); + }, 0); + } + } + + if (browser.safari) + { + var rememberDiv = document.createElement("div"); + rememberDiv.id = 'safari_rememberDiv'; + document.body.appendChild(rememberDiv); + rememberDiv.innerHTML = ''; + + var formDiv = document.createElement("div"); + formDiv.id = 'safari_formDiv'; + document.body.appendChild(formDiv); + + var reloader_content = document.createElement('div'); + reloader_content.id = 'safarireloader'; + var scripts = document.getElementsByTagName('script'); + for (var i = 0, s; s = scripts[i]; i++) { + if (s.src.indexOf("history.js") > -1) { + html = (new String(s.src)).replace(".js", ".html"); + } + } + reloader_content.innerHTML = ''; + document.body.appendChild(reloader_content); + reloader_content.style.position = 'absolute'; + reloader_content.style.left = reloader_content.style.top = '-9999px'; + iframe = reloader_content.getElementsByTagName('iframe')[0]; + + if (document.getElementById("safari_remember_field").value != "" ) { + historyHash = document.getElementById("safari_remember_field").value.split(","); + } + + } + + if (browser.firefox) + { + var anchorDiv = document.createElement("div"); + anchorDiv.id = 'firefox_anchorDiv'; + document.body.appendChild(anchorDiv); + } + + //setTimeout(checkForUrlChange, 50); + } + + return { + historyHash: historyHash, + backStack: function() { return backStack; }, + forwardStack: function() { return forwardStack }, + getPlayer: getPlayer, + initialize: function(src) { + _initialize(src); + }, + setURL: function(url) { + document.location.href = url; + }, + getURL: function() { + return document.location.href; + }, + getTitle: function() { + return document.title; + }, + setTitle: function(title) { + try { + backStack[backStack.length - 1].title = title; + } catch(e) { } + //if on safari, set the title to be the empty string. + if (browser.safari) { + if (title == "") { + try { + var tmp = window.location.href.toString(); + title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#")); + } catch(e) { + title = ""; + } + } + } + document.title = title; + }, + setDefaultURL: function(def) + { + defaultHash = def; + def = getHash(); + //trailing ? is important else an extra frame gets added to the history + //when navigating back to the first page. Alternatively could check + //in history frame navigation to compare # and ?. + if (browser.ie) + { + window['_ie_firstload'] = true; + var sourceToSet = historyFrameSourcePrefix + def; + var func = function() { + getHistoryFrame().src = sourceToSet; + window.location.replace("#" + def); + setInterval(checkForUrlChange, 50); + } + try { + func(); + } catch(e) { + window.setTimeout(function() { func(); }, 0); + } + } + + if (browser.safari) + { + currentHistoryLength = history.length; + if (historyHash.length == 0) { + historyHash[currentHistoryLength] = def; + var newloc = "#" + def; + window.location.replace(newloc); + } else { + //alert(historyHash[historyHash.length-1]); + } + //setHash(def); + setInterval(checkForUrlChange, 50); + } + + + if (browser.firefox || browser.opera) + { + var reg = new RegExp("#" + def + "$"); + if (window.location.toString().match(reg)) { + } else { + var newloc ="#" + def; + window.location.replace(newloc); + } + setInterval(checkForUrlChange, 50); + //setHash(def); + } + + }, + + /* Set the current browser URL; called from inside BrowserManager to propagate + * the application state out to the container. + */ + setBrowserURL: function(flexAppUrl, objectId) { + if (browser.ie && typeof objectId != "undefined") { + currentObjectId = objectId; + } + //fromIframe = fromIframe || false; + //fromFlex = fromFlex || false; + //alert("setBrowserURL: " + flexAppUrl); + //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ; + + var pos = document.location.href.indexOf('#'); + var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href; + var newUrl = baseUrl + '#' + flexAppUrl; + + if (document.location.href != newUrl && document.location.href + '#' != newUrl) { + currentHref = newUrl; + addHistoryEntry(baseUrl, newUrl, flexAppUrl); + currentHistoryLength = history.length; + } + + return false; + }, + + browserURLChange: function(flexAppUrl) { + var objectId = null; + if (browser.ie && currentObjectId != null) { + objectId = currentObjectId; + } + pendingURL = ''; + + if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) { + var pl = getPlayers(); + for (var i = 0; i < pl.length; i++) { + try { + pl[i].browserURLChange(flexAppUrl); + } catch(e) { } + } + } else { + try { + getPlayer(objectId).browserURLChange(flexAppUrl); + } catch(e) { } + } + + currentObjectId = null; + } + + } + +})(); + +// Initialization + +// Automated unit testing and other diagnostics + +function setURL(url) +{ + document.location.href = url; +} + +function backButton() +{ + history.back(); +} + +function forwardButton() +{ + history.forward(); +} + +function goForwardOrBackInHistory(step) +{ + history.go(step); +} + +//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); }); +(function(i) { + var u =navigator.userAgent;var e=/*@cc_on!@*/false; + var st = setTimeout; + if(/webkit/i.test(u)){ + st(function(){ + var dr=document.readyState; + if(dr=="loaded"||dr=="complete"){i()} + else{st(arguments.callee,10);}},10); + } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){ + document.addEventListener("DOMContentLoaded",i,false); + } else if(e){ + (function(){ + var t=document.createElement('doc:rdy'); + try{t.doScroll('left'); + i();t=null; + }catch(e){st(arguments.callee,0);}})(); + } else{ + window.onload=i; + } +})( function() {BrowserHistory.initialize();} ); Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/history/historyFrame.html =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/history/historyFrame.html (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/history/historyFrame.html (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,29 @@ + + + + + + + + Hidden frame for Browser History support. + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/index.template.html =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/index.template.html (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/index.template.html (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,121 @@ + + + + + + + + + + + + +${title} + + + + + + + + + + + + + + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/html-template/playerProductInstall.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/PlayerControlBar.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/src/PlayerControlBar.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/src/PlayerControlBar.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,6 @@ + + + + + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoControlBar.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoControlBar.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoControlBar.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,26 @@ + + + + + + + + + + + + + \ No newline at end of file Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoRecorderFCKEditor.mxml =================================================================== diff -u --- lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoRecorderFCKEditor.mxml (revision 0) +++ lams_flash/src/central/flex/VideoRecorderFCKEditor/src/VideoRecorderFCKEditor.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,354 @@ + + + + + + + + + + + + + Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/assets/images/pauseIcon.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/assets/images/playIcon.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/central/flex/VideoRecorderFCKEditor/src/assets/images/recordIcon.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/24-heart-gold.png =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/24-heart-red.png =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/24-heart-silver.png =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/deleteIcon.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/downArrow.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/exportIcon.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/playerVolume.png =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/images/upArrow.swf =================================================================== diff -u Binary files differ Index: lams_flash/src/common/flex/assets/styles/main.css =================================================================== diff -u --- lams_flash/src/common/flex/assets/styles/main.css (revision 0) +++ lams_flash/src/common/flex/assets/styles/main.css (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,35 @@ +Application { + backgroundColor:#ECECEC; + backgroundGradientColors:#ECECEC,#ECECEC; +} + +Tile { + top: 10; + bottom: 10; + left: 10; + right: 10; +} + +Label { + color: #000000; + fontWeight: bold; + fontSize: 14; +} + +.box { + borderColor: #50B2CB; + cornerRadius: 10; + borderStyle: solid; + borderThickness: 1; + paddingBottom: 10; + paddingTop: 10; + paddingLeft: 10; + paddingRight: 10; + backgroundColor:#ffffff; + backgroundAlpha: 1; +} + +Text { + fontSize: 12; + fontWeight: normal; +} \ No newline at end of file Index: lams_flash/src/common/flex/com/asfusion/controls/Rating.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/Rating.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/Rating.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,740 @@ +/* Copyright 2007 Nahuel Foronda (AsFusion) + +Licensed under the Apache License, Version 2.0 (the "License"); + +you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License + for the specific language governing permissions and limitations under the License. + +*/ +package com.asfusion.controls +{ + import com.asfusion.controls.ratingclasses.*; + + import flash.display.*; + import flash.events.MouseEvent; + + import mx.core.EdgeMetrics; + import mx.core.IFlexDisplayObject; + import mx.core.UIComponent; + import mx.managers.ISystemManager; + + /** + * Dispatched when the user changes the selected value by clicking on an item or when + * the selectedValue property is programatically changed. + */ + [Event(name="selectionChange", type="com.asfusion.controls.ratingclasses.RatingEvent")] + + /** + * Gap between items + * + * @default 5 + */ + [Style(name="horizontalGap", type="Number", format="Length", inherit="no")] + /** + * Number of pixels between the container's bottom border + * and the bottom of its content area. + * + * @default 0 + */ + [Style(name="paddingBottom", type="Number", format="Length", inherit="no")] + + /** + * Number of pixels between the container's top border + * and the top of its content area. + * + * @default 0 + */ + [Style(name="paddingTop", type="Number", format="Length", inherit="no")] + + /** + * Number of pixels between the container's left border + * and the left of its content area. + * + * @default 0 + */ + [Style(name="paddingLeft", type="Number", format="Length", inherit="no")] + + /** + * Number of pixels between the container's right border + * and the right of its content area. + * + * @default 0 + */ + [Style(name="paddingRight", type="Number", format="Length", inherit="no")] + /** + * Name of the class to use as the skin for the items when + * showing a user-selected value + * @default + */ + [Style(name="selectedSkin", type="Class", inherit="no")] + + /** + * Name of the class to use as the skin for the items when + * showing a value. + */ + [Style(name="upSkin", type="Class", inherit="no")] + + /** + * Name of the class to use as the skin for the items + * when not showing a value + */ + [Style(name="unselectedSkin", type="Class", inherit="no")] + + /** + * Name of the class to use as the skin for the items + * when user rolls over them + */ + [Style(name="overSkin", type="Class", inherit="no")] + + + [Mixin] + + /** + * Control that shows a certain number of items in a row to represent a "rating". + * If user selects an item, the "selectedValue" property will change and a RatingEvent will + * be dispatched. + */ + public class Rating extends UIComponent + { + /*------------------------------------------------------------------------------------------------ + * Protected properties + -------------------------------------------------------------------------------------------------*/ + /** @private */ + protected var selectedSkin:Class; + /** @private */ + protected var unselectedSkin:Class; + /** @private */ + protected var upSkin:Class; + /** @private */ + protected var disabledSkin:Class; + /** @private */ + protected var overSkin:Class; + /** @private */ + protected var horizontalGap:Number; + /** @private */ + protected var paddingBottom:Number; + /** @private */ + protected var paddingTop:Number; + /** @private */ + protected var paddingLeft:Number; + /** @private */ + protected var paddingRight:Number; + /** @private */ + protected var unselectedLayer:UIComponent; + /** @private */ + protected var selectedLayer:UIComponent; + /** @private */ + protected var upLayer:UIComponent; + /** @private */ + protected var disabledLayer:UIComponent; + /** @private */ + protected var overLayer:UIComponent; + /** @private */ + protected var selectedMaskLayer:Shape; + /** @private */ + protected var glassLayer:Shape; + /** @private */ + protected var needLayout:Boolean; + /** @private */ + protected var valueChanged:Boolean; + /** @private */ + protected var selectedValueChanged:Boolean; + /** @private */ + protected var itemCountChanged:Boolean; + /** @private */ + protected var itemCreationComplete:Boolean; + /** @private */ + protected var skinChanged:Boolean; + /** @private */ + protected var itemWidth:int; + /** @private */ + protected var itemHeight:int; + /** @private */ + protected var metrics:EdgeMetrics; + /** @private */ + protected var rollOverValue:uint; + + + private static var className:String = "Rating"; + + /*------------------------------------------------------------------------------------------------ + * Constructor + -------------------------------------------------------------------------------------------------*/ + public function Rating() + { + super(); + addEventListener(MouseEvent.MOUSE_OUT,handleItemRollOut); + addEventListener(MouseEvent.ROLL_OUT, handleRollOut); + addEventListener(MouseEvent.MOUSE_OVER, handleItemRollOver); + addEventListener(MouseEvent.CLICK, handleClick); + } + + /*------------------------------------------------------------------------------------------------ + * Static Functions + -------------------------------------------------------------------------------------------------*/ + + /*-.........................................init..................................................*/ + /** + * @private + */ + public static function init(systemManager:ISystemManager) : void + { + RatingStyle.initDefaultStyles(className); + } + + /*------------------------------------------------------------------------------------------------ + * Public Setters and Getters + -------------------------------------------------------------------------------------------------*/ + + /*-.........................................value................................................*/ + private var _value:Number; + + /** + * Value of the rating. It is the value shown unless showSelectedValue is set to true and user + * has changed the selected value. + */ + [Bindable] + public function set value(value:Number):void + { + valueChanged = (_value != value); + _value = value; + invalidateDisplayList(); + } + + public function get value():Number + { + return _value; + } + + /*-......................................votedValue............................................*/ + private var _votedValue:Number; + + [Bindable] + public function set votedValue(value:Number):void + { + _votedValue = value; + } + + public function get votedValue():Number + { + return _votedValue; + } + + /*-......................................voted.............................................*/ + private var _voted:Boolean; + + [Bindable] + public function set voted(value:Boolean):void + { + _voted = value; + } + + public function get voted():Boolean + { + return _voted; + } + + /*-.........................................selectedValue................................................*/ + private var _selectedValue:uint; + + /** + * The value selected by the user by clicking on an item. + */ + [Bindable (event="selectionChange")] + public function set selectedValue(value:uint):void + { + selectedValueChanged = (_selectedValue != value); + + if(selectedValueChanged) + { + _selectedValue = value; + invalidateDisplayList(); + var event: RatingEvent = new RatingEvent(RatingEvent.SELECTION_CHANGE); + event.selectedValue = value; + dispatchEvent(event); + } + } + + public function get selectedValue():uint + { + return _selectedValue; + } + + + /*-.........................................itemCount................................................*/ + private var _itemCount:uint = 5; + + /** + * Number of items(stars) in the rating component + */ + [Bindable] + public function set itemCount(value:uint):void + { + itemCountChanged = (_itemCount != value); + _itemCount = value; + invalidateProperties(); + } + + public function get itemCount():uint + { + return _itemCount; + } + + /*-.........................................liveRollOver................................................*/ + private var _liveRollOver:Boolean = true; + + /** + * Whether the component shows rollOver + */ + [Bindable] + public function set liveRollOver(value:Boolean):void + { + _liveRollOver = value; + } + public function get liveRollOver():Boolean + { + return _liveRollOver + } + + /*-.........................................showSelectedValue................................................*/ + private var _showSelectedValue:Boolean; + + /** + * Whether the component shows the selected value or not. If this property is true, the compoent will show + * the selectedValue instead of showing the value. + */ + [Bindable] + public function set showSelectedValue(value:Boolean):void + { + _showSelectedValue = value; + } + public function get showSelectedValue():Boolean + { + return _showSelectedValue + } + + + /*-.........................................visibleLayer................................................*/ + private var _visibleLayer:UIComponent; + /** + * @private + */ + protected function set visibleLayer(value:UIComponent):void + { + if(_visibleLayer && _visibleLayer != value) _visibleLayer.visible = false; + _visibleLayer = value; + _visibleLayer.visible = true; + } + /** + * @private + */ + protected function get visibleLayer():UIComponent + { + return _visibleLayer; + } + + /*------------------------------------------------------------------------------------------------ + * Override Methods + -------------------------------------------------------------------------------------------------*/ + + /** + * @private + */ + /*-.........................................createChildren.....................................*/ + override protected function createChildren():void + { + addChild(createGlassLayer()); + if(itemCount) createItems(); + } + + /** + * @private + */ + /*-.........................................commitProperties.....................................*/ + override protected function commitProperties():void + { + super.commitProperties(); + if(itemCreationComplete && itemCountChanged || skinChanged) + { + removeAll(); + createItems(); + invalidateDisplayList(); + itemCountChanged = false; + skinChanged = false; + } + } + + /** + * @private + */ + /*-.........................................updateDisplayList.....................................*/ + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void + { + layoutItems(); + updateValue(); + updateSelectedValue(); + + glassLayer.width = unscaledWidth; + glassLayer.height = unscaledHeight; + } + + /** + * @private + */ + /*-.........................................measure.....................................*/ + override protected function measure():void + { + if(!itemCreationComplete) + { + measuredMinWidth = measuredWidth = 0; + measuredMinHeight = measuredHeight = 0; + } + else + { + measuredHeight = metrics.bottom + metrics.top + itemHeight; + measuredWidth = metrics.left + metrics.right + (itemCount * itemWidth) + ((itemCount -1) * horizontalGap); + + measuredMinWidth = measuredWidth; + measuredMinHeight = measuredHeight; + } + } + + /** + * @private + */ + /*-.........................................stylesInitialized.....................................*/ + override public function stylesInitialized():void + { + readStyleValues(); + } + + /** + * @private + */ + /*-.........................................styleChanged.....................................*/ + override public function styleChanged(styleProp:String):void + { + + super.styleChanged(styleProp); + + if( styleProp == 'selectedSkin' || + styleProp == 'unselectedSkin' || + styleProp == 'upSkin'|| + styleProp == 'overSkin'|| + styleProp == 'disabledSkin') + { + this[styleProp] = getStyle(styleProp); + skinChanged = true; + invalidateProperties(); + } + + else if(styleProp == 'horizontalGap'|| + styleProp == 'paddingBottom'|| + styleProp == 'paddingTop' || + styleProp == 'paddingRight' || + styleProp == 'paddingLeft' ) + { + this[styleProp] = getStyle(styleProp); + } + + + + else if(styleProp == "styleName" && itemCreationComplete) + { + readStyleValues(); + skinChanged = true; + invalidateProperties(); + } + needLayout = true; + invalidateDisplayList(); + } + /*------------------------------------------------------------------------------------------------ + * Protected Methods + -------------------------------------------------------------------------------------------------*/ + /** + * @private + */ + /*-.........................................readStyleValues.....................................*/ + protected function readStyleValues():void + { + selectedSkin = getStyle("selectedSkin"); + unselectedSkin = getStyle("unselectedSkin"); + upSkin = getStyle("upSkin"); + overSkin = getStyle("overSkin"); + disabledSkin = getStyle("disabledSkin"); + + horizontalGap = getStyle("horizontalGap"); + paddingBottom = getStyle("paddingBottom"); + paddingTop = getStyle("paddingTop"); + paddingRight = getStyle("paddingRight"); + paddingLeft = getStyle("paddingLeft"); + + metrics = new EdgeMetrics(paddingLeft, paddingTop, paddingRight, paddingBottom); + } + + /** + * @private + */ + /*-.........................................createItems.....................................*/ + protected function createItems():void + { + unselectedLayer = new UIComponent(); + selectedLayer = new UIComponent(); + overLayer = new UIComponent(); + upLayer = new UIComponent(); + + for( var i:uint; i < itemCount; i++) + { + var unselectedItem:IFlexDisplayObject = new unselectedSkin(); + unselectedLayer.addChild(DisplayObject(unselectedItem)); + + var selectedItem:IFlexDisplayObject = new selectedSkin(); + selectedLayer.addChild(DisplayObject(selectedItem)); + + var upItem:IFlexDisplayObject = new upSkin(); + upLayer.addChild(DisplayObject(upItem)); + + var overItem:IFlexDisplayObject = new overSkin(); + overLayer.addChild(DisplayObject(overItem)); + + itemWidth = Math.max(unselectedItem.measuredWidth, selectedItem.measuredWidth, overItem.measuredWidth, upItem.measuredWidth); + itemHeight = Math.max(unselectedItem.measuredHeight, selectedItem.measuredHeight, overItem.measuredHeight, upItem.measuredHeight); + } + + addChild(unselectedLayer); + addChild(selectedLayer); + addChild(upLayer); + addChild(overLayer); + addChild(createSelectedMask()); + + unselectedLayer.visible = false; + selectedLayer.visible = false; + upLayer.visible = false; + overLayer.visible = false; + + itemCreationComplete = true; + needLayout = true; + } + + /** + * @private + */ + /*-.........................................createSelectedMask.....................................*/ + protected function createSelectedMask():DisplayObject + { + if(! selectedMaskLayer) + { + selectedMaskLayer = new Shape(); + var g:Graphics = selectedMaskLayer.graphics; + g.beginFill(0xFFFFFF); + g.drawRect(0, 0, 10, 10); + g.endFill(); + } + selectedMaskLayer.visible = false; + selectedMaskLayer.x = paddingLeft; + return selectedMaskLayer; + } + + /** + * @private + */ + /*-.........................................createGlassLayer.....................................*/ + protected function createGlassLayer():DisplayObject + { + if(! glassLayer) + { + glassLayer = new Shape(); + var g:Graphics = glassLayer.graphics; + g.beginFill(0x00000,0); + g.drawRect(0, 0, 10, 10); + g.endFill(); + } + glassLayer.visible = true; + return glassLayer; + } + + /** + * @private + */ + /*-.........................................removeAll.....................................*/ + protected function removeAll():void + { + removeChild(unselectedLayer); + removeChild(selectedLayer); + removeChild(overLayer); + removeChild(upLayer); + removeChild(selectedMaskLayer); + } + + /** + * @private + */ + /*-.........................................layoutItems.....................................*/ + protected function layoutItems():void + { + if(!needLayout) return; + + var xPos:int = paddingLeft; + var yPos:int = paddingTop; + + for(var i:uint; i < itemCount; i++) + { + unselectedLayer.getChildAt(i).x = xPos; + unselectedLayer.getChildAt(i).y = yPos; + + selectedLayer.getChildAt(i).x = xPos; + selectedLayer.getChildAt(i).y = yPos; + + upLayer.getChildAt(i).x = xPos; + upLayer.getChildAt(i).y = yPos; + + overLayer.getChildAt(i).x = xPos; + overLayer.getChildAt(i).y = yPos; + + xPos += itemWidth + horizontalGap; + } + needLayout = false; + unselectedLayer.visible = true; + } + + /** + * @private + */ + /*-.........................................updateValue.....................................*/ + protected function updateValue():void + { + if(!valueChanged) return; + + var floor:int = Math.floor(value); + + selectedMaskLayer.width = floor * (itemWidth + horizontalGap) + (value - floor) * itemWidth; + selectedMaskLayer.height = itemHeight; + upLayer.mask = selectedMaskLayer; + + visibleLayer = upLayer; + valueChanged = false; + } + + /** + * @private + */ + /*-.........................................updateSelectedValue.....................................*/ + protected function updateSelectedValue():void + { + if(!selectedValueChanged || !showSelectedValue) return; + + for( var i:uint; i < itemCount; i++) + { + var item:DisplayObject = selectedLayer.getChildAt(i); + item.visible = (selectedValue > i); + } + visibleLayer = selectedLayer; + + selectedValueChanged = false; + } + + /** + * @private + */ + /*-.........................................updateItemRollOver.....................................*/ + protected function updateItemRollOver():void + { + rollOverValue = 0; + for( var i:uint; i < itemCount; i++) + { + var item:DisplayObject = overLayer.getChildAt(i); + item.visible = (mouseX > item.x- horizontalGap/2); + + if(item.visible) rollOverValue++; + } + } + + /** + * @private + */ + /*-.........................................forceUpdateRollOver.....................................*/ + protected function forceUpdateRollOver(rating:int):void{ + for( var i:int = 0; i < _itemCount; i++) + { + if(i < rating){ + var item:DisplayObject = overLayer.getChildAt(i); + item.visible = true; + } + else{ + var item:DisplayObject = overLayer.getChildAt(i); + item.visible = false; + } + } + } + + /*------------------------------------------------------------------------------------------------ + * Mouse Events + -------------------------------------------------------------------------------------------------*/ + + /** + * @private + */ + /*-.........................................handleRollOut.....................................*/ + protected function handleRollOut(event:MouseEvent):void + { + if(enabled){ + overLayer.visible = false; + if(visibleLayer) visibleLayer.visible = true; + } + } + + /** + * @private + */ + /*-.........................................handleItemRollOver.....................................*/ + protected function handleItemRollOver(event:MouseEvent):void + { + if(enabled){ + if(voted){ + rollOverValue = _votedValue; + overLayer.visible = true; + if(visibleLayer) visibleLayer.visible = false; + forceUpdateRollOver(rollOverValue); + } + else if(liveRollOver) + { + updateItemRollOver(); + overLayer.visible = true; + if(visibleLayer) visibleLayer.visible = false; + } + } + } + + /** + * @private + */ + /*-.........................................handleItemRollOut.....................................*/ + protected function handleItemRollOut(event:MouseEvent):void + { + if(enabled){ + if(liveRollOver && !voted) + { + updateItemRollOver(); + } + } + } + + /** + * @private + */ + /*-.........................................handleClick.....................................*/ + protected function handleClick(event:MouseEvent):void + { + if(enabled){ + if(!voted){ + selectedValue = rollOverValue; + } + } + } + } +} + Index: lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/OverStar.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/OverStar.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/OverStar.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,34 @@ +package com.asfusion.controls.ratingclasses +{ + import mx.styles.*; + import mx.managers.ISystemManager; + + [Mixin] + /** + * Default skin for rollover item (star) + * */ + public class OverStar extends Star + { + private static var className:String = "OverStar"; + + /*------------------------------------------------------------------------------------------------ + * Static Methods + -------------------------------------------------------------------------------------------------*/ + + /** + * @private + */ + /*-.........................................init..................................................*/ + public static function init(systemManager:ISystemManager) : void + { + var style:CSSStyleDeclaration = new CSSStyleDeclaration(); + style.defaultFactory = function():void + { + this.backgroundColor = 0xFFE30E; + this.backgroundAlpha = 1; + } + + StyleManager.setStyleDeclaration(className, style, true); + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingEvent.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingEvent.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingEvent.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,20 @@ +package com.asfusion.controls.ratingclasses +{ + import flash.events.Event; + + /** Event dispatched when user changes rating selected value or + * when that value is programatically changed + * */ + public class RatingEvent extends Event + { + public static const SELECTION_CHANGE:String = "selectionChange"; + + public var selectedValue:uint; + + public function RatingEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + } +} \ No newline at end of file Index: lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingStyle.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingStyle.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/RatingStyle.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,37 @@ +package com.asfusion.controls.ratingclasses +{ + import mx.styles.CSSStyleDeclaration; + import mx.styles.StyleManager; + import com.asfusion.controls.ratingclasses.*; + + public class RatingStyle + { + /*------------------------------------------------------------------------------------------------ + * Static Methods + -------------------------------------------------------------------------------------------------*/ + /** + * @private + */ + public static function initDefaultStyles(className:String):void + { + var style:CSSStyleDeclaration = new CSSStyleDeclaration(); + style.defaultFactory = function():void + { + this.disabledSkin = Star; + this.overSkin = OverStar; + this.unselectedSkin = Star; + this.upSkin = SelectedStar; + this.selectedSkin = SelectedStar; + + this.horizontalGap = 5; + this.paddingBottom = 0; + this.paddingTop = 0; + this.paddingLeft = 0; + this.paddingRight = 0; + } + + StyleManager.setStyleDeclaration(className, style, true); + + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/SelectedStar.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/SelectedStar.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/SelectedStar.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,34 @@ +package com.asfusion.controls.ratingclasses +{ + import mx.styles.*; + import mx.managers.ISystemManager; + + [Mixin] + /** + * Default skin for selected item (star) + * */ + public class SelectedStar extends Star + { + private static var className:String = "SelectedStar"; + + /*------------------------------------------------------------------------------------------------ + * Static Methods + -------------------------------------------------------------------------------------------------*/ + + /*-.........................................init..................................................*/ + /** + * @private + */ + public static function init(systemManager:ISystemManager) : void + { + var style:CSSStyleDeclaration = new CSSStyleDeclaration(); + style.defaultFactory = function():void + { + this.backgroundColor = 0x000000; + this.backgroundAlpha = 1; + } + + StyleManager.setStyleDeclaration(className, style, true); + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/Star.as =================================================================== diff -u --- lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/Star.as (revision 0) +++ lams_flash/src/common/flex/com/asfusion/controls/ratingclasses/Star.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,138 @@ +package com.asfusion.controls.ratingclasses +{ + import mx.core.UIComponent; + import mx.styles.*; + import mx.managers.ISystemManager; + import flash.display.Graphics; + + [Mixin] + + /** + * Default skin for unselected item (star) + * */ + public class Star extends UIComponent + { + protected var outerRadius:Number; + protected var innerRadius:Number; + protected var borderThickness:Number; + protected var borderColor:Number; + protected var borderAlpha:Number; + protected var backgroundColor:Number; + protected var backgroundAlpha:Number; + + private var maxSize:Number; + private var ratio:Number; + + private static var className:String = "Star"; + + /*------------------------------------------------------------------------------------------------ + * Static Methods + -------------------------------------------------------------------------------------------------*/ + + /** + * @private + */ + /*-.........................................init..................................................*/ + public static function init(systemManager:ISystemManager) : void + { + var style:CSSStyleDeclaration = new CSSStyleDeclaration(); + style.defaultFactory = function():void + { + this.borderColor = 0x555555; + this.outerRadius = 50; + this.innerRadius = 25; + this.borderThickness = 1; + this.borderAlpha = 1; + this.width = 14; + this.height = 15; + this.backgroundColor = 0xffffff; + this.backgroundAlpha = 0; + } + + StyleManager.setStyleDeclaration(className, style, true); + } + + /*------------------------------------------------------------------------------------------------ + * Ocerride Methods + -------------------------------------------------------------------------------------------------*/ + /** + * @private + */ + override protected function createChildren():void + { + drawShape(graphics, measuredWidth/2, measuredHeight/2, (maxSize/2)/ratio,(maxSize/2) ); + } + + /** + * @private + */ + /*-.........................................stylesInitialized.....................................*/ + override public function stylesInitialized():void + { + readStyleValues(); + } + + /*------------------------------------------------------------------------------------------------ + * Protected Methods + -------------------------------------------------------------------------------------------------*/ + + /** + * @private + */ + /*-.........................................readStyleValues.....................................*/ + protected function readStyleValues():void + { + outerRadius = getStyle("outerRadius"); + innerRadius = getStyle("innerRadius"); + borderThickness = getStyle("borderThickness"); + borderColor = getStyle("borderColor"); + borderAlpha = getStyle("borderAlpha"); + measuredWidth = getStyle("width"); + measuredHeight = getStyle("height"); + backgroundColor = getStyle("backgroundColor"); + backgroundAlpha = getStyle("backgroundAlpha"); + + maxSize = Math.min(measuredHeight, measuredWidth); + ratio= outerRadius/innerRadius; + } + + /** + * @private + */ + /*-.........................................drawShape.....................................*/ + protected function drawShape(graphics:Graphics, x:Number, y:Number, innerRadius:Number, outerRadius:Number, points:Number = 5, angle:Number=90 ):void + { + graphics.clear(); + graphics.lineStyle(borderThickness,borderColor,borderAlpha); + if(backgroundAlpha > 0) + { + graphics.beginFill(backgroundColor, backgroundAlpha); + } + var count:int = Math.abs(points); + if (count>=2) + { + + // calculate distance between points + var step:Number = (Math.PI*2)/points; + var halfStep:Number = step/2; + + // calculate starting angle in radians + var start:Number = (angle/180)*Math.PI; + graphics.moveTo(x+(Math.cos(start)*outerRadius), y-(Math.sin(start)*outerRadius)); + + // draw lines + for (var i:int=1; i<=count; i++) + { + graphics.lineTo(x+Math.cos(start+(step*i)-halfStep)*innerRadius, + y-Math.sin(start+(step*i)-halfStep)*innerRadius); + graphics.lineTo(x+Math.cos(start+(step*i))*outerRadius, + y-Math.sin(start+(step*i))*outerRadius); + } + } + if(backgroundAlpha > 0) + { + graphics.endFill(); + } + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/conn/ImageService.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/conn/ImageService.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/conn/ImageService.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,40 @@ +package org.lamsfoundation.lams.common.conn +{ + import flash.display.BitmapData; + import flash.utils.ByteArray; + + import mx.graphics.codec.JPEGEncoder; + import mx.graphics.codec.PNGEncoder; + import mx.rpc.http.HTTPService; + + public class ImageService extends HTTPService + { + public var PNG_EXT:String = ".png"; + public var JPG_EXT:String = ".jpg"; + + public function ImageService(url:String, method:String) + { + this.url = url; + this.method = "POST"; + this.resultFormat = "e4x"; + this.request.method = method; + } + + public function sendImageToServer(image:BitmapData, ext:String, filename:String):void{ + var rawBytes:ByteArray; + if(ext == PNG_EXT){ + var pngEncoder:PNGEncoder = new PNGEncoder(); + rawBytes = pngEncoder.encode(image); + } + else if(ext == JPG_EXT){ + var jpegEncoder:JPEGEncoder = new JPEGEncoder(); + rawBytes = jpegEncoder.encode(image); + } + + this.request.ext = ext; + this.request.filname = filename; + this.request.rawBytes = rawBytes; + this.send(); + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,57 @@ +package org.lamsfoundation.lams.common.dictionary +{ + import flash.events.EventDispatcher; + + import mx.controls.Alert; + + public class XMLDictionary + { + private var eventDispatcher:EventDispatcher; + private var dictionaryXML:XML; + + public function XMLDictionary(xml:XML) + { + eventDispatcher = new EventDispatcher(); + dictionaryXML = new XML(xml); + + eventDispatcher.dispatchEvent(new XMLDictionaryEvent("COMPELTE")); + } + + public function getLabel(s:String):String{ + if(!isEmpty()){ + return dictionaryXML.language.entry.(@key==s).name; + } + + return null; + } + + public function getLabelAndConcatenate(s:String, a:Array):String{ + if(!isEmpty()){ + var concat:String = ""; + for(var i:int = 0; i < a.length; i++){ + concat += a[i]; + } + + return getLabel(s) + concat; + } + + return null; + } + + public function getLabelAndReplace(s:String, a:Array):String{ + if(!isEmpty()){ + var label:String = getLabel(s); + + for(var i:int = 0; i < a.length; i++){ + label = label.replace("{" + String(i) + "}", getLabel(a[i])); + } + } + + return label; + } + + public function isEmpty():Boolean{ + return dictionaryXML.toString() == ""; + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionaryEvent.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionaryEvent.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/dictionary/XMLDictionaryEvent.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,13 @@ +package org.lamsfoundation.lams.common.dictionary +{ + import flash.events.Event; + + public class XMLDictionaryEvent extends Event + { + public function XMLDictionaryEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/ResizeableTextArea.mxml =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/ResizeableTextArea.mxml (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/ResizeableTextArea.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,24 @@ + + + + + + + + Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButton.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButton.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButton.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,135 @@ +package org.lamsfoundation.lams.common.ui.components +{ + import flash.display.*; + import flash.events.MouseEvent; + + import mx.containers.HBox; + import mx.controls.Button; + import mx.controls.Label; + import mx.controls.RadioButton; + import mx.events.FlexEvent; + + public class SortButton extends HBox + { + [Embed(source="../../../../../../assets/images/upArrow.swf")] + [Bindable] + private var upArrow:Class; + + [Embed(source="../../../../../../assets/images/downArrow.swf")] + [Bindable] + private var downArrow:Class; + + private var button:Button; + private var buttonLabel:Label; + + public static const NA:String = "not selected"; + public static const ASC:String = "ascending"; + public static const DSC:String = "descending"; + + [Inspectable] + private var _sortBy:String; + + [Inspectable] + private var _selected:Boolean; + + [Inspectable] + private var _sortDirection:String; + + public function SortButton() + { + // call button's constructor + super(); + + // initialize sortDirection + if(_sortDirection == "" || _sortDirection != NA || _sortDirection != ASC || _sortDirection != DSC){ + _sortDirection = NA; + _selected = false; + } + + // create ui components + button = new Button(); + button.addEventListener(MouseEvent.CLICK, clickHandler); + + buttonLabel = new Label(); + + // set stles (sortDirection and ui components must be initialized first) + setStyles(); + + // add init event listener + addEventListener(FlexEvent.INITIALIZE, initializeHandler); + } + + private function setStyles():void{ + this.setStyle("gap", 0); + + if(_sortDirection == ASC){ + button.setStyle("icon", upArrow); + } + else if(_sortDirection == DSC){ + button.setStyle("icon", downArrow); + } + else{ + button.setStyle("icon", null); + } + } + + public function get sortBy():String{ + return _sortBy; + } + + public function set sortBy(sortBy:String):void{ + _sortBy = sortBy; + } + + public function get selected():Boolean{ + return _selected; + } + + public function set selected(selected:Boolean):void{ + if(selected){ + if(_sortDirection == NA || _sortDirection == DSC){ + _sortDirection = ASC; + button.setStyle("icon", upArrow); + } + else if(sortDirection == ASC){ + _sortDirection = DSC; + button.setStyle("icon", downArrow); + } + } + else{ + _sortDirection = NA; + button.setStyle("icon", null); + } + + _selected = selected; + } + + public function get sortDirection():String{ + return _sortDirection; + } + + public function set sortDirection(sortDirection:String):void{ + _sortDirection = sortDirection; + } + + // gets called when the component has been initialized + private function initializeHandler(event:FlexEvent):void + { + // paint the button + button.width = 17; + button.height = 17; + addChild(button); + + // paint the label + buttonLabel.text = this.label; + addChild(buttonLabel); + } + + // gets called when the button is clicked + protected function clickHandler(event:MouseEvent):void + { + // dispatch an event and let the sortButtonGroup take care of the rest + dispatchEvent(new SortEvent(_sortBy, _sortDirection)); + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButtonGroup.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButtonGroup.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortButtonGroup.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,78 @@ +package org.lamsfoundation.lams.common.ui.components +{ + import mx.containers.HBox; + import mx.events.FlexEvent; + + public class SortButtonGroup extends HBox + { + // an array of buttons + private var buttons:Array = []; + + // the selected button at the moment + private var selectedButton:SortButton; + + private var _sortBy:String; + private var _sortDirection:String; + + public function SortButtonGroup() + { + // call super constructor + super(); + + // add init event listener + addEventListener(FlexEvent.INITIALIZE, initializeHandler); + } + + // gets called when the component has been initialized + private function initializeHandler(event:FlexEvent):void{ + // get the buttons in the group + buttons = getChildren(); + + // for all buttons, add sortEvent listener and check for a selected button + var foundSelected:Boolean = false; + for(var i:int = 0; i < buttons.length; i++){ + var button:SortButton = buttons[i]; + button.addEventListener(SortEvent.EVENT_TYPE, sortEventHandler); + + if(button.selected == true){ + if(foundSelected){ + button.selected = false; + } + else{ + foundSelected = true; + selectedButton = button; + _sortBy = button.sortBy; + _sortDirection = button.sortDirection; + dispatchEvent(new SortEvent(button.sortBy, button.sortDirection)); + } + } + } + } + + private function sortEventHandler(event:SortEvent):void{ + selectedButton = SortButton(event.target); + + for(var i:int = 0; i < buttons.length; i++){ + var button:SortButton = buttons[i]; + if(button != selectedButton){ + button.selected = false; + } + else{ + button.selected = true; + _sortDirection = button.sortDirection; + _sortBy = button.sortBy; + } + } + + dispatchEvent(new SortEvent(_sortBy, _sortDirection)); + } + + public function get sortDirection():String{ + return _sortDirection; + } + + public function get sortBy():String{ + return _sortBy; + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortEvent.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortEvent.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/SortEvent.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,27 @@ +package org.lamsfoundation.lams.common.ui.components +{ + import flash.events.Event; + + public class SortEvent extends Event + { + public static const EVENT_TYPE:String = "sortEvent"; + private var _sortBy:String; + private var _sortDirection:String; + + public function SortEvent(sortBy:String, sortDirection:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(EVENT_TYPE, bubbles, cancelable); + + _sortBy = sortBy; + _sortDirection = sortDirection; + } + + public function get sortBy():String{ + return _sortBy; + } + + public function get sortDirection():String{ + return _sortDirection; + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplay.mxml =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplay.mxml (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplay.mxml (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,556 @@ + + + + + = metadata.duration){ + makeReadyAgain(); + dispatchEvent(new VideoDisplayEvent(VideoDisplayEvent.COMPLETE)); + } + } + + private function securityErrorHandler(event:SecurityErrorEvent):void { + trace("securityErrorHandler: " + event); + } + + private function asyncErrorHandler(event:AsyncErrorEvent):void { + trace("securityErrorHandler: " + event); + } + + ]]> + + + + + + + + + + + + + + \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplayEvent.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplayEvent.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/ui/components/VideoDisplayEvent.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,27 @@ +package org.lamsfoundation.lams.common.ui.components +{ + import flash.events.Event; + + public class VideoDisplayEvent extends Event + { + public static const RESET:String = "videoDisplayReset"; + public static const READY:String = "videoDisplayReady"; + public static const PAUSE:String = "videoDisplayPause"; + public static const UNPAUSE:String = "videoDisplayUnpause"; + public static const METADATA:String = "videoDisplayMetadata"; + public static const STARTCAM:String = "videoDisplayStartCam"; + public static const STOPCAM:String = "videoDisplayStopCam"; + public static const STARTPUBLISH:String = "videoDisplayStartPublish"; + public static const STOPPUBLISH:String = "videoDisplayStopPublish"; + public static const COMPLETE:String = "videoDisplayComplete"; + public static const BUFFERING:String = "videoDisplayBuffering"; + + public var metadata:Object; + + public function VideoDisplayEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/LAMSStringUtil.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/LAMSStringUtil.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/LAMSStringUtil.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,28 @@ +package org.lamsfoundation.lams.common.util +{ + import mx.utils.StringUtil; + + public class LAMSStringUtil extends StringUtil + { + public function LAMSStringUtil() + { + super(); + } + + // convert a string to a boolean + public static function stringToBool(string:String):Boolean{ + switch(string){ + case "1": + case "true": + case "yes": + return true; + case "0": + case "false": + case "no": + return false; + default: + return Boolean(string); + } + } + } +} \ No newline at end of file Index: lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/VideoDisplayUtil.as =================================================================== diff -u --- lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/VideoDisplayUtil.as (revision 0) +++ lams_flash/src/common/flex/org/lamsfoundation/lams/common/util/VideoDisplayUtil.as (revision 251a00158d63f52d7482fa4aa2decb78d6322a8c) @@ -0,0 +1,82 @@ +package org.lamsfoundation.lams.common.util +{ + import flash.media.Camera; + import flash.media.Microphone; + + public class VideoDisplayUtil + { + public function VideoDisplayUtil() {} + + // prints an info object + public static function printInfoObject(caller:String, infoObject:Object):void{ + trace("caller: " + caller); + for (var prop in infoObject) { + trace("\t"+prop+":\t"+infoObject[prop]); + } + } + + // create a filename for the video recorder tool + public static function createFilename(toolSessionId:int, userId:int):String{ + + return "lamsRecording_session" + toolSessionId + "_user" + userId + "_" + randomNumber(1, 1000000000); + } + + // create a filename for use in the fck editor + public static function createFilenameForFCK(userId:int):String{ + + return "lamsRecording_forFCK" + "_user" + userId + "_" + randomNumber(1, 1000000000); + } + + // creates a random number between bounds + private static function randomNumber(low:Number=NaN, high:Number=NaN):Number { + var low:Number = low; + var high:Number = high; + + if(isNaN(low)) + { + throw new Error("low must be defined"); + } + if(isNaN(high)) + { + throw new Error("high must be defined"); + } + + return Math.round(Math.random() * (high - low)) + low; + } + + // gets a camera and sets it up + public static function setupCamera():Camera { + // get cam + var cam:Camera = new Camera; + cam = Camera.getCamera(); + + // setting dimensions and framerate + cam.setMode(320, 240, 30); + // set to minimum of 70% quality + cam.setQuality(0,70); + + return cam; + } + + // sets up mic + public static function setupMic():Microphone{ + // get mic + var mic:Microphone = new Microphone(); + mic = Microphone.getMicrophone(); + + // setup rate + mic.rate = 44; + + return mic; + } + + // creates a string with the correct time formatting + public static function secondsToString(val:String):String{ + var valInt:Number = Number(val); + var minutes:int = valInt / 60; + var seconds:int = valInt % 60; + + return String(minutes) + ":" + String(seconds); + } + } +} \ No newline at end of file