# HG changeset patch # User durandn # Date 1446476639 -3600 # Node ID ba9f193121c3a8cd4e7068c7fdf26d5c01a0366f # Parent 21c941c07e7cc2976730b15bc425f4dceca04af6 Adjustements on Markers scenario (now displays a "teacher" markers row) + Added a new "markers_teacher" scenario to edit the teacher markers and browse user markers diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/static/remie/css/markers.css --- a/server/src/remie/static/remie/css/markers.css Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remie/static/remie/css/markers.css Mon Nov 02 16:03:59 2015 +0100 @@ -26,19 +26,37 @@ /* ----------------- Media Panel ----------------- */ /* ----------------------------------------------- */ -#player_container_widget_Markers_7{ +#markers_upper_container{ width: 560px !important; - height: 50px !important; margin: 0 40px !important; - top: -35px; + background: #FFFFFF none repeat scroll 0% 0%; } -#player_container_widget_Markers_7 .Ldt-Markers-Position{ +#markers_upper_container .Ldt-Markers-List, +#markers_lower_container .Ldt-Markers-List{ + background-color: #E0E0E0; +} + +#markers_lower_container{ + width: 560px !important; + margin: 0 40px !important; + background: #FFFFFF none repeat scroll 0% 0%; +} + +#markers_upper_container .Ldt-Markers-Position, +#markers_lower_container .Ldt-Markers-Position{ margin-left: -2px; width: 4px; background-color: #5a5a5a; } +.Ldt-Markers-userFilter-dropdown{ + position: relative; + top: -35px; + left: 565px; + width: 100px; +} + /* -------- Override video player style -------- */ #player_container_widget_Slider_3{ @@ -93,9 +111,10 @@ /* display: none; */ /* } */ +/* -------- Override Markers style -------- */ + .Ldt-Markers-Display, .Ldt-Markers-List { display: block; - height: 100% !important; } .Ldt-Markers-Marker{ @@ -104,7 +123,6 @@ } .Ldt-Markers-MarkerBall { - background-color: #1abacc !important; border: 3px solid white !important; border-radius: 50% !important; height: 25px !important; @@ -156,11 +174,13 @@ border-radius: 0; border-width: 2px; font-family: Open-Sans-Light; - min-height: 100px; + min-height: 25px; + max-height: 100px; padding: 10px; width: 100%; box-sizing: border-box; max-width: none; + margin-right: 5px; } .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-RoundButton { @@ -214,17 +234,3 @@ } -#player_container_widget_Markers_7 .Ldt-Markers-Inputs{ - background-color: rgba(225, 225, 225, 0); -} - -.Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-Info { - position: absolute; - left: 0; - width: 100%; -} - -.Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-Info .Ldt-Markers-MarkerEdit, -.Ldt-Markers-Info .Ldt-Markers-MarkerDescription{ - margin: 10px 0 0; -} \ No newline at end of file diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/static/remie/css/markers_student.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/remie/static/remie/css/markers_student.css Mon Nov 02 16:03:59 2015 +0100 @@ -0,0 +1,35 @@ +/* -------- Override Marker student scenario style -------- */ + +#markers_upper_container .Ldt-Markers-Marker:not(.Ldt-Markers-PlaceholderMarker) .Ldt-Markers-MarkerBall { + background-color: #a2cf18 !important; +} + +#markers_lower_container .Ldt-Markers-Marker:not(.Ldt-Markers-PlaceholderMarker) .Ldt-Markers-MarkerBall { + background-color: #1abacc !important; +} + +#markers_upper_container .Ldt-Markers-RoundButton { + display: none !important; +} + +#markers_upper_container .Ldt-Markers-Info{ + width: 100%; +} + +#markers_upper_container .Ldt-Markers-MarkerDescription{ + width: calc(100% - 54px); + margin-left: 29px; + margin-bottom: 10px; + margin-top: 10px; +} + +#markers_upper_container .Ldt-Markers-Inputs, +#markers_lower_container .Ldt-Markers-Inputs{ + background-color: rgba(225, 225, 225, 0); +} + + +#markers_lower_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-Info .Ldt-Markers-MarkerEdit, +#markers_lower_container .Ldt-Markers-Info .Ldt-Markers-MarkerDescription{ + margin: 10px -5px 0; +} \ No newline at end of file diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/static/remie/css/markers_teacher.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/remie/static/remie/css/markers_teacher.css Mon Nov 02 16:03:59 2015 +0100 @@ -0,0 +1,62 @@ +/* -------- Override Markers teacher scenario style -------- */ + + +#markers_upper_container .Ldt-Markers-Marker:not(.Ldt-Markers-PlaceholderMarker) .Ldt-Markers-MarkerBall { + background-color: #a2cf18 !important; +} + +#markers_lower_container .Ldt-Markers-Marker:not(.Ldt-Markers-PlaceholderMarker) .Ldt-Markers-MarkerBall { + background-color: #1abacc !important; +} + +#markers_upper_container .Ldt-Markers-Info{ + width: 100%; +} + +#markers_lower_container .Ldt-Markers-Info{ + width: 100%; +} + + +#markers_upper_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-Info .Ldt-Markers-MarkerEdit, +#markers_upper_container .Ldt-Markers-MarkerDescription{ + width: calc(100% - 54px); + margin-left: 29px; + margin-bottom: 10px; + margin-top: 10px; +} + +#markers_lower_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-Info .Ldt-Markers-MarkerEdit, +#markers_lower_container .Ldt-Markers-MarkerDescription{ + width: calc(100% - 54px); + margin-left: 29px; + margin-bottom: 10px; + margin-top: -10px; +} + +#markers_upper_container .Ldt-Markers-Inputs, +#markers_lower_container .Ldt-Markers-Inputs{ + background-color: rgba(225, 225, 225, 0); +} + + +#markers_upper_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-RoundButton.Ldt-Markers-Create{ + background-color: #a2cf18 !important; + border-color: #a2cf18 !important; +} + +#markers_upper_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-RoundButton.Ldt-Markers-Create:hover{ + border-color: #5a5a5a !important; +} + +#markers_lower_container .Ldt-Markers-RoundButton { + display: none !important; +} + +#markers_upper_container .Ldt-Markers-ScreenMain { + margin-top: -32px; +} + +#markers_upper_container .Ldt-Markers-Screen.Ldt-Markers-ScreenMain .Ldt-Markers-RoundButton{ + top: 40px; +} \ No newline at end of file diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/static/remie/metadataplayer/Markers.css --- a/server/src/remie/static/remie/metadataplayer/Markers.css Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remie/static/remie/metadataplayer/Markers.css Mon Nov 02 16:03:59 2015 +0100 @@ -19,8 +19,7 @@ .Ldt-Markers-Position { background: #fc00ff; - position: absolute; - top: -1px; + position: relative; left: 0; margin-left: -1px; width: 2px; @@ -56,7 +55,8 @@ line-height: 20px; } -.Ldt-Markers-RoundButton.Ldt-Markers-CannotCreate{ +.Ldt-Markers-RoundButton.Ldt-Markers-CannotCreate, +.Ldt-Markers-RoundButton.Ldt-Markers-PreviewDelete{ background-color: #999999; border-color: #797979 #444444 #222222 #696969; } @@ -72,14 +72,12 @@ } .Ldt-Markers-Info{ - height: 125px; width: 90%; display: inline-block; margin: 0px; } .Ldt-Markers-Screen{ - height: 125px; margin: 0px; } @@ -101,7 +99,10 @@ } a.Ldt-Markers-Close { - position: absolute; right: 2px; + position: relative; + float: right; + right: 2px; + top: 2px; display: inline-block; width: 17px; height: 17px; margin: 4px; background: url(img/widget-control.png); } @@ -116,12 +117,12 @@ } .Ldt-Markers-MarkerDescription{ - height: 45%; width: 90%; border: 1px solid #68273c; margin: 10px; padding: 10px; background: #ffffff; + overflow: scroll; } .Ldt-Markers-MarkerDescription:hover{ @@ -129,7 +130,6 @@ } .Ldt-Markers-MarkerEdit{ - height: 70%; width: 100%; margin: 10px; } @@ -179,7 +179,8 @@ border-color: #222222 #e87d9f #f0adc3 #68273c; } -.Ldt-Markers-RoundButton.Ldt-Markers-CannotCreate:hover{ +.Ldt-Markers-RoundButton.Ldt-Markers-CannotCreate:hover, +.Ldt-Markers-RoundButton.Ldt-Markers-PreviewDelete:hover{ background-color: #999999; border-color: #797979 #444444 #222222 #696969; } \ No newline at end of file diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/static/remie/metadataplayer/Markers.js --- a/server/src/remie/static/remie/metadataplayer/Markers.js Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remie/static/remie/metadataplayer/Markers.js Mon Nov 02 16:03:59 2015 +0100 @@ -6,6 +6,9 @@ IriSP.Widgets.Markers.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.Markers.prototype.defaults = { + pre_draw_callback: function(){ + return this.importUsers(); + }, annotation_type: "markers", line_height: 8, background: "#e0e0e0", @@ -32,12 +35,18 @@ custom_send_button: false, custom_cancel_button: false, preview_mode: false, + filter_per_user: false, + api_users_endpoint: "", + make_username_string_function: function(params){ + return params.username ? params.username : "Anonymous"; + }, + hide_if_empty: false, }; IriSP.Widgets.Markers.prototype.template = '
' + '
' - + '
' + + '
' + '
' + '
' + '
' @@ -45,6 +54,7 @@ + '
+
' + '{{^preview_mode}}
{{/preview_mode}}' + '{{#preview_mode}}
{{/preview_mode}}' + + '{{#filter_per_user}}{{#preview_mode}}{{/preview_mode}}{{/filter_per_user}}' + '
' + '
' + '
' @@ -125,41 +135,100 @@ } } +IriSP.Widgets.Markers.prototype.importUsers = function(){ + if (this.filter_per_user && this.preview_mode){ + this.usernames = Array(); + if (!this.source.users_data && this.api_users_endpoint){ + var _this = this, + _list = this.getWidgetAnnotations(), + usernames_list_string = ""; + + _list.forEach(function(_annotation){ + if(_this.usernames.indexOf(_annotation.creator) == -1){ + _this.usernames.push(_annotation.creator); + } + }); + this.usernames.forEach(function(_username){ + usernames_list_string+=_username+"," + }) + usernames_list_string = usernames_list_string.substring(0, usernames_list_string.length - 1); + _url = Mustache.to_html(this.api_users_endpoint, {usernames_list_string: encodeURIComponent(usernames_list_string), usernames_list_length: this.usernames.length}); + return IriSP.jQuery.ajax({ + async: false, + url: _url, + type: "GET", + success: function(_data) { + _this.source.users_data = _data.objects + }, + error: function(_xhr, _error, _thrown) { + console.log(_xhr) + console.log(_error) + console.log(_thrown) + } + }) + } + } +} + IriSP.Widgets.Markers.prototype.draw = function(){ var _this = this; - this.renderTemplate(); + if ((!this.filter_per_user) || (!this.preview_mode) || (this.usernames.length <= 1)){ + this.$.find(".Ldt-Markers-userFilter-dropdown").hide(); + } + else { + this.usernames.forEach(function(_user){ + var _users = _this.source.users_data.filter(function(_user_data){ + return _user_data.username == _user; + }), + _user_data = {}; + if (_users.length == 0){ + _user_data.username = _user; + } + else{ + _user_data = _users[0]; + } + _this.$.find(".Ldt-Markers-userFilter-dropdown").append("") + }); + this.$.find(".Ldt-Markers-userFilter-dropdown").change(this.functionWrapper("drawMarkers")) + this.$.find(".Ldt-Markers-userFilter-dropdown").change(this.functionWrapper("clearSelectedMarker")) + + } this.markers = this.getWidgetAnnotations().filter(function(_ann) { return ((_ann.getDuration() == 0) || (_ann.begin == _ann.end)); }); - this.drawMarkers(); - - this.$.find(".Ldt-Markers-Create").click(this.functionWrapper("onCreateClick")); - this.$.find(".Ldt-Markers-Delete").click(this.functionWrapper("onDeleteClick")); - this.$.find(".Ldt-Markers-RoundButton").hide() - this.updateCreateButtonState(this.media.getCurrentTime()) - this.$.find(".Ldt-Markers-Screen-SubmitDelete").click(this.functionWrapper("sendDelete")); - this.$.find(".Ldt-Markers-Screen-CancelDelete").click(function(){ - _this.showScreen("Main"); - _this.cancelEdit(); - }) - this.showScreen("Main"); - this.$.css({ - margin: "1px 0", - height: this.line_height, - background: this.background - }); - - this.$.find(".Ldt-Markers-Close").click(this.functionWrapper("revertToMainScreen")); - - this.onMediaEvent("timeupdate", this.functionWrapper("updatePosition")); - this.onMediaEvent("timeupdate", this.functionWrapper("updateCreateButtonState")); - this.onMediaEvent("play", this.functionWrapper("clearSelectedMarker")); - this.onMdpEvent("Markers.refresh", this.functionWrapper("drawMarkers")); - - this.newMarkerTimeCode = 0; - this.selectedMarker = false; + if (this.hide_if_empty && this.markers.length <= 0){ + this.$.hide(); + } + else { + this.drawMarkers(); + + this.$.find(".Ldt-Markers-Create").click(this.functionWrapper("onCreateClick")); + this.$.find(".Ldt-Markers-Delete").click(this.functionWrapper("onDeleteClick")); + this.$.find(".Ldt-Markers-RoundButton").hide() + this.updateCreateButtonState(this.media.getCurrentTime()) + this.$.find(".Ldt-Markers-Screen-SubmitDelete").click(this.functionWrapper("sendDelete")); + this.$.find(".Ldt-Markers-Screen-CancelDelete").click(function(){ + _this.showScreen("Main"); + _this.cancelEdit(); + }) + this.showScreen("Main"); + this.$.css({ + margin: "1px 0", + background: this.background + }); + + this.$.find(".Ldt-Markers-Close").click(this.functionWrapper("revertToMainScreen")); + + this.onMediaEvent("timeupdate", this.functionWrapper("updatePosition")); + this.onMediaEvent("timeupdate", this.functionWrapper("updateCreateButtonState")); + this.onMediaEvent("play", this.functionWrapper("clearSelectedMarker")); + this.onMdpEvent("Markers.refresh", this.functionWrapper("drawMarkers")); + + this.newMarkerTimeCode = 0; + this.selectedMarker = false; + } } @@ -359,11 +428,20 @@ IriSP.Widgets.Markers.prototype.drawMarkers = function(){ var _this = this, _scale = this.width / this.source.getDuration(), - list_$ = this.$.find('.Ldt-Markers-List'); + list_$ = this.$.find('.Ldt-Markers-List'), + _displayed_markers = this.markers; this.$.remove("Ldt-Markers-Marker"); list_$.html(""); - this.markers.forEach(function(_marker){ + + if (this.filter_per_user && this.usernames.length > 1){ + var _username = this.$.find(".Ldt-Markers-userFilter-dropdown")[0].options[this.$.find(".Ldt-Markers-userFilter-dropdown")[0].selectedIndex].value; + _displayed_markers = _displayed_markers.filter(function(_marker){ + return _marker.creator == _username; + }) + } + + _displayed_markers.forEach(function(_marker){ var _left = _marker.begin * _scale -1, _data = { left: _left, diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/templates/remie/iframe_markers.html --- a/server/src/remie/templates/remie/iframe_markers.html Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remie/templates/remie/iframe_markers.html Mon Nov 02 16:03:59 2015 +0100 @@ -3,18 +3,14 @@ Test +
-
-
-
-
-
-
-
+
+
+ +
+ + \ No newline at end of file diff -r 21c941c07e7c -r ba9f193121c3 server/src/remie/views.py --- a/server/src/remie/views.py Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remie/views.py Mon Nov 02 16:03:59 2015 +0100 @@ -77,6 +77,23 @@ return render_to_response(self.template_name, render_data, context_instance=RequestContext(request)) +class RemieMarkersTeacherView(View): + """ + The view with the markers-scenario + """ + template_name = "remie/iframe_markers_teacher.html" + + def get(self, request): + project_id = request.GET.get("project_id", "") # id of the project we're working on + current_user = request.user + render_data = { + "project_id": project_id, + "current_user": current_user.username, + } + return render_to_response(self.template_name, render_data, context_instance=RequestContext(request)) + + + class RemieMarkersPreviewView(View): """ The view with the markers-scenario diff -r 21c941c07e7c -r ba9f193121c3 server/src/remieplt/urls.py --- a/server/src/remieplt/urls.py Mon Nov 02 16:02:47 2015 +0100 +++ b/server/src/remieplt/urls.py Mon Nov 02 16:03:59 2015 +0100 @@ -26,7 +26,7 @@ from django.contrib.auth.decorators import login_required -from remie.views import RemieSegmentsSingleView, RemieSegmentsGroupView, RemieMarkersView, RemieTeacherView, RemieSegmentsPreviewView, RemieMarkersPreviewView, RemieIframeTesterView +from remie.views import RemieSegmentsSingleView, RemieSegmentsGroupView, RemieMarkersView, RemieTeacherView, RemieSegmentsPreviewView, RemieMarkersPreviewView, RemieMarkersTeacherView, RemieIframeTesterView js_info_dict = { 'packages': ('django.contrib.admin',), @@ -54,6 +54,7 @@ url(r'^remie/workunit/segments_group$', login_required(RemieSegmentsGroupView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_segments_group"), url(r'^remie/workunit/segments_single$', login_required(RemieSegmentsSingleView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_segments_single"), url(r'^remie/workunit/segments_preview$', login_required(RemieSegmentsPreviewView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_segments_preview"), + url(r'^remie/workunit/markers_teacher$', login_required(RemieMarkersTeacherView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_markers_teacher"), url(r'^remie/workunit/markers$', login_required(RemieMarkersView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_markers"), url(r'^remie/workunit/markers_preview$', login_required(RemieMarkersPreviewView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_markers_preview"), url(r'^remie/workunit/teacher$', login_required(RemieTeacherView.as_view(), login_url=reverse_lazy('cas_login')), name="remie_teacher"),