Gitlab CSE Unil

Commit 6c759df8 authored by Julien Furrer's avatar Julien Furrer
Browse files

Changed the way sharing properties are displayed in AOMgr

Display URL and label for ttp shared objects
parent 7d2e167d
......@@ -106,11 +106,18 @@ class AnObjSerializer(BaseAnObjSerializer):
class SharedAnObjSerializer(BaseAnObjSerializer):
sharing_opts = serializers.SerializerMethodField()
class Meta:
model = AnObj
fields = ('id', 'uuid', 'name', 'owners', 'owner', 'owner_name', 'annotations', 'locked',
'sharing_mode', 'allow_public_publishing')
'sharing_mode', 'sharing_opts', 'allow_public_publishing')
def get_sharing_opts(self, anobj):
if anobj.sharing_mode > 15:
return anobj.sharing_opts
else:
return None
class AnObjListSerializer(BaseAnObjSerializer):
......
......@@ -48,6 +48,7 @@ define([
this.publicPublishEl = this.$("#aom-prop-publishall");
this.propOwnerEl = this.$el.find(".aom-prop-owner").prev('dt').andSelf();
//this.propOwnerEl = this.$el.find(".aom-prop-owner").closest('.form-group');
this.sharingPropEl.find(".aom-prop-locked-info").popover({
placement: 'bottom',
......@@ -128,9 +129,10 @@ define([
// Update sharing properties
var sharingMode = itemModel.get('sharing_mode'),
ttpShared = itemModel.get('ttpShared'), // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked'),
publicPublish = itemModel.get('allow_public_publishing');
ttpShared = itemModel.get('ttpShared') === true, // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked') === true,
owned = itemModel.get('owned') === true,
publicPublish = itemModel.get('allow_public_publishing') === true;
this.sharingPropEl
.toggleClass("aom-prop-locked", locked)
......@@ -141,9 +143,13 @@ define([
if (ttpShared) {
this.$(".aom-shm-frontdrop").css("visibility", "hidden"); // Inhibbit the locking overlay for ttp sharing (not applied even for locked ttp images)
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-shm-frontdrop").css("visibility", "visible"); // Restore the locking overlay capability (it is active only for locked images)
}
if (ttpShared || !owned) {
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-prop-lock-but").removeAttr("disabled");
}
......@@ -160,6 +166,7 @@ define([
.closest(".checkbox").removeClass("disabled text-muted");
}
sharingModeSelect.val([sharingMode]);
this.sharingPropEl.find(".aom-prop-sharingmode-info").text(sharingModeSelect.find("option:selected").text());
this.publicPublishEl.val([publicPublish]);
this.propShMdParamsAll.addClass("hidden");
if (sharingMode) {
......@@ -176,6 +183,7 @@ define([
_setOptCtrlValue: function(shmGroupElem, sharingMode, itemModel) {
var me = this,
sharingOpts = itemModel.get('sharing_opts');
console.log("sharingOpts", sharingOpts);
//if (sharingOpts) try {
// sharingOpts = JSON.parse(itemModel.get('sharing_opts'));
//} catch(e) { sharingOpts = null; }
......@@ -220,7 +228,7 @@ define([
},
'attp_label': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.text(opts.label);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -228,7 +236,7 @@ define([
},
'attp_url': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.attr("href", opts.url);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -257,6 +265,7 @@ define([
clear: function() {
this.thumbEl.css("background-image", "none");
this.$(".aom-shm-frontdrop").css("visibility", "visible");
this._updateItemProp({get: function(){return ""}});
this.currentModel = null;
},
......@@ -286,8 +295,11 @@ define([
*/
setMode: function(mode) {
var isShared = mode === 'shared';
this.sharingPropEl.toggleClass('hidden', isShared);
this.sharingPropEl.find(".aom-prop-form").toggleClass('hidden', isShared);
this.propListEl.find(".aom-prop-lock-but").toggleClass('hidden', isShared);
this.propOwnerEl.toggleClass('hidden', !isShared);
this.sharingPropEl.find(".aom-info-share-form").toggleClass('hidden', !isShared);
},
// ########################
......
......@@ -1629,6 +1629,7 @@ fieldset[disabled] .btn-cimaf-layer.active {
}
.aom-info-panel .panel-body dl.aom-info-prop {
margin-top: 15px;
margin-left: 190px;
padding-right: 10px;
}
.aom-info-panel .panel-body dl.aom-info-prop dd {
......@@ -1739,7 +1740,7 @@ fieldset[disabled] .btn-cimaf-layer.active {
width: 100%;
z-index: 100;
}
#aom-shared-images-list .aom-list-item .btn-toolbar .aom-item-sh-status {
#aom-shared-images-list .aom-list-item .btn-toolbar .icon-share-alt {
display: none;
}
.aom-list-container {
......
......@@ -152,6 +152,7 @@
}
.aom-info-panel .panel-body dl.aom-info-prop {
margin-top: 15px;
margin-left: 190px;
padding-right: 10px;
}
.aom-info-panel .panel-body dl.aom-info-prop dd {
......@@ -262,7 +263,7 @@
width: 100%;
z-index: 100;
}
#aom-shared-images-list .aom-list-item .btn-toolbar .aom-item-sh-status {
#aom-shared-images-list .aom-list-item .btn-toolbar .icon-share-alt {
display: none;
}
.aom-list-container {
......
......@@ -4,6 +4,7 @@
@modal-header: #d0d0d0;
@aom-thumb-width: 150px;
@aom-thumb-margin: 30px;
@aom-thumb-height: @aom-thumb-width;
@aom-list-item-width: @aom-thumb-width + 30;
......@@ -106,9 +107,8 @@
font-size: 12px;
padding: 0;
.aom-image-thumb {
@thumb-margin: 30px;
width: @aom-thumb-width + @thumb-margin;
height: @aom-thumb-height + @thumb-margin;
width: @aom-thumb-width + @aom-thumb-margin;
height: @aom-thumb-height + @aom-thumb-margin;
background-color: @aom-list-item-bg;
border-color: @modal-header;
border-style: solid;
......@@ -119,6 +119,7 @@
dl.aom-info-prop {
margin-top: 15px;
margin-left: @aom-thumb-width + @aom-thumb-margin + 10px;
padding-right: 10px;
dd { margin-bottom: 1.4em; }
}
......@@ -233,7 +234,8 @@
#aom-shared-images-list {
.aom-list-item {
.btn-toolbar {
.aom-item-sh-status { display: none; }
//.aom-item-sh-status { display: none; }
.icon-share-alt { display: none; }
}
}
}
......
......@@ -14140,6 +14140,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
this.publicPublishEl = this.$("#aom-prop-publishall");
 
this.propOwnerEl = this.$el.find(".aom-prop-owner").prev('dt').andSelf();
//this.propOwnerEl = this.$el.find(".aom-prop-owner").closest('.form-group');
 
this.sharingPropEl.find(".aom-prop-locked-info").popover({
placement: 'bottom',
......@@ -14220,9 +14221,10 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
// Update sharing properties
var sharingMode = itemModel.get('sharing_mode'),
ttpShared = itemModel.get('ttpShared'), // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked'),
publicPublish = itemModel.get('allow_public_publishing');
ttpShared = itemModel.get('ttpShared') === true, // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked') === true,
owned = itemModel.get('owned') === true,
publicPublish = itemModel.get('allow_public_publishing') === true;
 
this.sharingPropEl
.toggleClass("aom-prop-locked", locked)
......@@ -14233,9 +14235,13 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
if (ttpShared) {
this.$(".aom-shm-frontdrop").css("visibility", "hidden"); // Inhibbit the locking overlay for ttp sharing (not applied even for locked ttp images)
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-shm-frontdrop").css("visibility", "visible"); // Restore the locking overlay capability (it is active only for locked images)
}
if (ttpShared || !owned) {
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-prop-lock-but").removeAttr("disabled");
}
 
......@@ -14252,6 +14258,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
.closest(".checkbox").removeClass("disabled text-muted");
}
sharingModeSelect.val([sharingMode]);
this.sharingPropEl.find(".aom-prop-sharingmode-info").text(sharingModeSelect.find("option:selected").text());
this.publicPublishEl.val([publicPublish]);
this.propShMdParamsAll.addClass("hidden");
if (sharingMode) {
......@@ -14268,6 +14275,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
_setOptCtrlValue: function(shmGroupElem, sharingMode, itemModel) {
var me = this,
sharingOpts = itemModel.get('sharing_opts');
console.log("sharingOpts", sharingOpts);
//if (sharingOpts) try {
// sharingOpts = JSON.parse(itemModel.get('sharing_opts'));
//} catch(e) { sharingOpts = null; }
......@@ -14312,7 +14320,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
},
 
'attp_label': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.text(opts.label);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -14320,7 +14328,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
},
 
'attp_url': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.attr("href", opts.url);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -14349,6 +14357,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
clear: function() {
this.thumbEl.css("background-image", "none");
this.$(".aom-shm-frontdrop").css("visibility", "visible");
this._updateItemProp({get: function(){return ""}});
this.currentModel = null;
},
......@@ -14378,8 +14387,11 @@ define('anobj-mgr/views/anobj/properties-panel',[
*/
setMode: function(mode) {
var isShared = mode === 'shared';
this.sharingPropEl.toggleClass('hidden', isShared);
this.sharingPropEl.find(".aom-prop-form").toggleClass('hidden', isShared);
this.propListEl.find(".aom-prop-lock-but").toggleClass('hidden', isShared);
this.propOwnerEl.toggleClass('hidden', !isShared);
this.sharingPropEl.find(".aom-info-share-form").toggleClass('hidden', !isShared);
},
 
// ########################
......
......@@ -14140,6 +14140,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
this.publicPublishEl = this.$("#aom-prop-publishall");
 
this.propOwnerEl = this.$el.find(".aom-prop-owner").prev('dt').andSelf();
//this.propOwnerEl = this.$el.find(".aom-prop-owner").closest('.form-group');
 
this.sharingPropEl.find(".aom-prop-locked-info").popover({
placement: 'bottom',
......@@ -14220,9 +14221,10 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
// Update sharing properties
var sharingMode = itemModel.get('sharing_mode'),
ttpShared = itemModel.get('ttpShared'), // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked'),
publicPublish = itemModel.get('allow_public_publishing');
ttpShared = itemModel.get('ttpShared') === true, // sharingMode > 15 are reserved for TTP
locked = itemModel.get('locked') === true,
owned = itemModel.get('owned') === true,
publicPublish = itemModel.get('allow_public_publishing') === true;
 
this.sharingPropEl
.toggleClass("aom-prop-locked", locked)
......@@ -14233,9 +14235,13 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
if (ttpShared) {
this.$(".aom-shm-frontdrop").css("visibility", "hidden"); // Inhibbit the locking overlay for ttp sharing (not applied even for locked ttp images)
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-shm-frontdrop").css("visibility", "visible"); // Restore the locking overlay capability (it is active only for locked images)
}
if (ttpShared || !owned) {
this.$(".aom-prop-lock-but").attr("disabled", "disabled");
} else {
this.$(".aom-prop-lock-but").removeAttr("disabled");
}
 
......@@ -14252,6 +14258,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
.closest(".checkbox").removeClass("disabled text-muted");
}
sharingModeSelect.val([sharingMode]);
this.sharingPropEl.find(".aom-prop-sharingmode-info").text(sharingModeSelect.find("option:selected").text());
this.publicPublishEl.val([publicPublish]);
this.propShMdParamsAll.addClass("hidden");
if (sharingMode) {
......@@ -14268,6 +14275,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
_setOptCtrlValue: function(shmGroupElem, sharingMode, itemModel) {
var me = this,
sharingOpts = itemModel.get('sharing_opts');
console.log("sharingOpts", sharingOpts);
//if (sharingOpts) try {
// sharingOpts = JSON.parse(itemModel.get('sharing_opts'));
//} catch(e) { sharingOpts = null; }
......@@ -14312,7 +14320,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
},
 
'attp_label': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.text(opts.label);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -14320,7 +14328,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
},
 
'attp_url': function($el, model, opts) {
if (opts.url && opts.label) {
if (opts && opts.url && opts.label) {
$el.attr("href", opts.url);
} else {
$el.closest('.aom-prop-shm').addClass('hidden');
......@@ -14349,6 +14357,7 @@ define('anobj-mgr/views/anobj/properties-panel',[
 
clear: function() {
this.thumbEl.css("background-image", "none");
this.$(".aom-shm-frontdrop").css("visibility", "visible");
this._updateItemProp({get: function(){return ""}});
this.currentModel = null;
},
......@@ -14378,8 +14387,11 @@ define('anobj-mgr/views/anobj/properties-panel',[
*/
setMode: function(mode) {
var isShared = mode === 'shared';
this.sharingPropEl.toggleClass('hidden', isShared);
this.sharingPropEl.find(".aom-prop-form").toggleClass('hidden', isShared);
this.propListEl.find(".aom-prop-lock-but").toggleClass('hidden', isShared);
this.propOwnerEl.toggleClass('hidden', !isShared);
this.sharingPropEl.find(".aom-info-share-form").toggleClass('hidden', !isShared);
},
 
// ########################
......
......@@ -12,7 +12,7 @@ urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^shibauth/', include('shibauth.urls')),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': "adim_app/home.html"}),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': "adim/home.html"}),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login', name="logout"),
url(r'^api/', include('adim.urls')),
......
......@@ -54,7 +54,7 @@ def get_or_create_user(attp_user):
user.first_name = attp_user['first_name']
user_changed = True
if attp_user.get('last_name') and user.first_name != attp_user['last_name']: # Update last_name if provided
if attp_user.get('last_name') and user.last_name != attp_user['last_name']: # Update last_name if provided
user.last_name = attp_user['last_name']
user_changed = True
......
......@@ -21,14 +21,12 @@
<div class="panel-body">
<img class="aom-image-thumb"
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
{# ===== AnObj properties ===== #}
<dl class="aom-info-prop aom-prop-unlocked">
<dt>Nom</dt>
<dd class="aom-prop-name"></dd>
<dt>Propriétaire</dt>
<dd class="aom-prop-owner"></dd>
<dt>URL</dt>
<dd>
<div class="input-group input-group-sm">
......@@ -44,6 +42,10 @@
</div>
</dd>
<dt>
<dt class="hidden">Propriétaire</dt>
<dd class="aom-prop-owner hidden"></dd>
<button class="btn btn-xs btn-default aom-prop-lock-but">
<span class="aom-prop-unlocked-status"><span class="icon-lock"></span> Verrouiller</span>
<span class="aom-prop-locked-status"><span class="icon-unlock"></span> Déverrouiller</span>
......@@ -52,7 +54,7 @@
</dl>
{# ===== Sharing parameters ===== #}
<div class="aom-info-share hidden aom-prop-unlocked">
<div class="aom-info-share aom-prop-unlocked">
<hr/>
<h5>Paramètres de partage
</h5>
......@@ -69,7 +71,38 @@
</a>{% endspaceless %}
</div>
<form class="form-horizontal" onsubmit="return false;">
{# Display Sharing information for shared images (hidden for owned images) #}
<form class="form-horizontal hidden aom-info-share-form">
<div class="form-group aom-prop-shm hidden" data-shmd="16,24,32">
<label for="" class="col-sm-4 control-label">Type de partage</label>
<div class="col-sm-8">
<p class="form-control-static aom-prop-sharingmode-info"></p>
</div>
<br>
<label class="col-sm-4 control-label">Titre de l'activité</label>
<div class="col-sm-8">
<p class="form-control-static">
<em><span data-shopt-key="attp_label" class="h5"></span></em>
</p>
</div>
<div class="col-sm-8 col-sm-offset-4">
<a class="btn btn-xs btn-info" data-shopt-key="attp_url" href="#" title="Afficher l'activité dans Moodle">
<span class="glyphicon glyphicon-eye-open"></span> afficher dans Moodle
</a>
</div>
</div>
{# <div class="form-group">#}
{# <label class="col-sm-4 control-label">Propriétaire</label>#}
{# <div class="col-sm-8">#}
{# <p class="form-control-static aom-prop-owner"></p>#}
{# </div>#}
{# </div>#}
</form>
{# Edit Sharing parameters for owned images (hidden for shared images) #}
<form class="form-horizontal hidden aom-prop-form" onsubmit="return false;">
<div class="aom-prop-locked-status aom-shm-frontdrop"></div>
{# ----- Sharing Mode ----- #}
......@@ -152,10 +185,9 @@
<div class="form-group aom-prop-shm hidden" data-shmd="16,24,32">
<div class="col-sm-12">
<label class="control-label">Titre de l'activité: </label>
{# <a data-shopt-key="attp_label" href="#" target="_blank" title="Afficher l'activité dans Moodle"></a>#}
<em><span data-shopt-key="attp_label" class="h5"></span></em>
<div class="pull-right" style="margin: 5px 0 0 5px;"><a class="btn btn-xs btn-info" data-shopt-key="attp_url" href="#" title="Afficher l'activité dans Moodle">
<span class="glyphicon glyphicon-pencil"></span> éditer dans Moodle
<span class="glyphicon glyphicon-eye-open"></span> afficher dans Moodle
</a></div>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment