diff --git a/pandora/edit/models.py b/pandora/edit/models.py index 343b3d22..f14c0d86 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -350,6 +350,7 @@ class Edit(models.Model): 'description', 'duration', 'editable', + 'editable', 'groups', 'id', 'items', diff --git a/static/js/editor.js b/static/js/editor.js index 3e229963..db4c9dc0 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -3,9 +3,7 @@ 'use strict'; pandora.ui.editor = function(data) { - var ui = pandora.user.ui, - rightsLevel = data.rightslevel, that = Ox.VideoAnnotationPanel({ annotationsCalendarSize: ui.annotationsCalendarSize, @@ -164,20 +162,13 @@ pandora.ui.editor = function(data) { pandora.$ui[dialog] = pandora.ui[dialog](data).open(); }, downloadvideo: function() { - pandora.ui.downloadVideoDialog({ - item: ui.item, - rightsLevel: rightsLevel, - title: data.title - }).open(); + document.location.href = pandora.getDownloadLink(ui.item, data.rightslevel); }, - downloadselection: function(selection) { - pandora.ui.downloadVideoDialog({ - item: ui.item, - 'in': selection['in'], - out: selection.out, - rightsLevel: rightsLevel, - title: data.title - }).open(); + downloadselection: function(data) { + document.location.href = '/' + ui.item + + '/' + Ox.max(pandora.site.video.resolutions) + + 'p.' + pandora.site.video.downloadFormat + + '?t=' + data['in'] + ',' + data.out; }, editannotation: function(data) { Ox.Log('', 'editAnnotation', data); diff --git a/static/js/folderList.js b/static/js/folderList.js index 85e5cad8..342f7e61 100644 --- a/static/js/folderList.js +++ b/static/js/folderList.js @@ -15,7 +15,7 @@ pandora.ui.folderList = function(id, section) { columns = [ { clickable: function(data) { - return data.editable + return data.user == pandora.user.username || (id == 'featured' && canEditFeatured); }, format: function(value, data) { @@ -31,7 +31,7 @@ pandora.ui.folderList = function(id, section) { id: 'user', operator: '+', tooltip: function(data) { - return data.editable + return data.user == pandora.user.username || (id == 'featured' && canEditFeatured) ? Ox._('Edit Icon') : ''; @@ -52,7 +52,7 @@ pandora.ui.folderList = function(id, section) { }, { editable: function(data) { - return data.editable; + return data.user == pandora.user.username; }, format: function(value) { return Ox.encodeHTMLEntities(value); @@ -81,7 +81,7 @@ pandora.ui.folderList = function(id, section) { { clickable: function(data) { return section != 'texts' && ( - data.type == 'smart' || data.editable + data.type == 'smart' || data.user == pandora.user.username ); }, format: function(value, data) { @@ -98,16 +98,16 @@ pandora.ui.folderList = function(id, section) { width: '10px', height: '10px', padding: '3px', - opacity: section == 'texts' || data.editable ? 1 : 0.25 + opacity: section == 'texts' || data.user == pandora.user.username ? 1 : 0.25 }); }, id: 'type', operator: '+', tooltip: function(data) { return data.type == 'static' - ? (data.editable ? Ox._('Edit {0}', [Ox._(folderItem)]) : '') + ? (data.user == pandora.user.username ? Ox._('Edit {0}', [Ox._(folderItem)]) : '') : data.type == 'smart' - ? (data.editable ? Ox._('Edit Query') : Ox._('Show Query')) + ? (data.user == pandora.user.username ? Ox._('Edit Query') : Ox._('Show Query')) : data.type.toUpperCase(); }, visible: true, @@ -264,7 +264,7 @@ pandora.ui.folderList = function(id, section) { columns: columns, droppable: id != 'volumes', items: items, - keys: ['modified', 'editable', 'groups'].concat(section != 'texts' + keys: ['modified'].concat(section != 'texts' ? ['query', 'name', 'view'] : ['rightslevel']), max: 1, min: 0, diff --git a/static/js/groupsDialog.js b/static/js/groupsDialog.js index 6065a519..15064887 100644 --- a/static/js/groupsDialog.js +++ b/static/js/groupsDialog.js @@ -36,18 +36,13 @@ pandora.ui.groupsDialog = function(options) { groups, selectedGroups; - if (options.groups) { - selectedGroups = options.groups; + pandora.api[isItem ? 'get' : 'getUser']({ + id: options.id, + keys: ['groups'] + }, function(result) { + selectedGroups = result.data.groups; renderGroups(); - } else { - pandora.api[isItem ? 'get' : 'getUser']({ - id: options.id, - keys: ['groups'] - }, function(result) { - selectedGroups = result.data.groups; - renderGroups(); - }); - } + }); function addGroup() { // disableElements(); diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 0df4dfa1..e9a9eb2c 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -266,67 +266,6 @@ pandora.ui.listGeneralPanel = function(listData) { ) .css({position: 'absolute', left: '160px', top: '64px'}) .appendTo(that), - $groupsInput = Ox.Input({ - disabled: false, - label: Ox._('Groups'), - labelWidth: 80, - value: listData.groups.join(', '), - width: 320 - }) - .bindEvent({ - change: editGroups - }) - .css({position: 'absolute', left: '160px', top: '88px'}) - .appendTo(that), - /* - $groupsLabel, - $groupsInput = Ox.FormElementGroup({ - elements: [ - Ox.Label({ - overlap: 'right', - textAlign: 'right', - title: Ox._('Groups'), - width: 80 - }), - Ox.FormElementGroup({ - elements: [ - $groupsLabel = Ox.Label({ - title: listData.groups ? listData.groups.join(', ') : '', - width: 224 - }), - Ox.Button({ - overlap: 'left', - title: 'edit', - tooltip: Ox._('Edit Groups'), - type: 'image' - }) - .bindEvent({ - click: function() { - console.log(listData) - pandora.$ui.groupsDialog = pandora.ui.groupsDialog({ - id: listData.id, - name: listData.id, - groups: listData.groups, - type: 'list' - }) - .bindEvent({ - groups: function(data) { - var groups = data.groups.join(', '); - //fixme edit groups - $groupsLabel.options({title: groups}); - } - }) - .open(); - } - }) - ], - float: 'right' - }) - ], - float: 'left' - }).css({position: 'absolute', left: '160px', top: '88px'}) - .appendTo(that), - */ $subscribersInput = Ox.Input({ disabled: true, label: Ox._('Subscribers'), @@ -334,7 +273,7 @@ pandora.ui.listGeneralPanel = function(listData) { value: subscribers, width: 320 }) - .css({position: 'absolute', left: '160px', top: '112px'}) + .css({position: 'absolute', left: '160px', top: '88px'}) [getSubscribersAction()]() .appendTo(that), $descriptionInput = Ox.Input({ @@ -382,19 +321,6 @@ pandora.ui.listGeneralPanel = function(listData) { }); } } - function editGroups(data) { - var groups = data.value.split(', '); - console.log(groups); - pandora.api['edit' + folderItem]({ - id: listData.id, - groups: groups - }, function(result) { - listData.groups = result.data.groups; - pandora.$ui.folderList[listData.folder].value( - result.data.id, 'groups', listData.groups - ); - }); - } function editStatus(data) { var status = data.value; $statusSelect.value(status == 'private' ? 'public' : 'private'); @@ -442,10 +368,10 @@ pandora.ui.listGeneralPanel = function(listData) { }); } function getDescriptionHeight() { - return (listData.status == 'private' ? 184 : 160) - 24; + return listData.status == 'private' ? 184 : 160; } function getDescriptionTop() { - return (listData.status == 'private' ? 88 : 112) + 24; + return listData.status == 'private' ? 88 : 112; } function getSubscribersAction() { return listData.status == 'private' ? 'hide' : 'show'; diff --git a/static/js/utils.js b/static/js/utils.js index 206e97f5..66ef9f76 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -714,7 +714,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) { data = $list.value(id); if (drag.targets) { drag.targets[id] = Ox.extend({ - editable: data.editable + editable: data.user == pandora.user.username && data.type == 'static', selected: $item.is('.OxSelected') }, data); @@ -828,10 +828,8 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) { operator: '&' } }, function(result) { - var folder = drag.target.status == 'featured' ? 'featured' : ( - drag.target.user == pandora.user.username - ? 'personal' : 'favorite' - ); + var folder = drag.target.status != 'featured' + ? 'personal' : 'featured'; pandora.$ui.folderList[folder].value( drag.target.id, 'items', result.data.items ); @@ -940,7 +938,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) { ); } else if ( drag.action == 'move' - && !drag.source.editable + && drag.source.user != pandora.user.username ) { image = 'symbolClose'; text = Ox._( @@ -953,7 +951,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) { 'You can\'t remove {0}
from smart {1}.', [itemName.plural, targetName.plural] ); - } else if (drag.target && !drag.target.editable) { + } else if (drag.target && drag.target.user != pandora.user.username) { image = 'symbolClose'; text = Ox._( 'You can only {0} {1}
to your own {2}', @@ -1728,10 +1726,9 @@ pandora.getListData = function(list) { if (folder) { data = pandora.$ui.folderList[folder].value(list); if (pandora.user.ui.section == 'item') { - data.editable = data.editable && data.type == 'static'; + data.editable = data.user == pandora.user.username && data.type == 'static'; } else { - data.editable = data.editable || data.user == pandora.user.username; - + data.editable = data.user == pandora.user.username; } data.folder = folder; }