Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java =================================================================== diff -u -rcfbe222136efc72d14e61537ebc809cd6912a723 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision cfbe222136efc72d14e61537ebc809cd6912a723) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -59,6 +59,7 @@ import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearnerChoiceGrouping; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAnnotation; import org.lamsfoundation.lams.learningdesign.LearningLibrary; import org.lamsfoundation.lams.learningdesign.License; import org.lamsfoundation.lams.learningdesign.OptionsActivity; @@ -598,6 +599,7 @@ parseActivitiesToMatchUpParentandInputActivities((JSONArray) JsonUtil.opt(ldJSON, AuthoringJsonTags.ACTIVITIES)); parseTransitions((JSONArray) JsonUtil.opt(ldJSON, AuthoringJsonTags.TRANSITIONS)); parseBranchMappings((JSONArray) JsonUtil.opt(ldJSON, AuthoringJsonTags.BRANCH_MAPPINGS)); + parseAnnotations((JSONArray) JsonUtil.opt(ldJSON, AuthoringJsonTags.ANNOTATIONS)); progressDefaultChildActivities(); @@ -1476,6 +1478,51 @@ } } + private void parseAnnotations(JSONArray annotationList) throws ObjectExtractorException, JSONException { + + Set existingAnnotations = learningDesign.getAnnotations(); + Set updatedAnnotations = new HashSet(); + + for (int annotationIndex = 0; annotationIndex < annotationList.length(); annotationIndex++) { + JSONObject annotationJSON = annotationList.getJSONObject(annotationIndex); + boolean found = false; + LearningDesignAnnotation annotation = null; + + if (existingAnnotations != null) { + for (LearningDesignAnnotation existingAnnotation : existingAnnotations) { + if (existingAnnotation.getAnnotationUIID().equals( + annotationJSON.getInt(AuthoringJsonTags.ANNOTATION_UIID))) { + annotation = existingAnnotation; + found = true; + break; + } + } + } + + if (annotation == null) { + annotation = new LearningDesignAnnotation(); + } + annotation.setLearningDesignId(learningDesign.getLearningDesignId()); + annotation.setAnnotationUIID(annotationJSON.getInt(AuthoringJsonTags.ANNOTATION_UIID)); + annotation.setTitle((String) JsonUtil.opt(annotationJSON, AuthoringJsonTags.TITLE)); + annotation.setXcoord((Integer) JsonUtil.opt(annotationJSON, AuthoringJsonTags.XCOORD)); + annotation.setYcoord((Integer) JsonUtil.opt(annotationJSON, AuthoringJsonTags.YCOORD)); + annotation.setEndXcoord((Integer) JsonUtil.opt(annotationJSON, AuthoringJsonTags.END_XCOORD)); + annotation.setEndYcoord((Integer) JsonUtil.opt(annotationJSON, AuthoringJsonTags.END_YCOORD)); + annotation.setColor((String) JsonUtil.opt(annotationJSON, AuthoringJsonTags.COLOR)); + + if (found) { + baseDAO.update(annotation); + } else { + baseDAO.insert(annotation); + } + + updatedAnnotations.add(annotation); + } + + learningDesign.setAnnotations(updatedAnnotations); + } + private Competence getComptenceFromSet(Set competences, String title) { if (competences != null) { for (Competence competence : competences) { Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -460,17 +460,16 @@ if (learningDesign != null) { Long learningDesignID = learningDesign.getLearningDesignId(); if (learningDesignID != null) { - responseJSON.put(AttributeNames.PARAM_LEARNINGDESIGN_ID, learningDesignID); - responseJSON.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, learningDesign.getContentFolderID()); - - Vector activityDTOs = getAuthoringService().getToolActivities(learningDesignID, - getUserLanguage()); - Vector validationDTOs =getAuthoringService().validateLearningDesign(learningDesignID); Gson gson = new GsonBuilder().create(); - String activitiesJSON = gson.toJson(activityDTOs); + Vector validationDTOs = getAuthoringService().validateLearningDesign( + learningDesignID); String validationJSON = gson.toJson(validationDTOs); - responseJSON.put("activities", new JSONArray(activitiesJSON)); responseJSON.put("validation", new JSONArray(validationJSON)); + + // get DTO with updated IDs + LearningDesignDTO learningDesignDTO = getLearningDesignService().getLearningDesignDTO(learningDesignID, + getUserLanguage()); + responseJSON.put("ld", new JSONObject(gson.toJson(learningDesignDTO))); } } Index: lams_central/web/author2.jsp =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/web/author2.jsp (.../author2.jsp) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/web/author2.jsp (.../author2.jsp) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -16,6 +16,8 @@ + + @@ -469,6 +471,14 @@ + + + Color: + + + + + Index: lams_central/web/includes/javascript/authoring/authoringActivity.js =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -150,7 +150,7 @@ ParallelActivity : function(id, uiid, learningLibraryID, x, y, title, childActivities){ - DecorationLib.Container.call(this, title); + DecorationLib.Container.call(this, id, uiid, title); this.id = +id; this.uiid = +uiid || ++layout.ld.maxUIID; @@ -173,7 +173,7 @@ * Constructor for an Optional Activity. */ OptionalActivity : function(id, uiid, x, y, title, minActivities, maxActivities) { - DecorationLib.Container.call(this, title || 'Optional Activity'); + DecorationLib.Container.call(this, id, uiid, title || 'Optional Activity'); this.id = +id; this.uiid = +uiid || ++layout.ld.maxUIID; @@ -195,11 +195,8 @@ * Constructor for a Floating Activity. */ FloatingActivity : function(id, uiid, x, y) { - DecorationLib.Container.call(this, 'Support Activity'); + DecorationLib.Container.call(this, id, uiid, 'Support Activity'); - this.id = +id; - this.uiid = +uiid || ++layout.ld.maxUIID; - this.draw = ActivityLib.draw.floatingActivity; this.draw(x, y); Index: lams_central/web/includes/javascript/authoring/authoringDecoration.js =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/web/includes/javascript/authoring/authoringDecoration.js (.../authoringDecoration.js) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/web/includes/javascript/authoring/authoringDecoration.js (.../authoringDecoration.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -7,7 +7,9 @@ /** * Abstract class for Region, Optional and Floating Activities. */ - Container : function(title) { + Container : function(id, uiid, title) { + this.id = +id; + this.uiid = +uiid || (layout.ld ? ++layout.ld.maxUIID : null); this.title = title; this.childActivities = []; @@ -18,8 +20,8 @@ /** * Constructor for region annotation. */ - Region : function(x, y, x2, y2, color, title) { - DecorationLib.Container.call(this, title); + Region : function(id, uiid, x, y, x2, y2, title, color) { + DecorationLib.Container.call(this, id, uiid, title); // we don't use it for region this.childActivities = null; @@ -33,7 +35,9 @@ /** * Constructor for label annotation. */ - Label : function(x, y, title){ + Label : function(id, uiid, x, y, title){ + this.id = +id; + this.uiid = +uiid || ++layout.ld.maxUIID; // set a default title, if none provided this.title = title || 'Label'; @@ -183,8 +187,9 @@ }, - addRegion : function(x, y, x2, y2) { - var region = new DecorationLib.Region(x, y, x2, y2, layout.colors.annotation); + addRegion : function(x, y, x2, y2, title, color) { + var region = new DecorationLib.Region(null, null, + x, y, x2, y2, title, color ? color : layout.colors.annotation); layout.regions.push(region); return region; }, @@ -221,7 +226,7 @@ addLabel : function(x, y, title) { - var label = new DecorationLib.Label(x, y, title); + var label = new DecorationLib.Label(null, null, x, y, title); layout.labels.push(label); return label; }, Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -66,7 +66,10 @@ 'transition' : 'rgb(119,126,157)', 'binActive' : 'red', 'selectEffect' : 'blue', - 'annotation' : 'yellow', + 'annotation' : '#FFFF00', + 'annotationPalette' : ['FFFF00', '00FFFF', '8A2BE2', '7FFF00', '6495ED', + 'FFF8DC', 'FF8C00', '00BFFF', 'DCDCDC', 'ADD8E6', '20B2AA', + 'B0C4DE', 'FFE4E1', 'FF4500', 'EE82EE'], 'optionalActivity' : 'rgb(194,213,254)' }, }; @@ -799,7 +802,17 @@ }); }); + $.each(ld.annotations, function(){ + var isRegion = this.endXcoord; + if (isRegion) { + DecorationLib.addRegion(this.xcoord, this.ycoord, this.endXcoord, this.endYcoord, + this. title, this.color); + } else { + DecorationLib.addLabel(this.xcoord, this.ycoord, this.title); + } + }); + if (arrangeNeeded) { MenuLib.arrangeActivities(); } else { @@ -822,6 +835,7 @@ transitions = [], groupings = [], branchMappings = [], + annotations = [], layoutActivities = [], // trim the title = title.trim(), @@ -967,7 +981,7 @@ } else if (activity instanceof ActivityLib.BranchActivity){ activityTypeID = 8; } else if (activity instanceof ActivityLib.FloatingActivity){ - activityTypeID = 15; + activityTypeID = 15; } @@ -1029,6 +1043,24 @@ } }); + // iterate over labels and regions + $.each(layout.labels.concat(layout.regions), function(){ + var box = this.items.shape.getBBox(), + isRegion = this instanceof DecorationLib.Region; + + annotations.push({ + 'id' : this.id, + 'annotationUIID' : this.uiid, + 'title' : this.title, + 'xCoord' : box.x, + 'yCoord' : box.y, + 'endXCoord' : isRegion ? box.x2 : null, + 'endYCoord' : isRegion ? box.y2 : null, + 'color' : isRegion ? this.items.shape.attr('fill') : null + }); + }); + + // serialise the sequence var ld = { // it is null if it is a new sequence @@ -1051,6 +1083,7 @@ 'transitions' : transitions, 'groupings' : groupings, 'branchMappings' : branchMappings, + 'annotations' : annotations, 'helpText' : null, 'duration' : null, @@ -1071,13 +1104,13 @@ }, success : function(response) { // if save was successful - if (response.learningDesignID) { + if (response.ld) { // assing the database-generated values - layout.ld.learningDesignID = response.learningDesignID; + layout.ld.learningDesignID = response.ld.learningDesignID; layout.ld.folderID = folderID; layout.ld.title = title; if (!layout.ld.contentFolderID) { - layout.ld.contentFolderID = response.contentFolderID; + layout.ld.contentFolderID = response.ld.contentFolderID; } $('#ldDescriptionFieldTitle').text(title); $('#ldDescriptionFieldDescription').text(description); @@ -1102,30 +1135,62 @@ } // assign database-generated properties to activities - $.each(response.activities, function() { + $.each(response.ld.activities, function() { var updatedActivity = this; $.each(layout.activities, function(){ - if (this instanceof ActivityLib.BranchingEdgeActivity && this.isStart) { + var isBranching = this instanceof ActivityLib.BranchingEdgeActivity, + found = false; + if (isBranching && !isStart) { + return true; + } + + if (isBranching) { if (updatedActivity.activityUIID == this.branchingActivity.uiid){ this.branchingActivity.id = updatedActivity.activityID; + found = true; } else { $.each(this.branchingActivity.branches, function(){ if (updatedActivity.activityUIID == this.branchingActivity.uiid){ this.id = updatedActivity.activityID; - } + } }); } } else if (updatedActivity.activityUIID == this.uiid) { this.id = updatedActivity.activityID; this.toolContentID = updatedActivity.toolContentID; + found = true; } + + // update transition IDs + $.each(this.transitions.from, function(){ + var existingTransition = this; + $.each(response.ld.transitions, function(){ + if (existingTransition.uiid == +this.transitionUIID) { + existingTransition.id = +this.transitionID; + return false; + } + }); + }); + + return !found; }); }); if (layout.floatingActivity) { layout.floatingActivity.id = response.floatingActivityID; } + // update annotation IDs + $.each(response.ld.annotations, function(){ + var updatedAnnotation = this; + $.each(layout.labels.concat(layout.regions), function(){ + if (this.uiid == updatedAnnotation.annotationUIID) { + this.id = updatedAnnotation.uid; + return false; + } + }); + }); + alert('Congratulations! Your design is valid and has been saved.'); result = true; } else { Index: lams_central/web/includes/javascript/authoring/authoringProperty.js =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -170,6 +170,7 @@ if (redrawNeeded) { transition.draw(); + ActivityLib.addSelectEffect(activity, true); } }); } @@ -214,6 +215,7 @@ if (redrawNeeded) { activity.draw(); + ActivityLib.addSelectEffect(activity, true); } }); } @@ -270,6 +272,7 @@ if (redrawNeeded) { activity.draw(); + ActivityLib.addSelectEffect(activity, true); } }; @@ -338,6 +341,7 @@ if (redrawNeeded) { activity.draw(); + ActivityLib.addSelectEffect(activity, true); } }); } @@ -402,6 +406,7 @@ if (redrawNeeded) { branchingActivity.start.draw(); branchingActivity.end.draw(); + ActivityLib.addSelectEffect(layout.items.selectedObject, true); } } @@ -446,6 +451,7 @@ if (redrawNeeded) { activity.draw(); + ActivityLib.addSelectEffect(activity, true); } }); } @@ -478,6 +484,7 @@ if (newTitle != activity.title) { activity.title = newTitle; activity.draw(); + ActivityLib.addSelectEffect(activity, true); } }); @@ -525,24 +532,41 @@ // first run, create the content content = region.propertiesContent = $('#propertiesContentRegion').clone().attr('id', null) .show().data('parentObject', region); + $('.propertiesContentFieldTitle', content).val(region.title); + var color = region.items.shape.attr('fill'); + $('.propertiesContentFieldColor', content).val(color) + .simpleColor({ + 'colors' : layout.colors.annotationPalette, + 'chooserCSS' : { + 'left' : 0, + 'top' : '30px', + 'margin' : '0' + } + }); $('input', content).change(function(){ // extract changed properties and redraw the transition var content = $(this).closest('.dialogContainer'), region = content.data('parentObject'), redrawNeeded = false, - newTitle = $('.propertiesContentFieldTitle', content).val(); + newTitle = $('.propertiesContentFieldTitle', content).val(), + color = region.items.shape.attr('fill'), + newColor = $('.propertiesContentFieldColor', content).val(); if (newTitle != region.title) { region.title = newTitle; redrawNeeded = true; } + redrawNeeded |= newColor != color; if (redrawNeeded) { - region.draw(); + region.draw(null, null, null, null, newColor); + ActivityLib.addSelectEffect(region, true); } }); } + + }, @@ -571,6 +595,7 @@ if (redrawNeeded) { label.draw(); + ActivityLib.addSelectEffect(label, true); } }); } Index: lams_central/web/includes/javascript/jquery.simple-color.js =================================================================== diff -u --- lams_central/web/includes/javascript/jquery.simple-color.js (revision 0) +++ lams_central/web/includes/javascript/jquery.simple-color.js (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1 @@ +!function(a){a.fn.simpleColor=function(b){function c(){b=a.simpleColorOptions;var c=a("
");c.css("position","relative");var e=this.value&&""!=this.value?this.value:b.defaultColor,f=a("
");f.css(a.extend(b.displayCSS,{"background-color":e})),f.data("color",e),c.append(f),b.displayColorCode&&(f.data("displayColorCode",!0),f.text(this.value),f.css({color:b.colorCodeColor,textAlign:b.colorCodeAlign}));var g=function(c){c.stopImmediatePropagation();if(a("html").bind("click.simpleColorDisplay",function(e){a("html").unbind("click.simpleColorDisplay"),a(".simpleColorChooser").hide();var g=a(e.target);(g.is(".simpleColorCell")===!1||a.contains(a(c.target).closest(".simpleColorContainer")[0],g[0])===!1)&&(f.css("background-color",f.data("color")),b.displayColorCode&&f.text(f.data("color"))),b.onClose&&b.onClose(d)}),c.data.container.chooser)c.data.container.chooser.toggle();else{var e=a("
");e.css(b.chooserCSS),c.data.container.chooser=e,c.data.container.append(e);for(var g=0;g");h.css({width:b.cellWidth+"px",height:b.cellHeight+"px",margin:b.cellMargin+"px",cursor:"pointer",lineHeight:b.cellHeight+"px",fontSize:"1px","float":"left","background-color":"#"+b.colors[g]}),e.append(h),(b.onCellEnter||b.livePreview)&&h.bind("mouseenter",function(){b.onCellEnter&&b.onCellEnter(this.id,d),b.livePreview&&(f.css("background-color","#"+this.id),b.displayColorCode&&f.text("#"+this.id))}),h.bind("click",{input:c.data.input,chooser:e,displayBox:f},function(c){var e="#"+this.id;c.data.input.value=e,a(c.data.input).change(),a(c.data.displayBox).data("color",e),c.data.displayBox.css("background-color",e),c.data.chooser.hide(),b.displayColorCode&&c.data.displayBox.text(e),b.onSelect&&b.onSelect(this.id,d)})}}},h={input:this,container:c,displayBox:f};f.bind("click",h,g),a(this).after(c),a(this).data("container",c)}var d=this,e=["990033","ff3366","cc0033","ff0033","ff9999","cc3366","ffccff","cc6699","993366","660033","cc3399","ff99cc","ff66cc","ff99ff","ff6699","cc0066","ff0066","ff3399","ff0099","ff33cc","ff00cc","ff66ff","ff33ff","ff00ff","cc0099","990066","cc66cc","cc33cc","cc99ff","cc66ff","cc33ff","993399","cc00cc","cc00ff","9900cc","990099","cc99cc","996699","663366","660099","9933cc","660066","9900ff","9933ff","9966cc","330033","663399","6633cc","6600cc","9966ff","330066","6600ff","6633ff","ccccff","9999ff","9999cc","6666cc","6666ff","666699","333366","333399","330099","3300cc","3300ff","3333ff","3333cc","0066ff","0033ff","3366ff","3366cc","000066","000033","0000ff","000099","0033cc","0000cc","336699","0066cc","99ccff","6699ff","003366","6699cc","006699","3399cc","0099cc","66ccff","3399ff","003399","0099ff","33ccff","00ccff","99ffff","66ffff","33ffff","00ffff","00cccc","009999","669999","99cccc","ccffff","33cccc","66cccc","339999","336666","006666","003333","00ffcc","33ffcc","33cc99","00cc99","66ffcc","99ffcc","00ff99","339966","006633","336633","669966","66cc66","99ff99","66ff66","339933","99cc99","66ff99","33ff99","33cc66","00cc66","66cc99","009966","009933","33ff66","00ff66","ccffcc","ccff99","99ff66","99ff33","00ff33","33ff33","00cc33","33cc33","66ff33","00ff00","66cc33","006600","003300","009900","33ff00","66ff00","99ff00","66cc00","00cc00","33cc00","339900","99cc66","669933","99cc33","336600","669900","99cc00","ccff66","ccff33","ccff00","999900","cccc00","cccc33","333300","666600","999933","cccc66","666633","999966","cccc99","ffffcc","ffff99","ffff66","ffff33","ffff00","ffcc00","ffcc66","ffcc33","cc9933","996600","cc9900","ff9900","cc6600","993300","cc6633","663300","ff9966","ff6633","ff9933","ff6600","cc3300","996633","330000","663333","996666","cc9999","993333","cc6666","ffcccc","ff3333","cc3333","ff6666","660000","990000","cc0000","ff0000","ff3300","cc9966","ffcc99","ffffff","cccccc","999999","666666","333333","000000","000000","000000","000000","000000","000000","000000","000000","000000"];return b=a.extend({defaultColor:this.attr("defaultColor")||"#FFF",cellWidth:this.attr("cellWidth")||10,cellHeight:this.attr("cellHeight")||10,cellMargin:this.attr("cellMargin")||1,boxWidth:this.attr("boxWidth")||"115px",boxHeight:this.attr("boxHeight")||"20px",columns:this.attr("columns")||16,insert:this.attr("insert")||"after",colors:this.attr("colors")||e,displayColorCode:this.attr("displayColorCode")||!1,colorCodeAlign:this.attr("colorCodeAlign")||"center",colorCodeColor:this.attr("colorCodeColor")||"#FFF",onSelect:null,onCellEnter:null,onClose:null,livePreview:!1},b||{}),b.totalWidth=b.columns*(b.cellWidth+2*b.cellMargin),b.chooserCSS=a.extend({border:"1px solid #000",margin:"0 0 0 5px",width:b.totalWidth,height:b.totalHeight,top:0,left:b.boxWidth,position:"absolute","background-color":"#fff"},b.chooserCSS||{}),b.displayCSS=a.extend({"background-color":b.defaultColor,border:"1px solid #000",width:b.boxWidth,height:b.boxHeight,"line-height":b.boxHeight+"px",cursor:"pointer"},b.displayCSS||{}),this.hide(),-1!=navigator.userAgent.indexOf("MSIE")&&(b.totalWidth+=2),b.totalHeight=Math.ceil(b.colors.length/b.columns)*(b.cellHeight+2*b.cellMargin),a.simpleColorOptions=b,this.each(c),a(".simpleColorDisplay").each(function(){a(this).click(function(a){a.stopPropagation()})}),this},a.fn.closeChooser=function(){return this.each(function(){a(this).data("container").find(".simpleColorChooser").hide()}),this},a.fn.setColor=function(b){return this.each(function(){var c=a(this).data("container").find(".simpleColorDisplay");c.css("background-color",b).data("color",b),c.data("displayColorCode")===!0&&c.text(b)}),this}}(jQuery); \ No newline at end of file Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml =================================================================== diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision c135649b64e98c9233da20bdcfb7689598116314) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -241,6 +241,12 @@ + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.hbm.xml =================================================================== diff -u --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.hbm.xml (revision 0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.hbm.xml (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml =================================================================== diff -u --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml (revision 0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040024.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040024.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040024.sql (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,42 @@ +-- Turn off autocommit, so nothing is committed if there is an error + +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; + +-- LDEV-3115 Flashless Authoring: annotation labels and regions, access dates for recently used LDs + +CREATE TABLE IF NOT EXISTS lams_learning_design_annotation ( + uid BIGINT(20) NOT NULL auto_increment + , learning_design_id BIGINT(20) NOT NULL + , ui_id INT(11) + , title VARCHAR(1024) + , xcoord INT(11) + , ycoord INT(11) + , end_xcoord INT(11) + , end_ycoord INT(11) + , color CHAR(7) + , CONSTRAINT FK_lams_learning_design_annotation_1 FOREIGN KEY (learning_design_id) + REFERENCES lams_learning_design (learning_design_id) + ON UPDATE CASCADE ON DELETE CASCADE + , PRIMARY KEY (uid) +)ENGINE=InnoDB; + + +CREATE TABLE IF NOT EXISTS lams_learning_design_access ( + learning_design_id BIGINT(20) NOT NULL + , user_id BIGINT(20) NOT NULL + , access_date DATETIME + , CONSTRAINT FK_lams_learning_design_access_1 FOREIGN KEY (learning_design_id) + REFERENCES lams_learning_design (learning_design_id) + ON UPDATE CASCADE ON DELETE CASCADE + , CONSTRAINT FK_lams_learning_design_access_2 FOREIGN KEY (user_id) + REFERENCES lams_user (user_id) + ON UPDATE CASCADE ON DELETE CASCADE + , PRIMARY KEY (learning_design_id, user_id) +)ENGINE=InnoDB; + + +-- If there were no errors, commit and restore autocommit to on +SET FOREIGN_KEY_CHECKS=0; +COMMIT; +SET AUTOCOMMIT = 1; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java =================================================================== diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision c135649b64e98c9233da20bdcfb7689598116314) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -137,6 +137,9 @@ private Set competences; /** persistent field */ + private Set annotations; + + /** persistent field */ private WorkspaceFolder workspaceFolder; /** persistent field */ @@ -574,6 +577,14 @@ public void setCompetences(Set competences) { this.competences = competences; } + + public Set getAnnotations() { + return annotations; + } + + public void setAnnotations(Set annotations) { + this.annotations = annotations; + } public void setFloatingActivity(FloatingActivity activity) { floatingActivity = activity; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAccess.java (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,100 @@ +/**************************************************************** + * Copyright (C) 2008 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 + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.learningdesign; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.HashCodeBuilder; + +/** + * Marks when an user used (opened, saved etc.) a learning design the last time. + * + * @author Marcin Cieslak + * + */ +public class LearningDesignAccess implements Serializable { + + Long learningDesignId; + Integer userId; + Date accessDate; + + public Long getLearningDesignId() { + return learningDesignId; + } + + public void setLearningDesignId(Long learningDesignId) { + this.learningDesignId = learningDesignId; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Date getAccessDate() { + return accessDate; + } + + public void setAccessDate(Date accessDate) { + this.accessDate = accessDate; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(learningDesignId).append(userId).toHashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + LearningDesignAccess other = (LearningDesignAccess) obj; + if (learningDesignId == null) { + if (other.learningDesignId != null) { + return false; + } + } else if (!learningDesignId.equals(other.learningDesignId)) { + return false; + } + if (userId == null) { + if (other.userId != null) { + return false; + } + } else if (!userId.equals(other.userId)) { + return false; + } + return true; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,152 @@ +/*************************************************************************** + * 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 + * ************************************************************************ + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.learningdesign; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.HashCodeBuilder; + +/** + * Stores decoration elements (labels and regions) on Learning Design canvas. + * + * @author Marcin Cieslak + */ +public class LearningDesignAnnotation implements Serializable { + + private Long uid; + private Integer annotationUIID; + private Long learningDesignId; + private String title; + private Integer xcoord; + private Integer ycoord; + private Integer endXcoord; + private Integer endYcoord; + private String color; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public Integer getAnnotationUIID() { + return annotationUIID; + } + + public void setAnnotationUIID(Integer annotationUIID) { + this.annotationUIID = annotationUIID; + } + + public Long getLearningDesignId() { + return learningDesignId; + } + + public void setLearningDesignId(Long learningDesignId) { + this.learningDesignId = learningDesignId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getXcoord() { + return xcoord; + } + + public void setXcoord(Integer xcoord) { + this.xcoord = xcoord; + } + + public Integer getYcoord() { + return ycoord; + } + + public void setYcoord(Integer ycoord) { + this.ycoord = ycoord; + } + + public Integer getEndXcoord() { + return endXcoord; + } + + public void setEndXcoord(Integer endXcoord) { + this.endXcoord = endXcoord; + } + + public Integer getEndYcoord() { + return endYcoord; + } + + public void setEndYcoord(Integer endYcoord) { + this.endYcoord = endYcoord; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(learningDesignId).append(annotationUIID).toHashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + LearningDesignAnnotation other = (LearningDesignAnnotation) obj; + if (annotationUIID == null) { + if (other.annotationUIID != null) { + return false; + } + } else if (!annotationUIID.equals(other.annotationUIID)) { + return false; + } + if (learningDesignId == null) { + if (other.learningDesignId != null) { + return false; + } + } else if (!learningDesignId.equals(other.learningDesignId)) { + return false; + } + return true; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/ILearningDesignDAO.java =================================================================== diff -u -r309a597eada52a4079f2985e0d97beedf9adda42 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/ILearningDesignDAO.java (.../ILearningDesignDAO.java) (revision 309a597eada52a4079f2985e0d97beedf9adda42) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/ILearningDesignDAO.java (.../ILearningDesignDAO.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -27,6 +27,7 @@ import org.lamsfoundation.lams.dao.IBaseDAO; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAccess; ; /** * @author Manpreet Minhas @@ -93,4 +94,5 @@ */ public List getLearningDesignTitlesByWorkspaceFolder(Integer workspaceFolderID); -} + public List getAccessByUser(Long userId); +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/LearningDesignDAO.java =================================================================== diff -u -r309a597eada52a4079f2985e0d97beedf9adda42 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/LearningDesignDAO.java (.../LearningDesignDAO.java) (revision 309a597eada52a4079f2985e0d97beedf9adda42) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/LearningDesignDAO.java (.../LearningDesignDAO.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -29,6 +29,7 @@ import org.hibernate.Query; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAccess; import org.lamsfoundation.lams.learningdesign.dao.ILearningDesignDAO; /** @@ -49,6 +50,8 @@ private static final String FIND_LD_NAMES_IN_FOLDER = "select title from " + LearningDesign.class.getName()+ " where workspace_folder_id=?"; + private static final String ACCESS_BY_USER ="from " + LearningDesignAccess.class + " as a where.userId = ?"; + /* * @see org.lamsfoundation.lams.learningdesign.dao.interfaces.ILearningDesignDAO#getLearningDesignById(java.lang.Long) */ @@ -113,5 +116,10 @@ public List getLearningDesignTitlesByWorkspaceFolder(Integer workspaceFolderID){ return this.getHibernateTemplate().find(FIND_LD_NAMES_IN_FOLDER,workspaceFolderID); } - -} + + @SuppressWarnings("unchecked") + @Override + public List getAccessByUser(Long userId) { + return this.getHibernateTemplate().find(ACCESS_BY_USER, userId); + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java =================================================================== diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java (.../LearningDesignDTO.java) (revision c135649b64e98c9233da20bdcfb7689598116314) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java (.../LearningDesignDTO.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -35,6 +35,7 @@ import org.lamsfoundation.lams.learningdesign.Competence; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.LearningDesign; +import org.lamsfoundation.lams.learningdesign.LearningDesignAnnotation; import org.lamsfoundation.lams.learningdesign.Transition; import org.lamsfoundation.lams.learningdesign.dao.hibernate.ActivityDAO; import org.lamsfoundation.lams.learningdesign.dao.hibernate.GroupingDAO; @@ -83,6 +84,7 @@ private ArrayList transitions; private ArrayList branchMappings; private ArrayList competences; + private Set annotations; public LearningDesignDTO() { } @@ -140,6 +142,7 @@ this.activities = populateActivities(learningDesign, languageCode); this.transitions = populateTransitions(learningDesign); this.competences = populateCompetences(learningDesign); + this.annotations = learningDesign.getAnnotations(); } @@ -737,4 +740,11 @@ this.competences = competences; } -} + public Set getAnnotations() { + return annotations; + } + + public void setAnnotations(Set annotations) { + this.annotations = annotations; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java =================================================================== diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java (.../LearningDesignService.java) (revision 9fb16007bc803d29180994effaed30ebb0a2e561) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignService.java (.../LearningDesignService.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -230,18 +230,19 @@ toolDTO.setActivityCategoryID(isParallel ? Activity.CATEGORY_SPLIT : libraryActivityDTO .getActivityCategoryID()); - if (libraryActivityDTO.getToolID() != null) { + if (libraryActivityDTO.getToolID() == null) { + String iconPath = libraryActivityDTO.getLibraryActivityUIImage(); + // to be uncommented as soon as SVG images are delivered + // iconPath = iconPath.replace(".swf", ".svg"); + toolDTO.setIconPath(iconPath); + } else { Tool tool = (Tool) learningLibraryDAO.find(Tool.class, libraryActivityDTO.getToolID()); - if (tool != null) { - String iconPath = libraryActivityDTO.getLibraryActivityUIImage(); - iconPath = iconPath.substring(0, iconPath.lastIndexOf('/') + 1); - iconPath += "icon_" + tool.getToolIdentifier() + ".svg"; - toolDTO.setIconPath(iconPath); - - toolDTO.setSupportsOutputs(tool.getSupportsOutputs()); - } + String iconPath = "tool/" + tool.getToolSignature() + "/images/icon_" + tool.getToolIdentifier() + + ".svg"; + toolDTO.setIconPath(iconPath); + toolDTO.setSupportsOutputs(tool.getSupportsOutputs()); } - + tools.add(toolDTO); } } Index: lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java =================================================================== diff -u -ree35ce3afcea957fc919c15fb254ae593cdb44c2 -r0144e9d0f7fc574a887933024183a8a9049bc414 --- lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision ee35ce3afcea957fc919c15fb254ae593cdb44c2) +++ lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -36,7 +36,8 @@ public static final String TRANSITIONS = "transitions"; public static final String ACTIVITIES = "activities"; public static final String BRANCH_MAPPINGS = "branchMappings"; - + public static final String ANNOTATIONS = "annotations"; + /* Learning Library specific tags */ public static final String LEARNING_LIBRARY_ID = "learningLibraryID"; public static final String LIB_ACTIVITIES = "templateActivities"; @@ -131,6 +132,7 @@ public static final String FIRST_ACTIVITY_UIID = "firstActivityUIID"; public static final String FLOATING_ACTIVITY_ID = "floatingActivityID"; public static final String FLOATING_ACTIVITY_UIID = "floatingActivityUIID"; + public static final String ANNOTATION_UIID = "annotationUIID"; public static final String MAX_ID = "maxID"; public static final String VALID_DESIGN = "validDesign"; @@ -168,7 +170,8 @@ public static final String START_YCOORD = "startYCoord"; public static final String END_XCOORD = "endXCoord"; public static final String END_YCOORD = "endYCoord"; - + public static final String COLOR = "color"; + /** Branch Mapping and Tool Condition Tags */ public static final String BRANCH_ACTIVITY_ENTRY_ID = "entryID"; public static final String BRANCH_ACTIVITY_ENTRY_UIID = "entryUIID"; Index: lams_tool_imscc/web/images/icon_sharedcommonCartridge.svg =================================================================== diff -u --- lams_tool_imscc/web/images/icon_sharedcommonCartridge.svg (revision 0) +++ lams_tool_imscc/web/images/icon_sharedcommonCartridge.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,132 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_lamc/web/images/icon_mc.svg =================================================================== diff -u --- lams_tool_lamc/web/images/icon_mc.svg (revision 0) +++ lams_tool_lamc/web/images/icon_mc.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,138 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_laqa/web/images/icon_qa.svg =================================================================== diff -u --- lams_tool_laqa/web/images/icon_qa.svg (revision 0) +++ lams_tool_laqa/web/images/icon_qa.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,189 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_larsrc/web/images/icon_sharedresources.svg =================================================================== diff -u --- lams_tool_larsrc/web/images/icon_sharedresources.svg (revision 0) +++ lams_tool_larsrc/web/images/icon_sharedresources.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,114 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_nb/web/images/icon_nb.svg =================================================================== diff -u --- lams_tool_nb/web/images/icon_nb.svg (revision 0) +++ lams_tool_nb/web/images/icon_nb.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,344 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_sbmt/web/images/icon_submitfile.svg =================================================================== diff -u --- lams_tool_sbmt/web/images/icon_submitfile.svg (revision 0) +++ lams_tool_sbmt/web/images/icon_submitfile.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,180 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_task/web/images/icon_sharedtaskList.svg =================================================================== diff -u --- lams_tool_task/web/images/icon_sharedtaskList.svg (revision 0) +++ lams_tool_task/web/images/icon_sharedtaskList.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,170 @@ + + + +image/svg+xml \ No newline at end of file Index: lams_tool_vote/web/images/icon_vote.svg =================================================================== diff -u --- lams_tool_vote/web/images/icon_vote.svg (revision 0) +++ lams_tool_vote/web/images/icon_vote.svg (revision 0144e9d0f7fc574a887933024183a8a9049bc414) @@ -0,0 +1,177 @@ + + + +image/svg+xml \ No newline at end of file