Ticket #1278: PATCH.zotero-trunk.patch

File PATCH.zotero-trunk.patch, 45.9 KB (added by fbennett, 8 years ago)

Fat patch with several changes to help support Bluebook

  • chrome/content/zotero/addCitationDialog.js

    diff -r -u zotero-trunk.orig/chrome/content/zotero/addCitationDialog.js zotero-trunk/chrome/content/zotero/addCitationDialog.js
    old new  
    2626                "suffix":"value", 
    2727                "locatorType":"selectedIndex", 
    2828                "locator":"value", 
    29                 "suppressAuthor":"checked" 
     29                /* 
     30                 * fbennett: 3 
     31                 *   5 lines 
     32                 */ 
     33                "suppressAuthor":"checked", 
     34                "volume-selector":"value", 
     35                "volume":"value", 
     36                "issued":"value", 
     37                "edition":"value" 
    3038        }; 
    3139         
    3240        var _itemData = new Object(); 
     
    5260        this.confirmRegenerate = confirmRegenerate; 
    5361        this.accept = accept; 
    5462        this.cancel = cancel; 
    55          
     63        /* 
     64         * fbennett: 2, 3 
     65         *   162 lines 
     66         */ 
     67        /* 
     68         * fbennett: Volume number setting 
     69         * 
     70         * ------------ 
     71         * What it does 
     72         * ------------ 
     73         * 
     74         * Some styles (well, Bluebook, anyway) require that the 
     75         * volume number be supplied for multi-volume works by a 
     76         * single author -- in back-references.  This means that a 
     77         * single bibliographic entry must be made to work with 
     78         * multiple volumes, treating the whole set as a single work. 
     79         *  
     80         * This patch modifies Zotero to supply a volume selection 
     81         * widget to the client UI when there is an appropriate value 
     82         * in the numberOfVolumes field, and the work cited is not a 
     83         * specific chapter, dictionary entry, or encyclopedia entry. 
     84         * 
     85         * The value in numberOfVolumes may be an integer or a 
     86         * comma-delimited string.  In the former case, a list of 
     87         * volume numbers ranging up from one is presented in the 
     88         * widget.  In the latter case, the literal elements are 
     89         * presented. 
     90         * 
     91         * Selections are persistent, both while editing and after 
     92         * rendering of the citation.  The value will feed through to 
     93         * CSL stylesheets in the normal way, through both text and 
     94         * number declarations. 
     95         * 
     96         * --------------- 
     97         * Functions added 
     98         * --------------- 
     99         * 
     100         * volumeNumberInit() hides the volume number widget in 
     101         * initial popup view. 
     102         * 
     103         * volumeNumber() enables the volume number widget with 
     104         * appropriate values. 
     105         * 
     106         * ------------------- 
     107         * Functions exploited 
     108         * ------------------- 
     109         * 
     110         * load() in the single condition resets screen when editing 
     111         * singles.  (citation is active, so should reset in this 
     112         * case). 
     113         *  
     114         * load() in the multiple condition resets screen when editing 
     115         * multiples.  (should take no action, because nothing is 
     116         * active on initial display). 
     117         * 
     118         * listItemSelected() resets screen upon selection in 
     119         * right-side multiples box. 
     120         * 
     121         * treeItemSelected() resets screen on selection in the 
     122         * left-side box. 
     123         * 
     124         * ---- 
     125         * Bugs 
     126         * ---- 
     127         * 
     128         * In single-citation entry mode, the selected value is lost 
     129         * when the user clicks away from the citation and clicks 
     130         * back.  This looks odd because the locator value (which does 
     131         * not depend on the citation data in any way, and so does not 
     132         * need to be reset) does not change. 
     133         * 
     134         * The handling of the fallback value could maybe use a little 
     135         * attention. 
     136         * 
     137         * In styles that do not require this level of precision, the 
     138         * additional field might strike some as a nuisance. 
     139         * Depending on how users react to this feature, it might be 
     140         * desirable to add a configuration option to suppress the 
     141         * selection box. 
     142         */ 
     143 
     144        function volumeNumberInit() { 
     145            document.getElementById("volume-selector").setAttribute("hidden",true); 
     146            document.getElementById("volume-popup").setAttribute("hidden",true); 
     147            document.getElementById("volume-label").setAttribute("hidden",true); 
     148        } 
     149 
     150        function volumeNumber(itemID,pos) { 
     151             
     152            var itemDataID = (pos ? itemID+"::"+pos : itemID); 
     153 
     154            if (itemID) { 
     155                var item = Zotero.Items.get(itemID); 
     156                if(item) { 
     157 
     158                    var volume_title = item.getField("title"); 
     159                    var volume_numberof = item.getField("numberOfVolumes"); 
     160                    var volume_blockers = ["bookTitle","encyclopediaTitle","dictionaryTitle"]; 
     161                    var volume_block = true; 
     162                    if(volume_title && volume_numberof) { 
     163                        volume_block = false; 
     164                        for (i in volume_blockers) { 
     165                            var blocker = volume_blockers[i]; 
     166                            if(item.getField(blocker)) { 
     167                                volume_block = true; 
     168                                break; 
     169                            } 
     170                        } 
     171                    } 
     172                    var volume_range = []; 
     173                    var volume_labels = []; 
     174                    if(!volume_block && volume_numberof) { 
     175                        var numberof = volume_numberof.toString(); 
     176                        if (numberof.match(/^\d+$/)) { 
     177                            for (i = 1; i <= parseInt(numberof); i++) { 
     178                                volume_range.push(i.toString()); 
     179                                volume_labels.push(i.toString()); 
     180                            } 
     181                        } else if (numberof.match(/,/)) { 
     182                            volume_range = numberof.replace(/, ?/g, "|").split("|"); 
     183                            for (i in volume_range) { 
     184                                volume_labels.push(volume_range[i].replace(/\/.*$/, "")); 
     185                                    } 
     186                        } else { 
     187                            volume_block = true; 
     188                        } 
     189                    } 
     190             
     191                    var menu_volume = document.getElementById("volume-selector"); 
     192                    var popup_volume = document.getElementById("volume-popup"); 
     193                    var label_volume = document.getElementById("volume-label"); 
     194                    label_volume.setAttribute("hidden",volume_block); 
     195                    popup_volume.setAttribute("hidden",volume_block); 
     196                    menu_volume.setAttribute("hidden",volume_block); 
     197                     
     198                    while(popup_volume.firstChild) { 
     199                        popup_volume.removeChild(popup_volume.firstChild); 
     200                    } 
     201                    var i = 0; 
     202                    var _volumeIndexArray = {}; 
     203                    for (var value in volume_range) { 
     204                        var volume = volume_range[value]; 
     205                        var label = volume_labels[value]; 
     206                        var child = document.createElement("menuitem"); 
     207                        child.setAttribute("value", volume); 
     208                        child.setAttribute("label", label); 
     209                        popup_volume.appendChild(child); 
     210                        _volumeIndexArray[volume] = i; 
     211                        i++; 
     212                    } 
     213                    if(_itemData && _itemData[itemDataID] && _itemData[itemDataID] && _itemData[itemDataID]["volume-selector"]) { 
     214                        var index = _volumeIndexArray[_itemData[itemDataID]["volume-selector"]]; 
     215                    } else { 
     216                        var index = 0; 
     217                    } 
     218                    menu_volume.selectedIndex = index; 
     219 
     220                } 
     221            } 
     222        } 
     223 
     224 
    56225        /* 
    57226         * initialize add citation dialog 
    58227         */ 
    59228        function load() { 
     229                volumeNumberInit(); 
    60230                document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); 
    61231                document.getElementById("show-editor-button").label = Zotero.getString("citation.showEditor"); 
    62232                 
     
    70240                if(io.citation.sortable) { 
    71241                        _sortCheckbox = document.getElementById("keepSorted"); 
    72242                        _sortCheckbox.hidden = false; 
    73                         if(io.citation.properties.sort === undefined) io.citation.properties.sort = true; 
     243                        /*  
     244                         * fbennett: n/a 
     245                         *   Was ===, which I'd never seen before, and assumed was a typo. 
     246                         */ 
     247                        if(io.citation.properties.sort == undefined) io.citation.properties.sort = true; 
    74248                        _sortCheckbox.checked = io.citation.properties.sort; 
    75249                } 
    76250                 
     
    101275                if(io.citation.citationItems.length) { 
    102276                        if(io.citation.citationItems.length == 1) { 
    103277                                // single citation 
     278                            /* 
     279                             * fbennett: 2, 3 
     280                             *   1 line 
     281                             */ 
     282                                volumeNumber(io.citation.citationItems[0].itemID); 
    104283                                _suppressNextTreeSelect = true; 
    105284                                itemsView.selectItem(io.citation.citationItems[0].itemID);       // treeview from selectItemsDialog.js 
    106285                                for(var property in _preserveData) { 
     
    119298                                        var item = Zotero.Items.get(io.citation.citationItems[i].itemID); 
    120299                                        if(item) { 
    121300                                                _addItem(item); 
    122                                                 _itemData[io.citation.citationItems[i].itemID] = io.citation.citationItems[i]; 
     301                                                /* 
     302                                                 * fbennett: 1 
     303                                                 *   1 line 
     304                                                 */ 
     305                                                _itemData[io.citation.citationItems[i].itemID+"::"+i] = io.citation.citationItems[i]; 
    123306                                        } 
    124307                                } 
    125308                        } 
     
    149332        function toggleMultipleSources() { 
    150333                _multipleSourcesOn = !_multipleSourcesOn; 
    151334                if(_multipleSourcesOn) { 
     335                        var items = itemsView.getSelectedItems(true); 
     336                        var itemID = (items.length ? items[0] : false); 
     337                        var itemDataID = itemID+"::"+0; 
    152338                        document.getElementById("multiple-sources").hidden = undefined; 
    153339                        document.getElementById("zotero-add-citation-dialog").width = "750"; 
    154340                        document.getElementById("multiple-sources-button").label = Zotero.getString("citation.singleSource");                    
     341                        // move user field content to multiple before adding XXXXX 
     342                        if (itemID) { 
     343                            _itemData[itemDataID] = new Object(); 
     344                            for (box in _preserveData) { 
     345                                element = document.getElementById(box); 
     346                                _itemData[itemDataID][box] = element[_preserveData[box]]; 
     347                            } 
     348                        } 
    155349                        window.sizeToContent(); 
    156350                        window.moveTo((window.screenX-75), window.screenY); 
    157351                        treeItemSelected(); 
    158352                        // disable adding info until citation added 
    159353                        _itemSelected(false); 
     354                        // add current selection 
     355                        if (itemID) { 
     356                            this.add(); 
     357                        } else { 
     358                            _updateAccept(); 
     359                            _updatePreview(); 
     360                        } 
    160361                } else { 
    161362                        document.getElementById("multiple-sources").hidden = true; 
    162363                        document.getElementById("zotero-add-citation-dialog").width = "600"; 
     
    174375                         
    175376                        // delete all items 
    176377                        _clearCitationList(); 
     378                        _updateAccept(); 
     379                        _updatePreview(); 
    177380                } 
    178                 _updateAccept(); 
    179                 _updatePreview(); 
    180381        } 
    181382         
    182383        /* 
     
    197398                        // disable boxes if item not added; otherwise, enable 
    198399                        _itemSelected(hasBeenAdded ? itemID : false); 
    199400                        // disable adding nothing, or things already added 
    200                         document.getElementById("add").disabled = !itemID || hasBeenAdded; 
     401                        document.getElementById("add").disabled = !itemID; 
     402                        /* 
     403                         * fbennett: 1, 2, 3 
     404                         *   6 lines 
     405                         */ 
     406                        document.getElementById("remove").disabled = true; 
     407                        pos = document.getElementById("citation-list").childNodes.length; 
     408                        volumeNumber(itemID,pos); 
    201409                } else { 
     410                        volumeNumber(itemID); 
    202411                        _updateAccept(); 
    203412                        _updatePreview(); 
    204413                } 
     
    208417         * called when an item in the selected items list is clicked 
    209418         */ 
    210419        function listItemSelected() { 
    211                 var selectedListItem = document.getElementById("citation-list").getSelectedItem(0); 
     420            /* 
     421             * fbennett: 1, 2, 3 
     422             *   8 lines 
     423             */ 
     424                var selectedListItem = document.getElementById("citation-list").getSelectedItem(0); 
    212425                var itemID = (selectedListItem ? selectedListItem.value : false); 
    213                 _itemSelected(itemID); 
     426                var pos = selectedListItem.parentNode.selectedIndex; 
     427                _itemSelected(itemID,pos); 
    214428                 
     429                volumeNumber(itemID,pos); 
    215430                document.getElementById("remove").disabled = !itemID; 
     431                document.getElementById("add").disabled = true; 
    216432        } 
    217433         
    218434        /* 
     
    220436         */ 
    221437        function add() { 
    222438                var item = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js 
    223                 _itemSelected(item.getID()); 
     439                /* 
     440                 * fbennett: 1 
     441                 *   7 lines 
     442                 */ 
     443                var citation_list = document.getElementById("citation-list"); 
     444                var pos = citation_list.childNodes.length; 
    224445                _addItem(item); 
     446                _itemSelected(item.getID(), pos); 
    225447                 
    226448                // don't let someone select it again 
    227                 document.getElementById("add").disabled = true; 
     449                document.getElementById("add").disabled = false; 
    228450                 
    229451                // allow user to press OK 
    230452                _updateAccept(); 
     
    239461                var citationList = document.getElementById("citation-list"); 
    240462                var selectedListItem = citationList.getSelectedItem(0); 
    241463                var itemID = selectedListItem.value; 
    242                  
     464                /* 
     465                 * fbennett: 1 
     466                 *   20 lines 
     467                 */ 
     468                var itemParent = selectedListItem.parentNode; 
     469                var pos = itemParent.selectedIndex; 
     470                var itemFamily = itemParent.childNodes; 
     471                var itemDataID = itemID+"::"+pos; 
     472 
    243473                // remove from _itemData 
    244                 delete _itemData[itemID]; 
    245                 _itemData[itemID] = undefined; 
     474                delete _itemData[itemDataID]; 
     475                _itemData[itemDataID] = undefined; 
    246476                _lastSelected = null; 
     477 
     478                // renumber in _itemData 
    247479                 
     480                for (i = pos+1; i < itemFamily.length; i++) { 
     481                    var oldID = itemFamily.item(i).value+"::"+i; 
     482                    var newID = itemFamily.item(i).value+"::"+pos; 
     483                    _itemData[newID] = _itemData[oldID]; 
     484                    delete _itemData[oldID]; 
     485                    pos++; 
     486                } 
     487 
    248488                // re-select currently selected in left pane 
    249489                var itemIDs = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js 
    250490                if(itemIDs.length) { 
     
    287527         * Ask whether to modfiy the preview 
    288528         */ 
    289529        function confirmRegenerate(focusShifted) { 
     530            /* 
     531             * fbennett: 2, 3 
     532             *   lines: 27 
     533             */ 
     534            var selectedListItem = document.getElementById("citation-list").getSelectedItem(0); 
     535                if (focusShifted && selectedListItem) { 
     536                    var itemID = selectedListItem.value; 
     537                    var pos = selectedListItem.parentNode.selectedIndex; 
     538                    var volume_selector = document.getElementById('volume-selector'); 
     539                    var volume =  document.getElementById('volume'); 
     540                    var edition = document.getElementById('edition'); 
     541                    var issued = document.getElementById('issued'); 
     542                    var elements = volume_selector.value.replace(/ ?\/ ?/g, "|").split("|"); 
     543 
     544                    if (elements.length > 1) { 
     545                        issued.setAttribute("value", elements[1]); 
     546                    } else { 
     547                        issued.removeAttribute("value"); 
     548                    } 
     549                    if (elements.length > 2) { 
     550                        edition.setAttribute("value", elements[2]); 
     551                    } else { 
     552                        edition.removeAttribute("value"); 
     553                    } 
     554                    if (elements.length > 0) { 
     555                        volume.setAttribute("value", elements[0]); 
     556                    } else { 
     557                        volume.removeAttribute("value"); 
     558                    } 
     559                    _itemSelected(itemID,pos); 
     560                } 
     561 
    290562                if(document.getElementById('editor').value == _originalHTML || _originalHTML === undefined) { 
    291563                        // no changes; just update without asking 
    292564                        _updatePreview(); 
     
    409681         * called when an item is selected; if itemID is false, disables fields; if 
    410682         * itemID is undefined, only updates _itemData array 
    411683         */ 
    412         function _itemSelected(itemID) { 
     684        /* 
     685         * fbennett: 1 
     686         *   3 lines 
     687         */ 
     688        function _itemSelected(itemID,pos) { 
     689                var itemDataID = (itemID ? itemID+"::"+pos : undefined); 
     690                 
    413691                if(_lastSelected && !_itemData[_lastSelected]) { 
    414692                        _itemData[_lastSelected] = new Object(); 
    415693                } 
     
    429707                        // restore previous property 
    430708                        if(itemID) { 
    431709                                domBox.disabled = false; 
    432                                 if(_itemData[itemID] && _itemData[itemID][box] !== undefined) { 
     710                                /* 
     711                                 * fbennett: 1 
     712                                 *   9 lines 
     713                                 */ 
     714                                if(_itemData[itemDataID] && _itemData[itemDataID][box] !== undefined) { 
    433715                                        if(property == "locatorType") { 
    434                                                 domBox[property] = _locatorIndexArray[_itemData[itemID][box]]; 
     716                                                domBox[property] = _locatorIndexArray[_itemData[itemDataID][box]]; 
    435717                                        } else { 
    436                                                 domBox[property] = _itemData[itemID][box]; 
     718                                                domBox[property] = _itemData[itemDataID][box]; 
    437719                                        } 
     720                                } else { 
     721                                    domBox[property] = ""; 
    438722                                } 
    439723                        } else if(itemID !== undefined) { 
    440724                                domBox.disabled = true; 
    441725                                domBox[property] = ""; 
    442726                        } 
    443727                } 
    444                  
    445                 if(itemID !== undefined) _lastSelected = itemID; 
     728                /* 
     729                 * fbennett: 1 
     730                 *  1 line 
     731                 */ 
     732                if(itemID !== undefined) _lastSelected = itemDataID; 
    446733        } 
    447734         
    448735        /* 
     
    464751                                // generate citationItems 
    465752                                for(var i=0; i<listLength; i++) { 
    466753                                        var itemID = citationList.childNodes[i].value; 
    467                                          
    468                                         var citationItem = _itemData[itemID]; 
     754                                        /* 
     755                                         * fbennett: 1 
     756                                         *   2 lines 
     757                                         */ 
     758                                        var itemDataID = itemID+"::"+i; 
     759                                        var citationItem = _itemData[itemDataID]; 
    469760                                        citationItem.itemID = itemID; 
    470761                                        io.citation.citationItems.push(citationItem); 
    471762                                } 
  • chrome/content/zotero/addCitationDialog.xul

    Only in zotero-trunk/chrome/content/zotero: addCitationDialog.js.orig
    diff -r -u zotero-trunk.orig/chrome/content/zotero/addCitationDialog.xul zotero-trunk/chrome/content/zotero/addCitationDialog.xul
    old new  
    160160                                        </vbox> 
    161161                                        <vbox> 
    162162                                                <checkbox id="keepSorted" hidden="true" checked="false" oncommand="Zotero_Citation_Dialog.sortCitation()" label="&zotero.citation.keepSorted.label;"/> 
     163<!-- 
     164  fbennett: n/a 
     165    onclick seems to work better here. 
     166--> 
    163167                                                <listbox id="citation-list" flex="1" align="stretch" seltype="single" 
    164                                                         onselect="Zotero_Citation_Dialog.listItemSelected();"></listbox> 
     168                                                        onclick="Zotero_Citation_Dialog.listItemSelected();"></listbox> 
    165169                                        </vbox> 
    166170                                </hbox> 
    167171                        </hbox> 
     
    181185                                <separator flex="4"/> 
    182186                                <vbox flex="1"> 
    183187                                        <hbox align="stretch"> 
    184                                                 <menulist onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locatorType"> 
    185                                                         <menupopup id="locator-type-popup"/> 
     188<!--  
     189  fbennett: 2, 3 
     190    18 lines 
     191--> 
     192+                                               <menulist onmouseout="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locatorType"> 
     193                                                        <menupopup id="locator-type-popup"/> 
     194                                                </menulist> 
     195                                                <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locator" flex="1"/> 
     196                                        </hbox> 
     197                                        <separator height="2px" flex="1"/> 
     198                                        <hbox align="stretch"> 
     199                                                <checkbox oncommand="Zotero_Citation_Dialog.confirmRegenerate(true)" id="suppressAuthor" label="&zotero.citation.suppressAuthor.label;"/> 
     200                                                <spacer flex="1"/> 
     201                                                <label value="&zotero.citation.volume.label;" id="volume-label"/> 
     202                                                <menulist onmouseout="Zotero_Citation_Dialog.confirmRegenerate(true)" id="volume-selector"> 
     203                                                        <menupopup id="volume-popup"/> 
    186204                                                </menulist> 
    187                                                 <textbox oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locator" flex="1"/> 
     205                                                <label id="edition" value="" hidden="true"/> 
     206                                                <label id="issued" value="" hidden="true"/> 
     207                                                <label id="volume" value="" hidden="true"/> 
    188208                                        </hbox> 
    189                                         <separator style="height: 2px" flex="1"/> 
    190                                         <checkbox oncommand="Zotero_Citation_Dialog.confirmRegenerate(true)" id="suppressAuthor" label="&zotero.citation.suppressAuthor.label;"/> 
    191                                 </vbox> 
     209                                </vbox> 
    192210                        </hbox> 
    193211                </vbox> 
    194212                 
  • chrome/content/zotero/xpcom/csl.js

    diff -r -u zotero-trunk.orig/chrome/content/zotero/xpcom/csl.js zotero-trunk/chrome/content/zotero/xpcom/csl.js
    old new  
    11/* 
    22    ***** BEGIN LICENSE BLOCK ***** 
    33     
    4     Copyright (c) 2006  Center for History and New Media 
     4   copyright (c) 2006  Center for History and New Media 
    55                        George Mason University, Fairfax, Virginia, USA 
    66                        http://chnm.gmu.edu 
    77     
     
    2020    ***** END LICENSE BLOCK ***** 
    2121*/ 
    2222 
     23 /* 
     24 * See separate PATCH.txt file for key to fbennett changes. 
     25 */ 
     26 
     27 
    2328/* 
    2429 * CSL: a class for creating bibliographies from CSL files 
    2530 * this is abstracted as a separate class for the benefit of anyone who doesn't 
     
    4853        Zotero.debug("CSL: style class is "+this.class); 
    4954         
    5055        this.hasBibliography = (this._csl.bibliography.length() ? 1 : 0); 
     56        /* 
     57         * fbennett: 5 
     58         *   7 lines 
     59         */ 
     60        this.daySuffixes = Zotero.getString("date.daySuffixes").replace(/, ?/g, "|").split("|"); 
     61        for each (i in [0,1,2,3]) { 
     62                if (suffix = this._getTerm("ordinal-0"+(i+1), false, false, false, true)) { 
     63                    this.daySuffixes[i] = suffix; 
     64                } 
     65            } 
     66 
    5167} 
    5268 
    5369/* 
     
    7086        "recipient":true, 
    7187        "interviewer":true, 
    7288        "collection-editor":true, 
    73         "author":true 
     89        /* 
     90         * fbennett: 6 
     91         *   3 lines 
     92         */ 
     93        "author":true, 
     94        "contributor":true, 
     95        "container-author":true 
    7496} 
    7597 
    7698/* 
     
    260282                        if(Zotero.CSL._textCharRegexp.test(prefix[prefix.length-1])) prefix += " "; 
    261283                         
    262284                        citationString.append(prefix); 
     285                        /* 
     286                         * fbennett: 7 
     287                         *   1 line 
     288                         */ 
     289                        citationString.has_prefix = true; 
    263290                } 
    264291                 
    265292                this._processElements(citationItem.item, context.layout, citationString, 
    266293                        context, citationItem, ignore); 
    267294                 
    268295                // add suffix 
     296                var hasSuffixPunctuation; 
    269297                if(citationItem.suffix) { 
    270298                        var suffix = citationItem.suffix; 
     299                        /* 
     300                         * fbennett: 7 
     301                         *   5 lines 
     302                         */ 
     303                        var sfx = suffix.replace(/^\s*/g, "").replace(/\s*$/g, ""); 
     304                        var pnct = Zotero.CSL.FormattedString._punctuation; 
     305                        if (pnct.indexOf(sfx[sfx.length-1]) != -1) { 
     306                            hasSuffixPunctuation = true; 
     307                        } else { 
     308                            hasSuffixPunctuation = false; 
     309                        } 
    271310                         
    272311                        // add space to suffix if last char is alphanumeric 
    273312                        if(Zotero.CSL._textCharRegexp.test(suffix[0])) suffix = " "+suffix; 
     
    276315                } 
    277316                 
    278317                string.concat(citationString); 
     318                string.hasSuffixPunctuation = hasSuffixPunctuation; 
    279319        } 
    280320         
    281321        var returnString = string.clone(); 
     
    489529/* 
    490530 * gets a term, in singular or plural form 
    491531 */ 
    492 Zotero.CSL.prototype._getTerm = function(term, plural, form, includePeriod) { 
     532/* 
     533 * fbennett: 5 
     534 *   1 line 
     535 */ 
     536Zotero.CSL.prototype._getTerm = function(term, plural, form, includePeriod, quiet) { 
    493537        if(!form) { 
    494538                form = "long"; 
    495539        } 
     
    502546                } else if(form != "long") { 
    503547                        return this._getTerm(term, plural, "long"); 
    504548                } else { 
     549                    /* 
     550                     * fbennett: 5 
     551                     *   3 lines 
     552                     */ 
     553                    if (!quiet) { 
    505554                        Zotero.debug("CSL: WARNING: could not find term \""+term+'"'); 
     555                    } 
    506556                        return ""; 
    507557                } 
    508558        } 
     
    758808                                         
    759809                                        if(variables[j] == "locator") { 
    760810                                                // special case for locator 
     811                                            /* 
     812                                             * fbennett: 3 
     813                                             *   9 lines 
     814                                             */ 
    761815                                                var text = citationItem && citationItem.locator ? citationItem.locator : ""; 
     816                                        } else if(variables[j] == "volume") { 
     817                                                // special case for volume 
     818                                                var text = citationItem && citationItem.volume ? citationItem.volume : item.getVariable("volume"); 
     819                                        } else if(variables[j] == "edition") { 
     820                                                // special case for edition 
     821                                                var text = citationItem && citationItem.edition ? citationItem.edition : item.getVariable("edition"); 
     822                                        } else if(variables[j] == "date") { 
     823                                                // special case for date 
     824                                                var text = citationItem && citationItem.date ? citationItem.date : item.getVariable("date"); 
    762825                                        } else if(citationItem && citationItem._csl && citationItem._csl[variables[j]]) { 
    763826                                                // override if requested 
    764827                                                var text = citationItem._csl[variables[j]]; 
     
    804867                                for(var j=0; j<variables.length; j++) { 
    805868                                        if(ignore[0][variables[j]]) continue; 
    806869                                         
    807                                         var text = item.getNumericVariable(variables[j], form); 
     870                                        /* 
     871                                         * fbennett: 9 
     872                                         *   1 line 
     873                                         */ 
     874                                        var text = item.getNumericVariable(variables[j], citationItem, form, this.daySuffixes); 
    808875                                        if(text) { 
    809876                                                newString.append(text); 
    810877                                                success = true; 
     
    920987                        for(var j=0; j<variables.length; j++) { 
    921988                                if(ignore[0][variables[j]]) continue; 
    922989                                 
    923                                 var date = item.getDate(variables[j]); 
     990                                /* 
     991                                 * fbennett: 3 
     992                                 *   1 line 
     993                                 */ 
     994                                var date = item.getDate(variables[j], citationItem); 
    924995                                if(!date) continue; 
    925996                                 
    926997                                var variableString = formattedString.clone(); 
     
    10371108                                         
    10381109                                        // inspect variables 
    10391110                                        var done = false; 
    1040                                         var attributes = ["variable", "is-date", "is-numeric", "is-plural", "type", "disambiguate", "locator", "position"]; 
     1111                                        var attributes = ["variable", "is-date", "is-numeric", "is-plural", "type", "disambiguate", "locator", "context", "position"]; 
    10411112                                        for(var k=0; !done && k<attributes.length; k++) { 
    1042                                                 var attribute = attributes[k]; 
     1113                                                var attribute = attributes[k]; 
    10431114                                                 
    10441115                                                if(newChild["@"+attribute].length()) { 
    10451116                                                        var variables = newChild["@"+attribute].toString().split(" "); 
     1117 
    10461118                                                        for(var j=0; !done && j<variables.length; j++) { 
    10471119                                                                var exists = false; 
    10481120                                                                if(attribute == "variable") { 
    1049                                                                         if(variables[j] == "locator") { 
     1121                                                                        if(variables[j] == "locator") { 
    10501122                                                                                // special case for locator 
    10511123                                                                                exists = citationItem && citationItem.locator && citationItem.locator.length > 0 
    10521124                                                                        } 
    10531125                                                                        else if(Zotero.CSL._dateVariables[variables[j]]) { 
    10541126                                                                                // getDate not false/undefined 
    1055                                                                                 exists = !!item.getDate(variables[j]); 
     1127                                                                            /* 
     1128                                                                             * fbennett: 3 
     1129                                                                             *   1 line 
     1130                                                                             */ 
     1131                                                                            exists = !!item.getDate(variables[j], citationItem); 
    10561132                                                                        } else if(Zotero.CSL._namesVariables[variables[j]]) { 
    10571133                                                                                // getNames not false/undefined, not empty 
    10581134                                                                                exists = item.getNames(variables[j]); 
     
    10621138                                                                                if (exists) exists = !!exists.length; 
    10631139                                                                        } 
    10641140                                                                } else if (attribute == "is-numeric") { 
    1065                                                                         exists = item.getNumericVariable(variables[j]); 
     1141                                                                    /* 
     1142                                                                     * fbennett: 9 
     1143                                                                     *   3 lines 
     1144                                                                     */ 
     1145                                                                    exists = item.getNumericVariable(variables[j], citationItem); 
    10661146                                                                } else if (attribute == "is-date") { // XXX - this needs improving 
    10671147                                                                        if (Zotero.CSL._dateVariables[variables[j]]) { 
    1068                                                                                 exists = !!item.getDate(variables[j]); 
     1148                                                                            exists = !!item.getDate(variables[j], citationItem); 
    10691149                                                                        } 
    10701150                                                                } else if(attribute == "is-plural") { 
    10711151                                                                        if(Zotero.CSL._namesVariables[variables[j]]) { 
     
    10851165                                                                        exists = (variables[j] == "true" && item.getProperty("disambiguate-condition")) 
    10861166                                                                                || (variables[j] == "false" && !item.getProperty("disambiguate-condition")); 
    10871167                                                                } else if(attribute == "locator") { 
    1088                                                                         exists = citationItem && citationItem.locator && 
    1089                                                                                 (citationItem.locatorType == variables[j] 
    1090                                                                                 || (!citationItem.locatorType && variables[j] == "page")); 
     1168 
     1169                                                                    exists = citationItem && citationItem.locator && 
     1170                                                                        (citationItem.locatorType == variables[j] 
     1171                                                                         || (!citationItem.locatorType && variables[j] == "page")); 
     1172 
     1173                                                                } else if (attribute == "context") { 
     1174 
     1175                                                                    if (variables[j] == "same-note") { 
     1176                                                                        exists = citationItem && citationItem.sameNote; 
     1177                                                                    } else if(variables[j] == "prefix-punctuation") { 
     1178                                                                        exists = citationItem && citationItem.prefixPunctuation; 
     1179                                                                    } 
    10911180                                                                } else {        // attribute == "position" 
     1181 
    10921182                                                                        if(variables[j] == "first") { 
    10931183                                                                                exists = !citationItem 
    10941184                                                                                        || !citationItem.position 
    10951185                                                                                        || citationItem.position == Zotero.CSL.POSITION_FIRST; 
    10961186                                                                        } else if(variables[j] == "subsequent") { 
    10971187                                                                                exists = citationItem && citationItem.position >= Zotero.CSL.POSITION_SUBSEQUENT; 
     1188                                                                                /* 
     1189                                                                                 * fbennett: 4 
     1190                                                                                 *   10 lines 
     1191                                                                                 */ 
    10981192                                                                        } else if(variables[j] == "ibid") { 
    10991193                                                                                exists = citationItem && citationItem.position >= Zotero.CSL.POSITION_IBID; 
    11001194                                                                        } else if(variables[j] == "ibid-with-locator") { 
    1101                                                                                 exists = citationItem && citationItem.position == Zotero.CSL.POSITION_IBID_WITH_LOCATOR; 
     1195                                                                                exists = citationItem && citationItem.position >= Zotero.CSL.POSITION_IBID_WITH_LOCATOR; 
    11021196                                                                        } 
    11031197                                                                } 
    11041198                                                                 
     
    17211815 * Mappings for names 
    17221816 */ 
    17231817Zotero.CSL.Item._zoteroNameMap = { 
    1724         "collection-editor":"seriesEditor" 
     1818    /* 
     1819     * fbennett: 6 
     1820     *   2 lines 
     1821     */ 
     1822    "collection-editor":"seriesEditor", 
     1823    "container-author":"containerAuthor" 
    17251824} 
    17261825 
    17271826/* 
     
    17441843/* 
    17451844 * Gets an Item.Date object for a specific type. 
    17461845 */ 
    1747 Zotero.CSL.Item.prototype.getDate = function(variable) { 
     1846/* 
     1847 * fbennett: 3 
     1848 *   8 lines 
     1849 */ 
     1850Zotero.CSL.Item.prototype.getDate = function(variable, citationItem) { 
    17481851        // ignore accessed date 
    17491852        if(this._ignoreURL && variable == "accessed") return false; 
    17501853         
    17511854        // load date variable if possible 
    17521855        this._refreshItem(); 
    1753         if(this._dates[variable] == undefined) { 
    1754                 this._createDate(variable); 
     1856        if(this._dates[variable] == undefined || citationItem) { 
     1857                this._createDate(variable, citationItem); 
    17551858        } 
    17561859         
    17571860        if(this._dates[variable]) return this._dates[variable]; 
     
    17611864Zotero.CSL.Item._zoteroFieldMap = { 
    17621865        "long":{ 
    17631866                "title":"title", 
    1764                 "container-title":["publicationTitle",  "reporter", "code"], /* reporter and code should move to SQL mapping tables */ 
     1867                /* 
     1868                 * fbennett: 11 
     1869                 *   1 line 
     1870                 */ 
     1871                "container-title":["publicationTitle", "journalAbbreviation", "reporter", "code"], /* reporter and code should move to SQL mapping tables */ 
    17651872                "collection-title":["seriesTitle", "series"], 
    17661873                "collection-number":"seriesNumber", 
    17671874                "publisher":["publisher", "distributor"], /* distributor should move to SQL mapping tables */ 
     
    17861893                "call-number":"callNumber", 
    17871894                "note":"extra", 
    17881895                "number":"number", 
    1789                 "references":"history" 
     1896                /* 
     1897                 * fbennett: 8 
     1898                 *   3 lines 
     1899                 */ 
     1900                "references":"history", 
     1901                "issued":"date", 
     1902                "accessed":"accessDate" 
    17901903        }, 
    17911904        "short":{ 
    17921905                "title":["shortTitle", "title"], 
     
    18401953/* 
    18411954 * convert a number into a ordinal number 1st, 2nd, 3rd etc. 
    18421955 */ 
    1843 Zotero.CSL.Item.prototype.makeOrdinal = function(value) { 
     1956/* 
     1957 * fbennett: 5 
     1958 *   3 lines 
     1959 */ 
     1960Zotero.CSL.Item.prototype.makeOrdinal = function(value, daySuffixes) { 
    18441961        var ind = parseInt(value); 
    1845         var daySuffixes = Zotero.getString("date.daySuffixes").replace(/, ?/g, "|").split("|"); 
    18461962        value += (parseInt(ind/10)%10) == 1 ? daySuffixes[3] : (ind % 10 == 1) ? daySuffixes[0] : (ind % 10 == 2) ? daySuffixes[1] : (ind % 10 == 3) ? daySuffixes[2] : daySuffixes[3]; 
    18471963        return value; 
    18481964} 
     
    18892005        "issue":"issue", 
    18902006        "number-of-volumes":"numberOfVolumes", 
    18912007        "edition":"edition", 
    1892         "number":"number" 
     2008        /* 
     2009         * fbennett: 5, 9  
     2010         *   17 lines  
     2011         *   (including the change to the function interface, which applies to 5) 
     2012         */  
     2013        "number":"number", 
     2014        "note":"extra", 
     2015        "title":"title", 
     2016        "container-title":"publicationTitle", 
     2017        "issued":"date", 
     2018        "page":"pages", 
     2019        "locator":"locator", 
     2020        "collection-number":"seriesNumber" 
    18932021} 
    18942022/* 
    18952023 * Gets a numeric object for a specific type. <number variable="edition" form="roman"/> 
    18962024 */ 
    1897 Zotero.CSL.Item.prototype.getNumericVariable = function(variable, form) { 
     2025// fbennett: add citationItem argument to function, to gain access to 
     2026// locator field 
     2027Zotero.CSL.Item.prototype.getNumericVariable = function(variable, citationItem, form, daySuffixes) { 
    18982028 
    18992029        if(!Zotero.CSL.Item._zoteroNumberFieldMap[variable]) return ""; 
    19002030         
     
    19102040         
    19112041        var matches; 
    19122042        for each(var zoteroField in zoteroFields) { 
    1913                 var value = this.zoteroItem.getField(zoteroField, false, true).toString(); 
    1914                  
     2043                /* 
     2044                 * fbennett: 3, 9 
     2045                 *   13 lines 
     2046                 */ 
     2047 
     2048                if(zoteroField == "locator") { 
     2049                    var value = citationItem.locator.toString(); 
     2050                } else if ( zoteroField == "volume" && citationItem && citationItem.volume) {  
     2051                // fbennett: special handling for volume field 
     2052                    var value = citationItem.volume; 
     2053                } else if(zoteroField == "edition" && citationItem && citationItem.edition) { 
     2054                // fbennett: edition too 
     2055                    var value = citationItem.edition; 
     2056                } else { 
     2057                    var value = this.zoteroItem.getField(zoteroField, false, true).toString(); 
     2058                } 
     2059 
    19152060                // Quoted strings are never numeric 
    19162061                if(value.match(Zotero.CSL._quotedRegexp)) { 
    19172062                        continue; 
     
    19212066                if(value != "" && (matches = value.match(Zotero.CSL._numberRegexp)) ) { 
    19222067                        value = matches[0]; 
    19232068                        if (form == "ordinal") { 
    1924                                 return this.makeOrdinal(value); 
     2069                            /* 
     2070                             * fbennett: 5 
     2071                             *   1 line 
     2072                             */ 
     2073                            return this.makeOrdinal(value, daySuffixes); 
    19252074                        } 
    19262075                        else if (form == "roman") {  
    19272076                                return this.makeRoman(value); 
     
    19512100        journalArticle:"article-journal", 
    19522101        magazineArticle:"article-magazine", 
    19532102        newspaperArticle:"article-newspaper", 
     2103        /* 
     2104         * fbennett: 10 
     2105         *   1 line 
     2106         */ 
     2107        dictionaryEntry:"entry-dictionary", 
    19542108        thesis:"thesis", 
    19552109        conferencePaper:"paper-conference", 
    19562110        letter:"personal_communication", 
     
    20572211 * Generates an date object for a given variable (currently supported: issued 
    20582212 * and accessed) 
    20592213 */ 
    2060 Zotero.CSL.Item.prototype._createDate = function(variable) { 
     2214/* 
     2215 * fbennett: 3 
     2216 *   9 lines 
     2217 */ 
     2218Zotero.CSL.Item.prototype._createDate = function(variable, citationItem) { 
    20612219        // first, figure out what date variable to use. 
    20622220        if(variable == "issued") { 
     2221            if (citationItem && citationItem.issued) { 
     2222                var date = citationItem.issued 
     2223            } else { 
    20632224                var date = this.zoteroItem.getField("date", false, true); 
    2064                 var sort = this.zoteroItem.getField("date", true, true); 
     2225            } 
     2226            var sort = this.zoteroItem.getField("date", true, true); 
    20652227        } else if(variable == "accessed") { 
    20662228                var date = this.zoteroItem.getField("accessDate", false, true); 
    20672229                var sort = this.zoteroItem.getField("accessDate", true, true); 
     
    25602722        this.closePunctuation = ""; 
    25612723        this.closeFormatting = ""; 
    25622724        this.useBritishStyleQuotes = false; 
     2725        /* 
     2726         * fbennett: 7 
     2727         *   2 lines 
     2728         */ 
     2729        this.hasPrefix = false; 
     2730        this.hasSuffixPunctuation = false; 
    25632731         
    25642732        // insert tab iff second-field-align is on 
    25652733        this.insertTabAfterField = (!subsequent && this.option.(@name == "second-field-align").@value.toString()); 
     
    26032771                        suffix = element.@suffix.toString(); 
    26042772                        element.@suffix = []; 
    26052773                } 
    2606                 haveAppended = this.append(formattedString.string, element, false, true); 
     2774                /* 
     2775                /* 
     2776                 * fbennett: 7 
     2777                 *   4 lines 
     2778                 */ 
     2779                if (formattedString.hasPrefix || this.hasSuffixPunctuation) { 
     2780                    doNotDelimit = true; 
     2781                } else { 
     2782                    doNotDelimit = false; 
     2783                } 
     2784                haveAppended = this.append(formattedString.string, element, doNotDelimit, true); 
    26072785        } 
    26082786         
    26092787        // if there's close punctuation to append, that also counts 
  • chrome/content/zotero/xpcom/integration.js

    Only in zotero-trunk/chrome/content/zotero/xpcom: csl.js.orig
    diff -r -u zotero-trunk.orig/chrome/content/zotero/xpcom/integration.js zotero-trunk/chrome/content/zotero/xpcom/integration.js
    old new  
    11971197 * sets position attribute on a citation 
    11981198 */ 
    11991199Zotero.Integration.Session.prototype.getCitationPositions = function(citation, update) { 
    1200         for(var previousIndex = citation.properties.index-1; 
    1201                 previousIndex != -1 
    1202                         && (!this.citationsByIndex[previousIndex] 
    1203                         || this.citationsByIndex[previousIndex].properties["delete"]);  
    1204                 previousIndex--) {} 
    1205         var previousCitation = (previousIndex == -1 ? false : this.citationsByIndex[previousIndex]); 
    1206          
    1207         // if only one source, and it's the same as the last, use ibid 
    1208         if(             // there must be a previous citation with one item, and this citation 
    1209                         // may only have one item 
    1210                         previousCitation && citation.citationItems.length == 1 
    1211                         && previousCitation.citationItems.length == 1 
    1212                         // the previous citation must have been a citation of the same item 
    1213                         && citation.citationItems[0].item == previousCitation.citationItems[0].item 
    1214                         // and if the previous citation had a locator (page number, etc.)  
    1215                         // then this citation must have a locator, or else we should do the  
    1216                         // full citation (see Chicago Manual of Style) 
    1217                         && (!previousCitation.citationItems[0].locator || citation.citationItems[0].locator)) { 
    1218                 // use ibid, but check whether to use ibid+pages 
    1219                 var newPosition = (citation.citationItems[0].locator == previousCitation.citationItems[0].locator 
    1220                         && citation.citationItems[0].locatorType == previousCitation.citationItems[0].locatorType 
    1221                         ? Zotero.CSL.POSITION_IBID : Zotero.CSL.POSITION_IBID_WITH_LOCATOR); 
    1222                 // update if desired 
    1223                 if(update && (citation.citationItems[0].position || newPosition) && citation.citationItems[0].position != newPosition) { 
    1224                         this.updateIndices[citation.properties.index] = true; 
    1225                 } 
    1226                 citation.citationItems[0].position = newPosition; 
     1200    /* 
     1201     * fbennett: 4 
     1202     *   133 lines 
     1203     */ 
     1204    for(var previousIndex = citation.properties.index-1; 
     1205        previousIndex != -1 
     1206            && (!this.citationsByIndex[previousIndex] 
     1207                || this.citationsByIndex[previousIndex].properties.delete);  
     1208        previousIndex--) {} 
     1209    var previousCitation = (previousIndex == -1 ? false : this.citationsByIndex[previousIndex]); 
     1210    // if one source is the same as the last, use ibid 
     1211    // 
     1212    // Case 1: source in previous citation 
     1213    // (1) Threshold conditions 
     1214    //     (a) there must be a previous citation with one item 
     1215    //     (b) this item must be the first in this citation 
     1216    //     (c) the previous citation must contain a reference to the same item ... 
     1217    // Case 2: immediately preceding source in this citation 
     1218    // (1) Threshold conditions 
     1219    //     (a) there must be an imediately preceding reference to  the 
     1220    //         same item in this citation 
     1221    // Evaluation 
     1222    //     (a) if the previous citation had no locator and this citation 
     1223    //         has one, use ibid+pages 
     1224    //     (b) if the previous citation had no locator and this citation 
     1225    //         also has none, use ibid 
     1226    //     (c) if the previous citation had a locator (page number, etc.)  
     1227    //         and this citation has a locator that is identical, use ibid 
     1228    //     (d) if the previous citation had a locator, and this citation 
     1229    //         has one that differs, use ibid+pages 
     1230    //     (e) if the previous citation had a locator and this citation 
     1231    //         has none, use subsequent 
     1232    //     (f) if the current and previous citations are not the same, 
     1233    //         set as FIRST or SUBSEQUENT, as appropriate. 
     1234    // 
     1235    // For Case 1 
     1236    var curr = citation.citationItems[0]; 
     1237    if(          
     1238       previousCitation  
     1239       && previousCitation.citationItems.length == 1 
     1240       && citation.citationItems[0].item == previousCitation.citationItems[0].item ) { 
     1241        var prev = previousCitation.citationItems[0]; 
     1242        var newPosition = this.compareCitePosition(prev, curr, false); 
     1243    } else { 
     1244        var newPosition = this.checkCitePosition(curr, citation, false); 
     1245    } 
     1246    this.updateCitePosition (curr, newPosition, citation, update); 
     1247    citation.citationItems[0].position = newPosition; 
     1248    this.checkCiteContext (citation.citationItems[0], newPosition); 
     1249    // 
     1250    // For Case 2 and non-matching cases 
     1251    for (var i = 1; i < citation.citationItems.length; i++) { 
     1252        var prev = citation.citationItems[i-1]; 
     1253        var curr = citation.citationItems[i]; 
     1254        if (prev.item == curr.item) { 
     1255            var newPosition = this.compareCitePosition(prev, curr, true); 
    12271256        } else { 
    1228                 // loop through to see which are first citations 
    1229                 for(var i=0; i<citation.citationItems.length; i++) { 
    1230                         var citationItem = citation.citationItems[i]; 
    1231                         var newPosition = (!this.citationsByItemID[citationItem.itemID] 
    1232                                         || this.citationsByItemID[citationItem.itemID][0].properties.index >= citation.properties.index 
    1233                                 ? Zotero.CSL.POSITION_FIRST : Zotero.CSL.POSITION_SUBSEQUENT); 
    1234                          
    1235                         // update if desired 
    1236                         if(update && (citation.citationItems[i].position || newPosition) && citation.citationItems[i].position != newPosition) { 
    1237                                 this.updateIndices[citation.properties.index] = true; 
    1238                         } 
    1239                         citation.citationItems[i].position = newPosition; 
    1240                 } 
     1257            var newPosition = this.checkCitePosition(curr, citation, true); 
     1258        } 
     1259        this.updateCitePosition (curr, newPosition, citation, update); 
     1260        citation.citationItems[i].position = newPosition; 
     1261        this.checkCiteContext (citation.citationItems[i], newPosition); 
     1262    } 
     1263} 
     1264 
     1265/* 
     1266 * evaluates position of qualifying cites 
     1267 */ 
     1268 
     1269Zotero.Integration.Session.prototype.compareCitePosition = function(prev, curr, samenote) { 
     1270 
     1271    var newPosition; 
     1272    if (!prev.locator) { 
     1273        if (curr.locator) { 
     1274            newPosition = Zotero.CSL.POSITION_IBID_WITH_LOCATOR; 
     1275        } else { 
     1276            newPosition = Zotero.CSL.POSITION_IBID; 
     1277        } 
     1278    } else { 
     1279        if (prev.locator == curr.locator) { 
     1280            newPosition = Zotero.CSL.POSITION_IBID; 
     1281        } else if (curr.locator) { 
     1282            newPosition = Zotero.CSL.POSITION_IBID_WITH_LOCATOR; 
     1283        } else { 
     1284            newPosition = Zotero.CSL.POSITION_SUBSEQUENT; 
    12411285        } 
     1286    } 
     1287    return newPosition; 
     1288} 
     1289 
     1290/* 
     1291 * checks if cite is in the same note and whether it has a prefix with terminal punctuation 
     1292 */ 
     1293Zotero.Integration.Session.prototype.checkCiteContext = function(citationItem, newPosition) { 
     1294 
     1295    if (newPosition ==  Zotero.CSL.POSITION_FIRST) { 
     1296        citationItem.sameNote = true; 
     1297    } else { 
     1298        citationItem.sameNote = false; 
     1299    } 
     1300 
     1301    if (citationItem.prefix && citationItem.prefix.match(/.*[:;.]\s*$/)) { 
     1302        citationItem.prefixPunctuation = true; 
     1303    } else { 
     1304        citationItem.prefixPunctuation = false; 
     1305    } 
     1306} 
     1307     
     1308/* 
     1309 * checks whether a cite is a first or subsequent reference 
     1310 */     
     1311Zotero.Integration.Session.prototype.checkCitePosition = function(curr, citation, samenote) { 
     1312 
     1313    var newPosition; 
     1314    if (!this.citationsByItemID[curr.itemID]) { 
     1315        newPosition = Zotero.CSL.POSITION_FIRST; 
     1316    } else if (this.citationsByItemID[curr.itemID][0].properties.index >= citation.properties.index) { 
     1317        newPosition = Zotero.CSL.POSITION_FIRST; 
     1318    } else { 
     1319        newPosition = Zotero.CSL.POSITION_SUBSEQUENT; 
     1320    } 
     1321    return newPosition; 
     1322} 
     1323 
     1324         
     1325/* 
     1326 * updates indexes 
     1327 * 
     1328 */ 
     1329Zotero.Integration.Session.prototype.updateCitePosition = function (curr, newPosition, citation, update) { 
     1330    if(update && (curr.position || newPosition) && curr.position != newPosition) { 
     1331        this.updateIndices[citation.properties.index] = true; 
     1332    } 
    12421333} 
    12431334 
    12441335/* 
  • chrome/locale/en-US/zotero/zotero.dtd

    Only in zotero-trunk/chrome/content/zotero/xpcom: integration.js.orig
    Only in zotero-trunk/chrome/content/zotero/xpcom: integration.js.rej
    diff -r -u zotero-trunk.orig/chrome/locale/en-US/zotero/zotero.dtd zotero-trunk/chrome/locale/en-US/zotero/zotero.dtd
    old new  
    132132<!ENTITY zotero.citation.suppressAuthor.label                   "Suppress Author"> 
    133133<!ENTITY zotero.citation.prefix.label                                   "Prefix:"> 
    134134<!ENTITY zotero.citation.suffix.label                                   "Suffix:"> 
     135<!ENTITY zotero.citation.volume.label                                   "Volume:"> 
    135136 
    136137<!ENTITY zotero.richText.italic.label                                   "Italic"> 
    137138<!ENTITY zotero.richText.bold.label                                             "Bold"> 
  • chrome/locale/en-US/zotero/zotero.properties

    diff -r -u zotero-trunk.orig/chrome/locale/en-US/zotero/zotero.properties zotero-trunk/chrome/locale/en-US/zotero/zotero.properties
    old new  
    321321creatorTypes.presenter                  = Presenter 
    322322creatorTypes.guest                              = Guest 
    323323creatorTypes.podcaster                  = Podcaster 
     324creatorTypes.containerAuthor            = Sponsor 
    324325 
    325326fileTypes.webpage                               = Web Page 
    326327fileTypes.image                                 = Image 
  • chrome/skin/default/zotero/overlay.css

    Only in zotero-trunk/chrome/locale/en-US/zotero: zotero.properties.orig
    diff -r -u zotero-trunk.orig/chrome/skin/default/zotero/overlay.css zotero-trunk/chrome/skin/default/zotero/overlay.css
    old new  
    11#zotero-status-bar-icon 
    22{ 
    3         width: 55px; 
     3        width: 74px; 
    44        margin: 0 0 -1px; /* For Fitts's law (on OS X, at least) */ 
    55        padding: 0 0 1px; 
    6         list-style-image: url(chrome://zotero/skin/zotero_status_bar.png); 
     6        list-style-image: url(chrome://zotero/skin/zotero_status_bar_lex.png); 
    77} 
    88#zotero-status-bar-icon[compact="true"] 
    99{ 
  • chrome/skin/default/zotero/preferences.css

    diff -r -u zotero-trunk.orig/chrome/skin/default/zotero/preferences.css zotero-trunk/chrome/skin/default/zotero/preferences.css
    old new  
    6060 
    6161#fontSize radio, #statusBarIcon radio 
    6262{ 
    63         width: 90px; 
     63        width: 114px; 
    6464} 
    6565 
    6666#fontSize radio .radio-icon, #statusBarIcon radio .radio-icon 
  • zotero-trunk

    Only in zotero-trunk/chrome/skin/default/zotero: preferences.css.orig
    Binary files zotero-trunk.orig/chrome/zotero.jar and zotero-trunk/chrome/zotero.jar differ
    diff -r -u zotero-trunk.orig/system.sql zotero-trunk/system.sql
    old new  
    361361INSERT INTO itemTypeFields VALUES (6, 90, NULL, 2); 
    362362INSERT INTO itemTypeFields VALUES (6, 12, NULL, 3); 
    363363INSERT INTO itemTypeFields VALUES (6, 6, NULL, 4); 
    364 INSERT INTO itemTypeFields VALUES (6, 14, NULL, 5); 
    365 INSERT INTO itemTypeFields VALUES (6, 15, NULL, 6); 
    366 INSERT INTO itemTypeFields VALUES (6, 10, NULL, 7); 
    367 INSERT INTO itemTypeFields VALUES (6, 87, NULL, 8); 
    368 INSERT INTO itemTypeFields VALUES (6, 116, NULL, 9); 
    369 INSERT INTO itemTypeFields VALUES (6, 13, NULL, 10); 
    370 INSERT INTO itemTypeFields VALUES (6, 1, NULL, 11); 
    371 INSERT INTO itemTypeFields VALUES (6, 27, NULL, 12); 
    372 INSERT INTO itemTypeFields VALUES (6, 18, NULL, 13); 
    373 INSERT INTO itemTypeFields VALUES (6, 19, NULL, 14); 
    374 INSERT INTO itemTypeFields VALUES (6, 62, NULL, 15); 
    375 INSERT INTO itemTypeFields VALUES (6, 2, NULL, 16); 
    376 INSERT INTO itemTypeFields VALUES (6, 22, NULL, 17); 
     364-- fbennett: 12 
     365--   14 lines 
     366INSERT INTO itemTypeFields VALUES (6, 7, NULL, 5); 
     367INSERT INTO itemTypeFields VALUES (6, 14, NULL, 6); 
     368INSERT INTO itemTypeFields VALUES (6, 15, NULL, 7); 
     369INSERT INTO itemTypeFields VALUES (6, 10, NULL, 8); 
     370INSERT INTO itemTypeFields VALUES (6, 87, NULL, 9); 
     371INSERT INTO itemTypeFields VALUES (6, 116, NULL, 10); 
     372INSERT INTO itemTypeFields VALUES (6, 13, NULL, 11); 
     373INSERT INTO itemTypeFields VALUES (6, 1, NULL, 12); 
     374INSERT INTO itemTypeFields VALUES (6, 27, NULL, 13); 
     375INSERT INTO itemTypeFields VALUES (6, 18, NULL, 14); 
     376INSERT INTO itemTypeFields VALUES (6, 19, NULL, 15); 
     377INSERT INTO itemTypeFields VALUES (6, 62, NULL, 16); 
     378INSERT INTO itemTypeFields VALUES (6, 2, NULL, 17); 
     379INSERT INTO itemTypeFields VALUES (6, 22, NULL, 18); 
    377380INSERT INTO itemTypeFields VALUES (7, 110, NULL, 1); 
    378381INSERT INTO itemTypeFields VALUES (7, 90, NULL, 2); 
    379382INSERT INTO itemTypeFields VALUES (7, 69, NULL, 3); 
     
    907910INSERT INTO creatorTypes VALUES(25, "guest"); 
    908911INSERT INTO creatorTypes VALUES(26, "podcaster"); 
    909912INSERT INTO creatorTypes VALUES(27, "reviewedAuthor"); 
     913-- fbennett: 6 
     914--   20 lines 
     915INSERT INTO creatorTypes VALUES(28, "containerAuthor"); 
    910916 
    911917INSERT INTO itemTypeCreatorTypes VALUES(2,1,1); 
    912918INSERT INTO itemTypeCreatorTypes VALUES(2,2,0); 
    913919INSERT INTO itemTypeCreatorTypes VALUES(2,3,0); 
    914920INSERT INTO itemTypeCreatorTypes VALUES(2,4,0); 
    915921INSERT INTO itemTypeCreatorTypes VALUES(2,5,0); 
     922INSERT INTO itemTypeCreatorTypes VALUES(2,28,0); 
    916923INSERT INTO itemTypeCreatorTypes VALUES(3,1,1); 
    917924INSERT INTO itemTypeCreatorTypes VALUES(3,2,0); 
    918925INSERT INTO itemTypeCreatorTypes VALUES(3,3,0); 
    919926INSERT INTO itemTypeCreatorTypes VALUES(3,4,0); 
    920927INSERT INTO itemTypeCreatorTypes VALUES(3,5,0); 
     928INSERT INTO itemTypeCreatorTypes VALUES(3,28,0); 
    921929INSERT INTO itemTypeCreatorTypes VALUES(4,1,1); 
    922930INSERT INTO itemTypeCreatorTypes VALUES(4,2,0); 
    923931INSERT INTO itemTypeCreatorTypes VALUES(4,3,0);