www

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

commit 091326b7e608fb751d2dffe4c7200266f5d90dd3
parent 9614828cecbabf6e2d2f45afc7d29ce6b378c906
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 17 Feb 2011 02:19:00 +0000

Fix "Reset Translators" and "Reset Styles" in the prefs


Diffstat:
Mchrome/content/zotero/xpcom/schema.js | 70+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js @@ -965,7 +965,75 @@ Zotero.Schema = new function(){ // Run a manual update from repository if pref set if (Zotero.Prefs.get('automaticScraperUpdates')) { - this.updateFromRepository(2, callback); + this.updateFromRepository(2, function () { + if (callback) { + callback(); + } + }); + } + + if (callback) { + callback(); + } + } + + + this.resetTranslators = function (callback, skipUpdate) { + Zotero.debug("Resetting translators"); + + var sql = "DELETE FROM version WHERE schema IN " + + "('translators', 'repository', 'lastcheck')"; + Zotero.DB.query(sql); + _dbVersions.repository = null; + _dbVersions.lastcheck = null; + + var translatorsDir = Zotero.getTranslatorsDirectory(); + translatorsDir.remove(true); + Zotero.getTranslatorsDirectory(); // recreate directory + Zotero.Translators.init(); + this.updateBundledFiles('translators'); + + // Run a manual update from repository if pref set + if (Zotero.Prefs.get('automaticScraperUpdates')) { + this.updateFromRepository(2, function () { + if (callback) { + callback(); + } + }); + } + + if (callback) { + callback(); + } + } + + + this.resetStyles = function (callback) { + Zotero.debug("Resetting translators and styles"); + + var sql = "DELETE FROM version WHERE schema IN " + + "('styles', 'repository', 'lastcheck')"; + Zotero.DB.query(sql); + _dbVersions.repository = null; + _dbVersions.lastcheck = null; + + var stylesDir = Zotero.getStylesDirectory(); + stylesDir.remove(true); + Zotero.getStylesDirectory(); // recreate directory + Zotero.Styles.init(); + this.updateBundledFiles('styles'); + + // Run a manual update from repository if pref set + if (Zotero.Prefs.get('automaticScraperUpdates')) { + this.updateFromRepository(2, function () { + if (callback) { + callback(); + } + }); + } + + if (callback) { + callback(); } }