From eb0e9a79f794ca169d3b03fe15ffae91a470097d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 16 Feb 2012 02:30:38 +0530 Subject: [PATCH 1/2] make traceback selectable, fixes #397 --- static/js/pandora/logsDialog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/pandora/logsDialog.js b/static/js/pandora/logsDialog.js index 4e46c1561..592c0081b 100644 --- a/static/js/pandora/logsDialog.js +++ b/static/js/pandora/logsDialog.js @@ -134,7 +134,11 @@ pandora.ui.logsDialog = function() { }) ], closeButton: true, - content: $('').append($('
').css({margin: '16px'}).html(value.text)),
+                            content: $('').append($('
').css({
+                                margin: '16px',
+                                MozUserSelect: 'text',
+                                WebkitUserSelect: 'text'
+                            }).html(value.text)),
                             height: height - 48,
                             keys: {enter: 'close', escape: 'close'},
                             maximizeButton: true,

From 7f017855907ebea1c6578b3ae78f91e7c83f8769 Mon Sep 17 00:00:00 2001
From: j <0x006A@0x2620.org>
Date: Thu, 16 Feb 2012 02:59:44 +0530
Subject: [PATCH 2/2] dont show username for own and featured lists, fixes #456
 check for canEditFeaturedList to enable edit link, fixes #447

---
 static/js/pandora/folderList.js | 17 ++++++++++-------
 static/js/pandora/info.js       | 10 ++++++----
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/static/js/pandora/folderList.js b/static/js/pandora/folderList.js
index db02cdf64..257f1334a 100644
--- a/static/js/pandora/folderList.js
+++ b/static/js/pandora/folderList.js
@@ -1,8 +1,8 @@
 // vim: et:ts=4:sw=4:sts=4:ft=javascript
 'use strict';
 pandora.ui.folderList = function(id) {
-    // FIXME: use canEditFeaturedLists capability, not 'admin'
     var i = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id),
+        canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level],
         that;
     if (pandora.user.ui.section == 'items') {
         var columns, items;
@@ -10,7 +10,7 @@ pandora.ui.folderList = function(id) {
             columns = [
                 {
                     clickable: function(data) {
-                        return data.user == pandora.user.username;
+                        return data.user == pandora.user.username || (id == 'featured' && canEditFeaturedLists);
                     },
                     format: function(value, data) {
                         return $('').attr({
@@ -25,7 +25,10 @@ pandora.ui.folderList = function(id) {
                     id: 'user',
                     operator: '+',
                     tooltip: function(data) {
-                        return data.user == pandora.user.username ? 'Edit Icon' : '';
+                        return data.user == pandora.user.username
+                            || (id == 'featured' && canEditFeaturedLists)
+                            ? 'Edit Icon'
+                            : '';
                     },
                     visible: true,
                     width: 16
@@ -104,7 +107,7 @@ pandora.ui.folderList = function(id) {
                                 height: '10px',
                                 padding: '3px',
                                 opacity: value == 'private' ? 0.25 : 1
-                            })
+                            });
                     },
                     id: 'status',
                     operator: '+',
@@ -240,7 +243,7 @@ pandora.ui.folderList = function(id) {
             pageLength: 1000,
             //selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
             sort: [{key: 'position', operator: '+'}],
-            sortable: id != 'featured' || pandora.user.level == 'admin'
+            sortable: id != 'featured' || canEditFeaturedLists
         })
         .css({
             left: 0,
@@ -276,7 +279,7 @@ pandora.ui.folderList = function(id) {
                             });
                         });
                     }
-                } else if (id == 'favorite' || (id == 'featured' && pandora.user.level == 'admin')) {
+                } else if (id == 'favorite' || (id == 'featured' && canEditFeaturedLists)) {
                     // this makes the button trigger a change event,
                     // which is already being handled in folders.js
                     pandora.$ui.manageListsButton[id].options({value: true});
@@ -321,7 +324,7 @@ pandora.ui.folderList = function(id) {
                         Ox.Request.clearCache(); // fixme: remove
                         that.reloadList();
                     });
-                } else if (id == 'featured' && pandora.user.level == 'admin') {
+                } else if (id == 'featured' && canEditFeaturedLists) {
                     that.options({selected: []});
                     pandora.api.editList({
                         id: data.ids[0],
diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js
index d6e782539..1cdd35825 100644
--- a/static/js/pandora/info.js
+++ b/static/js/pandora/info.js
@@ -137,7 +137,8 @@ pandora.ui.info = function() {
 pandora.ui.listInfo = function() {
 
     var list = pandora.user.ui._list,
-        editable = list.split(':')[0] == pandora.user.username,
+        canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level],
+        editable = list.split(':')[0] == pandora.user.username || canEditFeaturedLists,
         that = $('
').css({padding: '16px', textAlign: 'center'}), $icon = Ox.Element({ element: '', @@ -164,16 +165,17 @@ pandora.ui.listInfo = function() { if (list) { pandora.api.findLists({ query: {conditions: [{key: 'id', value: list, operator: '=='}]}, - keys: ['description', 'name', 'user'] + keys: ['description', 'status', 'name', 'user'] }, function(result) { if (result.data.items.length) { var item = result.data.items[0], - editable = item.user == pandora.user.username; + editable = item.user == pandora.user.username + || (item.status == 'featured' && canEditFeaturedLists); that.append( $title = Ox.Editable({ editable: editable, format: function(value) { - return Ox.encodeHTML(item.user + ': ' + value) + return Ox.encodeHTML(editable ? value : item.user + ': ' + value) }, tooltip: editable ? 'Doubleclick to edit title' : '', value: item.name,