Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -r5d62f3e3ddf8ecead3be4c6bcabfa9a6d1596f20 -rbd8e4d7f256d453e579e8138182bf51898b2b256
Binary files differ
Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r43ac8bf65cc71fe9d845910f28ddee4bf5c8ee32 -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 43ac8bf65cc71fe9d845910f28ddee4bf5c8ee32)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -670,6 +670,7 @@
authoring.fla.page.prop.optional.activities.min =Min activities:
authoring.fla.page.prop.optional.activities.max =Max activities:
authoring.fla.page.prop.color =Color:
+authoring.fla.page.prop.size =Size:
authoring.fla.page.dialog.cond.output.choose =[ Choose Output ]
authoring.fla.page.dialog.cond.options.choose =[ Options ]
authoring.fla.page.dialog.cond.greater =Greater than or equal to
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java
===================================================================
diff -u -r2c216dc6ff16c074af2d2db0e8c6f528b0ca4456 -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 2c216dc6ff16c074af2d2db0e8c6f528b0ca4456)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -886,6 +886,7 @@
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));
+ annotation.setSize(Short.valueOf((String) JsonUtil.opt(annotationJSON, AuthoringJsonTags.SIZE)));
if (found) {
baseDAO.update(annotation);
Index: lams_central/web/authoring/authoring.jsp
===================================================================
diff -u -r9129a47464a8fe42da6f861e9b1d3785e0974a2c -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 9129a47464a8fe42da6f861e9b1d3785e0974a2c)
+++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -953,6 +953,23 @@
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
Index: lams_central/web/css/authoring.css
===================================================================
diff -u -r822f80a44598d653f6e0884fad68f2bab04bfe81 -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/web/css/authoring.css (.../authoring.css) (revision 822f80a44598d653f6e0884fad68f2bab04bfe81)
+++ lams_central/web/css/authoring.css (.../authoring.css) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -137,6 +137,15 @@
width: 99%;
}
+.dialogContents .labelPlusSize {
+ cursor: pointer;
+}
+
+.dialogContents .labelMinusSize {
+ margin-left: 15px;
+ cursor: pointer;
+}
+
div#groupNamingDialog .btn-group,
div#gtbDialog .btn-group,
div#ctbDialog .btn-group,
Index: lams_central/web/includes/javascript/authoring/authoringDecoration.js
===================================================================
diff -u -rb40bf86f21292690dfe94f2167a73f9ee2488567 -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/web/includes/javascript/authoring/authoringDecoration.js (.../authoringDecoration.js) (revision b40bf86f21292690dfe94f2167a73f9ee2488567)
+++ lams_central/web/includes/javascript/authoring/authoringDecoration.js (.../authoringDecoration.js) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -24,7 +24,7 @@
/**
* Constructor for label annotation.
*/
- Label : function(id, uiid, x, y, title){
+ Label : function(id, uiid, x, y, title, color, size){
this.id = +id || null;
this.uiid = +uiid || ++layout.ld.maxUIID;
// set a default title, if none provided
@@ -36,7 +36,7 @@
this.loadPropertiesDialogContent = PropertyDefs.labelProperties;
}
- this.draw(x, y);
+ this.draw(x, y, color || layout.colors.activityText, size || layout.conf.labelDefaultSize);
},
@@ -161,10 +161,18 @@
* Label methods
*/
label : {
- draw : function(x, y) {
+ draw : function(x, y, color, size) {
var x = x ? x : this.items.shape.attr('x'),
- y = y ? y : this.items.shape.attr('y');
+ y = y ? y : this.items.shape.attr('y'),
+ color = color ? color : this.items.shape.attr('fill'),
+ // do not grow/shrink over given limits
+ size = size ? Math.max(layout.conf.labelMinSize, Math.min(layout.conf.labelMaxSize, size)) : null;
+ if (!size) {
+ size = this.items.shape.attr('font-size');
+ size = size.substring(0, size.indexOf('px'));
+ }
+
if (this.items) {
this.items.remove();
}
@@ -174,7 +182,11 @@
this.items.attr('uiid', this.uiid);
this.items.shape = paper.text(x, y, this.title)
.attr(layout.defaultTextAttributes)
- .attr('text-anchor', 'start');
+ .attr({
+ 'text-anchor' : 'start',
+ 'font-size' : size,
+ 'fill' : color
+ });
this.items.append(this.items.shape);
this.items.attr('cursor', 'pointer')
@@ -250,8 +262,8 @@
/**
* Adds a string on the canvas
*/
- addLabel : function(x, y, title) {
- var label = new DecorationDefs.Label(null, null, x, y, title);
+ addLabel : function(x, y, title, color, size) {
+ var label = new DecorationDefs.Label(null, null, x, y, title, color, size);
layout.labels.push(label);
GeneralLib.setModified(true);
return label;
Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js
===================================================================
diff -u -rd0d5266025fe26bb0c984f5bc472e81c5532ea3a -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision d0d5266025fe26bb0c984f5bc472e81c5532ea3a)
+++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -90,6 +90,9 @@
'containerActivityChildrenPadding' : 10,
'regionEmptyWidth' : 20,
'regionEmptyHeight' : 20,
+ 'labelDefaultSize' : 11,
+ 'labelMinSize' : 9,
+ 'labelMaxSize' : 20,
'groupingEffectPadding' : 5,
'selectEffectPadding' : 7,
@@ -121,9 +124,9 @@
// highlight branching edges on mouse hover
'branchingEdgeMatch' : 'blue',
'gate' : 'red',
- 'gateBorder' : '#801515',
+ 'gateBorder' : '#801515',
'gateText' : 'white',
- 'grouping' : '#caddfb',
+ 'grouping' : '#caddfb',
'groupingBorder' : '#00007f',
'optionalActivity' : '#caddfb',
'optionalActivityBorder' : '#00007f',
@@ -1958,7 +1961,7 @@
DecorationLib.addRegion(this.xcoord, this.ycoord, this.endXcoord, this.endYcoord,
this. title, this.color);
} else {
- DecorationLib.addLabel(this.xcoord, this.ycoord, this.title);
+ DecorationLib.addLabel(this.xcoord, this.ycoord, this.title, this.color, this.size);
}
});
@@ -2422,7 +2425,11 @@
// iterate over labels and regions
$.each(layout.labels.concat(layout.regions), function(){
var box = this.items.shape.getBBox(),
- isRegion = this instanceof DecorationDefs.Region;
+ isRegion = this instanceof DecorationDefs.Region,
+ size = isRegion ? null : this.items.shape.attr('font-size');
+ if (size) {
+ size = size.substring(0, size.indexOf('px'));
+ }
annotations.push({
'id' : this.id,
@@ -2432,7 +2439,8 @@
'yCoord' : parseInt(box.y),
'endXCoord' : isRegion ? parseInt(box.x2) : null,
'endYCoord' : isRegion ? parseInt(box.y2) : null,
- 'color' : isRegion ? Snap.color(this.items.shape.attr('fill')).hex : null
+ 'color' : Snap.color(this.items.shape.attr('fill')).hex,
+ 'size' : size
});
});
Index: lams_central/web/includes/javascript/authoring/authoringProperty.js
===================================================================
diff -u -r9129a47464a8fe42da6f861e9b1d3785e0974a2c -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 9129a47464a8fe42da6f861e9b1d3785e0974a2c)
+++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -404,13 +404,29 @@
content = label.propertiesContent = $('#propertiesContentLabel').clone().attr('id', null)
.show().data('parentObject', label);
$('.propertiesContentFieldTitle', content).val(label.title);
+ var color = label.items.shape.attr('fill');
+ // init colour chooser
+ $('.propertiesContentFieldColor', content).val(color)
+ .simpleColor({
+ 'colors' : layout.colors.annotationPalette,
+ 'chooserCSS' : {
+ 'left' : 2,
+ 'top' : '25px',
+ 'margin' : '0'
+ }
+ });
- $('input', content).change(function(){
+ var changeFunction = function(){
// extract changed properties and redraw the label, if needed
var content = $(this).closest('.dialogContents'),
label = content.data('parentObject'),
redrawNeeded = false,
- newTitle = $('.propertiesContentFieldTitle', content).val();
+ newTitle = $('.propertiesContentFieldTitle', content).val(),
+ color = label.items.shape.attr('fill'),
+ newColor = $('.propertiesContentFieldColor', content).val(),
+ size = label.items.shape.attr('font-size');
+ size = +size.substring(0, size.indexOf('px'));
+
if (newTitle == '') {
newTitle = undefined;
}
@@ -424,12 +440,27 @@
}
}
+ redrawNeeded |= newColor != color;
+ redrawNeeded |= label.newSize && (label.newSize <= layout.conf.labelMaxSize
+ || label.newSize >= layout.conf.labelMinSize);
+
if (redrawNeeded) {
ActivityLib.removeSelectEffect(label);
- label.draw();
+ label.draw(null, null, newColor, label.newSize);
ActivityLib.addSelectEffect(label, true);
GeneralLib.setModified(true);
}
+
+ label.newSize = null;
+ };
+
+ $('input', content).change(changeFunction);
+
+ $('.labelPlusSize, .labelMinusSize', content).click(function(){
+ label.newSize = label.items.shape.attr('font-size');
+ label.newSize = +label.newSize.substring(0, label.newSize.indexOf('px'))
+ + ($(this).hasClass('labelPlusSize') ? 1 : -1);
+ changeFunction.call(content);
});
}
},
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml
===================================================================
diff -u -rc7798d2b81a0595194a5e905ef6c33e372ad8007 -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml (.../LearningDesignAnnotation.hbm.xml) (revision c7798d2b81a0595194a5e905ef6c33e372ad8007)
+++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.hbm.xml (.../LearningDesignAnnotation.hbm.xml) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -25,6 +25,8 @@
+
+
\ No newline at end of file
Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170310.sql
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170310.sql (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170310.sql (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -0,0 +1,14 @@
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+SET FOREIGN_KEY_CHECKS=0;
+----------------------Put all sql statements below here-------------------------
+
+-- LDEV-4124 Add size to labels
+ALTER TABLE lams_learning_design_annotation ADD COLUMN size TINYINT;
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
+SET FOREIGN_KEY_CHECKS=1;
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java
===================================================================
diff -u -r51fb2a37254f24bb2a805d4ffd54482c779f43fa -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java (.../LearningDesignAnnotation.java) (revision 51fb2a37254f24bb2a805d4ffd54482c779f43fa)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignAnnotation.java (.../LearningDesignAnnotation.java) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -43,6 +43,7 @@
private Integer endXcoord;
private Integer endYcoord;
private String color;
+ private Short size;
public Long getUid() {
return uid;
@@ -116,6 +117,14 @@
this.color = color;
}
+ public Short getSize() {
+ return size;
+ }
+
+ public void setSize(Short size) {
+ this.size = size;
+ }
+
@Override
public int hashCode() {
return new HashCodeBuilder().append(learningDesignId).append(annotationUIID).toHashCode();
Index: lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java
===================================================================
diff -u -r51fb2a37254f24bb2a805d4ffd54482c779f43fa -rbd8e4d7f256d453e579e8138182bf51898b2b256
--- lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision 51fb2a37254f24bb2a805d4ffd54482c779f43fa)
+++ lams_common/src/java/org/lamsfoundation/lams/util/AuthoringJsonTags.java (.../AuthoringJsonTags.java) (revision bd8e4d7f256d453e579e8138182bf51898b2b256)
@@ -167,13 +167,14 @@
public static final String EXTERNAL_SIG = "externalSignature";
public static final String ENTRY = "entry";
- /** Branching Activity Specific Tags */
+ /** Annotation Specific Tags */
public static final String START_XCOORD = "startXCoord";
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";
-
+ public static final String SIZE = "size";
+
/** Branch Mapping and Tool Condition Tags */
public static final String BRANCH_ACTIVITY_ENTRY_ID = "entryID";
public static final String BRANCH_ACTIVITY_ENTRY_UIID = "entryUIID";