www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit e85790541bf8e60828801247b56b2b3dee8a3115
parent 0782344c4111f36b3b445f858ca9441b31644ad5
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 20 Mar 2013 22:35:44 -0400

Remove per-library sync error indicators, at least for now

The hidden column caused collection names to be cut off unnecessarily,
and the extra icons were overly distracting. For now, just show the
first error that comes in in the main sync error panel, along with the
library name.

Diffstat:
Mchrome/content/zotero/xpcom/collectionTreeView.js | 24------------------------
Mchrome/content/zotero/xpcom/sync.js | 96++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mchrome/content/zotero/zoteroPane.js | 5+++--
Mchrome/content/zotero/zoteroPane.xul | 19++++++++-----------
Mchrome/skin/default/zotero/overlay.css | 13++++++-------
5 files changed, 76 insertions(+), 81 deletions(-)

diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -403,9 +403,6 @@ Zotero.CollectionTreeView.prototype.getCellText = function(row, column) if (column.id == 'zotero-collections-name-column') { return obj.getName(); } - else if (column.id == 'zotero-collections-sync-status-column') { - return ""; - } else return ""; } @@ -426,27 +423,6 @@ Zotero.CollectionTreeView.prototype.getImageSrc = function(row, col) switch (collectionType) { case 'library': - if (col.id == 'zotero-collections-sync-status-column') { - if (itemGroup.isLibrary(true)) { - var libraryID = itemGroup.isLibrary() ? 0 : itemGroup.ref.libraryID; - var errors = Zotero.Sync.Runner.getErrors(libraryID); - if (errors) { - var e = Zotero.Sync.Runner.getPrimaryError(errors); - switch (e.errorMode) { - case 'warning': - var image = 'error'; - break; - - default: - var image = 'exclamation'; - break; - } - - return 'chrome://zotero/skin/' + image + '.png'; - } - } - return ''; - } break; case 'trash': diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -947,51 +947,73 @@ Zotero.Sync.Runner = new function () { this.updateErrorPanel = function (doc, errors) { var panel = doc.getElementById('zotero-sync-error-panel'); - var panelContent = doc.getElementById('zotero-sync-error-panel-content'); - var panelButtons = doc.getElementById('zotero-sync-error-panel-buttons'); // Clear existing panel content - while (panelContent.hasChildNodes()) { - panelContent.removeChild(panelContent.firstChild); - } - while (panelButtons.hasChildNodes()) { - panelButtons.removeChild(panelButtons.firstChild); + while (panel.hasChildNodes()) { + panel.removeChild(panel.firstChild); } - // TEMP: for now, we only show one error - var e = errors.concat().shift(); - e = this.parseSyncError(e); + var e = this - var desc = doc.createElement('description'); - var msg = e.message; - /*if (e.fileName) { - msg += '\n\nFile: ' + e.fileName + '\nLine: ' + e.lineNumber; - }*/ - desc.textContent = msg; - panelContent.appendChild(desc); - - // If not an error and there's no explicit button text, don't show - // button to report errors - if (e.errorMode != 'error' && typeof e.buttonText == 'undefined') { - e.buttonText = null; - } - - if (e.buttonText !== null) { - if (typeof e.buttonText == 'undefined') { - var buttonText = Zotero.getString('errorReport.reportError'); - var buttonCallback = function () { - doc.defaultView.ZoteroPane.reportErrors(); - }; + for each(var e in errors.concat()) { + e = this.parseSyncError(e); + + var box = doc.createElement('vbox'); + var label = doc.createElement('label'); + if (typeof e.libraryID != 'undefined') { + label.className = "zotero-sync-error-panel-library-name"; + if (e.libraryID == 0) { + var libraryName = Zotero.getString('pane.collections.library'); + } + else { + let group = Zotero.Groups.getByLibraryID(e.libraryID); + var libraryName = group.name; + } + label.setAttribute('value', libraryName); } - else { - var buttonText = e.buttonText; - var buttonCallback = e.buttonCallback; + var content = doc.createElement('hbox'); + var buttons = doc.createElement('hbox'); + buttons.pack = 'end'; + box.appendChild(label); + box.appendChild(content); + box.appendChild(buttons); + + var desc = doc.createElement('description'); + var msg = e.message; + /*if (e.fileName) { + msg += '\n\nFile: ' + e.fileName + '\nLine: ' + e.lineNumber; + }*/ + desc.textContent = msg; + content.appendChild(desc); + + // If not an error and there's no explicit button text, don't show + // button to report errors + if (e.errorMode != 'error' && typeof e.buttonText == 'undefined') { + e.buttonText = null; } - var button = doc.createElement('button'); - button.setAttribute('label', buttonText); - button.onclick = buttonCallback; - panelButtons.appendChild(button); + if (e.buttonText !== null) { + if (typeof e.buttonText == 'undefined') { + var buttonText = Zotero.getString('errorReport.reportError'); + var buttonCallback = function () { + doc.defaultView.ZoteroPane.reportErrors(); + }; + } + else { + var buttonText = e.buttonText; + var buttonCallback = e.buttonCallback; + } + + var button = doc.createElement('button'); + button.setAttribute('label', buttonText); + button.onclick = buttonCallback; + buttons.appendChild(button); + } + + panel.appendChild(box) + + // TEMP: Only show one error for now + break; } return panel; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -1093,10 +1093,11 @@ var ZoteroPane = new function() var itemgroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex); - if (itemgroup.isSeparator()) { + // Not necessary with seltype="cell", which calls nsITreeView::isSelectable() + /*if (itemgroup.isSeparator()) { document.getElementById('zotero-items-tree').view = this.itemsView = null; return; - } + }*/ itemgroup.setSearch(''); itemgroup.setTags(getTagSelection()); diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul @@ -209,13 +209,13 @@ </hbox> </hbox> <toolbarbutton id="zotero-tb-sync-error" hidden="true"/> - <!-- We put this here, but it's used for all sync errors --> - <panel id="zotero-sync-error-panel" type="arrow"> - <vbox> - <hbox id="zotero-sync-error-panel-content"/> - <hbox id="zotero-sync-error-panel-buttons"/> - </vbox> - </panel> + + <!-- + We put this here, but it can be used wherever + Zotero.Sync.Runner.updateErrorPanel() puts it + --> + <panel id="zotero-sync-error-panel" type="arrow"/> + <toolbarbutton id="zotero-tb-sync" class="zotero-tb-button" tooltip="_child" oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Server.manualSyncRequired = false; Zotero.Sync.Runner.sync()"> <tooltip @@ -305,16 +305,13 @@ ondragenter="return ZoteroPane_Local.collectionsView.onDragEnter(event)" ondragover="return ZoteroPane_Local.collectionsView.onDragOver(event)" ondrop="return ZoteroPane_Local.collectionsView.onDrop(event)" - seltype="single" flex="1"> + seltype="cell" flex="1"> <treecols> <treecol id="zotero-collections-name-column" flex="1" primary="true" hideheader="true"/> - <treecol - id="zotero-collections-sync-status-column" - hideheader="true"/> </treecols> <treechildren/> </tree> diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css @@ -430,17 +430,16 @@ list-style-image: url(chrome://zotero/skin/bell_error.png); } -#zotero-tb-sync-error { - /*border: 1px orange dashed;*/ -} - /* Sync error panel */ -#zotero-sync-error-panel { - margin-right: 0px; +.zotero-sync-error-panel-library-name { + font-size: 12px; + font-weight: bold; + margin-left: 0; + margin-bottom: 1.1em; } #zotero-sync-error-panel description { - width: 350px; + width: 370px; white-space: pre-wrap; }