Ticket #1278: 00-push-item-on-multiple-sources-switch.patch

File 00-push-item-on-multiple-sources-switch.patch, 2.5 KB (added by fbennett, 8 years ago)
  • chrome/content/zotero/addCitationDialog.js

    diff -r -u zotero-1.0-branch.orig/chrome/content/zotero/addCitationDialog.js zotero-1.0-branch/chrome/content/zotero/addCitationDialog.js
    old new  
    149149        function toggleMultipleSources() { 
    150150                _multipleSourcesOn = !_multipleSourcesOn; 
    151151                if(_multipleSourcesOn) { 
     152                        var items = itemsView.getSelectedItems(true); 
     153                        var itemID = (items.length ? items[0] : false); 
     154                        // var itemDataID = itemID+"::"+0; 
    152155                        document.getElementById("multiple-sources").hidden = undefined; 
    153156                        document.getElementById("zotero-add-citation-dialog").width = "750"; 
    154157                        document.getElementById("multiple-sources-button").label = Zotero.getString("citation.singleSource");                    
     158                        // move user field content to multiple before adding XXXXX 
     159                        if (itemID) { 
     160                            // _itemData[itemDataID] = new Object(); 
     161                            _itemData[itemID] = new Object(); 
     162                            for (box in _preserveData) { 
     163                                element = document.getElementById(box); 
     164                                // _itemData[itemDataID][box] = element[_preserveData[box]]; 
     165                                _itemData[itemID][box] = element[_preserveData[box]]; 
     166                            } 
     167                        } 
    155168                        window.sizeToContent(); 
    156169                        window.moveTo((window.screenX-75), window.screenY); 
    157170                        treeItemSelected(); 
    158171                        // disable adding info until citation added 
    159172                        _itemSelected(false); 
     173                        // add current selection 
     174                        if (itemID) { 
     175                            this.add(); 
     176                        } else { 
     177                            _updateAccept(); 
     178                            _updatePreview(); 
     179                        } 
    160180                } else { 
    161181                        document.getElementById("multiple-sources").hidden = true; 
    162182                        document.getElementById("zotero-add-citation-dialog").width = "600"; 
     
    174194                         
    175195                        // delete all items 
    176196                        _clearCitationList(); 
     197                        _updateAccept(); 
     198                        _updatePreview(); 
    177199                } 
    178                 _updateAccept(); 
    179                 _updatePreview(); 
    180200        } 
    181201         
    182202        /*