www

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

commit f5c988f918b38d2878a5ffaa1f5ef4dc2c5682aa
parent 4a2a1db3a43279905ac8c6191705e2a8ddd73fcb
Author: Simon Kornblith <simon@simonster.com>
Date:   Fri, 25 Sep 2009 08:30:07 +0000

- add resizer to integration windows
- don't automatically resize integration windows if a button is pressed
- move integration js/xul to integration subdirectory


Diffstat:
Dchrome/content/zotero/addCitationDialog.js | 528-------------------------------------------------------------------------------
Dchrome/content/zotero/addCitationDialog.xul | 210-------------------------------------------------------------------------------
Mchrome/content/zotero/bibliography.js | 3+--
Dchrome/content/zotero/editBibliographyDialog.xul | 116-------------------------------------------------------------------------------
Achrome/content/zotero/integration/addCitationDialog.js | 522+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Achrome/content/zotero/integration/addCitationDialog.xul | 200+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rchrome/content/zotero/editBibliographyDialog.js -> chrome/content/zotero/integration/editBibliographyDialog.js | 0
Achrome/content/zotero/integration/editBibliographyDialog.xul | 116+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Achrome/content/zotero/integration/integrationDocPrefs.xul | 46++++++++++++++++++++++++++++++++++++++++++++++
Dchrome/content/zotero/integrationDocPrefs.xul | 49-------------------------------------------------
Mchrome/content/zotero/xpcom/integration.js | 12++++++------
Mchrome/skin/default/zotero/zotero.css | 5+++++
12 files changed, 896 insertions(+), 911 deletions(-)

diff --git a/chrome/content/zotero/addCitationDialog.js b/chrome/content/zotero/addCitationDialog.js @@ -1,527 +0,0 @@ -/* - ***** BEGIN LICENSE BLOCK ***** - - Copyright (c) 2006 Center for History and New Media - George Mason University, Fairfax, Virginia, USA - http://chnm.gmu.edu - - Licensed under the Educational Community License, Version 1.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.opensource.org/licenses/ecl1.php - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ***** END LICENSE BLOCK ***** -*/ - -var Zotero_Citation_Dialog = new function () { - var _preserveData = { - "prefix":"value", - "suffix":"value", - "locatorType":"selectedIndex", - "locator":"value", - "suppressAuthor":"checked" - }; - - var _itemData = new Object(); - var _multipleSourcesOn = false; - var _lastSelected = null; - var _previewShown = false; - var _suppressNextTreeSelect = false; - var _locatorIndexArray = {}; - var _autoRegeneratePref; - var _acceptButton; - var _sortCheckbox; - var _originalHTML; - var io; - - this.load = load; - this.toggleMultipleSources = toggleMultipleSources; - this.toggleEditor = toggleEditor; - this.treeItemSelected = treeItemSelected; - this.listItemSelected = listItemSelected; - this.add = add; - this.remove = remove; - this.sortCitation = sortCitation; - this.confirmRegenerate = confirmRegenerate; - this.accept = accept; - this.cancel = cancel; - - /* - * initialize add citation dialog - */ - function load() { - document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); - document.getElementById("show-editor-button").label = Zotero.getString("citation.showEditor"); - - io = window.arguments[0].wrappedJSObject; - - // find accept button - _acceptButton = document.getElementById("zotero-add-citation-dialog").getButton("accept"); - _autoRegeneratePref = Zotero.Prefs.get("integration.autoRegenerate"); - - // if a style with sortable citations, present checkbox - if(io.citation.sortable) { - _sortCheckbox = document.getElementById("keepSorted"); - _sortCheckbox.hidden = false; - if(io.citation.properties.sort === undefined) io.citation.properties.sort = true; - _sortCheckbox.checked = io.citation.properties.sort; - } - - // load locators - var locators = Zotero.CSL.Global.getLocatorStrings(); - var menu = document.getElementById("locatorType"); - var popup = document.getElementById("locator-type-popup"); - var i = 0; - for(var value in locators) { - var locator = locators[value]; - locator = locator[0].toUpperCase()+locator.substr(1); - // add to popup - var child = document.createElement("menuitem"); - child.setAttribute("value", value); - child.setAttribute("label", locator); - popup.appendChild(child); - // add to array - _locatorIndexArray[value] = i; - i++; - } - menu.selectedIndex = 0; - - // load (from selectItemsDialog.js) - doLoad(); - - // if we already have a citation, load data from it - document.getElementById('editor').format = "Integration"; - if(io.citation.citationItems.length) { - if(io.citation.citationItems.length == 1) { - // single citation - _suppressNextTreeSelect = true; - itemsView.selectItem(io.citation.citationItems[0].itemID); // treeview from selectItemsDialog.js - for(var property in _preserveData) { - if(io.citation.citationItems[0][property]) { - if(property == "locatorType") { - document.getElementById(property)[_preserveData[property]] = _locatorIndexArray[io.citation.citationItems[0][property]]; - } else { - document.getElementById(property)[_preserveData[property]] = io.citation.citationItems[0][property]; - } - } - } - } else { - // multiple citations - toggleMultipleSources(); - for(var i=0; i<io.citation.citationItems.length; i++) { - var item = Zotero.Items.get(io.citation.citationItems[i].itemID); - if(item) { - _addItem(item); - _itemData[io.citation.citationItems[i].itemID] = io.citation.citationItems[i]; - } - } - } - - // show user-editable edited citation - if(io.citation.properties.custom) { - toggleEditor(io.citation.properties.custom); - io.citation.properties.custom = undefined; - } - - _updateAccept(); - } - } - - /* - * turn on/off multiple sources item list - */ - function toggleMultipleSources() { - _multipleSourcesOn = !_multipleSourcesOn; - if(_multipleSourcesOn) { - var items = itemsView.getSelectedItems(true); - var itemID = (items.length ? items[0] : false); - // var itemDataID = itemID+"::"+0; - document.getElementById("multiple-sources").hidden = undefined; - document.getElementById("zotero-add-citation-dialog").width = "750"; - document.getElementById("multiple-sources-button").label = Zotero.getString("citation.singleSource"); - // move user field content to multiple before adding XXXXX - if (itemID) { - // _itemData[itemDataID] = new Object(); - _itemData[itemID] = new Object(); - var element; - for (var box in _preserveData) { - element = document.getElementById(box); - // _itemData[itemDataID][box] = element[_preserveData[box]]; - _itemData[itemID][box] = element[_preserveData[box]]; - } - } - window.sizeToContent(); - window.moveTo((window.screenX-75), window.screenY); - treeItemSelected(); - // disable adding info until citation added - _itemSelected(false); - // add current selection - if (itemID) { - this.add(); - } else { - _updateAccept(); - _updatePreview(); - } - } else { - document.getElementById("multiple-sources").hidden = true; - document.getElementById("zotero-add-citation-dialog").width = "600"; - document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); - window.sizeToContent(); - window.moveTo((window.screenX+75), window.screenY); - - // enable all fields - for(var i in _preserveData) { - document.getElementById(i).disabled = false; - } - - // delete item list - _itemData = new Object(); - - // delete all items - _clearCitationList(); - _updateAccept(); - _updatePreview(); - } - } - - /* - * called when an item in the item selection tree is clicked - */ - function treeItemSelected() { - if(_suppressNextTreeSelect) { - _suppressNextTreeSelect = false; - _updateAccept(); - return; - } - var items = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js - var itemID = (items.length ? items[0] : false); - - if(_multipleSourcesOn) { - // if item is also on right side, show info - var hasBeenAdded = itemID && _itemData[itemID] !== undefined; - // disable boxes if item not added; otherwise, enable - _itemSelected(hasBeenAdded ? itemID : false); - // disable adding nothing, or things already added - document.getElementById("add").disabled = !itemID || hasBeenAdded; - } else { - _updateAccept(); - _updatePreview(); - } - } - - /* - * called when an item in the selected items list is clicked - */ - function listItemSelected() { - var selectedListItem = document.getElementById("citation-list").getSelectedItem(0); - var itemID = (selectedListItem ? selectedListItem.value : false); - _itemSelected(itemID); - - document.getElementById("remove").disabled = !itemID; - } - - /* - * Adds a citation to the multipleSources list - */ - function add() { - var item = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js - _itemSelected(item.getID()); - _addItem(item); - - // don't let someone select it again - document.getElementById("add").disabled = true; - - // allow user to press OK - _updateAccept(); - _updatePreview(); - sortCitation(); - } - - /* - * Deletes a citation from the multipleSources list - */ - function remove() { - var citationList = document.getElementById("citation-list"); - var selectedListItem = citationList.getSelectedItem(0); - var itemID = selectedListItem.value; - - // remove from _itemData - delete _itemData[itemID]; - _itemData[itemID] = undefined; - _lastSelected = null; - - // re-select currently selected in left pane - var itemIDs = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js - if(itemIDs.length) { - document.getElementById("zotero-items-tree").focus(); - treeItemSelected(); - } - - // remove from list - citationList.removeChild(selectedListItem); - - _updateAccept(); - _updatePreview(); - treeItemSelected(); - } - - /* - * Sorts the list of citations - */ - function sortCitation() { - io.citation.properties.sort = _sortCheckbox && _sortCheckbox.checked; - if(_sortCheckbox.checked) { - _getCitation(); - - // delete all existing items from list - _clearCitationList(); - - // run preview function to re-sort, if it hasn't already been - // run - io.previewFunction(); - - // add items back to list - for(var i=0; i<io.citation.citationItems.length; i++) { - var item = Zotero.Items.get(io.citation.citationItems[i].itemID); - _addItem(item); - } - } - } - - /* - * Ask whether to modfiy the preview - */ - function confirmRegenerate(focusShifted) { - if(document.getElementById('editor').value == _originalHTML || _originalHTML === undefined) { - // no changes; just update without asking - _updatePreview(); - return; - } - - if(_autoRegeneratePref == -1) { - if(focusShifted) { // only ask after onchange event; oninput is too - // frequent for this to be worthwhile - var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Components.interfaces.nsIPromptService); - - var saveBehavior = { value: false }; - var regenerate = promptService.confirmEx( - this.window, - Zotero.getString('integration.regenerate.title'), - Zotero.getString('integration.regenerate.body'), - promptService.STD_YES_NO_BUTTONS, - null, null, null, - Zotero.getString('integration.regenerate.saveBehavior'), - saveBehavior - ); - - if(saveBehavior.value) { - _autoRegeneratePref = (regenerate == 0 ? 1 : 0); - Zotero.Prefs.set("integration.autoRegenerate", _autoRegeneratePref); - } - - if(regenerate == 0) { - _updatePreview(); - } - } - } else if(_autoRegeneratePref == 1) { - _updatePreview(); - } - } - - /* - * Shows the edit pane - */ - function toggleEditor(text) { - var editor = document.getElementById('editor'); - editor.hidden = _previewShown; - _previewShown = !_previewShown; - - if(_previewShown) { - document.getElementById("show-editor-button").label = Zotero.getString("citation.hideEditor"); - window.sizeToContent(); - if(text) { - editor.value = text; - } else { - _updatePreview(); - } - } else { - document.getElementById("show-editor-button").label = Zotero.getString("citation.showEditor"); - window.sizeToContent(); - } - } - - /* - * called when accept button is clicked - */ - function accept() { - _getCitation(); - var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected - && document.getElementById('editor').value != _originalHTML // and citation has been edited - - if(isCustom) { - var citation = document.getElementById('editor').value - } else { - var citation = (io.citation.citationItems.length ? io.previewFunction() : ""); - } - - if(Zotero.Utilities.prototype.trim(citation) == "") { - var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Components.interfaces.nsIPromptService); - var insert = promptService.confirm(window, - Zotero.getString("integration.emptyCitationWarning.title"), - Zotero.getString("integration.emptyCitationWarning.body")); - if(!insert) return false; - } - - if(isCustom) io.citation.properties.custom = citation; - - return true; - } - - /* - * called when cancel button is clicked - */ - function cancel() { - io.citation.citationItems = new Array(); - } - - /* - * Updates the contents of the preview pane - */ - function _updatePreview() { - if(_previewShown) { - var editor = document.getElementById('editor'); - _getCitation(); - - editor.readonly = !io.citation.citationItems.length; - editor.value = _originalHTML = (io.citation.citationItems.length ? io.previewFunction() : ""); - } - } - - /* - * Controls whether the accept (OK) button should be enabled - */ - function _updateAccept(status) { - if(_multipleSourcesOn) { - _acceptButton.disabled = !document.getElementById("citation-list").childNodes.length; - } else { - _acceptButton.disabled = !itemsView.getSelectedItems().length; // treeview from selectItemsDialog.js - } - } - - /* - * called when an item is selected; if itemID is false, disables fields; if - * itemID is undefined, only updates _itemData array - */ - function _itemSelected(itemID) { - if(_lastSelected && !_itemData[_lastSelected]) { - _itemData[_lastSelected] = new Object(); - } - - for(var box in _preserveData) { - var domBox = document.getElementById(box); - var property = _preserveData[box]; - - // save property - if(_lastSelected) { - if(property == "locatorType") { - _itemData[_lastSelected][box] = domBox.selectedItem.value; - } else { - _itemData[_lastSelected][box] = domBox[property]; - } - } - // restore previous property - if(itemID) { - domBox.disabled = false; - if(_itemData[itemID] && _itemData[itemID][box] !== undefined) { - if(property == "locatorType") { - domBox[property] = _locatorIndexArray[_itemData[itemID][box]]; - } else { - domBox[property] = _itemData[itemID][box]; - } - } - } else if(itemID !== undefined) { - domBox.disabled = true; - domBox[property] = ""; - } - } - - if(itemID !== undefined) _lastSelected = itemID; - } - - /* - * updates io.citation to reflect selected items - */ - function _getCitation() { - io.citation.citationItems = new Array(); - - // use to map selectedIndexes back to page/paragraph/line - var locatorTypeElements = document.getElementById("locatorType").getElementsByTagName("menuitem"); - if(_multipleSourcesOn) { - _itemSelected(); // store locator info - - var citationList = document.getElementById("citation-list"); - var listLength = citationList.childNodes.length; - - var citationItems = new Array(); - if(listLength) { - // generate citationItems - for(var i=0; i<listLength; i++) { - var itemID = citationList.childNodes[i].value; - - var citationItem = _itemData[itemID]; - citationItem.itemID = itemID; - io.citation.citationItems.push(citationItem); - } - } - } else { - var items = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js - - var citationItem = new Zotero.CSL.CitationItem(); - citationItem.itemID = items[0]; - for(var property in _preserveData) { - if(property == "locatorType") { - citationItem[property] = document.getElementById(property).selectedItem.value; - } else { - citationItem[property] = document.getElementById(property)[_preserveData[property]]; - } - } - - if(citationItem["locator"] == "") { - citationItem["locator"] = citationItem["locatorType"] = undefined; - } - - io.citation.citationItems = [citationItem]; - } - } - - /* - * Add an item to the item list (multiple sources only) - */ - function _addItem(item) { - var itemNode = document.createElement("listitem"); - itemNode.setAttribute("value", item.getID()); - itemNode.setAttribute("label", item.getField("title")); - itemNode.setAttribute("class", "listitem-iconic"); - itemNode.setAttribute("image", item.getImageSrc()); - document.getElementById("citation-list").appendChild(itemNode); - } - - /* - * Removes all items from the multiple sources list - */ - function _clearCitationList() { - var citationList = document.getElementById("citation-list"); - while(citationList.firstChild) { - citationList.removeChild(citationList.firstChild); - } - } -} -\ No newline at end of file diff --git a/chrome/content/zotero/addCitationDialog.xul b/chrome/content/zotero/addCitationDialog.xul @@ -1,210 +0,0 @@ -<?xml version="1.0"?> -<!-- - ***** BEGIN LICENSE BLOCK ***** - - Copyright (c) 2006 Center for History and New Media - George Mason University, Fairfax, Virginia, USA - http://chnm.gmu.edu - - Licensed under the Educational Community License, Version 1.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.opensource.org/licenses/ecl1.php - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ***** END LICENSE BLOCK ***** ---> -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> - -<dialog - id="zotero-add-citation-dialog" - orient="vertical" - title="&zotero.integration.addEditCitation.title;" - width="600" height="450" - onload="Zotero_Citation_Dialog.load();" - onunload="doUnload();" - ondialogaccept="return Zotero_Citation_Dialog.accept();" - ondialogcancel="Zotero_Citation_Dialog.cancel();" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - style="padding: 0" - persist="screenX screenY width height"> - - <script src="include.js"/> - <script src="selectItemsDialog.js"/> - <script src="addCitationDialog.js"/> - - <vbox id="zotero-select-items-container" flex="1" style="padding: 1em"> - <vbox flex="1"> - <hbox flex="1"> - <vbox align="stretch" flex="1"> - <hbox align="center" pack="end"> - <label value="&zotero.toolbar.search.label;" control="zotero-tb-search"/> - <textbox id="zotero-tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" - onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { if (this.value == '') { cancelDialog(); return false; } this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;"> - <toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> - </textbox> - </hbox> - <hbox flex="1" style="margin-top: 5px"> - <tree id="zotero-collections-tree" - style="width: 200px;" hidecolumnpicker="true" seltype="single" - onselect="onCollectionSelected();"> - <treecols> - <treecol - id="zotero-collections-name-column" - flex="1" - primary="true" - hideheader="true"/> - </treecols> - <treechildren/> - </tree> - - <tree id="zotero-items-tree" - enableColumnDrag="true" flex="1" seltype="single" - onselect="Zotero_Citation_Dialog.treeItemSelected();"> - <treecols> - <treecol - id="zotero-items-column-title" primary="true" - label="&zotero.items.title_column;" - flex="4" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-firstCreator" - label="&zotero.items.creator_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-type" hidden="true" - label="&zotero.items.type_column;" - width="40" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-date" hidden="true" - label="&zotero.items.date_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-year" hidden="true" - label="&zotero.items.year_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-publisher" hidden="true" - label="&zotero.items.publisher_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-publicationTitle" hidden="true" - label="&zotero.items.publication_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-journalAbbreviation" hidden="true" - label="&zotero.items.journalAbbr_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-language" hidden="true" - label="&zotero.items.language_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-accessDate" hidden="true" - label="&zotero.items.accessDate_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-callNumber" hidden="true" - label="&zotero.items.callNumber_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-repository" hidden="true" - label="&zotero.items.repository_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-rights" hidden="true" - label="&zotero.items.rights_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-dateAdded" hidden="true" - label="&zotero.items.dateAdded_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-dateModified" hidden="true" - label="&zotero.items.dateModified_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - </treecols> - <treechildren/> - </tree> - </hbox> - </vbox> - - <hbox hidden="true" id="multiple-sources"> - <vbox align="center" pack="center"> - <toolbarbutton id="add" oncommand="Zotero_Citation_Dialog.add()" disabled="true"/> - <toolbarbutton id="remove" oncommand="Zotero_Citation_Dialog.remove()" disabled="true"/> - </vbox> - <vbox> - <checkbox id="keepSorted" hidden="true" checked="false" oncommand="Zotero_Citation_Dialog.sortCitation()" label="&zotero.citation.keepSorted.label;"/> - <listbox id="citation-list" flex="1" align="stretch" seltype="single" - onselect="Zotero_Citation_Dialog.listItemSelected();"></listbox> - </vbox> - </hbox> - </hbox> - - <hbox align="stretch" style="margin-top: 8px"> - <vbox flex="1"> - <hbox align="center"> - <label value="&zotero.citation.prefix.label;"/> - <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" class="fix" id="prefix" align="stretch" flex="1"/> - </hbox> - <hbox align="center"> - <label value="&zotero.citation.suffix.label;"/> - <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" class="fix" id="suffix" align="stretch" flex="1"/> - </hbox> - <spacer flex="1"/> - </vbox> - <separator flex="4"/> - <vbox flex="1"> - <hbox align="stretch"> - <menulist onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locatorType"> - <menupopup id="locator-type-popup"/> - </menulist> - <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locator" flex="1"/> - </hbox> - <separator style="height: 2px" flex="1"/> - <checkbox oncommand="Zotero_Citation_Dialog.confirmRegenerate(true)" id="suppressAuthor" label="&zotero.citation.suppressAuthor.label;"/> - </vbox> - </hbox> - </vbox> - - <textbox id="editor" type="styled" mode="integration" hidden="true" flex="1"/> - - <hbox style="margin-top: 15px"> - <hbox> - <button id="show-editor-button" oncommand="Zotero_Citation_Dialog.toggleEditor()"/> - <button id="multiple-sources-button" oncommand="Zotero_Citation_Dialog.toggleMultipleSources()"/> - </hbox> - <vbox flex="1" align="end"> - <hbox> - <button dlgtype="cancel"/> - <button dlgtype="accept" disabled="true"/> - </hbox> - </vbox> - </hbox> - </vbox> -</dialog> diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js @@ -42,8 +42,7 @@ var Zotero_File_Interface_Bibliography = new function() { function init() { // Set font size from pref // Affects bibliography.xul and integrationDocPrefs.xul - var sbc = document.getElementById('zotero-bibliography-container'); - if(sbc) Zotero.setFontSize(sbc); + Zotero.setFontSize(document.documentElement); if(window.arguments && window.arguments.length) { _io = window.arguments[0]; diff --git a/chrome/content/zotero/editBibliographyDialog.xul b/chrome/content/zotero/editBibliographyDialog.xul @@ -1,116 +0,0 @@ -<?xml version="1.0"?> -<!-- - ***** BEGIN LICENSE BLOCK ***** - - Copyright (c) 2006 Center for History and New Media - George Mason University, Fairfax, Virginia, USA - http://chnm.gmu.edu - - Licensed under the Educational Community License, Version 1.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.opensource.org/licenses/ecl1.php - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ***** END LICENSE BLOCK ***** ---> -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> -<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?> -<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> - -<dialog - id="zotero-edit-bibliography-dialog" - orient="vertical" - title="&zotero.integration.editBibliography.title;" - width="750" height="450" - onload="Zotero_Bibliography_Dialog.load();" - onunload="doUnload();" - ondialogaccept="Zotero_Bibliography_Dialog.accept();" - buttons="accept" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - style="padding: 0 5px 15px" - persist="screenX screenY width height"> - - <script src="include.js"/> - <script src="selectItemsDialog.js"/> - <script src="editBibliographyDialog.js"/> - - <vbox id="zotero-select-items-container" flex="1" style="padding: 1em"> - <vbox flex="1"> - <hbox flex="1"> - <vbox align="stretch" flex="1"> - <hbox align="center" pack="end"> - <label value="&zotero.toolbar.search.label;" control="zotero-tb-search"/> - <textbox id="zotero-tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;"> - <toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> - </textbox> - </hbox> - <hbox flex="1" style="margin-top: 5px"> - <tree id="zotero-collections-tree" - style="width: 150px;" hidecolumnpicker="true" seltype="single" - onselect="onCollectionSelected();"> - <treecols> - <treecol - id="zotero-collections-name-column" - flex="1" - primary="true" - hideheader="true"/> - </treecols> - <treechildren/> - </tree> - - <tree id="zotero-items-tree" - flex="1" hidecolumnpicker="true" seltype="single" - onselect="Zotero_Bibliography_Dialog.treeItemSelected();"> - <treecols> - <treecol - id="zotero-items-column-title" primary="true" - label="&zotero.items.title_column;" - flex="4" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-firstCreator" - label="&zotero.items.creator_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-dateAdded" hidden="true" - label="&zotero.items.dateAdded_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - <splitter class="tree-splitter"/> - <treecol - id="zotero-items-column-dateModified" hidden="true" - label="&zotero.items.dateModified_column;" - flex="1" persist="width ordinal hidden sortActive sortDirection"/> - </treecols> - <treechildren/> - </tree> - </hbox> - </vbox> - - <hbox id="source-list"> - <vbox align="center" pack="center"> - <toolbarbutton id="add" oncommand="Zotero_Bibliography_Dialog.add()" disabled="true"/> - <toolbarbutton id="remove" oncommand="Zotero_Bibliography_Dialog.remove()" disabled="true"/> - </vbox> - <vbox> - <label value="&zotero.integration.references.label;"/> - <listbox id="item-list" flex="1" align="stretch" seltype="single" - style="width: 250px;" onselect="Zotero_Bibliography_Dialog.listItemSelected();"/> - </vbox> - </hbox> - </hbox> - </vbox> - - <textbox id="editor" type="styled" mode="integration" flex="1"/> - </vbox> -</dialog> diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js @@ -0,0 +1,521 @@ +/* + ***** BEGIN LICENSE BLOCK ***** + + Copyright (c) 2006 Center for History and New Media + George Mason University, Fairfax, Virginia, USA + http://chnm.gmu.edu + + Licensed under the Educational Community License, Version 1.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.opensource.org/licenses/ecl1.php + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ***** END LICENSE BLOCK ***** +*/ + +var Zotero_Citation_Dialog = new function () { + var _preserveData = { + "prefix":"value", + "suffix":"value", + "locatorType":"selectedIndex", + "locator":"value", + "suppressAuthor":"checked" + }; + + var _itemData = new Object(); + var _multipleSourcesOn = false; + var _lastSelected = null; + var _previewShown = false; + var _suppressNextTreeSelect = false; + var _locatorIndexArray = {}; + var _autoRegeneratePref; + var _acceptButton; + var _sortCheckbox; + var _originalHTML; + var io; + + this.load = load; + this.toggleMultipleSources = toggleMultipleSources; + this.toggleEditor = toggleEditor; + this.treeItemSelected = treeItemSelected; + this.listItemSelected = listItemSelected; + this.add = add; + this.remove = remove; + this.sortCitation = sortCitation; + this.confirmRegenerate = confirmRegenerate; + this.accept = accept; + this.cancel = cancel; + + /* + * initialize add citation dialog + */ + function load() { + document.documentElement.getButton("extra1").label = Zotero.getString("citation.multipleSources"); + document.documentElement.getButton("extra2").label = Zotero.getString("citation.showEditor"); + + io = window.arguments[0].wrappedJSObject; + + // find accept button + _acceptButton = document.getElementById("zotero-add-citation-dialog").getButton("accept"); + _autoRegeneratePref = Zotero.Prefs.get("integration.autoRegenerate"); + + // if a style with sortable citations, present checkbox + if(io.citation.sortable) { + _sortCheckbox = document.getElementById("keepSorted"); + _sortCheckbox.hidden = false; + if(io.citation.properties.sort === undefined) io.citation.properties.sort = true; + _sortCheckbox.checked = io.citation.properties.sort; + } + + // load locators + var locators = Zotero.CSL.Global.getLocatorStrings(); + var menu = document.getElementById("locatorType"); + var popup = document.getElementById("locator-type-popup"); + var i = 0; + for(var value in locators) { + var locator = locators[value]; + locator = locator[0].toUpperCase()+locator.substr(1); + // add to popup + var child = document.createElement("menuitem"); + child.setAttribute("value", value); + child.setAttribute("label", locator); + popup.appendChild(child); + // add to array + _locatorIndexArray[value] = i; + i++; + } + menu.selectedIndex = 0; + + // load (from selectItemsDialog.js) + doLoad(); + + // if we already have a citation, load data from it + document.getElementById('editor').format = "Integration"; + if(io.citation.citationItems.length) { + if(io.citation.citationItems.length == 1) { + // single citation + _suppressNextTreeSelect = true; + itemsView.selectItem(io.citation.citationItems[0].itemID); // treeview from selectItemsDialog.js + for(var property in _preserveData) { + if(io.citation.citationItems[0][property]) { + if(property == "locatorType") { + document.getElementById(property)[_preserveData[property]] = _locatorIndexArray[io.citation.citationItems[0][property]]; + } else { + document.getElementById(property)[_preserveData[property]] = io.citation.citationItems[0][property]; + } + } + } + } else { + // multiple citations + toggleMultipleSources(); + for(var i=0; i<io.citation.citationItems.length; i++) { + var item = Zotero.Items.get(io.citation.citationItems[i].itemID); + if(item) { + _addItem(item); + _itemData[io.citation.citationItems[i].itemID] = io.citation.citationItems[i]; + } + } + } + + // show user-editable edited citation + if(io.citation.properties.custom) { + toggleEditor(io.citation.properties.custom); + io.citation.properties.custom = undefined; + } + + _updateAccept(); + } + } + + /* + * turn on/off multiple sources item list + */ + function toggleMultipleSources() { + _multipleSourcesOn = !_multipleSourcesOn; + if(_multipleSourcesOn) { + var items = itemsView.getSelectedItems(true); + var itemID = (items.length ? items[0] : false); + // var itemDataID = itemID+"::"+0; + document.getElementById("multiple-sources").hidden = undefined; + document.getElementById("zotero-add-citation-dialog").width = "750"; + document.documentElement.getButton("extra1").label = Zotero.getString("citation.singleSource"); + // move user field content to multiple before adding XXXXX + if (itemID) { + // _itemData[itemDataID] = new Object(); + _itemData[itemID] = new Object(); + var element; + for (var box in _preserveData) { + element = document.getElementById(box); + // _itemData[itemDataID][box] = element[_preserveData[box]]; + _itemData[itemID][box] = element[_preserveData[box]]; + } + } + treeItemSelected(); + // disable adding info until citation added + _itemSelected(false); + // add current selection + if (itemID) { + this.add(); + } else { + _updateAccept(); + _updatePreview(); + } + } else { + document.getElementById("multiple-sources").hidden = true; + document.getElementById("zotero-add-citation-dialog").width = "600"; + document.documentElement.getButton("extra1").label = Zotero.getString("citation.multipleSources"); + + // enable all fields + for(var i in _preserveData) { + document.getElementById(i).disabled = false; + } + + // delete item list + _itemData = new Object(); + + // delete all items + _clearCitationList(); + _updateAccept(); + _updatePreview(); + } + } + + /* + * called when an item in the item selection tree is clicked + */ + function treeItemSelected() { + if(_suppressNextTreeSelect) { + _suppressNextTreeSelect = false; + _updateAccept(); + return; + } + var items = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js + var itemID = (items.length ? items[0] : false); + + if(_multipleSourcesOn) { + // if item is also on right side, show info + var hasBeenAdded = itemID && _itemData[itemID] !== undefined; + // disable boxes if item not added; otherwise, enable + _itemSelected(hasBeenAdded ? itemID : false); + // disable adding nothing, or things already added + document.getElementById("add").disabled = !itemID || hasBeenAdded; + } else { + _updateAccept(); + _updatePreview(); + } + } + + /* + * called when an item in the selected items list is clicked + */ + function listItemSelected() { + var selectedListItem = document.getElementById("citation-list").getSelectedItem(0); + var itemID = (selectedListItem ? selectedListItem.value : false); + _itemSelected(itemID); + + document.getElementById("remove").disabled = !itemID; + } + + /* + * Adds a citation to the multipleSources list + */ + function add() { + var item = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js + _itemSelected(item.getID()); + _addItem(item); + + // don't let someone select it again + document.getElementById("add").disabled = true; + + // allow user to press OK + _updateAccept(); + _updatePreview(); + sortCitation(); + } + + /* + * Deletes a citation from the multipleSources list + */ + function remove() { + var citationList = document.getElementById("citation-list"); + var selectedListItem = citationList.getSelectedItem(0); + var itemID = selectedListItem.value; + + // remove from _itemData + delete _itemData[itemID]; + _itemData[itemID] = undefined; + _lastSelected = null; + + // re-select currently selected in left pane + var itemIDs = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js + if(itemIDs.length) { + document.getElementById("zotero-items-tree").focus(); + treeItemSelected(); + } + + // remove from list + citationList.removeChild(selectedListItem); + + _updateAccept(); + _updatePreview(); + treeItemSelected(); + } + + /* + * Sorts the list of citations + */ + function sortCitation() { + io.citation.properties.sort = _sortCheckbox && _sortCheckbox.checked; + if(_sortCheckbox.checked) { + _getCitation(); + + // delete all existing items from list + _clearCitationList(); + + // run preview function to re-sort, if it hasn't already been + // run + io.previewFunction(); + + // add items back to list + for(var i=0; i<io.citation.citationItems.length; i++) { + var item = Zotero.Items.get(io.citation.citationItems[i].itemID); + _addItem(item); + } + } + } + + /* + * Ask whether to modfiy the preview + */ + function confirmRegenerate(focusShifted) { + if(document.getElementById('editor').value == _originalHTML || _originalHTML === undefined) { + // no changes; just update without asking + _updatePreview(); + return; + } + + if(_autoRegeneratePref == -1) { + if(focusShifted) { // only ask after onchange event; oninput is too + // frequent for this to be worthwhile + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + var saveBehavior = { value: false }; + var regenerate = promptService.confirmEx( + this.window, + Zotero.getString('integration.regenerate.title'), + Zotero.getString('integration.regenerate.body'), + promptService.STD_YES_NO_BUTTONS, + null, null, null, + Zotero.getString('integration.regenerate.saveBehavior'), + saveBehavior + ); + + if(saveBehavior.value) { + _autoRegeneratePref = (regenerate == 0 ? 1 : 0); + Zotero.Prefs.set("integration.autoRegenerate", _autoRegeneratePref); + } + + if(regenerate == 0) { + _updatePreview(); + } + } + } else if(_autoRegeneratePref == 1) { + _updatePreview(); + } + } + + /* + * Shows the edit pane + */ + function toggleEditor(text) { + var editor = document.getElementById('editor'); + editor.hidden = _previewShown; + _previewShown = !_previewShown; + + if(_previewShown) { + document.documentElement.getButton("extra2").label = Zotero.getString("citation.hideEditor"); + if(text) { + editor.value = text; + } else { + _updatePreview(); + } + } else { + document.documentElement.getButton("extra2").label = Zotero.getString("citation.showEditor"); + } + } + + /* + * called when accept button is clicked + */ + function accept() { + _getCitation(); + var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected + && document.getElementById('editor').value != _originalHTML // and citation has been edited + + if(isCustom) { + var citation = document.getElementById('editor').value + } else { + var citation = (io.citation.citationItems.length ? io.previewFunction() : ""); + } + + if(Zotero.Utilities.prototype.trim(citation) == "") { + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + var insert = promptService.confirm(window, + Zotero.getString("integration.emptyCitationWarning.title"), + Zotero.getString("integration.emptyCitationWarning.body")); + if(!insert) return false; + } + + if(isCustom) io.citation.properties.custom = citation; + + return true; + } + + /* + * called when cancel button is clicked + */ + function cancel() { + io.citation.citationItems = new Array(); + } + + /* + * Updates the contents of the preview pane + */ + function _updatePreview() { + if(_previewShown) { + var editor = document.getElementById('editor'); + _getCitation(); + + editor.readonly = !io.citation.citationItems.length; + editor.value = _originalHTML = (io.citation.citationItems.length ? io.previewFunction() : ""); + } + } + + /* + * Controls whether the accept (OK) button should be enabled + */ + function _updateAccept(status) { + if(_multipleSourcesOn) { + _acceptButton.disabled = !document.getElementById("citation-list").childNodes.length; + } else { + _acceptButton.disabled = !itemsView.getSelectedItems().length; // treeview from selectItemsDialog.js + } + } + + /* + * called when an item is selected; if itemID is false, disables fields; if + * itemID is undefined, only updates _itemData array + */ + function _itemSelected(itemID) { + if(_lastSelected && !_itemData[_lastSelected]) { + _itemData[_lastSelected] = new Object(); + } + + for(var box in _preserveData) { + var domBox = document.getElementById(box); + var property = _preserveData[box]; + + // save property + if(_lastSelected) { + if(property == "locatorType") { + _itemData[_lastSelected][box] = domBox.selectedItem.value; + } else { + _itemData[_lastSelected][box] = domBox[property]; + } + } + // restore previous property + if(itemID) { + domBox.disabled = false; + if(_itemData[itemID] && _itemData[itemID][box] !== undefined) { + if(property == "locatorType") { + domBox[property] = _locatorIndexArray[_itemData[itemID][box]]; + } else { + domBox[property] = _itemData[itemID][box]; + } + } + } else if(itemID !== undefined) { + domBox.disabled = true; + domBox[property] = ""; + } + } + + if(itemID !== undefined) _lastSelected = itemID; + } + + /* + * updates io.citation to reflect selected items + */ + function _getCitation() { + io.citation.citationItems = new Array(); + + // use to map selectedIndexes back to page/paragraph/line + var locatorTypeElements = document.getElementById("locatorType").getElementsByTagName("menuitem"); + if(_multipleSourcesOn) { + _itemSelected(); // store locator info + + var citationList = document.getElementById("citation-list"); + var listLength = citationList.childNodes.length; + + var citationItems = new Array(); + if(listLength) { + // generate citationItems + for(var i=0; i<listLength; i++) { + var itemID = citationList.childNodes[i].value; + + var citationItem = _itemData[itemID]; + citationItem.itemID = itemID; + io.citation.citationItems.push(citationItem); + } + } + } else { + var items = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js + + var citationItem = new Zotero.CSL.CitationItem(); + citationItem.itemID = items[0]; + for(var property in _preserveData) { + if(property == "locatorType") { + citationItem[property] = document.getElementById(property).selectedItem.value; + } else { + citationItem[property] = document.getElementById(property)[_preserveData[property]]; + } + } + + if(citationItem["locator"] == "") { + citationItem["locator"] = citationItem["locatorType"] = undefined; + } + + io.citation.citationItems = [citationItem]; + } + } + + /* + * Add an item to the item list (multiple sources only) + */ + function _addItem(item) { + var itemNode = document.createElement("listitem"); + itemNode.setAttribute("value", item.getID()); + itemNode.setAttribute("label", item.getField("title")); + itemNode.setAttribute("class", "listitem-iconic"); + itemNode.setAttribute("image", item.getImageSrc()); + document.getElementById("citation-list").appendChild(itemNode); + } + + /* + * Removes all items from the multiple sources list + */ + function _clearCitationList() { + var citationList = document.getElementById("citation-list"); + while(citationList.firstChild) { + citationList.removeChild(citationList.firstChild); + } + } +} +\ No newline at end of file diff --git a/chrome/content/zotero/integration/addCitationDialog.xul b/chrome/content/zotero/integration/addCitationDialog.xul @@ -0,0 +1,200 @@ +<?xml version="1.0"?> +<!-- + ***** BEGIN LICENSE BLOCK ***** + + Copyright (c) 2006 Center for History and New Media + George Mason University, Fairfax, Virginia, USA + http://chnm.gmu.edu + + Licensed under the Educational Community License, Version 1.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.opensource.org/licenses/ecl1.php + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ***** END LICENSE BLOCK ***** +--> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://global/skin/dialog.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> + +<dialog + id="zotero-add-citation-dialog" + orient="vertical" + title="&zotero.integration.addEditCitation.title;" + width="600" height="450" + onload="Zotero_Citation_Dialog.load();" + onunload="doUnload();" + ondialogaccept="return Zotero_Citation_Dialog.accept();" + ondialogcancel="Zotero_Citation_Dialog.cancel();" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + persist="screenX screenY width height" + resizable="true" + buttons="extra1,extra2,accept,cancel" + ondialogextra2="Zotero_Citation_Dialog.toggleEditor()" + ondialogextra1="Zotero_Citation_Dialog.toggleMultipleSources()"> + + <script src="../include.js"/> + <script src="../selectItemsDialog.js"/> + <script src="addCitationDialog.js"/> + + <vbox id="zotero-select-items-container" flex="1"> + <vbox flex="1"> + <hbox flex="1"> + <vbox align="stretch" flex="1"> + <hbox align="center" pack="end"> + <label value="&zotero.toolbar.search.label;" control="zotero-tb-search"/> + <textbox id="zotero-tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" + onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { if (this.value == '') { cancelDialog(); return false; } this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;"> + <toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> + </textbox> + </hbox> + <hbox flex="1" style="margin-top: 5px"> + <tree id="zotero-collections-tree" + style="width: 200px;" hidecolumnpicker="true" seltype="single" + onselect="onCollectionSelected();"> + <treecols> + <treecol + id="zotero-collections-name-column" + flex="1" + primary="true" + hideheader="true"/> + </treecols> + <treechildren/> + </tree> + + <tree id="zotero-items-tree" + enableColumnDrag="true" flex="1" seltype="single" + onselect="Zotero_Citation_Dialog.treeItemSelected();"> + <treecols> + <treecol + id="zotero-items-column-title" primary="true" + label="&zotero.items.title_column;" + flex="4" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-firstCreator" + label="&zotero.items.creator_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-type" hidden="true" + label="&zotero.items.type_column;" + width="40" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-date" hidden="true" + label="&zotero.items.date_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-year" hidden="true" + label="&zotero.items.year_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-publisher" hidden="true" + label="&zotero.items.publisher_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-publicationTitle" hidden="true" + label="&zotero.items.publication_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-journalAbbreviation" hidden="true" + label="&zotero.items.journalAbbr_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-language" hidden="true" + label="&zotero.items.language_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-accessDate" hidden="true" + label="&zotero.items.accessDate_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-callNumber" hidden="true" + label="&zotero.items.callNumber_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-repository" hidden="true" + label="&zotero.items.repository_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-rights" hidden="true" + label="&zotero.items.rights_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-dateAdded" hidden="true" + label="&zotero.items.dateAdded_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-dateModified" hidden="true" + label="&zotero.items.dateModified_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + </treecols> + <treechildren/> + </tree> + </hbox> + </vbox> + + <hbox hidden="true" id="multiple-sources"> + <vbox align="center" pack="center"> + <toolbarbutton id="add" oncommand="Zotero_Citation_Dialog.add()" disabled="true"/> + <toolbarbutton id="remove" oncommand="Zotero_Citation_Dialog.remove()" disabled="true"/> + </vbox> + <vbox> + <checkbox id="keepSorted" hidden="true" checked="false" oncommand="Zotero_Citation_Dialog.sortCitation()" label="&zotero.citation.keepSorted.label;"/> + <listbox id="citation-list" flex="1" align="stretch" seltype="single" + onselect="Zotero_Citation_Dialog.listItemSelected();"></listbox> + </vbox> + </hbox> + </hbox> + + <hbox align="stretch" style="margin-top: 8px"> + <vbox flex="1"> + <hbox align="center"> + <label value="&zotero.citation.prefix.label;"/> + <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" class="fix" id="prefix" align="stretch" flex="1"/> + </hbox> + <hbox align="center"> + <label value="&zotero.citation.suffix.label;"/> + <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" class="fix" id="suffix" align="stretch" flex="1"/> + </hbox> + <spacer flex="1"/> + </vbox> + <separator flex="4"/> + <vbox flex="1"> + <hbox align="stretch"> + <menulist onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locatorType"> + <menupopup id="locator-type-popup"/> + </menulist> + <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locator" flex="1"/> + </hbox> + <separator style="height: 2px" flex="1"/> + <checkbox oncommand="Zotero_Citation_Dialog.confirmRegenerate(true)" id="suppressAuthor" label="&zotero.citation.suppressAuthor.label;"/> + </vbox> + </hbox> + </vbox> + + <textbox id="editor" type="styled" mode="integration" hidden="true" flex="1"/> + </vbox> +</dialog> diff --git a/chrome/content/zotero/editBibliographyDialog.js b/chrome/content/zotero/integration/editBibliographyDialog.js diff --git a/chrome/content/zotero/integration/editBibliographyDialog.xul b/chrome/content/zotero/integration/editBibliographyDialog.xul @@ -0,0 +1,116 @@ +<?xml version="1.0"?> +<!-- + ***** BEGIN LICENSE BLOCK ***** + + Copyright (c) 2006 Center for History and New Media + George Mason University, Fairfax, Virginia, USA + http://chnm.gmu.edu + + Licensed under the Educational Community License, Version 1.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.opensource.org/licenses/ecl1.php + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ***** END LICENSE BLOCK ***** +--> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?> +<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> + +<dialog + id="zotero-edit-bibliography-dialog" + orient="vertical" + title="&zotero.integration.editBibliography.title;" + width="750" height="450" + onload="Zotero_Bibliography_Dialog.load();" + onunload="doUnload();" + ondialogaccept="Zotero_Bibliography_Dialog.accept();" + buttons="accept" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + persist="screenX screenY width height" + resizable="true"> + + <script src="../include.js"/> + <script src="../selectItemsDialog.js"/> + <script src="editBibliographyDialog.js"/> + + <vbox id="zotero-select-items-container" flex="1"> + <vbox flex="1"> + <hbox flex="1"> + <vbox align="stretch" flex="1"> + <hbox align="center" pack="end"> + <label value="&zotero.toolbar.search.label;" control="zotero-tb-search"/> + <textbox id="zotero-tb-search" type="timed" timeout="250" oncommand="onSearch()" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;"> + <toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> + </textbox> + </hbox> + <hbox flex="1" style="margin-top: 5px"> + <tree id="zotero-collections-tree" + style="width: 150px;" hidecolumnpicker="true" seltype="single" + onselect="onCollectionSelected();"> + <treecols> + <treecol + id="zotero-collections-name-column" + flex="1" + primary="true" + hideheader="true"/> + </treecols> + <treechildren/> + </tree> + + <tree id="zotero-items-tree" + flex="1" hidecolumnpicker="true" seltype="single" + onselect="Zotero_Bibliography_Dialog.treeItemSelected();"> + <treecols> + <treecol + id="zotero-items-column-title" primary="true" + label="&zotero.items.title_column;" + flex="4" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-firstCreator" + label="&zotero.items.creator_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-dateAdded" hidden="true" + label="&zotero.items.dateAdded_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-dateModified" hidden="true" + label="&zotero.items.dateModified_column;" + flex="1" persist="width ordinal hidden sortActive sortDirection"/> + </treecols> + <treechildren/> + </tree> + </hbox> + </vbox> + + <hbox id="source-list"> + <vbox align="center" pack="center"> + <toolbarbutton id="add" oncommand="Zotero_Bibliography_Dialog.add()" disabled="true"/> + <toolbarbutton id="remove" oncommand="Zotero_Bibliography_Dialog.remove()" disabled="true"/> + </vbox> + <vbox> + <label value="&zotero.integration.references.label;"/> + <listbox id="item-list" flex="1" align="stretch" seltype="single" + style="width: 250px;" onselect="Zotero_Bibliography_Dialog.listItemSelected();"/> + </vbox> + </hbox> + </hbox> + </vbox> + + <textbox id="editor" type="styled" mode="integration" flex="1"/> + </vbox> +</dialog> diff --git a/chrome/content/zotero/integration/integrationDocPrefs.xul b/chrome/content/zotero/integration/integrationDocPrefs.xul @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin/global.css"?> +<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?> +<?xml-stylesheet href="chrome://zotero/skin/bibliography.css"?> +<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> + +<dialog + id="zotero-doc-prefs-dialog" + orient="vertical" + buttons="accept" + title="&zotero.integration.docPrefs.title;" + onload="Zotero_File_Interface_Bibliography.init();" + ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection();" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + persist="screenX screenY"> + + <script src="../include.js"/> + <script src="../bibliography.js"/> + + <groupbox> + <caption label="&zotero.bibliography.style.label;"/> + <listbox id="style-listbox" onselect="Zotero_File_Interface_Bibliography.styleChanged()"/> + </groupbox> + + <groupbox> + <caption label="&zotero.integration.prefs.displayAs.label;"/> + <radiogroup id="displayAs" orient="horizontal"> + <radio id="footnotes" label="&zotero.integration.prefs.footnotes.label;" selected="true"/> + <radio id="endnotes" label="&zotero.integration.prefs.endnotes.label;"/> + </radiogroup> + </groupbox> + + <groupbox> + <caption label="&zotero.integration.prefs.formatUsing.label;"/> + + <radiogroup id="formatUsing" orient="vertical"> + <radio id="fields" selected="true"/> + <label class="radioDescription" id="fields-caption"/> + <label class="radioDescription" id="fields-file-format-notice"/> + <radio id="bookmarks" label="&zotero.integration.prefs.bookmarks.label;"/> + <description class="radioDescription" id="bookmarks-caption" style="white-space: pre;">&zotero.integration.prefs.bookmarks.caption;</description> + <description class="radioDescription" id="bookmarks-file-format-notice"/> + </radiogroup> + </groupbox> +</dialog> +\ No newline at end of file diff --git a/chrome/content/zotero/integrationDocPrefs.xul b/chrome/content/zotero/integrationDocPrefs.xul @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet href="chrome://global/skin/global.css"?> -<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?> -<?xml-stylesheet href="chrome://zotero/skin/bibliography.css"?> -<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> - -<dialog - id="zotero-doc-prefs-dialog" - orient="vertical" - buttons="accept" - title="&zotero.integration.docPrefs.title;" - onload="Zotero_File_Interface_Bibliography.init();" - ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection();" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - style="padding: 0" - persist="screenX screenY"> - - <script src="include.js"/> - <script src="bibliography.js"/> - - <vbox id="zotero-bibliography-container" style="padding: 0.5em"> - <groupbox> - <caption label="&zotero.bibliography.style.label;"/> - <listbox id="style-listbox" onselect="Zotero_File_Interface_Bibliography.styleChanged()"/> - </groupbox> - - <groupbox> - <caption label="&zotero.integration.prefs.displayAs.label;"/> - <radiogroup id="displayAs" orient="horizontal"> - <radio id="footnotes" label="&zotero.integration.prefs.footnotes.label;" selected="true"/> - <radio id="endnotes" label="&zotero.integration.prefs.endnotes.label;"/> - </radiogroup> - </groupbox> - - <groupbox> - <caption label="&zotero.integration.prefs.formatUsing.label;"/> - - <radiogroup id="formatUsing" orient="vertical"> - <radio id="fields" selected="true"/> - <label class="radioDescription" id="fields-caption"/> - <label class="radioDescription" id="fields-file-format-notice"/> - <radio id="bookmarks" label="&zotero.integration.prefs.bookmarks.label;"/> - <description class="radioDescription" id="bookmarks-caption" style="white-space: pre;">&zotero.integration.prefs.bookmarks.caption;</description> - <description class="radioDescription" id="bookmarks-file-format-notice"/> - </radiogroup> - </groupbox> - </vbox> -</dialog> -\ No newline at end of file diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -861,7 +861,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWindowWatcher) - .openWindow(null, 'chrome://zotero/content/integrationDocPrefs.xul', '', + .openWindow(null, 'chrome://zotero/content/integration/integrationDocPrefs.xul', '', 'chrome,modal,centerscreen', io, true); if(!io.style) throw new Zotero.Integration.UserCancelledException(); @@ -898,7 +898,7 @@ Zotero.Integration.Session.prototype.reselectItem = function(exception) { Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWindowWatcher) .openWindow(null,'chrome://zotero/content/selectItemsDialog.xul', '', - 'chrome,modal,centerscreen,resizable=yes', io, true); + 'chrome,modal,centerscreen,resizable', io, true); if(io.dataOut && io.dataOut.length) { var itemID = io.dataOut[0]; @@ -1252,8 +1252,8 @@ Zotero.Integration.Session.prototype.editCitation = function(index, noteIndex, c Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWindowWatcher) .openWindow( - null, 'chrome://zotero/content/addCitationDialog.xul', '', - 'chrome,modal,centerscreen,resizable=yes', + null, 'chrome://zotero/content/integration/addCitationDialog.xul', '', + 'chrome,modal,centerscreen,resizable', io ); @@ -1399,8 +1399,8 @@ Zotero.Integration.Session.prototype.editBibliography = function() { Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWindowWatcher) .openWindow( - null, 'chrome://zotero/content/editBibliographyDialog.xul', '', - 'chrome,modal,centerscreen,resizable=yes', + null, 'chrome://zotero/content/integration/editBibliographyDialog.xul', '', + 'chrome,modal,centerscreen,resizable', io, true ); diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css @@ -143,6 +143,11 @@ zoteromergepane { -moz-binding: url('chrome://zotero/content/bindings/merge.xml#merge-pane'); } +dialog[resizable="true"] +{ + -moz-binding: url('chrome://zotero/content/bindings/resizabledialog.xml#resizabledialog'); +} + .zotero-clicky { -moz-border-radius: 6px;