diff --git a/pandora/item/views.py b/pandora/item/views.py index 701c50bf..d0203628 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -438,6 +438,10 @@ def edit(request): if 'rightslevel' in data: item.level = data['rightslevel'] del data['rightslevel'] + if 'user' in data: + if request.user.get_profile().get_level() in ('admin', 'staff'): + item.user = models.User.objects.get(username=data['user']) + del data['user'] r = item.edit(data) if r: r.wait() diff --git a/static/js/pandora/infoView.padma.js b/static/js/pandora/infoView.padma.js index 4cbaec41..d9fbfb09 100644 --- a/static/js/pandora/infoView.padma.js +++ b/static/js/pandora/infoView.padma.js @@ -268,7 +268,7 @@ pandora.ui.infoView = function(data) { html.push( formatKey(key) + formatValue(data[key], key) - ) + ); } }); $('
').css(css).html(html.join('; ')).appendTo($center); @@ -311,7 +311,7 @@ pandora.ui.infoView = function(data) { html.push( formatKey(key) + formatValue(data[key], key) - ) + ); } }); $('
').css(css).html(html.join('; ')).appendTo($center); @@ -408,13 +408,38 @@ pandora.ui.infoView = function(data) { $div = $('
').css(css).css({marginTop: '16px'}).appendTo($center); html = []; - ['user', 'created', 'modified'].forEach(function(key) { - data[key] && html.push( - formatKey(key == 'modified' ? 'Last Modified' : key) - + (key == 'user' ? data.user : Ox.formatDate(data[key], '%F %T')) - ); - }); - $div.html(html.join('; ')); + if (['admin', 'staff'].indexOf(pandora.user.level) > -1) { + $('
') + .css({float: 'left'}) + .html(formatKey('user').replace('', ' ')) + .appendTo($div); + Ox.Editable({ + placeholder: formatLight('No User'), + tooltip: 'Doubleclick to edit', + value: data.user + }) + .bindEvent({ + submit: function(event) { + editMetadata('user', event.value); + } + }) + .appendTo($div); + ['created', 'modified'].forEach(function(key) { + data[key] && html.push( + formatKey(key == 'modified' ? 'Last Modified' : key) + + (key == 'user' ? data.user : Ox.formatDate(data[key], '%F %T')) + ); + }); + $div.append(html.join('; ')); + } else { + ['user', 'created', 'modified'].forEach(function(key) { + data[key] && html.push( + formatKey(key == 'modified' ? 'Last Modified' : key) + + (key == 'user' ? data.user : Ox.formatDate(data[key], '%F %T')) + ); + }); + $div.html(html.join('; ')); + } $('
').css({height: '16px'}).appendTo($center);