Index: lams_central/web/newLesson.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/Attic/newLesson.jsp,v
diff -u -r1.3 -r1.4
--- lams_central/web/newLesson.jsp 8 Jan 2013 11:19:31 -0000 1.3
+++ lams_central/web/newLesson.jsp 9 Jan 2013 15:18:37 -0000 1.4
@@ -104,21 +104,33 @@
-
+
+
+ ▲
+
|
-
+
+
+ ▲
+
|
-
+
+ ▲
+
+
|
-
+
+ ▲
+
+
|
Index: lams_central/web/css/newLesson.css
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/css/Attic/newLesson.css,v
diff -u -r1.3 -r1.4
--- lams_central/web/css/newLesson.css 8 Jan 2013 11:19:31 -0000 1.3
+++ lams_central/web/css/newLesson.css 9 Jan 2013 15:18:37 -0000 1.4
@@ -146,6 +146,13 @@
text-align: center;
}
+.sortUsersButton {
+ text-align: right;
+ padding-right: 3px;
+ float: right;
+ cursor: pointer;
+}
+
.droppableHighlight {
padding : 1px;
border: 5px solid #5c9ccc;
Index: lams_central/web/includes/javascript/newLesson.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/Attic/newLesson.js,v
diff -u -r1.3 -r1.4
--- lams_central/web/includes/javascript/newLesson.js 8 Jan 2013 11:19:31 -0000 1.3
+++ lams_central/web/includes/javascript/newLesson.js 9 Jan 2013 15:18:37 -0000 1.4
@@ -1,6 +1,7 @@
-// ********** MAIN FUNCTIONS **********
+// ********** MAIN FUNCTIONS **********
var tree;
-var lastSelectedUsers = [];
+var lastSelectedUsers = {};
+var sortOrderDescending = {};
var submitInProgress = false;
function initLessonTab(){
@@ -159,6 +160,8 @@
}
});
});
+
+ $('.sortUsersButton').click(sortUsers);
}
@@ -176,7 +179,7 @@
});
$('#introEnableField').change(function(){
- $('#introSection input, #introSection textarea').prop('disabled', !$(this).is(':checked'));
+ $('#introDescriptionField, #introImageField').prop('disabled', !$(this).is(':checked'));
});
$('#presenceEnableField').change(function(){
@@ -367,7 +370,10 @@
if (users) {
// create user DIVs
$.each(users, function(index, userJSON) {
- $('#' + containerID).append($('').attr('userId', userJSON.userID)
+ $('#' + containerID).append($('').attr({
+ 'userId' : userJSON.userID,
+ 'sortKey' : userJSON.lastName
+ })
.addClass('draggableUser')
.text(userJSON.firstName + ' ' + userJSON.lastName
+ ' (' + userJSON.login + ')')
@@ -401,6 +407,36 @@
return list;
}
+function sortUsers() {
+ var buttonId = $(this).attr('id');
+ var container = $('#' + buttonId.substring(buttonId.indexOf('-') + 1));
+ var users = container.children('div.draggableUser');
+ if (users.length > 1) {
+ var sortOrderDesc = sortOrderDescending[buttonId];
+
+ users.each(function(){
+ $(this).detach();
+ }).sort(function(a, b){
+ var keyA = $(a).attr('sortKey');
+ var keyB = $(b).attr('sortKey');
+ var result = keyA > keyB ? 1 : keyA < keyB ? -1 : 0;
+ return sortOrderDesc ? result : -result;
+ }).each(function(){
+ $(this).appendTo(container);
+ });
+
+ if (sortOrderDesc) {
+ $(this).html('▲');
+ sortOrderDescending[buttonId] = false;
+ } else {
+ $(this).html('▼');
+ sortOrderDescending[buttonId] = true;
+ }
+
+ colorDraggableUsers(container);
+ }
+}
+
// ********** ADVANCED TAB FUNCTIONS **********
function updateSplitLearnersFields(){