Skip to content

Commit

Permalink
Merge branch 'jurism-5.0-dev' into jurism-5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Jun 26, 2017
2 parents 5ec969c + abb3983 commit f21f89e
Show file tree
Hide file tree
Showing 150 changed files with 6,444 additions and 13,190 deletions.
46 changes: 46 additions & 0 deletions .babelrc
@@ -0,0 +1,46 @@
{
"compact": false,
"retainLines": true,
"presets": [],
"ignore": [
"resource/require.js",
"chrome/content/zotero/include.js",
"resource/tinymce/tinymce.js",
"chrome/content/zotero/xpcom/citeproc.js",
"resource/csl-validator.js",
"resource/react.js",
"resource/react-dom.js",
"resource/bluebird.js",
"resource/bluebird/*.js",
"test/resource/httpd.js",
"test/resource/mocha.js",
"test/resource/co-mocha.js"
],
"plugins": [
"syntax-flow",
"syntax-jsx",
"syntax-async-generators",
"syntax-class-properties",
"syntax-decorators",
"syntax-do-expressions",
"syntax-export-extensions",
"syntax-flow",
"syntax-jsx",
"syntax-object-rest-spread",
"transform-react-jsx",
"transform-react-display-name",
[
"transform-async-to-module-method",
{
"module": "resource://zotero/bluebird.js",
"method": "coroutine"
}
],
[
"transform-es2015-modules-commonjs",
{
"strictMode": false
}
]
]
}
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.DS_Store
node_modules
build
6 changes: 0 additions & 6 deletions .gitmodules
Expand Up @@ -4,12 +4,6 @@
[submodule "styles"]
path = styles
url = https://github.com/Juris-M/jm-styles.git
[submodule "test/resource/chai"]
path = test/resource/chai
url = https://github.com/chaijs/chai.git
[submodule "test/resource/mocha"]
path = test/resource/mocha
url = https://github.com/mochajs/mocha.git
[submodule "csl-locale-submodule"]
path = chrome/content/zotero/locale/csl
url = https://github.com/citation-style-language/locales.git
Expand Down
42 changes: 34 additions & 8 deletions .travis.yml
@@ -1,10 +1,16 @@
sudo: false
language: cpp
compiler:
- gcc
language: node_js
node_js:
- "node"
cache:
directories:
- "node_modules"
env:
- FX_VERSION="50.1.0"
- FX_VERSION="45.0.2esr"
global:
secure: "NxvkbZ7/Op7BTGQRR3C4q8lLoO29f8WtyNN27NSH7AO3H0vBr1Vp5xO8gn+H2qHEug5HvM+YrZ/xAkNXaZVbOInmBmKVMxqVvdpKp9JM1Amf+gzsXWQphfySvs6iqzyP6cwU/jspdvX/WSakgU5v7PWXxtUIaKxdANt6Rw7W+Pc="
matrix:
- FX_VERSION="54.0b"
- FX_VERSION="45.0.2esr"
matrix:
fast_finish: true
#allow_failures:
Expand All @@ -15,12 +21,32 @@ install:
- if [ $FX_VERSION = "45.0.2esr" ]; then
wget -O tarball "https://archive.mozilla.org/pub/firefox/releases/45.0.2esr/linux-x86_64/en-US/firefox-45.0.2esr.tar.bz2";
fi
- if [ $FX_VERSION = "50.1.0" ]; then
wget -O tarball "http://archive.mozilla.org/pub/firefox/tinderbox-builds/mozilla-release-linux64-add-on-devel/1481240107/firefox-50.1.0.en-US.linux-x86_64-add-on-devel.tar.bz2";
- if [ $FX_VERSION = "54.0b" ]; then
wget -O tarball "https://archive.mozilla.org/pub/firefox/tinderbox-builds/mozilla-beta-linux64-add-on-devel/1496339244/firefox-54.0.en-US.linux-x86_64-add-on-devel.tar.bz2";
fi
- tar xf tarball
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i
- node_modules/.bin/gulp build
- if [ $FX_VERSION = "54.0b" ] &&
[ $TRAVIS_REPO_SLUG = "zotero/zotero" ] &&
[ $TRAVIS_BRANCH = "master" ] &&
[ $TRAVIS_PULL_REQUEST = "false" ]; then
mkdir build-zip;
cd build;
zip -r ../build-zip/$TRAVIS_COMMIT.zip *;
cd ..;
gem install dpl;
dpl --provider=s3
--access-key-id=AKIAJFDVJ54MCAEXPQ5Q
--bucket=zotero-download
--local-dir=build-zip
--upload-dir=ci/client
--acl=public-read
--skip_cleanup=true;
fi
- unset AWS_SECRET_ACCESS_KEY
script:
- test/runtests.sh -x firefox/firefox
- test/runtests.sh -x firefox/firefox -f
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -8,7 +8,7 @@ set -e
PRODUCT="Juris-M: reference manager with legal and multilingual support"
IS_BETA="false"
FORK="zotero"
BRANCH="jurism-5.0"
BRANCH="jurism-5.0-dev"
CLIENT="jurism"
VERSION_ROOT="5.0m"
SIGNED_STUB="juris_m-"
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/zotero/bindings/noteeditor.xml
Expand Up @@ -442,7 +442,7 @@
// If editable and no existing tags, open new empty row
var tagsBox = this.id('tags');
if (tagsBox.mode == 'edit' && tagsBox.count == 0) {
this.id('tags').new();
this.id('tags').newTag();
}
]]></body>
</method>
Expand Down Expand Up @@ -573,7 +573,7 @@
tagsbox and tagsLabel above, so be sure to update fixPopup() if it changes
-->
<xul:menupopup id="tagsPopup" ignorekeys="true"
onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.new(); } */ this.setAttribute('showing', 'true'); }"
onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.newTag(); } */ this.setAttribute('showing', 'true'); }"
onpopuphidden="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ this.setAttribute('showing', 'false'); }">
<xul:tagsbox id="tags" flex="1" mode="edit"/>
</xul:menupopup>
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/zotero/bindings/relatedbox.xml
Expand Up @@ -193,7 +193,7 @@
var remove = document.createElement("label");
remove.setAttribute('value','-');
remove.setAttribute('onclick',
"document.getBindingParent(this).remove('" + id + "');");
"document.getBindingParent(this).remove(" + id + ");");
remove.setAttribute('class','zotero-clicky zotero-clicky-minus');
}
Expand Down
6 changes: 3 additions & 3 deletions chrome/content/zotero/bindings/tagsbox.xml
Expand Up @@ -725,7 +725,7 @@
</method>


<method name="new">
<method name="newTag">
<body>
<![CDATA[
var rowsElement = this.id('tagRows');
Expand Down Expand Up @@ -954,7 +954,7 @@
next.click();
}
else {
next = this.new();
next = this.newTag();
next = next.firstChild.nextSibling;
}
Expand Down Expand Up @@ -1056,7 +1056,7 @@
<xul:label id="tagsNum"/>
<xul:button id="addButton" label="&zotero.item.add;"
onkeypress="return document.getBindingParent(this)._onAddButtonKeypress(event)"
oncommand="document.getBindingParent(this).new();"/>
oncommand="document.getBindingParent(this).newTag();"/>
</xul:hbox>
<xul:grid>
<xul:columns>
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/zotero/bindings/tagselector.xml
Expand Up @@ -805,7 +805,7 @@
</method>


<method name="delete">
<method name="deleteTag">
<parameter name="name"/>
<body><![CDATA[
return Zotero.spawn(function* () {
Expand Down Expand Up @@ -1090,7 +1090,7 @@
<menuitem label="&zotero.tagSelector.renameTag;"
oncommand="document.getBindingParent(this).rename(_popupNode.textContent); event.stopPropagation()"/>
<menuitem label="&zotero.tagSelector.deleteTag;"
oncommand="document.getBindingParent(this).delete(_popupNode.textContent); event.stopPropagation()"/>
oncommand="document.getBindingParent(this).deleteTag(_popupNode.textContent); event.stopPropagation()"/>
</menupopup>

<deck id="tags-deck">
Expand Down
12 changes: 9 additions & 3 deletions chrome/content/zotero/icon.js
Expand Up @@ -259,10 +259,16 @@ function getTooltipText(button) {
// Use defaults if necessary
if (!text) {
// Get the stringbundle manually
Components.utils.import("resource://gre/modules/Services.jsm");
let appLocale;
if (Services.locale.getAppLocale) {
appLocale = Services.locale.getAppLocale();
}
// Fx <=53
else {
appLocale = Services.locale.getApplicationLocale();
}
let src = 'chrome://zotero/locale/zotero.properties';
let localeService = Components.classes['@mozilla.org/intl/nslocaleservice;1']
.getService(Components.interfaces.nsILocaleService);
let appLocale = localeService.getApplicationLocale();
let stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
let stringBundle = stringBundleService.createBundle(src, appLocale);
Expand Down
7 changes: 6 additions & 1 deletion chrome/content/zotero/include.js
@@ -1,5 +1,10 @@
var Zotero = Components.classes["@zotero.org/Zotero;1"]
/* global Components:false */
/* eslint-disable no-unused-vars */

var Zotero = Components.classes['@zotero.org/Zotero;1']
// Currently uses only nsISupports
//.getService(Components.interfaces.chnmIZoteroService).
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;

Components.utils.import('resource://zotero/require.js');
4 changes: 2 additions & 2 deletions chrome/content/zotero/note.js
Expand Up @@ -37,8 +37,8 @@ function onLoad() {
if (window.arguments) {
var io = window.arguments[0];
}
var itemID = io.itemID;
var collectionID = io.collectionID;
var itemID = parseInt(io.itemID);
var collectionID = parseInt(io.collectionID);
var parentItemKey = io.parentItemKey;

return Zotero.spawn(function* () {
Expand Down
3 changes: 3 additions & 0 deletions chrome/content/zotero/preferences/preferences_sync.js
Expand Up @@ -333,6 +333,9 @@ Zotero_Preferences.Sync = {
addRow(Zotero.getString("pane.collections.libraryAndFeeds"), "L" + Zotero.Libraries.userLibraryID,
librariesToSkip.indexOf("L" + Zotero.Libraries.userLibraryID) == -1);

// Sort groups
var collation = Zotero.getLocaleCollation();
groups.sort((a, b) => collation.compareString(1, a.data.name, b.data.name));
// Add group rows
for (let group of groups) {
addRow(group.data.name, "G" + group.id, librariesToSkip.indexOf("G" + group.id) == -1);
Expand Down
17 changes: 11 additions & 6 deletions chrome/content/zotero/standalone/standalone.js
Expand Up @@ -156,12 +156,17 @@ const ZoteroStandalone = new function() {
* Handles help menu requests
*/
this.openHelp = function(type) {
if(type === "troubleshooting") {
ZoteroPane.loadURI("http://www.zotero.org/support/getting_help");
} else if(type === "feedback") {
ZoteroPane.loadURI("http://forums.zotero.org/categories/");
} else {
ZoteroPane.loadURI("http://www.zotero.org/support/");
switch (type) {
case "troubleshooting":
ZoteroPane.loadURI(ZOTERO_CONFIG.TROUBLESHOOTING_URL);
break;

case "feedback":
ZoteroPane.loadURI(ZOTERO_CONFIG.FEEDBACK_URL);
break;

default:
ZoteroPane.loadURI(ZOTERO_CONFIG.SUPPORT_URL);
}
}

Expand Down
33 changes: 17 additions & 16 deletions chrome/content/zotero/xpcom/collectionTreeView.js
Expand Up @@ -259,8 +259,10 @@ Zotero.CollectionTreeView.prototype.refresh = Zotero.Promise.coroutine(function*
});


/*
* Redisplay everything
/**
* Refresh tree and invalidate
*
* See note for refresh() for requirements of calling code
*/
Zotero.CollectionTreeView.prototype.reload = function()
{
Expand Down Expand Up @@ -433,13 +435,11 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
}
this._removeRow(row);
yield this._addSortedRow('collection', id);
if (!extraData[id].skipSelect) {
yield this.selectByID(currentTreeRow.id);
if (reopen) {
let newRow = this.getRowIndexByID(rowID);
if (!this.isContainerOpen(newRow)) {
yield this.toggleOpenState(newRow);
}
yield this.selectByID(currentTreeRow.id);
if (reopen) {
let newRow = this.getRowIndexByID(rowID);
if (!this.isContainerOpen(newRow)) {
yield this.toggleOpenState(newRow);
}
}
}
Expand Down Expand Up @@ -484,17 +484,18 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
break;

case 'group':
if (ids.length != 1) {
case 'feed':
if (type == 'groups' && ids.length != 1) {
Zotero.logError("WARNING: Multiple groups shouldn't currently be added "
+ "together in collectionTreeView::notify()")
}
yield this.reload();
yield this.selectByID(currentTreeRow.id);
break;

case 'feed':
yield this.reload();
yield this.selectByID("L" + id);
yield this.selectByID(
// Groups only come from sync, so they should never be auto-selected
(type != 'group' && selectRow)
? "L" + id
: currentTreeRow.id
);
break;
}
}
Expand Down
30 changes: 16 additions & 14 deletions chrome/content/zotero/xpcom/data/collection.js
Expand Up @@ -286,20 +286,22 @@ Zotero.Collection.prototype._saveData = Zotero.Promise.coroutine(function* (env)
env.parent ? env.parent : null
);

if (isNew) {
env.sqlColumns.unshift('collectionID');
env.sqlValues.unshift(collectionID ? { int: collectionID } : null);

let placeholders = env.sqlColumns.map(() => '?').join();
let sql = "INSERT INTO collections (" + env.sqlColumns.join(', ') + ") "
+ "VALUES (" + placeholders + ")";
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
else {
let sql = 'UPDATE collections SET '
+ env.sqlColumns.map(x => x + '=?').join(', ') + ' WHERE collectionID=?';
env.sqlValues.push(collectionID ? { int: collectionID } : null);
yield Zotero.DB.queryAsync(sql, env.sqlValues);
if (env.sqlColumns.length) {
if (isNew) {
env.sqlColumns.unshift('collectionID');
env.sqlValues.unshift(collectionID ? { int: collectionID } : null);

let placeholders = env.sqlColumns.map(() => '?').join();
let sql = "INSERT INTO collections (" + env.sqlColumns.join(', ') + ") "
+ "VALUES (" + placeholders + ")";
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
else {
let sql = 'UPDATE collections SET '
+ env.sqlColumns.map(x => x + '=?').join(', ') + ' WHERE collectionID=?';
env.sqlValues.push(collectionID ? { int: collectionID } : null);
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
}

if (this._changed.parentKey) {
Expand Down

0 comments on commit f21f89e

Please sign in to comment.