Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bandwagon
diff options
context:
space:
mode:
Diffstat (limited to 'bandwagon')
-rw-r--r--bandwagon/chrome.manifest13
-rw-r--r--bandwagon/components/bandwagon-service.js492
-rw-r--r--bandwagon/content/scripts/bandwagon.js31
-rw-r--r--bandwagon/content/scripts/factory/collectionFactory.js758
-rw-r--r--bandwagon/content/scripts/factory/feedFactory.js626
-rw-r--r--bandwagon/content/scripts/logger.js4
-rw-r--r--bandwagon/content/scripts/model/addon.js (renamed from bandwagon/content/scripts/model/feedItem.js)83
-rw-r--r--bandwagon/content/scripts/model/collection.js211
-rw-r--r--bandwagon/content/scripts/model/feed.js189
-rw-r--r--bandwagon/content/scripts/model/serviceDocument.js78
-rw-r--r--bandwagon/content/scripts/rpc/constants.js13
-rw-r--r--bandwagon/content/scripts/rpc/net.js13
-rw-r--r--bandwagon/content/scripts/rpc/service.js204
-rw-r--r--bandwagon/content/scripts/util.js44
-rw-r--r--bandwagon/content/ui/bindings/bandwagon.css12
-rw-r--r--bandwagon/content/ui/bindings/bandwagon.xml279
-rw-r--r--bandwagon/content/ui/collectionsPaneController.js838
-rw-r--r--bandwagon/content/ui/dialog.js4
-rw-r--r--bandwagon/content/ui/feedsPaneController.js779
-rw-r--r--bandwagon/content/ui/overlays/browserOverlay.xul22
-rw-r--r--bandwagon/content/ui/overlays/browserOverlayController.js103
-rw-r--r--bandwagon/content/ui/overlays/extensionsOverlay.xul150
-rw-r--r--bandwagon/content/ui/overlays/extensionsOverlayController.js128
-rw-r--r--bandwagon/content/ui/publish.xul19
-rw-r--r--bandwagon/content/ui/publishController.js68
-rw-r--r--bandwagon/content/ui/settings.xul296
-rw-r--r--bandwagon/content/ui/settingsController.js439
-rw-r--r--bandwagon/defaults/preferences/bandwagon.js4
-rw-r--r--bandwagon/install.rdf13
-rw-r--r--bandwagon/locale/en-US/bandwagonAddon.properties27
-rw-r--r--bandwagon/locale/en-US/bandwagonFeedItem.properties27
-rw-r--r--bandwagon/locale/en-US/browserOverlay.dtd38
-rw-r--r--bandwagon/locale/en-US/browserOverlay.properties4
-rw-r--r--bandwagon/locale/en-US/extensionOverlay.properties16
-rw-r--r--bandwagon/locale/en-US/extensionsOverlay.dtd45
-rw-r--r--bandwagon/locale/en-US/publish.dtd11
-rw-r--r--bandwagon/locale/en-US/publish.properties9
-rw-r--r--bandwagon/locale/en-US/settings.dtd68
-rw-r--r--bandwagon/locale/en-US/settings.properties15
-rw-r--r--bandwagon/skin/extensionsOverlay.css94
-rw-r--r--bandwagon/skin/global.css2
-rw-r--r--bandwagon/skin/images/Toolbar-small.pngbin37477 -> 0 bytes
-rw-r--r--bandwagon/skin/images/addon-toolbar.pngbin0 -> 8896 bytes
-rw-r--r--bandwagon/skin/images/gear.pngbin0 -> 722 bytes
-rw-r--r--bandwagon/skin/images/icon32.pngbin0 -> 1965 bytes
-rw-r--r--bandwagon/skin/images/plus.pngbin0 -> 336 bytes
-rw-r--r--bandwagon/skin/images/reload.pngbin0 -> 706 bytes
-rw-r--r--bandwagon/skin/images/star32.pngbin0 -> 1191 bytes
-rw-r--r--bandwagon/skin/images/tango-addonfeed-32x32.pngbin2585 -> 0 bytes
-rw-r--r--bandwagon/skin/images/wrench.pngbin390 -> 0 bytes
-rw-r--r--bandwagon/skin/platform/linux/browserOverlay.css56
-rw-r--r--bandwagon/skin/platform/mac/browserOverlay.css64
-rw-r--r--bandwagon/skin/platform/vista/browserOverlay.css56
-rw-r--r--bandwagon/skin/platform/xp/browserOverlay.css56
-rw-r--r--bandwagon/skin/publish.css5
-rw-r--r--bandwagon/skin/settings.css31
56 files changed, 4055 insertions, 2482 deletions
diff --git a/bandwagon/chrome.manifest b/bandwagon/chrome.manifest
index 10e58b3..99d2cf5 100644
--- a/bandwagon/chrome.manifest
+++ b/bandwagon/chrome.manifest
@@ -1,7 +1,12 @@
-content bandwagon jar:bandwagon.jar!/content/
-locale bandwagon en-US jar:bandwagon.jar!/locale/en-US/
-skin bandwagon classic/1.0 jar:bandwagon.jar!/skin/
+content bandwagon jar:bandwagon.jar!/content/
+locale bandwagon en-US jar:bandwagon.jar!/locale/en-US/
+skin bandwagon classic/1.0 jar:bandwagon.jar!/skin/
-overlay chrome://browser/content/browser.xul chrome://bandwagon/content/ui/overlays/browserOverlay.xul
+overlay chrome://browser/content/browser.xul chrome://bandwagon/content/ui/overlays/browserOverlay.xul
overlay chrome://mozapps/content/extensions/extensions.xul chrome://bandwagon/content/ui/overlays/extensionsOverlay.xul
+style chrome://global/content/customizeToolbar.xul chrome://bandwagon/skin/browserOverlay.css
+override chrome://bandwagon/skin/browserOverlay.css chrome://bandwagon/skin/platform/linux/browserOverlay.css os=Linux
+override chrome://bandwagon/skin/browserOverlay.css chrome://bandwagon/skin/platform/mac/browserOverlay.css os=Darwin
+override chrome://bandwagon/skin/browserOverlay.css chrome://bandwagon/skin/platform/xp/browserOverlay.css os=WINNT osversion<=5.1
+override chrome://bandwagon/skin/browserOverlay.css chrome://bandwagon/skin/platform/vista/browserOverlay.css os=WINNT osversion>=6
diff --git a/bandwagon/components/bandwagon-service.js b/bandwagon/components/bandwagon-service.js
index 3a773fc..7ddb6b6 100644
--- a/bandwagon/components/bandwagon-service.js
+++ b/bandwagon/components/bandwagon-service.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -48,6 +48,7 @@ const ExtensionsManager = Cc["@mozilla.org/extensions/manager;1"];
const Storage = Cc["@mozilla.org/storage/service;1"];
const DirectoryService = Cc["@mozilla.org/file/directory_service;1"];
const ObserverService = Cc["@mozilla.org/observer-service;1"];
+const CookieManager = Cc["@mozilla.org/cookiemanager;1"];
const nsIWindowMediator = Ci.nsIWindowMediator;
const nsITimer = Ci.nsITimer;
@@ -56,6 +57,7 @@ const mozIStorageService = Ci.mozIStorageService;
const nsIProperties = Ci.nsIProperties;
const nsIFile = Ci.nsIFile;
const nsIObserverService = Ci.nsIObserverService;
+const nsICookieManager = Ci.nsICookieManager;
var Bandwagon;
@@ -68,16 +70,17 @@ function BandwagonService()
BandwagonService.prototype = {
- feeds: {},
+ collections: {},
_initialized: false,
_service: null,
- _feedUpdateObservers: [],
- _feedListChangeObservers: [],
+ _collectionUpdateObservers: [],
+ _collectionListChangeObservers: [],
_storageConnection: null,
- _feedFactory: null,
- _feedUpdateTimer: null,
+ _collectionFactory: null,
+ _collectionUpdateTimer: null,
_bwObserver: null,
+ _serviceDocument: null,
init: function()
{
@@ -103,9 +106,10 @@ BandwagonService.prototype = {
this._service = new Bandwagon.RPC.Service();
this._service.registerLogger(Bandwagon.Logger);
- this._service.registerObserver(this._getFeedObserver);
+ this._service.registerObserver(this._getCollectionObserver);
+ this._service.registerObserver(this._getServiceDocumentObserver);
- this.registerFeedUpdateObserver(this._feedUpdateObserver);
+ this.registerCollectionUpdateObserver(this._collectionUpdateObserver);
// init sqlite storage (also creating tables in sqlite if needed). create factory objects.
@@ -119,15 +123,24 @@ BandwagonService.prototype = {
this.firstrun();
}
- // storage initialized, tables created - open the feeds
+ // storage initialized, tables created - open the collections
- var storageFeeds = this._feedFactory.openFeeds();
+ var storageCollections = this._collectionFactory.openCollections();
- for (var id in storageFeeds)
+ for (var id in storageCollections)
{
- this.feeds[id] = storageFeeds[id];
- this.feeds[id].setAllNotified();
- Bandwagon.Logger.debug("opened feed from storage: " + id);
+ this.collections[id] = storageCollections[id];
+ this.collections[id].setAllNotified();
+ Bandwagon.Logger.debug("opened collection from storage: " + id);
+ }
+
+ this._serviceDocument = this._collectionFactory.openServiceDocument();
+ this._service._serviceDocument = this._serviceDocument;
+
+ if (!this._serviceDocument)
+ {
+ // no service document in storage, we never had it or we've lost it - go fetch it
+ this.updateCollectionsList();
}
// start the update timer
@@ -147,10 +160,10 @@ BandwagonService.prototype = {
}
};
- this._feedUpdateTimer = Timer.createInstance(nsITimer);
- this._feedUpdateTimer.init(
+ this._collectionUpdateTimer = Timer.createInstance(nsITimer);
+ this._collectionUpdateTimer.init(
this._bwObserver,
- (Bandwagon.Preferences.getPreference("debug")?30*1000:Bandwagon.FEED_UPDATE_TIMER_DELAY*1000),
+ (Bandwagon.Preferences.getPreference("debug")?30*1000:Bandwagon.COLLECTION_UPDATE_TIMER_DELAY*1000),
nsITimer.TYPE_REPEATING_SLACK
);
@@ -169,7 +182,7 @@ BandwagonService.prototype = {
uninit: function()
{
- this._feedUpdateTimer = null;
+ this._collectionUpdateTimer = null;
this.commitAll();
},
@@ -205,14 +218,14 @@ BandwagonService.prototype = {
Bandwagon.Logger.debug("Will autopublish extension '" + willAutopublishExtensions[i].id + "'...");
// publish willAutopublishExtensions[i]
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- var feed = bandwagonService.feeds[id];
+ var collection = bandwagonService.collections[id];
- if (!feed.autoPublish)
+ if (!collection.autoPublish)
continue;
- Bandwagon.Logger.debug("...to feed '" + feed.url + "'");
+ Bandwagon.Logger.debug("...to collection '" + collection.resourceURL + "'");
var extension =
{
@@ -220,7 +233,7 @@ BandwagonService.prototype = {
name: willAutopublishExtensions[i].name
}
- bandwagonService.publishToFeed(extension, feed, "", null);
+ bandwagonService.publishToCollection(extension, collection, "", null);
}
// add to autopublish
@@ -231,13 +244,13 @@ BandwagonService.prototype = {
}
},
- _getFeedObserver: function(event)
+ _getCollectionObserver: function(event)
{
- Bandwagon.Logger.info("in _getFeedObserver()");
+ Bandwagon.Logger.info("in _getCollectionObserver()");
- if (event.getType() == Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_FEED_COMPLETE)
+ if (event.getType() == Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_COLLECTION_COMPLETE)
{
- var feed = event.feed;
+ var collection = event.collection;
if (event.isError())
{
@@ -246,84 +259,169 @@ BandwagonService.prototype = {
}
else
{
- if (feed != null && feed.url != null)
+ if (collection != null && collection.resourceURL != null)
{
- Bandwagon.Logger.info("Finished getting updates for feed '" + feed.url + "'");
- bandwagonService.feeds[feed.url] = feed;
+ Bandwagon.Logger.info("Finished getting updates for collection '" + collection.resourceURL + "'");
+ bandwagonService.collections[collection.resourceURL] = collection;
}
}
// we want to notify the observers even if there's been an error
- bandwagonService._notifyFeedUpdateObservers(feed);
+ bandwagonService._notifyCollectionUpdateObservers(collection);
}
},
- _notifyFeedUpdateObservers: function(feed)
+ _getServiceDocumentObserver: function(event)
{
- Bandwagon.Logger.debug("Notifying feed update observers");
+ Bandwagon.Logger.info("in _getServiceDocumentObserver()");
- for (var i=0; i<bandwagonService._feedUpdateObservers.length; i++)
+ if (event.getType() == Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_SERVICE_DOCUMENT_COMPLETE)
{
- if (bandwagonService._feedUpdateObservers[i])
+ if (event.isError())
{
- bandwagonService._feedUpdateObservers[i](feed);
+ Bandwagon.Logger.error("Could not update collections list: " + event.getError().toString());
+ }
+ else
+ {
+ bandwagonService._serviceDocument = event.serviceDocument;
+ bandwagonService._service._serviceDocument = bandwagonService._serviceDocument;
+
+ var collections = bandwagonService._serviceDocument.collections;
+
+ Bandwagon.Logger.debug("Updating collections list: saw " + collections.length + " collections");
+
+ for (var id in bandwagonService.collections)
+ {
+ var isStaleCollection = true;
+
+ for (var jd in collections)
+ {
+ if (bandwagonService.collections[id].equals(collections[jd]))
+ {
+ isStaleCollection = false;
+ break;
+ }
+ }
+
+ if (isStaleCollection)
+ {
+ Bandwagon.Logger.debug("Updating collections list: removing stale collection: " + bandwagonService.collections[id].toString());
+
+ bandwagonService.deleteCollection(bandwagonService.collections[id]);
+ }
+ }
+
+ for (var id in collections)
+ {
+ var collection = collections[id];
+
+ if (bandwagonService.collections[collection.resourceURL])
+ {
+ // we have already added this collection
+ }
+ else
+ {
+ // this is a new collection
+ Bandwagon.Logger.debug("Updating collections list: adding new collection: " + collection.toString());
+
+ bandwagonService.collections[collection.resourceURL] = collection;
+
+ bandwagonService.forceCheckForUpdates(collection);
+ }
+ }
+
+ bandwagonService._notifyListChangeObservers();
+
+ if (Bandwagon.COMMIT_NOW)
+ bandwagonService.commitAll();
}
}
},
- registerFeedUpdateObserver: function(observer)
+ _notifyCollectionUpdateObservers: function(collection)
{
- Bandwagon.Logger.debug("Registering feed update observer");
- this._feedUpdateObservers.push(observer);
+ Bandwagon.Logger.debug("Notifying collection update observers");
+
+ for (var i=0; i<bandwagonService._collectionUpdateObservers.length; i++)
+ {
+ if (bandwagonService._collectionUpdateObservers[i])
+ {
+ bandwagonService._collectionUpdateObservers[i](collection);
+ }
+ }
},
- unregisterFeedUpdateObserver: function(observer)
+ registerCollectionUpdateObserver: function(observer)
{
- Bandwagon.Logger.debug("Unregistering feed update observer");
+ Bandwagon.Logger.debug("Registering collection update observer");
+ this._collectionUpdateObservers.push(observer);
+ },
- for (var i=0; i<this._feedUpdateObservers.length; i++)
+ unregisterCollectionUpdateObserver: function(observer)
+ {
+ Bandwagon.Logger.debug("Unregistering collection update observer");
+
+ for (var i=0; i<this._collectionUpdateObservers.length; i++)
{
- if (this._feedUpdateObservers[i] == observer)
+ if (this._collectionUpdateObservers[i] == observer)
{
- delete this._feedUpdateObservers[i];
+ delete this._collectionUpdateObservers[i];
}
}
},
_notifyListChangeObservers: function()
{
- Bandwagon.Logger.debug("Notifying feed list change observers");
+ Bandwagon.Logger.debug("Notifying collection list change observers");
- for (var i=0; i<bandwagonService._feedListChangeObservers.length; i++)
+ for (var i=0; i<bandwagonService._collectionListChangeObservers.length; i++)
{
- if (bandwagonService._feedListChangeObservers[i])
+ if (bandwagonService._collectionListChangeObservers[i])
{
- bandwagonService._feedListChangeObservers[i]();
+ bandwagonService._collectionListChangeObservers[i]();
}
}
},
- registerFeedListChangeObserver: function(observer)
+ registerCollectionListChangeObserver: function(observer)
{
- Bandwagon.Logger.debug("Registering feed list change observer");
- this._feedListChangeObservers.push(observer);
+ Bandwagon.Logger.debug("Registering collection list change observer");
+ this._collectionListChangeObservers.push(observer);
},
- unregisterFeedListChangeObserver: function(observer)
+ unregisterCollectionListChangeObserver: function(observer)
{
- Bandwagon.Logger.debug("Unregistering feed list change observer");
+ Bandwagon.Logger.debug("Unregistering collection list change observer");
- for (var i=0; i<this._feedListChangeObservers.length; i++)
+ for (var i=0; i<this._collectionListChangeObservers.length; i++)
{
- if (this._feedListChangeObservers[i] == observer)
+ if (this._collectionListChangeObservers[i] == observer)
{
- delete this._feedListChangeObservers[i];
+ delete this._collectionListChangeObservers[i];
}
}
},
- checkForUpdates: function(feed)
+ updateCollectionsList: function()
+ {
+ Bandwagon.Logger.debug("Updating collections list...");
+
+ this.updateServiceDocument();
+ },
+
+ updateServiceDocument: function()
+ {
+ if (!this.isAMOAuthenticated())
+ {
+ Bandwagon.Logger.debug("Not authenticated in AMO");
+ return;
+ }
+
+ this._service.getServiceDocument();
+ },
+
+ checkForUpdates: function(collection)
{
var doCheck = false;
var now = new Date();
@@ -334,15 +432,15 @@ BandwagonService.prototype = {
// so a check must be due
doCheck = true;
}
- else if (feed.updateInterval > 0)
+ else if (collection.updateInterval > 0)
{
var dateLastCheck = null;
var dateNextCheck = null;
- if (feed.dateLastCheck != null)
+ if (collection.dateLastCheck != null)
{
- dateLastCheck = feed.dateLastCheck;
- dateNextCheck = new Date(dateLastCheck.getTime() + feed.updateInterval*1000);
+ dateLastCheck = collection.dateLastCheck;
+ dateNextCheck = new Date(dateLastCheck.getTime() + collection.updateInterval*1000);
}
else
{
@@ -357,14 +455,14 @@ BandwagonService.prototype = {
}
else
{
- Bandwagon.Logger.warn(feed.url + ": no global update interval nor feed update interval -- won't update");
+ Bandwagon.Logger.warn(collection.resourceURL + ": no global update interval nor collection update interval -- won't update");
}
if (doCheck)
{
- this._service.getFeed(feed);
+ this._service.getCollection(collection);
- feed.dateLastCheck = now;
+ collection.dateLastCheck = now;
}
},
@@ -388,65 +486,76 @@ BandwagonService.prototype = {
}
}
- for (var id in this.feeds)
+ for (var id in this.collections)
{
- var feed = this.feeds[id];
+ var collection = this.collections[id];
- this.checkForUpdates(feed);
+ this.checkForUpdates(collection);
}
Bandwagon.Preferences.setPreference("updateall.datelastcheck", now.getTime()/1000);
},
- forceCheckForUpdates: function(feed)
+ forceCheckForUpdates: function(collection)
{
- this._service.getFeed(feed);
- feed.dateLastCheck = new Date();
+ this._service.getCollection(collection);
+ collection.dateLastCheck = new Date();
},
forceCheckAllForUpdates: function()
{
- for (var id in this.feeds)
+ for (var id in this.collections)
{
- var feed = this.feeds[id];
- this.forceCheckForUpdates(feed);
+ var collection = this.collections[id];
+ this.forceCheckForUpdates(collection);
}
},
- subscribe: function(feed)
+ forceCheckAllForUpdatesAndUpdateCollectionsList: function()
{
- feed.preview = false;
- feed.setAllNotified();
+ this.forceCheckAllForUpdates();
+ this.updateCollectionsList();
+ },
+
+ /** OBSOLETE
+ subscribe: function(collection)
+ {
+ collection.preview = false;
+ collection.setAllNotified();
- this._service.subscribeFeed(feed);
+ this._service.subscribeCollection(collection);
},
+ */
- unsubscribe: function(feed)
+ /** OBSOLETE
+ unsubscribe: function(collection)
{
- this._service.unsubscribeFeed(feed);
+ this._service.unsubscribeCollection(collection);
},
+ */
firstrun: function()
{
- Bandwagon.Logger.info("This is bandwagon's firstrun");
-
- // set up and save default feeds
+ Bandwagon.Logger.info("This is bandwagon's firstrun. Welcome!");
- this._addDefaultFeed(Bandwagon.DEFAULT_FEED1_URL, Bandwagon.DEFAULT_FEED1_NAME);
- this._addDefaultFeed("http://www.33eels.com/clients/briks/bandwagon/testfeed.xml", "test feed");
+ // set up and save default collections
- // check for cookie to see if we have to add a feed like that
-
- var addFeedCookieValue = Bandwagon.Util.getCookie(Bandwagon.MAGIC_ADD_FEED_COOKIE_HOST, Bandwagon.MAGIC_ADD_FEED_COOKIE_NAME);
-
- if (addFeedCookieValue)
+ // FIXME temporarily disabling this
+ //this._addDefaultCollection(Bandwagon.DEFAULT_COLLECTION1_URL, Bandwagon.DEFAULT_COLLECTION1_NAME);
+ //this._addDefaultCollection("http://www.33eels.com/clients/briks/bandwagon/testcollection.xml", "test collection");
+
+ /** OBSOLETE
+ // check for cookie to see if we have to add a collection like that
+ var addCollectionCookieValue = Bandwagon.Util.getCookie(Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_HOST, Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_NAME);
+ if (addCollectionCookieValue)
{
- Bandwagon.Logger.info("Found magic 'add feed' cookie. Adding the feed '" + addFeedCookieValue + "'.");
- this.addPreviewFeed(addFeedCookieValue);
+ Bandwagon.Logger.info("Found magic 'add collection' cookie. Adding the collection '" + addCollectionCookieValue + "'.");
+ this.addPreviewCollection(addCollectionCookieValue);
// TODO we don't have to because we're in firstrun, but should we delete cookie to be neat?
}
+ */
// the last check date is now
@@ -458,75 +567,117 @@ BandwagonService.prototype = {
Bandwagon.Controller.BrowserOverlay.openFirstRunLandingPage();
},
- _addDefaultFeed: function(url, name)
+ _addDefaultCollection: function(url, name)
{
- var feed = this._feedFactory.newFeed();
- feed.url = url;
- feed.name = name;
- feed.showNotifications = false;
+ var collection = this._collectionFactory.newCollection();
+ collection.resourceURL = url;
+ collection.name = name;
+ collection.showNotifications = false;
- this.feeds[feed.url] = feed;
+ this.collections[collection.resourceURL] = collection;
if (Bandwagon.COMMIT_NOW)
- this.commit(feed);
+ this.commit(collection);
- this.forceCheckForUpdates(feed);
- this.subscribe(feed);
+ this.forceCheckForUpdates(collection);
+ this.subscribe(collection);
},
- addPreviewFeed: function(url)
+ /** OBSOLETE
+ addPreviewCollection: function(url)
{
- var feed = this._feedFactory.newFeed();
- feed.url = url;
- feed.preview = true;
- this.feeds[feed.url] = feed;
+ var collection = this._collectionFactory.newCollection();
+ collection.resourceURL = url;
+ collection.preview = true;
+ this.collections[collection.resourceURL] = collection;
- this.forceCheckForUpdates(feed);
+ this.forceCheckForUpdates(collection);
bandwagonService._notifyListChangeObservers();
- return feed;
+ return collection;
},
+ */
uninstall: function()
{
// TODO
},
- commit: function(feed)
+ commit: function(collection)
{
- if (!bandwagonService._feedFactory)
+ if (!bandwagonService._collectionFactory)
return;
- if (feed.preview)
+ /** OBSOLETE
+ if (collection.preview)
return;
+ */
- Bandwagon.Logger.debug("In commit() with feed: " + feed.url);
+ Bandwagon.Logger.debug("In commit() with collection: " + collection.resourceURL);
- bandwagonService._feedFactory.commitFeed(feed);
+ bandwagonService._collectionFactory.commitCollection(collection);
},
commitAll: function()
{
Bandwagon.Logger.debug("In commitAll()");
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- var feed = bandwagonService.feeds[id];
+ var collection = bandwagonService.collections[id];
- this.commit(feed);
+ this.commit(collection);
}
+
+ if (bandwagonService._serviceDocument)
+ bandwagonService._collectionFactory.commitServiceDocument(bandwagonService._serviceDocument);
+ },
+
+ removeAddonFromCollection: function(guid, collection)
+ {
+ Bandwagon.Logger.debug("In removeAddonFromCollection()");
+
+ this._service.removeAddonFromCollection(guid, collection);
+ },
+
+ newCollection: function(collection, callback)
+ {
+ Bandwagon.Logger.debug("In newCollection()");
+
+ /*
+ var internalCallback = function(event)
+ {
+ if (!event.isError())
+ {
+ var collection = event.collection;
+
+ bandwagonService.collections[collection.resourceURL] = collection;
+ //bandwagonService._notifyCollectionUpdateObservers(collection);
+ bandwagonService._notifyListChangeObservers();
+ }
+
+ if (callback)
+ {
+ callback(event);
+ }
+ }
+
+ this._service.newCollection(collection, internalCallback);
+ */
+
+ this._service.newCollection(collection, callback);
},
- deleteFeed: function(feed)
+ deleteCollection: function(collection)
{
- this._feedFactory.deleteFeed(feed);
+ this._collectionFactory.deleteCollection(collection);
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- if (feed.equals(bandwagonService.feeds[id]))
+ if (collection.equals(bandwagonService.collections[id]))
{
- delete bandwagonService.feeds[id];
+ delete bandwagonService.collections[id];
bandwagonService._notifyListChangeObservers();
@@ -535,25 +686,25 @@ BandwagonService.prototype = {
}
},
- getFeedItemsPerPage: function(feed)
+ getAddonsPerPage: function(collection)
{
- // returns the global feed items per page, if enabled. otherwise, this feed's feed items per page.
+ // returns the global collection items per page, if enabled. otherwise, this collection's collection items per page.
- var feedItemsPerPage;
+ var addonsPerPage;
- if (Bandwagon.Preferences.getPreference("feeditemsperpage.enabled"))
+ if (Bandwagon.Preferences.getPreference("addonsperpage.enabled"))
{
- feedItemsPerPage = Bandwagon.Preferences.getPreference("feeditemsperpage");
+ addonsPerPage = Bandwagon.Preferences.getPreference("addonsperpage");
}
else
{
- feedItemsPerPage = feed.feedItemsPerPage;
+ addonsPerPage = collection.addonsPerPage;
}
- if (feedItemsPerPage<1)
- feedItemsPerPage = 1;
+ if (addonsPerPage<1)
+ addonsPerPage = 1;
- return feedItemsPerPage;
+ return addonsPerPage;
},
getPreviouslySharedEmailAddresses: function()
@@ -563,6 +714,9 @@ BandwagonService.prototype = {
addPreviouslySharedEmailAddress: function(emailAddress)
{
+ emailAddress = emailAddress.replace(/^\s+/, "");
+ emailAddress = emailAddress.replace(/\s+$/, "");
+
var previouslySharedEmailAddresses = this.getPreviouslySharedEmailAddresses();
for (var i=0; i<previouslySharedEmailAddresses.length; i++)
@@ -578,9 +732,19 @@ BandwagonService.prototype = {
Bandwagon.Preferences.setPreferenceList("publish.shared.emails", previouslySharedEmailAddresses);
},
- publishToFeed: function(extension, feed, personalNote, callback)
+ addPreviouslySharedEmailAddresses: function(commaSeparatedEmailAddresses)
{
- this._service.publishToFeed(extension, feed, personalNote, callback);
+ var bits = commaSeparatedEmailAddresses.split(",");
+
+ for (var i=0; i<bits.length; i++)
+ {
+ this.addPreviouslySharedEmailAddress(bits[i]);
+ }
+ },
+
+ publishToCollection: function(extension, collection, personalNote, callback)
+ {
+ this._service.publishToCollection(extension, collection, personalNote, callback);
},
shareToEmail: function(extension, emailAddress, personalNote, callback)
@@ -588,36 +752,56 @@ BandwagonService.prototype = {
this._service.shareToEmail(extension, emailAddress, personalNote, callback);
},
- _feedUpdateObserver: function(feed)
+ isAMOAuthenticated: function()
{
- // called when a feed is updated
+ var cm = CookieManager.getService(nsICookieManager);
+
+ var iterator = cm.enumerator;
- // if there are new items, notify the user if notifications are enabled for this user and it's not a preview of a feed
+ while (iterator.hasMoreElements())
+ {
+ var cookie = iterator.getNext();
- Bandwagon.Logger.debug("in _feedUpdateObserver() with feed '" + feed + "', unnotified feed items = " + feed.getUnnotifiedFeedItems().length)
+ if (cookie instanceof Ci.nsICookie)
+ {
+ if (cookie.host == Bandwagon.AMO_AUTH_COOKIE_HOST && cookie.name == Bandwagon.AMO_AUTH_COOKIE_NAME)
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ _collectionUpdateObserver: function(collection)
+ {
+ // called when a collection is updated
+
+ // if there are new items, notify the user if notifications are enabled for this user and it's not a preview of a collection
+
+ Bandwagon.Logger.debug("in _collectionUpdateObserver() with collection '" + collection + "', unnotified collection items = " + collection.getUnnotifiedAddons().length)
var globalShowNotifications = Bandwagon.Preferences.getPreference("notifyall.enabled");
- if (feed.getUnnotifiedFeedItems().length > 0 && (feed.showNotifications || globalShowNotifications) && !feed.preview)
+ if (collection.getUnnotifiedAddons().length > 0 && (collection.showNotifications || globalShowNotifications) && !collection.preview)
{
var browserWindow = WindowMediator.getService(nsIWindowMediator).getMostRecentWindow("navigator:browser");
if (browserWindow)
{
- browserWindow.Bandwagon.Controller.BrowserOverlay.showNewFeedItemsAlert(feed);
+ browserWindow.Bandwagon.Controller.BrowserOverlay.showNewAddonsAlert(collection);
}
else
{
Bandwagon.Logger.error("Can't find a browser window to notify the user");
}
- feed.setAllNotified();
+ collection.setAllNotified();
}
- // commit the feed
+ // commit the collection
if (Bandwagon.COMMIT_NOW)
- bandwagonService.commit(feed);
+ bandwagonService.commit(collection);
},
_initStorage: function()
@@ -644,7 +828,7 @@ BandwagonService.prototype = {
return;
}
- this._feedFactory = new Bandwagon.Factory.FeedFactory(this._storageConnection);
+ this._collectionFactory = new Bandwagon.Factory.CollectionFactory(this._storageConnection);
this._initStorageTables();
},
@@ -659,7 +843,12 @@ BandwagonService.prototype = {
try
{
this._storageConnection.executeSimpleSQL(
- "CREATE TABLE IF NOT EXISTS feeds "
+ "CREATE TABLE IF NOT EXISTS serviceDocument "
+ + "(emailResourceURL TEXT NOT NULL, "
+ + "collectionListResourceURL TEXT NOT NULL)"
+ );
+ this._storageConnection.executeSimpleSQL(
+ "CREATE TABLE IF NOT EXISTS collections "
+ "(id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "url TEXT NOT NULL UNIQUE, "
+ "name TEXT NOT NULL, "
@@ -670,12 +859,18 @@ BandwagonService.prototype = {
+ "showNotifications INTEGER NOT NULL, "
+ "autoPublish INTEGER NOT NULL, "
+ "active INTEGER NOT NULL DEFAULT 1, "
- + "feedItemsPerPage INTEGER NOT NULL)"
+ + "addonsPerPage INTEGER NOT NULL, "
+ + "creator TEXT, "
+ + "listed INTEGER NOT NULL DEFAULT 1, "
+ + "writable INTEGER NOT NULL DEFAULT 0, "
+ + "subscribed INTEGER NOT NULL DEFAULT 1, "
+ + "lastModified INTEGER, "
+ + "addonsResourceURL TEXT)"
);
this._storageConnection.executeSimpleSQL(
- "CREATE TABLE IF NOT EXISTS feedItems "
+ "CREATE TABLE IF NOT EXISTS collectionsAddons "
+ "(id INTEGER PRIMARY KEY AUTOINCREMENT, "
- + "feed INTEGER NOT NULL, "
+ + "collection INTEGER NOT NULL, "
+ "addon INTEGER NOT NULL, "
+ "read INTEGER NOT NULL DEFAULT 0)"
);
@@ -724,6 +919,11 @@ BandwagonService.prototype = {
+ "comment TEXT NOT NULL, "
+ "author TEXT NOT NULL)"
);
+ this._storageConnection.executeSimpleSQL(
+ "CREATE TABLE IF NOT EXISTS addonAuthors "
+ + "(addon INTEGER NOT NULL, "
+ + "author TEXT NOT NULL)"
+ );
}
catch (e)
{
diff --git a/bandwagon/content/scripts/bandwagon.js b/bandwagon/content/scripts/bandwagon.js
index 55039b1..ff34feb 100644
--- a/bandwagon/content/scripts/bandwagon.js
+++ b/bandwagon/content/scripts/bandwagon.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -42,15 +42,26 @@ Bandwagon.RPC = new function() {}
Bandwagon.EMID = "sharing@addons.mozilla.org";
Bandwagon.SQLITE_FILENAME = "bandwagon.sqlite";
-Bandwagon.FEED_UPDATE_TIMER_DELAY = 60 * 60; // interval between checking if feeds need updating (in seconds) (this will always be 30 seconds in debug mode)
-Bandwagon.DEFAULT_FEED_UPDATE_INTERVAL = 24 * 60 * 60; // default individual feed update interval (in seconds)
-Bandwagon.DEFAULT_FEED_ITEMS_PER_PAGE = 20;
-Bandwagon.DEFAULT_FEED1_URL = "https://services.addons.mozilla.org/en-US/firefox/api/1.1/list/featured/all/10/";
-Bandwagon.DEFAULT_FEED1_NAME = "Featured Add-ons";
+Bandwagon.COLLECTION_UPDATE_TIMER_DELAY = 60 * 60; // interval between checking if collection needs updating (in seconds) (this will always be 30 seconds in debug mode)
+Bandwagon.DEFAULT_COLLECTION_UPDATE_INTERVAL = 24 * 60 * 60; // default individual collection update interval (in seconds)
+Bandwagon.DEFAULT_ADDONS_PER_PAGE = 20;
+
+// REMEMBER: when changing AMO_HOST, the service document url in scripts/rpc/constants.js also has to be changed.
+
+Bandwagon.AMO_HOST = "bandwagon.stage.mozilla.com";
+Bandwagon.COLLECTIONSPANE_DO_SUBSCRIBE_URL = "https://" + Bandwagon.AMO_HOST + "/en-US/collections";
+Bandwagon.COLLECTIONSPANE_DO_LOGIN_URL = "https://" + Bandwagon.AMO_HOST + "/en-US/firefox/users/login?to=en-US%2Ffirefox%2Fcollections";
+Bandwagon.COLLECTIONSPANE_DO_NEW_COLLECTION_URL = "https://" + Bandwagon.AMO_HOST + "/en-US/firefox/collections/add";
Bandwagon.FIRSTRUN_LANDING_PAGE = "http://www.google.com/search?hl=en&q=bandwagon+first+run+landing+page&btnG=Google+Search&aq=f&oq="; // TODO
-Bandwagon.FEEDSPANE_DO_SUBSCRIBE_URL = "http://www.google.com/search?hl=en&q=bandwagon+subscribe+page&btnG=Search"; // TODO
-Bandwagon.MAGIC_ADD_FEED_COOKIE_HOST = "www.33eels.com"; // TODO
-Bandwagon.MAGIC_ADD_FEED_COOKIE_NAME = "bandwagon_addfeed";
+Bandwagon.AMO_AUTH_COOKIE_HOST = Bandwagon.AMO_HOST;
+Bandwagon.AMO_AUTH_COOKIE_NAME = "AMOv3";
+
+/* ** OBSOLETE
+//Bandwagon.DEFAULT_COLLECTION1_URL = "https://services.addons.mozilla.org/en-US/firefox/api/1.1/list/featured/all/10/";
+//Bandwagon.DEFAULT_COLLECTION1_NAME = "Featured Add-ons";
+//Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_HOST = "www.33eels.com";
+//Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_NAME = "bandwagon_addcollection";
+*/
Bandwagon.COMMIT_NOW = 0; // 1=commit on the fly. 0=commit when browser exit.
diff --git a/bandwagon/content/scripts/factory/collectionFactory.js b/bandwagon/content/scripts/factory/collectionFactory.js
new file mode 100644
index 0000000..a6b59ac
--- /dev/null
+++ b/bandwagon/content/scripts/factory/collectionFactory.js
@@ -0,0 +1,758 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David McNamara
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Bandwagon.Factory.CollectionFactory = function(connection)
+{
+ this.Bandwagon = Bandwagon;
+ this.connection = connection;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.openServiceDocument = function()
+{
+ if (!this.connection)
+ return null;
+
+ var statement = this.connection.createStatement("SELECT * FROM serviceDocument LIMIT 1");
+
+ var serviceDocument = null;
+
+ try
+ {
+ statement.execute();
+
+ while (statement.executeStep())
+ {
+ serviceDocument = new this.Bandwagon.Model.ServiceDocument();
+ serviceDocument.emailResourceURL = statement.getUTF8String(0);
+ serviceDocument.collectionListResourceURL = statement.getUTF8String(1);
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return serviceDocument;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.commitServiceDocument = function(serviceDocument)
+{
+ if (!this.connection)
+ return null;
+
+ var statement1 = this.connection.createStatement("DELETE FROM serviceDocument");
+
+ try
+ {
+ statement1.execute();
+ }
+ finally
+ {
+ statement1.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO serviceDocument VALUES (?1, ?2)");
+
+ try
+ {
+ statement2.bindUTF8StringParameter(0, serviceDocument.emailResourceURL);
+ statement2.bindUTF8StringParameter(1, serviceDocument.collectionListResourceURL);
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.newCollection = function()
+{
+ return new this.Bandwagon.Model.Collection();
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.openCollection = function(collection_id)
+{
+ if (!this.connection)
+ return null;
+
+ var collections = {};
+
+ var statement = this.connection.createStatement("SELECT * FROM collections where id = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, collection_id);
+ statement.execute();
+
+ var collection = this._openCollectionFromRS(statement);
+
+ if (!collection)
+ return null;
+
+ collection.addons = this._openAddons(collection);
+
+ collections[collection.resourceURL] = collection;
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return collection;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.openCollections = function()
+{
+ if (!this.connection)
+ return null;
+
+ var collections = {};
+
+ var statement = this.connection.createStatement("SELECT * FROM collections");
+
+ try
+ {
+ while (statement.executeStep())
+ {
+ var collection = this._openCollectionFromRS(statement);
+
+ if (!collection)
+ continue;
+
+ collection.addons = this._openAddons(collection);
+
+ collections[collection.resourceURL] = collection;
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return collections;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.commitCollection = function(collection)
+{
+ if (!this.connection)
+ return;
+
+ var statement = this.connection.createStatement("REPLACE INTO collections VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17)");
+
+ try
+ {
+ (collection.storageID==-1?statement.bindNullParameter(0):statement.bindInt32Parameter(0, collection.storageID));
+ statement.bindUTF8StringParameter(1, collection.resourceURL);
+ statement.bindUTF8StringParameter(2, collection.name);
+ statement.bindUTF8StringParameter(3, collection.description);
+ statement.bindInt32Parameter(4, collection.dateAdded.getTime()/1000);
+ (collection.dateLastCheck == null?statement.bindNullParameter(5):statement.bindInt32Parameter(5, collection.dateLastCheck.getTime()/1000));
+ statement.bindInt32Parameter(6, collection.updateInterval);
+ statement.bindInt32Parameter(7, (collection.showNotifications?1:0));
+ statement.bindInt32Parameter(8, (collection.autoPublish?1:0));
+ statement.bindInt32Parameter(9, (collection.active?1:0));
+ statement.bindInt32Parameter(10, collection.addonsPerPage);
+ statement.bindUTF8StringParameter(11, collection.creator);
+ statement.bindInt32Parameter(12, collection.listed);
+ statement.bindInt32Parameter(13, collection.writable);
+ statement.bindInt32Parameter(14, collection.subscribed);
+ (collection.lastModified == null?statement.bindNullParameter(15):statement.bindInt32Parameter(15, collection.lastModified.getTime()/1000));
+ statement.bindUTF8StringParameter(16, collection.addonsResourceURL);
+
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ if (collection.storageID == -1)
+ {
+ collection.storageID = this.connection.lastInsertRowID;
+ }
+
+ for (var id in collection.addons)
+ {
+ this._commitAddon(collection, collection.addons[id]);
+ }
+
+ return true;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.commitCollections = function(collections)
+{
+ for (var id in collections)
+ {
+ this.commitCollection(collections[id]);
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype.deleteCollection = function(collection)
+{
+ if (!this.connection)
+ return null;
+
+ var statement1 = this.connection.createStatement("DELETE FROM collections where id = ?1");
+ var statement2 = this.connection.createStatement("DELETE FROM collectionsAddons where collection = ?1");
+
+ try
+ {
+ // TODO transaction here?
+
+ statement1.bindInt32Parameter(0, collection.storageID);
+ statement1.execute();
+
+ statement2.bindInt32Parameter(0, collection.storageID);
+ statement2.execute();
+ }
+ finally
+ {
+ statement1.reset();
+ statement2.reset();
+ }
+
+ return (statement2.lastError>0?false:true);
+}
+
+// private methods
+
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionFromRS = function(resultset)
+{
+ var collection = new this.Bandwagon.Model.Collection();
+ collection.storageID = resultset.getInt32(0);
+ collection.resourceURL = resultset.getUTF8String(1);
+ collection.name = resultset.getUTF8String(2);
+ collection.description = resultset.getUTF8String(3);
+ collection.dateAdded = new Date(resultset.getInt32(4)*1000);
+
+ if (!resultset.getIsNull(5))
+ collection.dateLastCheck = new Date(resultset.getInt32(5)*1000);
+
+ collection.updateInterval = resultset.getInt32(6);
+ collection.showNotifications = (resultset.getInt32(7)==1?true:false);
+ collection.autoPublish = (resultset.getInt32(8)==1?true:false);
+ collection.active = (resultset.getInt32(9)==1?true:false);
+ collection.addonsPerPage = resultset.getInt32(10);
+ collection.creator = resultset.getUTF8String(11);
+ collection.listed = resultset.getInt32(12);
+ collection.writable = resultset.getInt32(13);
+ collection.subscribed = resultset.getInt32(14);
+
+ if (!resultset.getIsNull(15))
+ collection.lastModified = new Date(resultset.getInt32(15)*1000);
+
+ collection.addonsResourceURL = resultset.getUTF8String(16);
+
+ return collection;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddons = function(collection)
+{
+ var addons = {};
+
+ var statement = this.connection.createStatement("SELECT addons.*, collectionsAddons.id, collectionsAddons.read FROM addons LEFT JOIN collectionsAddons ON addons.id = collectionsAddons.addon WHERE collectionsAddons.collection = ?1 LIMIT ?2");
+
+ try
+ {
+ statement.bindInt32Parameter(0, collection.storageID);
+ statement.bindInt32Parameter(1, this.Bandwagon.DEFAULT_ADDONS_PER_PAGE);
+
+ while (statement.executeStep())
+ {
+ var addon = new this.Bandwagon.Model.Addon();
+ addon.Bandwagon = this.Bandwagon;
+
+ addon.storageID = statement.getInt32(0);
+ addon.guid = statement.getUTF8String(1);
+ addon.name = statement.getUTF8String(2);
+ addon.type = statement.getInt32(3);
+ addon.version = statement.getUTF8String(4);
+ addon.status = statement.getInt32(5);
+ addon.summary = statement.getUTF8String(6);
+ addon.description = statement.getUTF8String(7);
+ addon.icon = statement.getUTF8String(8);
+ addon.eula = statement.getUTF8String(9);
+ addon.thumbnail = statement.getUTF8String(10);
+ addon.learnmore = statement.getUTF8String(11);
+ addon.author = statement.getUTF8String(12);
+ addon.category = statement.getUTF8String(13);
+ addon.dateAdded = new Date(statement.getInt32(14)*1000);
+ addon.collectionsAddonsStorageID = statement.getInt32(15);
+ addon.read = (statement.getInt32(16)==1?true:false);
+
+ addon.compatibleApplications = this._openAddonCompatibleApplications(addon);
+ addon.compatibleOS = this._openAddonCompatibleOS(addon);
+ addon.installs = this._openAddonInstalls(addon);
+ addon.comments = this._openAddonComments(addon);
+ addon.authors = this._openAddonAuthors(addon);
+
+ addons[addon.guid] = addon;
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return addons;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddonCompatibleApplications = function(addon)
+{
+ var compatibleApplications = {};
+
+ var statement = this.connection.createStatement("SELECT * FROM addonCompatibleApplications WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addon.storageID);
+
+ while (statement.executeStep())
+ {
+ var application =
+ {
+ name: statement.getUTF8String(1).toString().toUpperCase(),
+ applicationId: statement.getInt32(2),
+ minVersion: statement.getUTF8String(3),
+ maxVersion: statement.getUTF8String(4),
+ guid: statement.getUTF8String(5)
+ };
+
+ compatibleApplications[application.name.toUpperCase()] = application;
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return compatibleApplications;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddonCompatibleOS = function(addon)
+{
+ var compatibleOS = {};
+
+ var statement = this.connection.createStatement("SELECT * FROM addonCompatibleOS WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addon.storageID);
+
+ while (statement.executeStep())
+ {
+ var os = statement.getUTF8String(1).toString().toUpperCase();
+
+ compatibleOS[os] = os;
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return compatibleOS;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddonInstalls = function(addon)
+{
+ var installs = {};
+
+ var statement = this.connection.createStatement("SELECT * FROM addonInstalls WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addon.storageID);
+
+ while (statement.executeStep())
+ {
+ var install =
+ {
+ url: statement.getUTF8String(1),
+ hash: statement.getUTF8String(2),
+ os: statement.getUTF8String(3).toString().toUpperCase()
+ };
+
+ installs[install.os] = install;
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return installs;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddonComments = function(addon)
+{
+ var comments = [];
+
+ var statement = this.connection.createStatement("SELECT * FROM addonComments WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addon.storageID);
+
+ while (statement.executeStep())
+ {
+ var comment =
+ {
+ comment: statement.getUTF8String(1),
+ author: statement.getUTF8String(2)
+ };
+
+ comments.push(comment);
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return comments;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._openAddonAuthors = function(addon)
+{
+ var authors = [];
+
+ var statement = this.connection.createStatement("SELECT * FROM addonAuthors WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addon.storageID);
+
+ while (statement.executeStep())
+ {
+ authors.push(statement.getUTF8String(1));
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ return authors;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddon = function(collection, addon)
+{
+ if (!this.connection)
+ return;
+
+ // addons
+ // if guid already exists - just update the addon
+ // if guid doesn't exist - insert
+
+ var statement = this.connection.createStatement("SELECT id FROM addons where guid = ?1");
+ var addonStorageID = null;
+
+ try
+ {
+ statement.bindUTF8StringParameter(0, addon.guid);
+
+ while (statement.executeStep())
+ {
+ addonStorageID = statement.getInt32(0);
+ }
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("REPLACE INTO addons VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)");
+
+ try
+ {
+ if (addonStorageID != null)
+ {
+ // addon already exists (in another collection, or from previous commit of this collection)
+ statement2.bindInt32Parameter(0, addonStorageID);
+ }
+ else if (addon.storageID != -1)
+ {
+ // addon doesn't already exist, but exists from a previous commit of this collection (?)
+ statement2.bindInt32Parameter(0, addon.storageID);
+ }
+ else
+ {
+ // new addon
+ statement2.bindNullParameter(0)
+ }
+
+ statement2.bindUTF8StringParameter(1, addon.guid);
+ statement2.bindUTF8StringParameter(2, addon.name);
+ statement2.bindInt32Parameter(3, addon.type);
+ statement2.bindUTF8StringParameter(4, addon.version);
+ statement2.bindInt32Parameter(5, addon.status);
+ statement2.bindUTF8StringParameter(6, addon.summary);
+ statement2.bindUTF8StringParameter(7, addon.description);
+ statement2.bindUTF8StringParameter(8, addon.icon);
+ statement2.bindUTF8StringParameter(9, addon.eula);
+ statement2.bindUTF8StringParameter(10, addon.thumbnail);
+ statement2.bindUTF8StringParameter(11, addon.learnmore);
+ statement2.bindUTF8StringParameter(12, addon.author);
+ statement2.bindUTF8StringParameter(13, addon.category);
+ statement2.bindUTF8StringParameter(14, addon.dateAdded.getTime()/1000);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+
+ if (addon.storageID == -1 && addonStorageID == null)
+ {
+ addonStorageID = this.connection.lastInsertRowID;
+ }
+
+ // add the other addon bits
+
+ for (var id in addon.compatibleApplications)
+ {
+ this._commitAddonCompatibleApplication(addonStorageID, addon.compatibleApplications[id]);
+ }
+
+ for (var id in addon.compatibleOS)
+ {
+ this._commitAddonCompatibleOS(addonStorageID, addon.compatibleOS[id]);
+ }
+
+ for (var id in addon.installs)
+ {
+ this._commitAddonInstall(addonStorageID, addon.installs[id]);
+ }
+
+ for (var i=0; i<addon.comments.length; i++)
+ {
+ this._commitAddonComment(addonStorageID, addon.comments[i]);
+ }
+
+ for (var id in addon.authors)
+ {
+ this._commitAddonAuthor(addonStorageID, addon.authors[id]);
+ }
+
+ // add the addon connector
+
+ var statement3 = this.connection.createStatement("REPLACE INTO collectionsAddons VALUES (?1, ?2, ?3, ?4)");
+
+ try
+ {
+ if (addon.collectionsAddonsStorageID == -1)
+ {
+ statement3.bindNullParameter(0);
+ }
+ else
+ {
+ statement3.bindInt32Parameter(0, addon.collectionsAddonsStorageID);
+ }
+
+ statement3.bindInt32Parameter(1, collection.storageID);
+ statement3.bindInt32Parameter(2, addonStorageID);
+ statement3.bindInt32Parameter(3, (addon.read?1:0));
+
+ statement3.execute();
+ }
+ finally
+ {
+ statement3.reset();
+ }
+
+ if (addon.collectionsAddonsStorageID == -1)
+ {
+ addon.collectionsAddonsStorageID = this.connection.lastInsertRowID;
+ }
+
+ return true;
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonCompatibleApplication = function(addonStorageID, application)
+{
+ var statement = this.connection.createStatement("DELETE FROM addonCompatibleApplications WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addonStorageID);
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO addonCompatibleApplications VALUES (?1, ?2, ?3, ?4, ?5, ?6)");
+
+ try
+ {
+ statement2.bindInt32Parameter(0, addonStorageID);
+ statement2.bindUTF8StringParameter(1, application.name);
+ statement2.bindInt32Parameter(2, application.applicationId);
+ statement2.bindUTF8StringParameter(3, application.minVersion);
+ statement2.bindUTF8StringParameter(4, application.maxVersion);
+ statement2.bindUTF8StringParameter(5, application.guid);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonCompatibleOS = function(addonStorageID, os)
+{
+ var statement = this.connection.createStatement("DELETE FROM addonCompatibleOS WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addonStorageID);
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO addonCompatibleOS VALUES (?1, ?2)");
+
+ try
+ {
+ statement2.bindInt32Parameter(0, addonStorageID);
+ statement2.bindUTF8StringParameter(1, os);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonInstall = function(addonStorageID, install)
+{
+ var statement = this.connection.createStatement("DELETE FROM addonInstalls WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addonStorageID);
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO addonInstalls VALUES (?1, ?2, ?3, ?4)");
+
+ try
+ {
+ statement2.bindInt32Parameter(0, addonStorageID);
+ statement2.bindUTF8StringParameter(1, install.url);
+ statement2.bindUTF8StringParameter(2, install.hash);
+ statement2.bindUTF8StringParameter(3, install.os);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonComment = function(addonStorageID, comment)
+{
+ var statement = this.connection.createStatement("DELETE FROM addonComments WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addonStorageID);
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO addonComments VALUES (?1, ?2, ?3)");
+
+ try
+ {
+ statement2.bindInt32Parameter(0, addonStorageID);
+ statement2.bindUTF8StringParameter(1, comment.comment);
+ statement2.bindUTF8StringParameter(2, comment.author);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonAuthor = function(addonStorageID, author)
+{
+ var statement = this.connection.createStatement("DELETE FROM addonAuthors WHERE addon = ?1");
+
+ try
+ {
+ statement.bindInt32Parameter(0, addonStorageID);
+ statement.execute();
+ }
+ finally
+ {
+ statement.reset();
+ }
+
+ var statement2 = this.connection.createStatement("INSERT INTO addonAuthors VALUES (?1, ?2)");
+
+ try
+ {
+ statement2.bindInt32Parameter(0, addonStorageID);
+ statement2.bindUTF8StringParameter(1, author);
+
+ statement2.execute();
+ }
+ finally
+ {
+ statement2.reset();
+ }
+}
+
+
diff --git a/bandwagon/content/scripts/factory/feedFactory.js b/bandwagon/content/scripts/factory/feedFactory.js
deleted file mode 100644
index b58823b..0000000
--- a/bandwagon/content/scripts/factory/feedFactory.js
+++ /dev/null
@@ -1,626 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bandwagon.
- *
- * The Initial Developer of the Original Code is
- * David McNamara.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-Bandwagon.Factory.FeedFactory = function(connection)
-{
- this.Bandwagon = Bandwagon;
- this.connection = connection;
-}
-
-Bandwagon.Factory.FeedFactory.prototype.newFeed = function()
-{
- return new this.Bandwagon.Model.Feed();
-}
-
-Bandwagon.Factory.FeedFactory.prototype.openFeed = function(feed_id)
-{
- if (!this.connection)
- return null;
-
- var feeds = {};
-
- var statement = this.connection.createStatement("SELECT * FROM feeds where id = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, feed_id);
- statement.execute();
-
- var feed = this._openFeedFromRS(statement);
-
- if (!feed)
- return null;
-
- feed.feedItems = this._openFeedItems(feed);
-
- feeds[feed.url] = feed;
- }
- finally
- {
- statement.reset();
- }
-
- return feed;
-}
-
-Bandwagon.Factory.FeedFactory.prototype.openFeeds = function()
-{
- if (!this.connection)
- return null;
-
- var feeds = {};
-
- var statement = this.connection.createStatement("SELECT * FROM feeds");
-
- try
- {
- while (statement.executeStep())
- {
- var feed = this._openFeedFromRS(statement);
-
- if (!feed)
- continue;
-
- feed.feedItems = this._openFeedItems(feed);
-
- feeds[feed.url] = feed;
- }
- }
- finally
- {
- statement.reset();
- }
-
- return feeds;
-}
-
-Bandwagon.Factory.FeedFactory.prototype.commitFeed = function(feed)
-{
- if (!this.connection)
- return;
-
- var statement = this.connection.createStatement("REPLACE INTO feeds VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11)");
-
- try
- {
- (feed.id==-1?statement.bindNullParameter(0):statement.bindInt32Parameter(0, feed.id));
- statement.bindUTF8StringParameter(1, feed.url);
- statement.bindUTF8StringParameter(2, feed.name);
- statement.bindUTF8StringParameter(3, feed.description);
- statement.bindInt32Parameter(4, feed.dateAdded.getTime()/1000);
- (feed.dateLastCheck == null?statement.bindNullParameter(5):statement.bindInt32Parameter(5, feed.dateLastCheck.getTime()/1000));
- statement.bindInt32Parameter(6, feed.updateInterval);
- statement.bindInt32Parameter(7, (feed.showNotifications?1:0));
- statement.bindInt32Parameter(8, (feed.autoPublish?1:0));
- statement.bindInt32Parameter(9, (feed.active?1:0));
- statement.bindInt32Parameter(10, feed.feedItemsPerPage);
-
- statement.execute();
- }
- finally
- {
- statement.reset();
- }
-
- if (feed.id == -1)
- {
- feed.id = this.connection.lastInsertRowID;
- }
-
- for (var id in feed.feedItems)
- {
- this._commitFeedItem(feed, feed.feedItems[id]);
- }
-
- return true;
-}
-
-Bandwagon.Factory.FeedFactory.prototype.commitFeeds = function(feeds)
-{
- for (var id in feeds)
- {
- this.commitFeed(feeds[id]);
- }
-}
-
-Bandwagon.Factory.FeedFactory.prototype.deleteFeed = function(feed)
-{
- if (!this.connection)
- return null;
-
- var statement1 = this.connection.createStatement("DELETE FROM feeds where id = ?1");
- var statement2 = this.connection.createStatement("DELETE FROM feedItems where feed = ?1");
-
- try
- {
- // TODO transaction here?
-
- statement1.bindInt32Parameter(0, feed.id);
- statement1.execute();
-
- statement2.bindInt32Parameter(0, feed.id);
- statement2.execute();
- }
- finally
- {
- statement1.reset();
- statement2.reset();
- }
-
- return (statement2.lastError>0?false:true);
-}
-
-// private methods
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedFromRS = function(resultset)
-{
- var feed = new this.Bandwagon.Model.Feed();
- feed.id = resultset.getInt32(0);
- feed.url = resultset.getUTF8String(1);
- feed.name = resultset.getUTF8String(2);
- feed.description = resultset.getUTF8String(3);
- feed.dateAdded = new Date(resultset.getInt32(4)*1000);
-
- if (!resultset.getIsNull(5))
- feed.dateLastCheck = new Date(resultset.getInt32(5)*1000);
-
- feed.updateInterval = resultset.getInt32(6);
- feed.showNotifications = (resultset.getInt32(7)==1?true:false);
- feed.autoPublish = (resultset.getInt32(8)==1?true:false);
- feed.active = (resultset.getInt32(9)==1?true:false);
- feed.feedItemsPerPage = resultset.getInt32(10);
-
- return feed;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedItems = function(feed)
-{
- var feedItems = {};
-
- var statement = this.connection.createStatement("SELECT addons.*, feedItems.id, feedItems.read FROM addons LEFT JOIN feedItems ON addons.id = feedItems.addon WHERE feedItems.feed = ?1 LIMIT ?2");
-
- try
- {
- statement.bindInt32Parameter(0, feed.id);
- statement.bindInt32Parameter(1, this.Bandwagon.DEFAULT_FEED_ITEMS_PER_PAGE);
-
- while (statement.executeStep())
- {
- var feedItem = new this.Bandwagon.Model.FeedItem();
- feedItem.Bandwagon = this.Bandwagon;
-
- feedItem.id = statement.getInt32(0);
- feedItem.guid = statement.getUTF8String(1);
- feedItem.name = statement.getUTF8String(2);
- feedItem.type = statement.getInt32(3);
- feedItem.version = statement.getUTF8String(4);
- feedItem.status = statement.getInt32(5);
- feedItem.summary = statement.getUTF8String(6);
- feedItem.description = statement.getUTF8String(7);
- feedItem.icon = statement.getUTF8String(8);
- feedItem.eula = statement.getUTF8String(9);
- feedItem.thumbnail = statement.getUTF8String(10);
- feedItem.learnmore = statement.getUTF8String(11);
- feedItem.author = statement.getUTF8String(12);
- feedItem.category = statement.getUTF8String(13);
- feedItem.dateAdded = new Date(statement.getInt32(14)*1000);
- feedItem.feedItemId = statement.getInt32(15);
- feedItem.read = (statement.getInt32(16)==1?true:false);
-
- feedItem.compatibleApplications = this._openFeedItemCompatibleApplications(feedItem);
- feedItem.compatibleOS = this._openFeedItemCompatibleOS(feedItem);
- feedItem.installs = this._openFeedItemInstalls(feedItem);
- feedItem.comments = this._openFeedItemComments(feedItem);
-
- feedItems[feedItem.guid] = feedItem;
- }
- }
- finally
- {
- statement.reset();
- }
-
- return feedItems;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleApplications = function(feedItem)
-{
- var compatibleApplications = {};
-
- var statement = this.connection.createStatement("SELECT * FROM addonCompatibleApplications WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, feedItem.id);
-
- while (statement.executeStep())
- {
- var application =
- {
- name: statement.getUTF8String(1).toString().toUpperCase(),
- applicationId: statement.getInt32(2),
- minVersion: statement.getUTF8String(3),
- maxVersion: statement.getUTF8String(4),
- guid: statement.getUTF8String(5)
- };
-
- compatibleApplications[application.name.toUpperCase()] = application;
- }
- }
- finally
- {
- statement.reset();
- }
-
- return compatibleApplications;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleOS = function(feedItem)
-{
- var compatibleOS = {};
-
- var statement = this.connection.createStatement("SELECT * FROM addonCompatibleOS WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, feedItem.id);
-
- while (statement.executeStep())
- {
- var os = statement.getUTF8String(1).toString().toUpperCase();
-
- compatibleOS[os] = os;
- }
- }
- finally
- {
- statement.reset();
- }
-
- return compatibleOS;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemInstalls = function(feedItem)
-{
- var installs = {};
-
- var statement = this.connection.createStatement("SELECT * FROM addonInstalls WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, feedItem.id);
-
- while (statement.executeStep())
- {
- var install =
- {
- url: statement.getUTF8String(1),
- hash: statement.getUTF8String(2),
- os: statement.getUTF8String(3).toString().toUpperCase()
- };
-
- installs[install.os] = install;
- }
- }
- finally
- {
- statement.reset();
- }
-
- return installs;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemComments = function(feedItem)
-{
- var comments = [];
-
- var statement = this.connection.createStatement("SELECT * FROM addonComments WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, feedItem.id);
-
- while (statement.executeStep())
- {
- var comment =
- {
- comment: statement.getUTF8String(1),
- author: statement.getUTF8String(2)
- };
-
- comments.push(comment);
- }
- }
- finally
- {
- statement.reset();
- }
-
- return comments;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedItem)
-{
- if (!this.connection)
- return;
-
- // addons
- // if guid already exists - just update the addon
- // if guid doesn't exist - insert
-
- var statement = this.connection.createStatement("SELECT id FROM addons where guid = ?1");
- var addonid = null;
-
- try
- {
- statement.bindUTF8StringParameter(0, feedItem.guid);
-
- while (statement.executeStep())
- {
- addonid = statement.getInt32(0);
- }
- }
- finally
- {
- statement.reset();
- }
-
- var statement2 = this.connection.createStatement("REPLACE INTO addons VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)");
-
- try
- {
- if (addonid != null)
- {
- // addon already exists (in another feed, or from previous commit of this feed)
- statement2.bindInt32Parameter(0, addonid);
- }
- else if (feedItem.id != -1)
- {
- // addon doesn't already exist, but exists from a previous commit of this feed (?)
- statement2.bindInt32Parameter(0, feedItem.id);
- }
- else
- {
- // new addon
- statement2.bindNullParameter(0)
- }
-
- statement2.bindUTF8StringParameter(1, feedItem.guid);
- statement2.bindUTF8StringParameter(2, feedItem.name);
- statement2.bindInt32Parameter(3, feedItem.type);
- statement2.bindUTF8StringParameter(4, feedItem.version);
- statement2.bindInt32Parameter(5, feedItem.status);
- statement2.bindUTF8StringParameter(6, feedItem.summary);
- statement2.bindUTF8StringParameter(7, feedItem.description);
- statement2.bindUTF8StringParameter(8, feedItem.icon);
- statement2.bindUTF8StringParameter(9, feedItem.eula);
- statement2.bindUTF8StringParameter(10, feedItem.thumbnail);
- statement2.bindUTF8StringParameter(11, feedItem.learnmore);
- statement2.bindUTF8StringParameter(12, feedItem.author);
- statement2.bindUTF8StringParameter(13, feedItem.category);
- statement2.bindUTF8StringParameter(14, feedItem.dateAdded.getTime()/1000);
-
- statement2.execute();
- }
- finally
- {
- statement2.reset();
- }
-
- if (feedItem.id == -1 && addonid == null)
- {
- addonid = this.connection.lastInsertRowID;
- }
-
- // add the other addon bits
-
- for (var id in feedItem.compatibleApplications)
- {
- this._commitAddonCompatibleApplication(addonid, feedItem.compatibleApplications[id]);
- }
-
- for (var id in feedItem.compatibleOS)
- {
- this._commitAddonCompatibleOS(addonid, feedItem.compatibleOS[id]);
- }
-
- for (var id in feedItem.installs)
- {
- this._commitAddonInstall(addonid, feedItem.installs[id]);
- }
-
- for (var i=0; i<feedItem.comments.length; i++)
- {
- this._commitAddonComment(addonid, feedItem.comments[i]);
- }
-
- // add the feedItem connector
-
- var statement3 = this.connection.createStatement("REPLACE INTO feedItems VALUES (?1, ?2, ?3, ?4)");
-
- try
- {
- if (feedItem.feedItemId == -1)
- {
- statement3.bindNullParameter(0);
- }
- else
- {
- statement3.bindInt32Parameter(0, feedItem.feedItemId);
- }
-
- statement3.bindInt32Parameter(1, feed.id);
- statement3.bindInt32Parameter(2, addonid);
- statement3.bindInt32Parameter(3, (feedItem.read?1:0));
-
- statement3.execute();
- }
- finally
- {
- statement3.reset();
- }
-
- if (feedItem.feedItemId == -1)
- {
- feedItem.feedItemId = this.connection.lastInsertRowID;
- }
-
- return true;
-}
-
-Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleApplication = function(addonid, application)
-{
- var statement = this.connection.createStatement("DELETE FROM addonCompatibleApplications WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, addonid);
- statement.execute();
- }
- finally
- {
- statement.reset();
- }
-
- var statement2 = this.connection.createStatement("INSERT INTO addonCompatibleApplications VALUES (?1, ?2, ?3, ?4, ?5, ?6)");
-
- try
- {
- statement2.bindInt32Parameter(0, addonid);
- statement2.bindUTF8StringParameter(1, application.name);
- statement2.bindInt32Parameter(2, application.applicationId);
- statement2.bindUTF8StringParameter(3, application.minVersion);
- statement2.bindUTF8StringParameter(4, application.maxVersion);
- statement2.bindUTF8StringParameter(5, application.guid);
-
- statement2.execute();
- }
- finally
- {
- statement2.reset();
- }
-}
-
-Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleOS = function(addonid, os)
-{
- var statement = this.connection.createStatement("DELETE FROM addonCompatibleOS WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, addonid);
- statement.execute();
- }
- finally
- {
- statement.reset();
- }
-
- var statement2 = this.connection.createStatement("INSERT INTO addonCompatibleOS VALUES (?1, ?2)");
-
- try
- {
- statement2.bindInt32Parameter(0, addonid);
- statement2.bindUTF8StringParameter(1, os);
-
- statement2.execute();
- }
- finally
- {
- statement2.reset();
- }
-}
-
-Bandwagon.Factory.FeedFactory.prototype._commitAddonInstall = function(addonid, install)
-{
- var statement = this.connection.createStatement("DELETE FROM addonInstalls WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, addonid);
- statement.execute();
- }
- finally
- {
- statement.reset();
- }
-
- var statement2 = this.connection.createStatement("INSERT INTO addonInstalls VALUES (?1, ?2, ?3, ?4)");
-
- try
- {
- statement2.bindInt32Parameter(0, addonid);
- statement2.bindUTF8StringParameter(1, install.url);
- statement2.bindUTF8StringParameter(2, install.hash);
- statement2.bindUTF8StringParameter(3, install.os);
-
- statement2.execute();
- }
- finally
- {
- statement2.reset();
- }
-}
-
-Bandwagon.Factory.FeedFactory.prototype._commitAddonComment = function(addonid, comment)
-{
- var statement = this.connection.createStatement("DELETE FROM addonComments WHERE addon = ?1");
-
- try
- {
- statement.bindInt32Parameter(0, addonid);
- statement.execute();
- }
- finally
- {
- statement.reset();
- }
-
- var statement2 = this.connection.createStatement("INSERT INTO addonComments VALUES (?1, ?2, ?3)");
-
- try
- {
- statement2.bindInt32Parameter(0, addonid);
- statement2.bindUTF8StringParameter(1, comment.comment);
- statement2.bindUTF8StringParameter(2, comment.author);
-
- statement2.execute();
- }
- finally
- {
- statement2.reset();
- }
-}
-
diff --git a/bandwagon/content/scripts/logger.js b/bandwagon/content/scripts/logger.js
index ce8d42c..b4393df 100644
--- a/bandwagon/content/scripts/logger.js
+++ b/bandwagon/content/scripts/logger.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
diff --git a/bandwagon/content/scripts/model/feedItem.js b/bandwagon/content/scripts/model/addon.js
index b71a592..5ef72b9 100644
--- a/bandwagon/content/scripts/model/feedItem.js
+++ b/bandwagon/content/scripts/model/addon.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -34,7 +34,7 @@
*
* ***** END LICENSE BLOCK ***** */
-Bandwagon.Model.FeedItem = function()
+Bandwagon.Model.Addon = function()
{
try
{
@@ -45,8 +45,8 @@ Bandwagon.Model.FeedItem = function()
this.TYPE_EXTENSION = 1;
this.STATUS_PUBLIC = 4;
- this.id = -1; // internal bandwagon addon id
- this.feedItemId = -1; // internal bandwagon feeditem id
+ this.storageID = -1;
+ this.collectionsAddonsStorageID = -1;
this.name = "";
this.type = -1;
@@ -65,12 +65,12 @@ Bandwagon.Model.FeedItem = function()
this.compatibleOS = {};
this.installs = {};
- this.author = "";
- this.category = "";
+ this.authors = {};
+ this.categories = {};
this.dateAdded = new Date();
this.comments = [];
- this.read = false; // has the user seen this add-on in the feeds pane
+ this.read = false; // has the user seen this add-on in the collections pane
this.notified = false; // have we notified the user that we have a new addon
// *** temp comment
@@ -78,13 +78,13 @@ Bandwagon.Model.FeedItem = function()
}
-Bandwagon.Model.FeedItem.INSTALL_YES = 1;
-Bandwagon.Model.FeedItem.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION = 2;
-Bandwagon.Model.FeedItem.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION = 3;
-Bandwagon.Model.FeedItem.INSTALL_NO_MUST_DOWNLOAD_BETA = 4;
-Bandwagon.Model.FeedItem.INSTALL_NO_NOT_COMPATIBLE_OS = 5;
+Bandwagon.Model.Addon.INSTALL_YES = 1;
+Bandwagon.Model.Addon.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION = 2;
+Bandwagon.Model.Addon.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION = 3;
+Bandwagon.Model.Addon.INSTALL_NO_MUST_DOWNLOAD_BETA = 4;
+Bandwagon.Model.Addon.INSTALL_NO_NOT_COMPATIBLE_OS = 5;
-Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
+Bandwagon.Model.Addon.prototype.canInstall = function(env)
{
// check is the extension compatible with this os
@@ -92,7 +92,7 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
{
var details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_NO_NOT_COMPATIBLE_OS,
+ type: Bandwagon.Model.Addon.INSTALL_NO_NOT_COMPATIBLE_OS,
requiredVersion: env.os
};
@@ -109,7 +109,7 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
var details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_NO_NOT_COMPATIBLE_OS,
+ type: Bandwagon.Model.Addon.INSTALL_NO_NOT_COMPATIBLE_OS,
requiredVersion: env.appName
};
@@ -130,7 +130,7 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
{
details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_NO_MUST_DOWNLOAD_BETA,
+ type: Bandwagon.Model.Addon.INSTALL_NO_MUST_DOWNLOAD_BETA,
requiredVersion: application.minVersion
};
}
@@ -138,7 +138,7 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
{
details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION,
+ type: Bandwagon.Model.Addon.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION,
requiredVersion: application.minVersion
};
}
@@ -152,7 +152,7 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
var details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION,
+ type: Bandwagon.Model.Addon.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION,
requiredVersion: application.maxVersion
};
@@ -163,17 +163,17 @@ Bandwagon.Model.FeedItem.prototype.canInstall = function(env)
var details =
{
- type: Bandwagon.Model.FeedItem.INSTALL_YES,
+ type: Bandwagon.Model.Addon.INSTALL_YES,
requiredVersion: ""
};
return details;
}
-Bandwagon.Model.FeedItem.prototype.getInstaller = function(os)
+Bandwagon.Model.Addon.prototype.getInstaller = function(os)
{
var install;
- var feedItem = this;
+ var addon = this;
os = os.toUpperCase();
@@ -193,19 +193,19 @@ Bandwagon.Model.FeedItem.prototype.getInstaller = function(os)
{
URL: install.url,
Hash: install.hash,
- IconURL: feedItem.icon,
+ IconURL: addon.icon,
toString: function () { return this.URL; }
};
return installer;
}
-Bandwagon.Model.FeedItem.prototype.toString = function()
+Bandwagon.Model.Addon.prototype.toString = function()
{
return this.name + " (" + this.guid + ")";
}
-Bandwagon.Model.FeedItem.prototype.equals = function(other)
+Bandwagon.Model.Addon.prototype.equals = function(other)
{
if (other == null)
return false;
@@ -213,7 +213,7 @@ Bandwagon.Model.FeedItem.prototype.equals = function(other)
return (this.guid == other.guid);
}
-Bandwagon.Model.FeedItem.prototype.unserialize = function(xaddon)
+Bandwagon.Model.Addon.prototype.unserialize = function(xaddon)
{
this.name = xaddon.name.text().toString();
this.type = xaddon.type.attribute("id").toString();
@@ -261,21 +261,28 @@ Bandwagon.Model.FeedItem.prototype.unserialize = function(xaddon)
this.compatibleApplications[application.name.toUpperCase()] = application;
}
- /* TODO feed is missing info for the following:
- *
- * - author
- * - category
- * - when added
- * - comments
- */
-
- if (xaddon.dateadded && xaddon.dateadded.text().toString() != "")
+ for each (var xauthor in xaddon.authors.author)
{
- this.dateAdded = new Date(xaddon.dateadded.text().toString());
+ this.authors[xauthor.text().toString()] = xauthor.text().toString();
}
- else if (this.dateAdded == null)
+
+ for each (var xcategory in xaddon.categories.category)
{
- this.dateAdded = new Date();
+ this.categories[xcategory.text().toString()] = xcategory.text().toString();
}
+
+ this.dateAdded = this.Bandwagon.Util.ISO8601toDate(xaddon.meta.added.text().toString());
+
+ this.comments = [];
+
+ var comment0Comment = xaddon.meta.comments.text().toString();
+ var comment0Author = xaddon.meta.addedby.text().toString();
+
+ if (!comment0Author.match(/\w/))
+ comment0Author = "Unknown";
+
+ if (comment0Comment.match(/\w/))
+ this.comments.push({comment: comment0Comment, author: comment0Author});
+
}
diff --git a/bandwagon/content/scripts/model/collection.js b/bandwagon/content/scripts/model/collection.js
new file mode 100644
index 0000000..a29df57
--- /dev/null
+++ b/bandwagon/content/scripts/model/collection.js
@@ -0,0 +1,211 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David McNamara
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Bandwagon.Model.Collection = function()
+{
+ this.Bandwagon = Bandwagon;
+
+ this.storageID = -1;
+ this.resourceURL = "";
+ this.addonsResourceURL = "";
+
+ this.name = "";
+ this.description = "";
+ this.creator = "";
+ this.listed = false;
+ this.writable = false;
+ this.subscribed = false;
+ this.lastModified = new Date();
+
+ this.password = null;
+ this.dateAdded = new Date();
+ this.dateLastCheck = null;
+ this.updateInterval = this.Bandwagon.DEFAULT_COLLECTION_UPDATE_INTERVAL; // in seconds
+ this.showNotifications = true;
+ this.autoPublish = false;
+ this.active = true;
+ this.addonsPerPage = this.Bandwagon.DEFAULT_ADDONS_PER_PAGE;
+
+ //this.preview = false;
+
+ this.status = this.STATUS_NEW;
+
+ this.addons = {};
+}
+
+Bandwagon.Model.Collection.prototype.STATUS_NEW = 0;
+Bandwagon.Model.Collection.prototype.STATUS_LOADING = 1;
+Bandwagon.Model.Collection.prototype.STATUS_LOADERROR = 2;
+Bandwagon.Model.Collection.prototype.STATUS_LOADED = 3;
+
+Bandwagon.Model.Collection.prototype.getUnreadAddons = function()
+{
+ var unreadAddons = [];
+
+ for (var id in this.addons)
+ {
+ if (!this.addons[id].read)
+ {
+ unreadAddons.push(this.addons[id]);
+ }
+ }
+
+ return unreadAddons;
+}
+
+Bandwagon.Model.Collection.prototype.setAllRead = function()
+{
+ for (var id in this.addons)
+ {
+ this.addons[id].read = true;
+ }
+}
+
+Bandwagon.Model.Collection.prototype.getUnnotifiedAddons = function()
+{
+ var unnotifiedAddons = [];
+
+ for (var id in this.addons)
+ {
+ if (!this.addons[id].notified)
+ {
+ unnotifiedAddons.push(this.addons[id]);
+ }
+ }
+
+ return unnotifiedAddons;
+}
+
+Bandwagon.Model.Collection.prototype.setAllNotified = function()
+{
+ for (var id in this.addons)
+ {
+ this.addons[id].notified = true;
+ }
+}
+
+Bandwagon.Model.Collection.prototype.getSortedAddons = function()
+{
+ var sortedAddons = [];
+
+ for (var id in this.addons)
+ {
+ sortedAddons.push(this.addons[id]);
+ }
+
+ sortedAddons.sort(function(a, b)
+ {
+ // sorting is unread, then dateadded
+
+ if (a.read == false && b.read == true ) return -1;
+ if (a.read == true && b.read == false ) return 1;
+
+ return (a.dateAdded.getTime() < b.dateAdded.getTime()?1:-1);
+ });
+
+ return sortedAddons;
+}
+
+Bandwagon.Model.Collection.prototype.hasAddon = function()
+{
+ for (var id in this.addons)
+ {
+ if (this.addons[id] && this.addons[id].guid)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+Bandwagon.Model.Collection.prototype.getNicknameFromName = function()
+{
+ return this.name.replace(/\W/g, "_");
+}
+
+Bandwagon.Model.Collection.prototype.toString = function()
+{
+ return this.name + " (" + this.resourceURL + ")";
+}
+
+Bandwagon.Model.Collection.prototype.equals = function(other)
+{
+ if (other == null)
+ return false;
+
+ return (this.resourceURL == other.resourceURL);
+}
+
+Bandwagon.Model.Collection.prototype.unserialize = function(xcollection)
+{
+ var xmlns = new Namespace('http://www.w3.org/XML/1998/namespace');
+ var baseURL = xcollection.@xmlns::base.toString();
+
+ //this.resourceURL = baseURL + "/" + xcollection.attribute("href").toString();
+
+ this.name = xcollection.attribute("name").toString();
+ this.description = xcollection.attribute("description").toString();
+ this.creator = xcollection.attribute("creator").toString();
+ this.listed = (xcollection.attribute("listed").toString()=="yes"?true:false);
+ this.writable = (xcollection.attribute("writable").toString()=="yes"?true:false);
+ this.subscribed = (xcollection.attribute("subscribed").toString()=="yes"?true:false);
+ this.lastModified = this.Bandwagon.Util.ISO8601toDate(xcollection.attribute("lastmodified").toString());
+
+ //this.addonsResourceURL = baseURL + "/" + xcollection.addons.attribute("href").toString();
+
+ for each (var xaddon in xcollection.addons.addon)
+ {
+ var addon = new this.Bandwagon.Model.Addon();
+ addon.Bandwagon = this.Bandwagon;
+
+ addon.unserialize(xaddon);
+
+ if (addon.guid && addon.guid != "" && addon.name && addon.name != "")
+ {
+ if (this.addons[addon.guid])
+ {
+ // "merge" with existing item
+ this.addons[addon.guid].unserialize(xaddon);
+ }
+ else
+ {
+ this.addons[addon.guid] = addon;
+ }
+ }
+ }
+}
+
diff --git a/bandwagon/content/scripts/model/feed.js b/bandwagon/content/scripts/model/feed.js
deleted file mode 100644
index 412ee4a..0000000
--- a/bandwagon/content/scripts/model/feed.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bandwagon.
- *
- * The Initial Developer of the Original Code is
- * David McNamara.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-Bandwagon.Model.Feed = function()
-{
- this.Bandwagon = Bandwagon;
-
- this.id = -1; // internal bandwagon id
-
- this.url = "";
- this.name = "";
- this.description = "";
- this.password = null;
- this.dateAdded = new Date();
- this.dateLastCheck = null;
- this.updateInterval = this.Bandwagon.DEFAULT_FEED_UPDATE_INTERVAL; // in seconds
- this.showNotifications = true;
- this.autoPublish = false;
- this.active = true;
- this.feedItemsPerPage = this.Bandwagon.DEFAULT_FEED_ITEMS_PER_PAGE;
-
- this.preview = false;
- this.editable = false;
- this.status = this.STATUS_NEW;
-
- this.feedItems = {};
-}
-
-Bandwagon.Model.Feed.prototype.STATUS_NEW = 0;
-Bandwagon.Model.Feed.prototype.STATUS_LOADING = 1;
-Bandwagon.Model.Feed.prototype.STATUS_LOADERROR = 2;
-Bandwagon.Model.Feed.prototype.STATUS_LOADED = 3;
-
-Bandwagon.Model.Feed.prototype.getUnreadFeedItems = function()
-{
- var unreadFeedItems = [];
-
- for (var id in this.feedItems)
- {
- if (!this.feedItems[id].read)
- {
- unreadFeedItems.push(this.feedItems[id]);
- }
- }
-
- return unreadFeedItems;
-}
-
-Bandwagon.Model.Feed.prototype.setAllRead = function()
-{
- for (var id in this.feedItems)
- {
- this.feedItems[id].read = true;
- }
-}
-
-Bandwagon.Model.Feed.prototype.getUnnotifiedFeedItems = function()
-{
- var unnotifiedFeedItems = [];
-
- for (var id in this.feedItems)
- {
- if (!this.feedItems[id].notified)
- {
- unnotifiedFeedItems.push(this.feedItems[id]);
- }
- }
-
- return unnotifiedFeedItems;
-}
-
-Bandwagon.Model.Feed.prototype.setAllNotified = function()
-{
- for (var id in this.feedItems)
- {
- this.feedItems[id].notified = true;
- }
-}
-
-Bandwagon.Model.Feed.prototype.getSortedFeedItems = function()
-{
- var sortedFeedItems = [];
-
- for (var id in this.feedItems)
- {
- sortedFeedItems.push(this.feedItems[id]);
- }
-
- sortedFeedItems.sort(function(a, b)
- {
- // sorting is unread, then dateadded
-
- if (a.read == false && b.read == true ) return -1;
- if (a.read == true && b.read == false ) return 1;
-
- return (a.dateAdded.getTime() < b.dateAdded.getTime()?1:-1);
- });
-
- return sortedFeedItems;
-}
-
-Bandwagon.Model.Feed.prototype.hasFeedItem = function()
-{
- for (var id in this.feedItems)
- {
- if (this.feedItems[id] && this.feedItems[id].guid)
- {
- return true;
- }
- }
-
- return false;
-}
-
-Bandwagon.Model.Feed.prototype.toString = function()
-{
- return this.name + " (" + this.url + ")";
-}
-
-Bandwagon.Model.Feed.prototype.equals = function(other)
-{
- if (other == null)
- return false;
-
- return (this.url == other.url);
-}
-
-Bandwagon.Model.Feed.prototype.unserialize = function(xaddons)
-{
- for each (var xaddon in xaddons.addon)
- {
- var feedItem = new this.Bandwagon.Model.FeedItem();
- feedItem.Bandwagon = this.Bandwagon;
-
- feedItem.unserialize(xaddon);
-
- if (feedItem.guid && feedItem.guid != "" && feedItem.name && feedItem.name != "")
- {
- if (this.feedItems[feedItem.guid])
- {
- // "merge" with existing item
- this.feedItems[feedItem.guid].unserialize(xaddon);
- }
- else
- {
- this.feedItems[feedItem.guid] = feedItem;
- }
- }
- }
-
- /* TODO feed is missing info for the following:
- *
- * - site url
- */
-
-}
diff --git a/bandwagon/content/scripts/model/serviceDocument.js b/bandwagon/content/scripts/model/serviceDocument.js
new file mode 100644
index 0000000..70ae5b3
--- /dev/null
+++ b/bandwagon/content/scripts/model/serviceDocument.js
@@ -0,0 +1,78 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David McNamara
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Bandwagon.Model.ServiceDocument = function()
+{
+ this.Bandwagon = Bandwagon;
+
+ this.emailResourceURL = "";
+ this.collectionListResourceURL = "";
+
+ this.collections = [];
+}
+
+Bandwagon.Model.ServiceDocument.prototype.unserialize = function(xsharing)
+{
+ var xmlns = new Namespace('http://www.w3.org/XML/1998/namespace');
+ var baseURL = xsharing.@xmlns::base.toString();
+
+ // resource urls
+
+ this.emailResourceURL = baseURL + "/" + xsharing.email.attribute("href").toString();
+ this.collectionListResourceURL = baseURL + "/" + xsharing.collections.attribute("href").toString();
+
+ // collections
+
+ for each (var xcollection in xsharing.collections.collection)
+ {
+ var collection = new this.Bandwagon.Model.Collection();
+ collection.Bandwagon = this.Bandwagon;
+
+ collection.resourceURL = baseURL + "/" + xcollection.attribute("href").toString();
+
+ collection.name = xcollection.attribute("name").toString();
+ collection.description = xcollection.attribute("description").toString();
+ collection.creator = xcollection.attribute("creator").toString();
+ collection.listed = (xcollection.attribute("listed").toString()=="yes"?true:false);
+ collection.writable = (xcollection.attribute("writable").toString()=="yes"?true:false);
+ collection.subscribed = (xcollection.attribute("subscribed").toString()=="yes"?true:false);
+ collection.lastModified = this.Bandwagon.Util.ISO8601toDate(xcollection.attribute("lastmodified").toString());
+
+ collection.addonsResourceURL = baseURL + "/" + xcollection.addons.attribute("href").toString();
+
+ this.collections.push(collection);
+ }
+}
diff --git a/bandwagon/content/scripts/rpc/constants.js b/bandwagon/content/scripts/rpc/constants.js
index 7f6e7da..7ecc85e 100644
--- a/bandwagon/content/scripts/rpc/constants.js
+++ b/bandwagon/content/scripts/rpc/constants.js
@@ -37,11 +37,14 @@
Bandwagon.RPC.Constants = new function()
{
- this.BANDWAGON_RPC_BASE_URL = "https://preview.addons.mozilla.org/en-US/";
- this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_ACTION = "firefox/api/recommend_email";
+ this.BANDWAGON_RPC_SERVICE_DOCUMENT = "https://bandwagon.stage.mozilla.com/en-US/firefox/api/1.3/sharing";
- this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_FEED_COMPLETE = 100;
- this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_COMPLETE = 200;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_SERVICE_DOCUMENT_COMPLETE = 100;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_COLLECTION_COMPLETE = 200;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_COMPLETE = 300;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_PUBLISH_COMPLETE = 400;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_REMOVE_ADDON_FROM_COLLECTION_COMPLETE = 500;
+ this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_NEW_COLLECTION_COMPLETE = 600;
// xhr layer constants
@@ -63,7 +66,7 @@ Bandwagon.RPC.Constants = new function()
this.BANDWAGON_RPC_SERVICE_ERROR_BAD_REQUEST = 1400; //400 BAD REQUEST = Invalid request URI or header, or unsupported nonstandard parameter.
this.BANDWAGON_RPC_SERVICE_ERROR_UNAUTHORIZED = 1401; //401 UNAUTHORIZED = Authorization required.
this.BANDWAGON_RPC_SERVICE_ERROR_FORBIDDEN = 1403; //403 FORBIDDEN = Unsupported standard parameter, or authentication or authorization failed.
- this.BANDWAGON_RPC_SERVICE_ERROR_NOT_FOUND = 1404; //404 NOT FOUND = Resource (such as a feed or entry) not found.
+ this.BANDWAGON_RPC_SERVICE_ERROR_NOT_FOUND = 1404; //404 NOT FOUND = Resource (such as a collection or entry) not found.
this.BANDWAGON_RPC_SERVICE_ERROR_CONFLICT = 1409; //409 CONFLICT = Specified version number doesn't match resource's latest version number.
this.BANDWAGON_RPC_SERVICE_ERROR_BAD_CONTEXT = 1422; //422 BAD CONTENT = The data within this entry's <content> is not valid. For example, this may indicate not "well-formed" XML
this.BANDWAGON_RPC_SERVICE_ERROR_INTERNAL_SERVER_ERROR = 1500; //500 INTERNAL SERVER ERROR = Internal error. This is the default code that is used for all unrecognized errors.
diff --git a/bandwagon/content/scripts/rpc/net.js b/bandwagon/content/scripts/rpc/net.js
index 82c712e..28c3340 100644
--- a/bandwagon/content/scripts/rpc/net.js
+++ b/bandwagon/content/scripts/rpc/net.js
@@ -117,9 +117,12 @@ Bandwagon.RPC.Net = function(Bandwagon, Components)
// parse xml here instead, put in response var
var xmlStr = rpcnetrequest.responseText;
- // workaround for E4X bug/feature
+ // workaround for E4X bugs/features
xmlStr = xmlStr.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551
+ //default xml namespace = 'http://addons.mozilla.org/';
+ xmlStr = xmlStr.replace(/xmlns="http:\/\/addons.mozilla.org\/"/, "");
+
response = new XML(xmlStr);
//rpcnet._logger.debug("Bandwagon.RPC.Net.send.onreadystatechange: ' + rpcnet.id + ': XML representation: '" + response.toXMLString() + "'");
@@ -257,10 +260,16 @@ Bandwagon.RPC.Net.prototype.setMethod = function(method)
{
this._method = 'POST';
}
- else
+ else if (method == 'DELETE')
+ {
+ this._method = 'DELETE';
+ }
+ else
{
this._method = 'GET';
}
+
+ this._method = method;
}
Bandwagon.RPC.Net.prototype.setCredentials = function(username, password)
diff --git a/bandwagon/content/scripts/rpc/service.js b/bandwagon/content/scripts/rpc/service.js
index 3d86270..dbf2eef 100644
--- a/bandwagon/content/scripts/rpc/service.js
+++ b/bandwagon/content/scripts/rpc/service.js
@@ -46,7 +46,8 @@ Bandwagon.RPC.Service = function()
// private instance variables
this._observers = new Array();
this._logger = null;
- this._serviceRootURL = this.Bandwagon.RPC.Constants.BANDWAGON_RPC_BASE_URL;
+ this._serviceDocument = null;
+ this._serviceRootURL = this.Bandwagon.RPC.Constants.BANDWAGON_RPC_SERVICE_DOCUMENT;
this.rpcComplete = function(rpcnet, result, response, type, callback)
{
@@ -119,6 +120,10 @@ Bandwagon.RPC.Service = function()
rpcnet.setMethod("POST");
rpcnet.setPostData(data);
}
+ else if (method == "DELETE")
+ {
+ rpcnet.setMethod("DELETE");
+ }
else
{
rpcnet.setMethod("GET");
@@ -189,30 +194,59 @@ Bandwagon.RPC.Service.prototype.unregisterObserver = function(observerId)
* Bandwagon Protocol Methods Below Here
*/
-Bandwagon.RPC.Service.prototype.getFeed = function(feed, callback)
+Bandwagon.RPC.Service.prototype.getServiceDocument = function(callback)
+{
+ var service = this;
+
+ this._logger.debug("Bandwagon.RPC.Service.getServiceDocument: getting service document for logged in user");
+
+ var internalCallback = function(event)
+ {
+ if (event.isError())
+ {
+ }
+ else
+ {
+ event.serviceDocument = new Bandwagon.Model.ServiceDocument();
+ event.serviceDocument.unserialize(event.getData());
+ }
+
+ if (callback)
+ {
+ callback(event);
+ }
+ }
+
+ this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_SERVICE_DOCUMENT_COMPLETE,
+ internalCallback,
+ service.Bandwagon.RPC.Constants.BANDWAGON_RPC_SERVICE_DOCUMENT,
+ "GET",
+ null);
+}
+
+Bandwagon.RPC.Service.prototype.getCollection = function(collection, callback)
{
var service = this;
- this._logger.debug("Bandwagon.RPC.Service.login: getting updates for feed '" + feed.url + "' ...");
+ this._logger.debug("Bandwagon.RPC.Service.getCollection: getting updates for collection '" + collection.toString() + "' ...");
- feed.status = feed.STATUS_LOADING;
+ collection.status = collection.STATUS_LOADING;
- // TODO feed.password handling goes here
var data = null;
var internalCallback = function(event)
{
if (event.isError())
{
- feed.status = feed.STATUS_LOADERROR;
+ collection.status = collection.STATUS_LOADERROR;
}
else
{
- feed.unserialize(event.getData());
- feed.status = feed.STATUS_LOADED;
+ collection.unserialize(event.getData());
+ collection.status = collection.STATUS_LOADED;
}
- event.feed = feed;
+ event.collection = collection;
if (callback)
{
@@ -220,53 +254,143 @@ Bandwagon.RPC.Service.prototype.getFeed = function(feed, callback)
}
}
- this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_FEED_COMPLETE,
+ this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_GET_COLLECTION_COMPLETE,
internalCallback,
- feed.url,
+ collection.resourceURL,
"GET",
data);
}
-Bandwagon.RPC.Service.prototype.subscribeFeed = function(feed, callback)
+Bandwagon.RPC.Service.prototype.newCollection = function(collection, callback)
+{
+ var service = this;
+
+ this._logger.debug("Bandwagon.RPC.Service.newCollection: creating new collection '" + collection.toString() + "' ...");
+
+ if (collection.name == "" || service._serviceDocument == null)
+ {
+ if (callback)
+ callback(new this.Bandwagon.RPC.Event());
+
+ return;
+ }
+
+ var data = {
+ name: collection.name,
+ description: collection.description,
+ nickname: collection.getNicknameFromName(),
+ listed: (collection.listed?1:0)
+ };
+
+ var internalCallback = function(event)
+ {
+ if (event.isError())
+ {
+ collection.status = collection.STATUS_LOADERROR;
+ }
+ else
+ {
+ collection.unserialize(event.getData());
+ collection.status = collection.STATUS_LOADED;
+ }
+
+ event.collection = collection;
+
+ if (callback)
+ {
+ callback(event);
+ }
+ }
+
+ this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_NEW_COLLECTION_COMPLETE,
+ internalCallback,
+ service._serviceDocument.collectionListResourceURL,
+ "POST",
+ data);
+}
+
+
+/** OBSOLETE
+Bandwagon.RPC.Service.prototype.subscribeCollection = function(collection, callback)
{
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.subscribeFeed: TBD");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.subscribeCollection: TBD");
// TODO
if (callback)
callback(new this.Bandwagon.RPC.Event());
}
+*/
-Bandwagon.RPC.Service.prototype.unsubscribeFeed = function(feed, callback)
+/** OBSOLETE
+Bandwagon.RPC.Service.prototype.unsubscribeCollection = function(collection, callback)
{
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.unsubscribeFeed: TBD");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.unsubscribeCollection: TBD");
// TODO
if (callback)
callback(new this.Bandwagon.RPC.Event());
}
+*/
-Bandwagon.RPC.Service.prototype.publishToFeed = function(extension, feed, personalNote, callback)
+Bandwagon.RPC.Service.prototype.removeAddonFromCollection = function(guid, collection, callback)
{
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToFeed: extension.guid = '" + extension.guid + "', extension.name = '" + extension.name + "', feed = '" + feed.url + "', personalNote = '" + personalNote + "'");
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToFeed: TBD");
+ var service = this;
- // TODO
+ if (guid.substring(0,1) == "{")
+ {
+ guid = guid.substring(1, guid.length-2);
+ }
- if (callback)
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.removeAddonFromCollection: extension.guid = '" + guid + "', collection = '" + collection.resourceURL);
+
+ var internalCallback = function(event)
+ {
+ // don't need to do anything here
+ if (callback)
+ callback(event);
+ }
+
+ this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_REMOVE_ADDON_FROM_COLLECTION_COMPLETE,
+ internalCallback,
+ collection.addonsResourceURL + guid,
+ "DELETE",
+ null);
+}
+
+Bandwagon.RPC.Service.prototype.publishToCollection = function(extension, collection, personalNote, callback)
+{
+ var service = this;
+
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToCollection: extension.guid = '" + extension.guid + "', extension.name = '" + extension.name + "', collection = '" + collection.resourceURL + "', personalNote = '" + personalNote + "'");
+
+ var data = {
+ "guid": extension.guid,
+ "comments": personalNote
+ };
+
+ var internalCallback = function(event)
{
- setTimeout(function() { callback(new this.Bandwagon.RPC.Event()) }, 2000);
+ // don't need to do anything here
+ if (callback)
+ callback(event);
}
+
+ this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_PUBLISH_COMPLETE,
+ internalCallback,
+ collection.addonsResourceURL,
+ "POST",
+ data);
}
Bandwagon.RPC.Service.prototype.shareToEmail = function(extension, emailAddress, personalNote, callback)
{
var service = this;
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToFeed: extension.guid = '" + extension.guid + "', extension.name = '" + extension.name + "', emailAddress = '" + emailAddress + "', personalNote = '" + personalNote + "'");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.shareToEmail: extension.guid = '" + extension.guid + "', extension.name = '" + extension.name + "', emailAddress = '" + emailAddress + "', personalNote = '" + personalNote + "'");
- if (!extension.guid || extension.guid == "" || !emailAddress || emailAddress == "")
+ if (!extension.guid || extension.guid == "" || !emailAddress || emailAddress == "" || service._serviceDocument == null)
{
if (callback)
callback(new this.Bandwagon.RPC.Event());
@@ -274,48 +398,22 @@ Bandwagon.RPC.Service.prototype.shareToEmail = function(extension, emailAddress,
return;
}
- var data = null;
-
var data = {
"guid": extension.guid,
- "emails[0]": emailAddress,
- "message": personalNote
+ "to": emailAddress,
+ "comments": personalNote
};
var internalCallback = function(event)
{
- if (!event.isError())
- {
- // check for service level errors
-
- var response = event.getData();
-
- // success has a body of "<success/>"
- // failure has a body e.g. "<error>Add-on not found!</error>"
-
- if (response.name() == "success")
- {
- // all ok
- }
- else if (response.name() == "error")
- {
- // "expected" error -- update the event to indicate this error
- event.setError(new service.Bandwagon.RPC.Error(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_SERVICE_ERROR, response.text().toString()));
- }
- else
- {
- // unknown response -- update the event to indicate an error
- event.setError(new service.Bandwagon.RPC.Error(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_SERVICE_ERROR_UNEXPECTED_XML));
- }
- }
-
+ // don't need to do anything here
if (callback)
callback(event);
}
this.rpcSend(service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_COMPLETE,
internalCallback,
- service.Bandwagon.RPC.Constants.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_ACTION,
+ service._serviceDocument.emailResourceURL,
"POST",
data);
}
diff --git a/bandwagon/content/scripts/util.js b/bandwagon/content/scripts/util.js
index 9dde8bb..8044f31 100644
--- a/bandwagon/content/scripts/util.js
+++ b/bandwagon/content/scripts/util.js
@@ -249,3 +249,47 @@ Bandwagon.Util.getInstalledExtensions = function()
return items;
}
+Bandwagon.Util.ISO8601toDate = function(dString)
+{
+ var x = new Date();
+
+ var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
+
+ if (dString.toString().match(new RegExp(regexp))) {
+ var d = dString.match(new RegExp(regexp));
+ var offset = 0;
+
+ x.setUTCDate(1);
+ x.setUTCFullYear(parseInt(d[1],10));
+ x.setUTCMonth(parseInt(d[3],10) - 1);
+ x.setUTCDate(parseInt(d[5],10));
+ x.setUTCHours(parseInt(d[7],10));
+ x.setUTCMinutes(parseInt(d[9],10));
+ x.setUTCSeconds(parseInt(d[11],10));
+ if (d[12])
+ x.setUTCMilliseconds(parseFloat(d[12]) * 1000);
+ else
+ x.setUTCMilliseconds(0);
+ if (d[13] != 'Z') {
+ offset = (d[15] * 60) + parseInt(d[17],10);
+ offset *= ((d[14] == '-') ? -1 : 1);
+ x.setTime(x.getTime() - offset * 60 * 1000);
+ }
+ }
+ else
+ {
+ x.setTime(Date.parse(dString));
+ }
+
+ return x;
+};
+
+Bandwagon.Util.getBrowserLocale = function()
+{
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefService);
+
+ return prefSvc.getCharPref("general.useragent.locale");
+};
+
+
diff --git a/bandwagon/content/ui/bindings/bandwagon.css b/bandwagon/content/ui/bindings/bandwagon.css
index 1d012cc..7bb9f18 100644
--- a/bandwagon/content/ui/bindings/bandwagon.css
+++ b/bandwagon/content/ui/bindings/bandwagon.css
@@ -1,13 +1,13 @@
-bandwagonFeedItem {
- -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-feeditem");
+bandwagonAddon {
+ -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-addon");
}
-bandwagonFeedItemExpanded {
- -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-feeditem-expanded");
+bandwagonAddonExpanded {
+ -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-addon-expanded");
}
-bandwagonFeed {
- -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-feed");
+bandwagonCollection {
+ -moz-binding: url("chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-collection");
}
bandwagonPublishButton {
diff --git a/bandwagon/content/ui/bindings/bandwagon.xml b/bandwagon/content/ui/bindings/bandwagon.xml
index 600d9f3..ac31bcf 100644
--- a/bandwagon/content/ui/bindings/bandwagon.xml
+++ b/bandwagon/content/ui/bindings/bandwagon.xml
@@ -44,7 +44,7 @@
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml">
- <binding id="bandwagon-feed" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
+ <binding id="bandwagon-collection" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<resources>
<stylesheet src="chrome://bandwagon/skin/extensionsOverlay.css"/>
@@ -59,13 +59,13 @@
</content>
<implementation>
- <field name="feed"/>
+ <field name="collection"/>
<field name="controller"/>
<constructor>
<![CDATA[
- if (this.feed)
- this.setFeed(this.feed);
+ if (this.collection)
+ this.setCollection(this.collection);
setTimeout(this.controller.bindingsReady, 100);
]]>
@@ -86,7 +86,7 @@
onset="this.setAttribute('preview', val);"
/>
- <property name="editable"
+ <property name="writable"
onget="return !document.getAnonymousElementByAttribute(this, 'anonid', 'star').collapsed;"
onset="document.getAnonymousElementByAttribute(this, 'anonid', 'star').collapsed = !val;"
/>
@@ -96,16 +96,16 @@
onset="document.getAnonymousElementByAttribute(this, 'anonid', 'unread').value = val; document.getAnonymousElementByAttribute(this, 'anonid', 'unread').collapsed = (val == 0);"
/>
- <method name="setFeed">
- <parameter name="feed"/>
+ <method name="setCollection">
+ <parameter name="collection"/>
<body>
<![CDATA[
- this.feed = feed;
- this.name = (feed.name && feed.name !=""?feed.name:feed.url);
- this.url = feed.url;
- this.preview = feed.preview;
- this.editable = feed.editable;
- this.unread = feed.getUnreadFeedItems().length;
+ this.collection = collection;
+ this.name = (collection.name && collection.name !=""?collection.name:collection.resourceURL);
+ this.url = collection.resourceURL;
+ this.preview = collection.preview;
+ this.writable = collection.writable;
+ this.unread = collection.getUnreadAddons().length;
]]>
</body>
</method>
@@ -114,14 +114,14 @@
</binding>
- <binding id="bandwagon-feeditem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
+ <binding id="bandwagon-addon" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<resources>
<stylesheet src="chrome://bandwagon/skin/extensionsOverlay.css"/>
</resources>
<content>
- <xul:stringbundle src="chrome://bandwagon/locale/bandwagonFeedItem.properties"
+ <xul:stringbundle src="chrome://bandwagon/locale/bandwagonAddon.properties"
anonid="stringbundle"/>
<xul:hbox flex="1">
@@ -144,13 +144,13 @@
</content>
<implementation>
- <field name="feedItem"/>
+ <field name="addon"/>
<field name="_stringBundle">document.getAnonymousElementByAttribute(this, "anonid", "stringbundle");</field>
<constructor>
<![CDATA[
- if (this.feedItem)
- this.setFeedItem(this.feedItem);
+ if (this.addon)
+ this.setAddon(this.addon);
]]>
</constructor>
@@ -197,15 +197,43 @@
</setter>
</property>
- <property name="author"
- onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'author')?document.getAnonymousElementByAttribute(this, 'anonid', 'author').value:'')"
- onset="if (document.getAnonymousElementByAttribute(this, 'anonid', 'author')) document.getAnonymousElementByAttribute(this, 'anonid', 'author').value = this._stringBundle.getFormattedString('bandwagon.feeditem.author', [val])"
- />
+ <property name="authors"
+ onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'author')?document.getAnonymousElementByAttribute(this, 'anonid', 'author').value:'')">
+ <setter>
+ <![CDATA[
+ if (document.getAnonymousElementByAttribute(this, 'anonid', 'authors'))
+ {
+ var authors = "";
+
+ if (!val || val.length == 0)
+ {
+ authors = "?";
+ }
+ else
+ {
+ for each (var item in val)
+ {
+ authors += item + ", ";
+ }
+ if (authors.substring(authors.length-2) == ", ")
+ {
+ authors = authors.substring(0, authors.length-2);
+ }
+ }
+
+ document.getAnonymousElementByAttribute(this, 'anonid', 'authors').value = this._stringBundle.getFormattedString('bandwagon.addon.author', [authors]);
+ }
+ ]]>
+ </setter>
+ </property>
+
+ <!--
<property name="category"
onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'category')?document.getAnonymousElementByAttribute(this, 'anonid', 'category').value:'')"
- onset="if (document.getAnonymousElementByAttribute(this, 'anonid', 'category')) document.getAnonymousElementByAttribute(this, 'anonid', 'category').value = this._stringBundle.getFormattedString('bandwagon.feeditem.category', [val])"
+ onset="if (document.getAnonymousElementByAttribute(this, 'anonid', 'category')) document.getAnonymousElementByAttribute(this, 'anonid', 'category').value = this._stringBundle.getFormattedString('bandwagon.addon.category', [val])"
/>
+ -->
<property name="read"
onget="return this.getAttribute('read')"
@@ -226,36 +254,36 @@
if (diff < 60)
{
- sbString = "bandwagon.feeditem.added.justnow";
+ sbString = "bandwagon.addon.added.justnow";
}
else if (diff < 60 * 60)
{
- sbString = "bandwagon.feeditem.added.minute";
+ sbString = "bandwagon.addon.added.minute";
sbVal = Math.ceil(diff/60);
}
else if (diff < 60 * 60 * 24)
{
- sbString = "bandwagon.feeditem.added.hour";
+ sbString = "bandwagon.addon.added.hour";
sbVal = Math.floor(diff/60/60);
}
else if (diff < 60 * 60 * 24 * 7)
{
- sbString = "bandwagon.feeditem.added.day";
+ sbString = "bandwagon.addon.added.day";
sbVal = Math.floor(diff/60/60/24);
}
else if (diff < 60 * 60 * 24 * 30)
{
- sbString = "bandwagon.feeditem.added.week";
+ sbString = "bandwagon.addon.added.week";
sbVal = Math.floor(diff/60/60/24/7);
}
else if (diff < 60 * 60 * 24 * 356)
{
- sbString = "bandwagon.feeditem.added.month";
+ sbString = "bandwagon.addon.added.month";
sbVal = Math.floor(diff/60/60/24/30);
}
else
{
- sbString = "bandwagon.feeditem.added.year";
+ sbString = "bandwagon.addon.added.year";
sbVal = Math.floor(diff/60/60/24/356);
}
@@ -284,31 +312,31 @@
>
<setter>
<![CDATA[
- if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').firstChild.nodeValue = this._stringBundle.getFormattedString('bandwagon.feeditem.comment.description', [val.comment]);
- if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor').value = this._stringBundle.getFormattedString('bandwagon.feeditem.comment.author', [val.author]);
+ if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').firstChild.nodeValue = this._stringBundle.getFormattedString('bandwagon.addon.comment.description', [val.comment]);
+ if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor').value = this._stringBundle.getFormattedString('bandwagon.addon.comment.author', [val.author]);
]]>
</setter>
</property>
- <method name="setFeedItem">
- <parameter name="feedItem"/>
+ <method name="setAddon">
+ <parameter name="addon"/>
<body>
<![CDATA[
- this.feedItem = feedItem;
- this.name = feedItem.name;
- this.guid = feedItem.guid;
- this.summary = feedItem.summary;
- this.description = feedItem.summary; // Use summary and not description
- this.iconURL = feedItem.icon;
- this.thumbnailURL = feedItem.thumbnail;
- this.author = (feedItem.author?feedItem.author:"Unknown");
- this.category = (feedItem.category?feedItem.category:"Unknown");
- this.dateAdded = feedItem.dateAdded;
- this.read = feedItem.read;
-
- if (feedItem.comments.length > 0)
+ this.addon = addon;
+ this.name = addon.name;
+ this.guid = addon.guid;
+ this.summary = addon.summary;
+ this.description = addon.summary; // Use summary and not description
+ this.iconURL = addon.icon;
+ this.thumbnailURL = addon.thumbnail;
+ this.authors = addon.authors;
+ //this.category = (addon.category?addon.category:"Unknown");
+ this.dateAdded = addon.dateAdded;
+ this.read = addon.read;
+
+ if (addon.comments.length > 0)
{
- this.comment = feedItem.comments[0];
+ this.comment = addon.comments[0];
}
else
{
@@ -319,7 +347,7 @@
}
}
- var canInstall = feedItem.canInstall(Bandwagon.Util.getHostEnvironmentInfo());
+ var canInstall = addon.canInstall(Bandwagon.Util.getHostEnvironmentInfo());
this.showVersionHelper(canInstall.type, canInstall.requiredVersion);
if (document.getAnonymousElementByAttribute(this, 'anonid', 'publish'))
@@ -339,7 +367,7 @@
if (publishButton)
{
publishButton.emailAddresses = Bandwagon.Controller.ExtensionsOverlay._getEmailAddresses();
- publishButton.writableFeeds = Bandwagon.Controller.ExtensionsOverlay._getWritableFeeds();
+ publishButton.writableCollections = Bandwagon.Controller.ExtensionsOverlay._getWritableCollections();
publishButton.invalidate();
}
]]>
@@ -354,44 +382,44 @@
if (document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox')
&& document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning'))
{
- if (type == Bandwagon.Model.FeedItem.INSTALL_YES)
+ if (type == Bandwagon.Model.Addon.INSTALL_YES)
{
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox').disabled = false;
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').collapsed = true;
}
else
{
- if (type == Bandwagon.Model.FeedItem.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION)
+ if (type == Bandwagon.Model.Addon.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION)
{
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(
- document.createTextNode(this._stringBundle.getString("bandwagon.feeditem.olderversionsoffirefox")));
+ document.createTextNode(this._stringBundle.getString("bandwagon.addon.olderversionsoffirefox")));
}
- else if (type == Bandwagon.Model.FeedItem.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION)
+ else if (type == Bandwagon.Model.Addon.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION)
{
var atffwl = document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarninglink');
- atffwl.value = this._stringBundle.getFormattedString("bandwagon.feeditem.upgradetofirefoxn1", [version]);
+ atffwl.value = this._stringBundle.getFormattedString("bandwagon.addon.upgradetofirefoxn1", [version]);
atffwl.collapsed = false;
- atffwl.addEventListener("click", function() { Bandwagon.Controller.FeedsPane.doUpgradeToFirefoxN(version); }, true);
+ atffwl.addEventListener("click", function() { Bandwagon.Controller.CollectionsPane.doUpgradeToFirefoxN(version); }, true);
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(
- document.createTextNode(this._stringBundle.getString("bandwagon.feeditem.upgradetofirefoxn2")));
+ document.createTextNode(this._stringBundle.getString("bandwagon.addon.upgradetofirefoxn2")));
}
- else if (type == Bandwagon.Model.FeedItem.INSTALL_NO_MUST_DOWNLOAD_BETA)
+ else if (type == Bandwagon.Model.Addon.INSTALL_NO_MUST_DOWNLOAD_BETA)
{
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(
- document.createTextNode(this._stringBundle.getFormattedString("bandwagon.feeditem.requiresfirefoxbeta1", [version])));
+ document.createTextNode(this._stringBundle.getFormattedString("bandwagon.addon.requiresfirefoxbeta1", [version])));
var atffwl = document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarninglink');
- atffwl.value = this._stringBundle.getFormattedString("bandwagon.feeditem.requiresfirefoxbeta2", [version]);
+ atffwl.value = this._stringBundle.getFormattedString("bandwagon.addon.requiresfirefoxbeta2", [version]);
atffwl.collapsed = false;
- atffwl.addEventListener("click", function() { Bandwagon.Controller.FeedsPane.doDownloadFirefoxNBeta(version); }, true);
+ atffwl.addEventListener("click", function() { Bandwagon.Controller.CollectionsPane.doDownloadFirefoxNBeta(version); }, true);
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(atffwl);
}
- else if (type == Bandwagon.Model.FeedItem.INSTALL_NO_NOT_COMPATIBLE_OS)
+ else if (type == Bandwagon.Model.Addon.INSTALL_NO_NOT_COMPATIBLE_OS)
{
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(
- document.createTextNode(this._stringBundle.getFormattedString("bandwagon.feeditem.notcompatible", [version])));
+ document.createTextNode(this._stringBundle.getFormattedString("bandwagon.addon.notcompatible", [version])));
}
document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox').disabled = true;
@@ -447,10 +475,10 @@
</implementation>
</binding>
- <binding id="bandwagon-feeditem-expanded" extends="chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-feeditem">
+ <binding id="bandwagon-addon-expanded" extends="chrome://bandwagon/content/ui/bindings/bandwagon.xml#bandwagon-addon">
<content>
- <xul:stringbundle src="chrome://bandwagon/locale/bandwagonFeedItem.properties"
+ <xul:stringbundle src="chrome://bandwagon/locale/bandwagonAddon.properties"
anonid="stringbundle"/>
<xul:hbox flex="1">
@@ -466,15 +494,17 @@
<xul:label anonid="dateadded"/>
</xul:hbox>
<xul:hbox anonid="byline" flex="1">
- <xul:label anonid="author"/>
+ <xul:label anonid="authors"/>
<xul:spacer flex="1"/>
- <xul:label anonid="category"/>
+ <!--<xul:label anonid="category"/>-->
</xul:hbox>
+ <xul:label anonid="commentauthor" flex="1"/>
+ <xul:description anonid="commentdesc"> </xul:description>
</xul:vbox>
</xul:hbox>
<xul:hbox align="stretch"
anonid="fulldesc"
- class="feed-item-details"
+ class="collection-item-details"
flex="1">
<xul:vbox pack="start">
<xul:hbox anonid="bandwagonThumbnailContainer"
@@ -485,15 +515,13 @@
</xul:hbox>
</xul:vbox>
<xul:vbox flex="1">
- <xul:description anonid="commentdesc"> </xul:description>
- <xul:label anonid="commentauthor" flex="1" class="right"/>
<xul:description anonid="description">
- <xul:label anonid="learnmore" class="text-link" value="&feeditem.moreinfo;" onclick="Bandwagon.Controller.FeedsPane.doMoreInfo()"/>
+ <xul:label anonid="learnmore" class="text-link" value="&addon.moreinfo;" onclick="Bandwagon.Controller.CollectionsPane.doMoreInfo()"/>
</xul:description>
<xul:spacer flex="1"/>
<xul:hbox pack="end" class="publishButton">
<xul:bandwagonPublishButton anonid="publish" label="&publishto.label;"/>
- <xul:button anonid="addtofirefox" label="&feeditem.addtofirefox;" oncommand="Bandwagon.Controller.FeedsPane.doAddToFirefox()"/>
+ <xul:button anonid="addtofirefox" label="&addon.addtofirefox;" oncommand="Bandwagon.Controller.CollectionsPane.doAddToFirefox()"/>
</xul:hbox>
<xul:description anonid="addtofirefoxwarning" class="right">
<xul:label anonid="addtofirefoxwarninglink" class="text-link" collapsed="true"/>
@@ -530,43 +558,32 @@
<content>
<xul:button label="&publishto.label;"
type="menu"
- anonid="publishButton1"
+ anonid="publishButton"
class="publishButton"
collapsed="true">
- <xul:menupopup anonid="writableFeeds">
- <!-- writable feeds go here -->
- <xul:menuseparator anonid="writableFeedSeparator"/>
- <xul:menu label="&email.address.label;" anonid="emailAddressMenu1">
- <xul:menupopup anonid="emailAddresses1">
+ <xul:menupopup anonid="writableCollections">
+ <!-- writable collections go here -->
+ <xul:menuitem label="&new.collection.label;" oncommand="Bandwagon.Controller.ExtensionsOverlay.doNewCollection();" anonid="newCollection"/>
+ <xul:menuseparator anonid="writableCollectionSeparator"/>
+ <xul:menu label="&email.address.label;" anonid="emailAddressMenu">
+ <xul:menupopup anonid="emailAddresses">
<!-- email addresses go here -->
- <xul:menuseparator anonid="emailAddressSeparator1"/>
+ <xul:menuseparator anonid="emailAddressSeparator"/>
<xul:menuitem label="&new.email.address.label;" oncommand="Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail();"/>
</xul:menupopup>
</xul:menu>
</xul:menupopup>
</xul:button>
- <xul:button label="&publishto.label;"
- type="menu"
- anonid="publishButton2"
- class="publishButton"
- collapsed="true">
- <xul:menupopup anonid="emailAddresses2">
- <!-- email addresses go here -->
- <xul:menuseparator anonid="emailAddressSeparator2"/>
- <xul:menuitem label="&new.email.address.label;"/>
- </xul:menupopup>
- </xul:button>
-
</content>
<implementation>
<field name="emailAddresses"/>
- <field name="writableFeeds"/>
+ <field name="writableCollections"/>
<constructor>
<![CDATA[
- if (this.emailAddresses && this.writableFeeds)
+ if (this.emailAddresses && this.writableCollections)
{
this.invalidate();
}
@@ -578,21 +595,18 @@
<![CDATA[
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var elemWritableFeedsPopup = document.getAnonymousElementByAttribute(this, "anonid", "writableFeeds");
- var elemWritableFeedSeparator = document.getAnonymousElementByAttribute(this, "anonid", "writableFeedSeparator");
- var elemEmailAddressesPopup1 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddresses1");
- var elemEmailAddressesPopup2 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddresses2");
- var elemEmailAddressSeparator1 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressSeparator1");
- var elemEmailAddressSeparator2 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressSeparator2");
- var elemEmailAddressMenu1 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressMenu1");
- var elemEmailAddressMenu2 = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressMenu2");
- var elemPublishButton1 = document.getAnonymousElementByAttribute(this, "anonid", "publishButton1");
- var elemPublishButton2 = document.getAnonymousElementByAttribute(this, "anonid", "publishButton2");
+ var elemWritableCollectionsPopup = document.getAnonymousElementByAttribute(this, "anonid", "writableCollections");
+ var elemWritableCollectionSeparator = document.getAnonymousElementByAttribute(this, "anonid", "writableCollectionSeparator");
+ var elemEmailAddressesPopup = document.getAnonymousElementByAttribute(this, "anonid", "emailAddresses");
+ var elemEmailAddressSeparator = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressSeparator");
+ var elemEmailAddressMenu = document.getAnonymousElementByAttribute(this, "anonid", "emailAddressMenu");
+ var elemPublishButton = document.getAnonymousElementByAttribute(this, "anonid", "publishButton");
+ var elemNewCollection = document.getAnonymousElementByAttribute(this, "anonid", "newCollection");
// populate the email address menu
- var activeEmailMenu = (this.writableFeeds.length==0?elemEmailAddressesPopup2:elemEmailAddressesPopup1);
- var activeEmailAddressSeparator = (this.writableFeeds.length==0?elemEmailAddressSeparator2:elemEmailAddressSeparator1);
+ var activeEmailMenu = elemEmailAddressesPopup;
+ var activeEmailAddressSeparator = elemEmailAddressSeparator;
if (this.emailAddresses.length)
{
@@ -621,40 +635,47 @@
activeEmailAddressSeparator.collapsed = true;
}
- if (this.writableFeeds.length)
+ // populate the collections menu
+
+ function createAddToCollectionCallbackFunction(collection)
{
- // populate the feeds menu
+ return function() { Bandwagon.Controller.ExtensionsOverlay.doPublishToCollection(collection); }
+ }
- function createFeedCallbackFunction(feed)
- {
- return function() { Bandwagon.Controller.ExtensionsOverlay.doPublishToFeed(feed); }
- }
+ function createRemoveFromCollectionCallbackFunction(collection)
+ {
+ return function() { Bandwagon.Controller.ExtensionsOverlay.doRemoveFromCollection(collection); }
+ }
- for (var i=0; i<this.writableFeeds.length; i++)
- {
- var feed = this.writableFeeds[i];
+ for (var i=0; i<this.writableCollections.length; i++)
+ {
+ var collection = this.writableCollections[i];
- if (document.getAnonymousElementByAttribute(this, "anonid", "bandwagon-feed-" + feed.url))
- continue;
+ if (document.getAnonymousElementByAttribute(this, "anonid", "bandwagon-collection-" + collection.resourceURL))
+ continue;
- var callback = createFeedCallbackFunction(feed);
+ var callbackAdd = createAddToCollectionCallbackFunction(collection);
+ var callbackRemove = createRemoveFromCollectionCallbackFunction(collection);
- var elemWritableFeed = document.createElementNS(XULNS, "menuitem");
- elemWritableFeed.setAttribute("label", (feed.name?feed.name:feed.url));
- elemWritableFeed.setAttribute("anonid", "bandwagon-feed-" + feed.url);
- elemWritableFeed.addEventListener("command", callback, true);
+ var elemWritableCollection = document.createElementNS(XULNS, "menuitem");
+ elemWritableCollection.setAttribute("label", (collection.name?collection.name:collection.resourceURL));
+ elemWritableCollection.setAttribute("anonid", "bandwagon-collection-" + collection.resourceURL);
- elemWritableFeedsPopup.insertBefore(elemWritableFeed, elemWritableFeedSeparator);
+ if (collection.__containsCurrentlySelectedExtension)
+ {
+ elemWritableCollection.setAttribute("checked", "true");
+ elemWritableCollection.setAttribute("autocheck", "false");
+ elemWritableCollection.addEventListener("command", callbackRemove, true);
+ }
+ else
+ {
+ elemWritableCollection.addEventListener("command", callbackAdd, true);
}
- elemPublishButton1.collapsed = false;
- elemPublishButton2.collapsed = true;
- }
- else
- {
- elemPublishButton1.collapsed = true;
- elemPublishButton2.collapsed = false;
+ elemWritableCollectionsPopup.insertBefore(elemWritableCollection, elemNewCollection);
}
+
+ elemPublishButton.collapsed = false;
]]>
</body>
</method>
diff --git a/bandwagon/content/ui/collectionsPaneController.js b/bandwagon/content/ui/collectionsPaneController.js
new file mode 100644
index 0000000..017e4fe
--- /dev/null
+++ b/bandwagon/content/ui/collectionsPaneController.js
@@ -0,0 +1,838 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David McNamara
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Bandwagon.Controller.CollectionsPane = new function()
+{
+ this.initialized = false;
+ this.initializedBindings = false;
+
+ this.preferredCollection = null;
+
+ this.elemBandwagonCollections = null;
+ this.elemBandwagonAddons = null;
+ this.elemBandwagonButtonViewSite = null;
+ //this.elemBandwagonButtonUpdate = null;
+ this.elemBandwagonButtonRemove = null;
+ this.elemBandwagonCollectionTitle = null;
+ this.elemBandwagonCollectionDescription = null;
+ this.elemBandwagonCollectionsNotification = null;
+ this.elemBandwagonCollectionDeck = null;
+ this.elemBandwagonCollectionHeader = null;
+ this.stringBundle = null;
+
+ //this.previewNotificationVal = "bandwagon-collection-preview";
+}
+
+Bandwagon.Controller.CollectionsPane.init = function()
+{
+ if (Bandwagon.Controller.CollectionsPane.initialized == true) return;
+
+ Bandwagon.Logger.debug("Initializing Bandwagon.Controller.CollectionsPane");
+
+ this.elemBandwagonCollections = document.getElementById("bandwagon-collections-list");
+ this.elemBandwagonAddons = document.getElementById("bandwagon-addons-list");
+ this.elemBandwagonButtonViewSite = document.getElementById("bandwagon-button-viewsite");
+ //this.elemBandwagonButtonUpdate = document.getElementById("bandwagon-button-update");
+ this.elemBandwagonButtonRemove = document.getElementById("bandwagon-button-remove");
+ this.elemBandwagonExtensionsDeck = document.getElementById("bandwagon-extensions-deck");
+ this.elemBandwagonCollectionTitle = document.getElementById("bandwagon-collection-title");
+ this.elemBandwagonCollectionDescription = document.getElementById("bandwagon-collection-description");
+ this.elemBandwagonCollectionsNotification = document.getElementById("bandwagon-collections-notification");
+ this.elemBandwagonCollectionDeck = document.getElementById("bandwagon-collection-deck");
+ this.elemBandwagonCollectionHeader = document.getElementById("bandwagon-collection-header");
+
+ Bandwagon.Controller.CollectionsPane._repopulateCollectionsList();
+ Bandwagon.Controller.CollectionsPane.invalidate();
+
+ this.elemBandwagonCollections.addEventListener("select", Bandwagon.Controller.CollectionsPane.doShowCollection, true);
+ this.elemBandwagonAddons.addEventListener("select", Bandwagon.Controller.CollectionsPane.doExpandAddon, true);
+
+ bandwagonService.registerCollectionUpdateObserver(Bandwagon.Controller.CollectionsPane.collectionUpdateObserver);
+ bandwagonService.registerCollectionListChangeObserver(Bandwagon.Controller.CollectionsPane.collectionListChangeObserver);
+
+ Bandwagon.Preferences.addObserver(Bandwagon.Controller.CollectionsPane.prefObserver);
+ Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService).addObserver(Bandwagon.Controller.CollectionsPane.prefObserver, "nsPref:changed", false);
+}
+
+/**
+ * Triggered when the user navigates to the collections pane from a different view in the extensions manager
+ */
+Bandwagon.Controller.CollectionsPane.onViewSelect = function()
+{
+ Bandwagon.Logger.debug("in Bandwagon.Controller.CollectionsPane.onViewSelect()");
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem != null)
+ {
+ // make sure the expanded collection item is scrolled into view
+ var elemsAddonExpanded = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.getElementsByTagName("bandwagonAddonExpanded");
+
+ if (elemsAddonExpanded && elemsAddonExpanded[0])
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.ensureElementIsVisible(elemsAddonExpanded[0]);
+ }
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.bindingsReady = function()
+{
+ // the bindings are ready, do any final initialization
+
+ if (Bandwagon.Controller.CollectionsPane.initializedBindings == false)
+ {
+ Bandwagon.Controller.CollectionsPane._selectPreferredCollection();
+ Bandwagon.Controller.CollectionsPane.initializedBindings = true;
+ }
+
+ Bandwagon.Controller.CollectionsPane.initialized = true;
+}
+
+Bandwagon.Controller.CollectionsPane.uninit = function()
+{
+ if (Bandwagon.Controller.CollectionsPane.initialized != true) return;
+
+ Bandwagon.Logger.debug("Uninitializing Bandwagon.Controller.CollectionsPane");
+
+ Bandwagon.Controller.CollectionsPane.initialized = false;
+
+ bandwagonService.unregisterCollectionUpdateObserver(Bandwagon.Controller.CollectionsPane.collectionUpdateObserver);
+ bandwagonService.unregisterCollectionListChangeObserver(Bandwagon.Controller.CollectionsPane.collectionListChangeObserver);
+
+ Bandwagon.Preferences.removeObserver(Bandwagon.Controller.CollectionsPane.prefObserver);
+
+ // now is a good time to save collections to storage
+ if (Bandwagon.COMMIT_NOW)
+ bandwagonService.commitAll();
+}
+
+/**
+ * Updates the interface disabled-ness based on the state of the selected collection, etc.
+ */
+Bandwagon.Controller.CollectionsPane.invalidate = function()
+{
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem == null)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonButtonViewSite.disabled = true;
+ //Bandwagon.Controller.CollectionsPane.elemBandwagonButtonUpdate.disabled = true;
+ Bandwagon.Controller.CollectionsPane.elemBandwagonButtonRemove.disabled = true;
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionHeader.collapsed = true;
+
+ Bandwagon.Controller.CollectionsPane._repopulateAddonsList(null);
+
+ Bandwagon.Controller.CollectionsPane._invalidateExtensionsDeck();
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonButtonViewSite.disabled = false;
+ //Bandwagon.Controller.CollectionsPane.elemBandwagonButtonUpdate.disabled = false;
+ Bandwagon.Controller.CollectionsPane.elemBandwagonButtonRemove.disabled = false;
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionHeader.collapsed = false;
+
+ var collection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+
+ if (collection.status == collection.STATUS_LOADING)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 1;
+ }
+ else if (collection.status == collection.STATUS_LOADERROR)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 3;
+ }
+ else if (collection.hasAddon() == 0)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 2;
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 0;
+ }
+ }
+}
+
+Bandwagon.Controller.CollectionsPane._invalidateExtensionsDeck = function()
+{
+ var elemsBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.getElementsByTagName("bandwagonCollection");
+
+ if (elemsBandwagonCollection.length == 0)
+ {
+ if (!bandwagonService.isAMOAuthenticated())
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonExtensionsDeck.selectedIndex = 2;
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonExtensionsDeck.selectedIndex = 1;
+ }
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonExtensionsDeck.selectedIndex = 0;
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.collectionListChangeObserver = function()
+{
+ Bandwagon.Logger.debug("In Bandwagon.Controller.CollectionsPane.collectionListChangeObserver()");
+
+ var prevCollection = null;
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem)
+ {
+ prevCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+ }
+
+ Bandwagon.Controller.CollectionsPane._repopulateCollectionsList();
+ Bandwagon.Controller.CollectionsPane._invalidateExtensionsDeck();
+
+ if (prevCollection != null)
+ {
+ Bandwagon.Controller.CollectionsPane._selectCollection(prevCollection);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.collectionUpdateObserver = function(collection)
+{
+ if (collection == null)
+ {
+ Bandwagon.Logger.debug("In Bandwagon.Controller.CollectionsPane.collectionUpdateObserver() with collection <null>");
+ }
+ else
+ {
+ Bandwagon.Logger.debug("In Bandwagon.Controller.CollectionsPane.collectionUpdateObserver() with collection '" + collection.toString() + "'");
+
+ // update the unread count for this collection
+
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var elemsBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.getElementsByTagNameNS(XULNS, "bandwagonCollection");
+
+ for (var i=0; i<elemsBandwagonCollection.length; i++)
+ {
+ if (elemsBandwagonCollection[i].collection.equals(collection))
+ {
+ elemsBandwagonCollection[i].unread = collection.getUnreadAddons().length;
+ break;
+ }
+ }
+
+ // if this collection is currently selected, update the view
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem && collection.equals(Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection))
+ {
+ Bandwagon.Controller.CollectionsPane._repopulateAddonsList(collection);
+
+ /* OBSOLETE
+ // if this is a just arrived collection preview, show the notification box
+ if (collection.preview)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.notificationsHidden = false;
+ setTimeout(Bandwagon.Controller.CollectionsPane._createPreviewNotification, 200);
+ }
+ */
+ }
+ }
+
+ Bandwagon.Controller.CollectionsPane.invalidate();
+}
+
+Bandwagon.Controller.CollectionsPane.doUpdateAll = function(event)
+{
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 1;
+
+ bandwagonService.forceCheckAllForUpdatesAndUpdateCollectionsList();
+}
+
+Bandwagon.Controller.CollectionsPane.doSubscribe = function(event)
+{
+ Bandwagon.Controller.CollectionsPane._openLocalizedURL(Bandwagon.COLLECTIONSPANE_DO_SUBSCRIBE_URL);
+}
+
+Bandwagon.Controller.CollectionsPane.doLogin = function(event)
+{
+ Bandwagon.Controller.CollectionsPane._openLocalizedURL(Bandwagon.COLLECTIONSPANE_DO_LOGIN_URL);
+}
+
+
+Bandwagon.Controller.CollectionsPane.doSettings = function(event)
+{
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefService);
+ var prefServiceCache = prefSvc.getBranch(null);
+ var instantApply = prefServiceCache.getBoolPref("browser.preferences.instantApply");
+ var flags = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
+
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var win = wm.getMostRecentWindow("Bandwagon:Settings");
+
+ if (win)
+ {
+ win.focus();
+ }
+ else
+ {
+ window.openDialog("chrome://bandwagon/content/ui/settings.xul",
+ "bandwagonsettings",
+ flags);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.doViewSite = function(event)
+{
+ // TODO use url from collection
+ Bandwagon.Controller.CollectionsPane._openURL("http://www.google.com/search?hl=en&q=bandwagon+view+site&btnG=Search");
+}
+
+Bandwagon.Controller.CollectionsPane.doUpdate = function(event)
+{
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem == null)
+ return;
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 1;
+
+ var collection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+
+ if (collection == null)
+ return;
+
+ bandwagonService.forceCheckForUpdates(collection);
+}
+
+Bandwagon.Controller.CollectionsPane.doRemove = function(event)
+{
+ // TODO
+ alert('TBD');
+}
+
+/** OBSOLETE
+Bandwagon.Controller.CollectionsPane.doRemove = function(event)
+{
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem == null)
+ return;
+
+ var collection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+
+ if (collection == null)
+ return;
+
+ bandwagonService.deleteCollection(collection);
+
+ if (!collection.preview)
+ bandwagonService.unsubscribe(collection);
+}
+*/
+
+Bandwagon.Controller.CollectionsPane.doShowCollection = function()
+{
+ var collection = null;
+
+ var selectedElemBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem;
+
+ if (selectedElemBandwagonCollection != null)
+ {
+ collection = selectedElemBandwagonCollection.collection;
+ }
+
+ // if collection == null, then display will be cleared
+
+ // misc. ui
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionTitle.setAttribute("value", (collection?(collection.name?collection.name:collection.resourceURL):""));
+
+ if (collection && collection.description != "")
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDescription.setAttribute("value", collection.description);
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDescription.removeAttribute("collsaped");
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDescription.setAttribute("collapsed", true);
+ }
+
+ /** OBSOLETE
+ // collection preview notification box
+ if (collection && collection.preview && collection.status != collection.STATUS_LOADING)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.notificationsHidden = false;
+
+ // this needs to be in a seperate thread
+ setTimeout(Bandwagon.Controller.CollectionsPane._createPreviewNotification, 500);
+ }
+ else
+ */
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.notificationsHidden = true;
+ }
+
+ // show items
+
+ Bandwagon.Controller.CollectionsPane._repopulateAddonsList(collection);
+
+ // invalidate
+
+ Bandwagon.Controller.CollectionsPane.invalidate();
+
+ // show the loading dialog if needed
+
+ if (collection && collection.status == collection.STATUS_LOADING)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 1;
+ }
+
+ // set all items in this collection to be "read"
+ // if we've just opened this dialog, don't update the read count
+
+ if (collection)
+ {
+ collection.setAllRead();
+
+ if (Bandwagon.Controller.CollectionsPane.initialized)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.unread = 0;
+ }
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.doExpandAddon = function(event)
+{
+ if (event)
+ event.preventDefault();
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem && Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem.nodeName == "bandwagonAddonExpanded")
+ {
+ return;
+ }
+
+ var elemsAddonExpanded = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.getElementsByTagName("bandwagonAddonExpanded");
+
+ for (var i=0; i<elemsAddonExpanded.length; i++)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.removeChild(elemsAddonExpanded[i]);
+ }
+
+ var elemsAddon = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.childNodes;
+
+ for (var i=0; i<elemsAddon.length; i++)
+ {
+ elemsAddon[i].collapsed = false;
+ }
+
+ var selectedElemBandwagonAddon = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem;
+
+ if (selectedElemBandwagonAddon != null && selectedElemBandwagonAddon.addon != null)
+ {
+ selectedElemBandwagonAddon.read = true;
+
+ var addon = selectedElemBandwagonAddon.addon;
+ addon.read = true;
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.unread = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection.getUnreadAddons().length;
+
+ // collapse this, show the expanded binding
+
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var elemBandwagonAddonExpanded = document.createElementNS(XULNS, "bandwagonAddonExpanded");
+
+ elemBandwagonAddonExpanded.addon = addon;
+
+ try
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddonExpanded.setAddon(addon);
+ } catch (e) {}
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.insertBefore(elemBandwagonAddonExpanded, selectedElemBandwagonAddon);
+
+ selectedElemBandwagonAddon.collapsed = true;
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.doMoreInfo = function(event)
+{
+ if (event)
+ event.preventDefault();
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonAddons == null)
+ return;
+
+ Bandwagon.Controller.CollectionsPane._openURL(Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem.addon.learnmore);
+}
+
+Bandwagon.Controller.CollectionsPane.doAddToFirefox = function()
+{
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem == null)
+ return;
+
+ var addon = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem.addon;
+
+ if (!isXPInstallEnabled())
+ return;
+
+ if (addon.eula && addon.eula != "")
+ {
+ var eula = {
+ name: addon.name,
+ text: addon.eula,
+ accepted: false
+ };
+
+ window.openDialog("chrome://mozapps/content/extensions/eula.xul", "_blank",
+ "chrome,dialog,modal,centerscreen,resizable=no", eula);
+
+ if (!eula.accepted)
+ return;
+ }
+
+ var installer = addon.getInstaller(Bandwagon.Util.getHostEnvironmentInfo().os);
+
+ if (!installer)
+ {
+ Bandwagon.Logger.warn("No compatible os targets found.");
+ return;
+ }
+
+ var params = [];
+ params[addon.name] = installer;
+
+ // TODO do some user collectionback here?
+
+ var callback = function(url, status)
+ {
+ Bandwagon.Logger.info("Finished installing '" + url + "'; status = " + status);
+
+ // TODO some user collectionback here?
+ }
+
+ InstallTrigger.install(params, callback);
+}
+
+Bandwagon.Controller.CollectionsPane.doUpgradeToFirefoxN = function(version)
+{
+ Bandwagon.Logger.info("in Bandwagon.Controller.CollectionsPane.doUpgradeToFirefoxN() with version = " + version);
+
+ Bandwagon.Controller.CollectionsPane._openURL("http://www.mozilla.com/en-US/firefox/all.html");
+}
+
+Bandwagon.Controller.CollectionsPane.doDownloadFirefoxNBeta = function(version)
+{
+ Bandwagon.Logger.info("in Bandwagon.Controller.CollectionsPane.doDownloadFirefoxNBeta() with version = " + version);
+
+ Bandwagon.Controller.CollectionsPane._openURL("http://www.mozilla.com/en-US/firefox/all-beta.html");
+}
+
+/** OBSOLETE
+Bandwagon.Controller.CollectionsPane.doShowCollectionPreview = function(collectionURL)
+{
+ // this is executed when the browser overlay controller opens the EM window to subscribe to a new collection.
+ // i.e. after a custom bandwagonSubscribe is detected and handled
+
+ Bandwagon.Logger.debug("In Bandwagon.Controller.CollectionsPane.doShowCollectionPreview() with collectionURL = " + collectionURL);
+
+ // check if we already have this collection
+
+ if (bandwagonService.collections[collectionURL])
+ {
+ var collection = bandwagonService.collections[collectionURL];
+ Bandwagon.Controller.CollectionsPane.preferredCollection = collection;
+ //Bandwagon.Controller.CollectionsPane._selectCollection(collection);
+ setTimeout(function() { Bandwagon.Controller.CollectionsPane._selectCollection(collection); }, 500);
+ return;
+ }
+
+ // add and select the collection
+
+ var collection = bandwagonService.addPreviewCollection(collectionURL);
+ //collection.status = collection.STATUS_LOADING;
+
+ Bandwagon.Controller.CollectionsPane.preferredCollection = collection;
+ setTimeout(function() { Bandwagon.Controller.CollectionsPane._selectCollection(collection); }, 500);
+}
+*/
+
+/** OBSOLETE
+Bandwagon.Controller.CollectionsPane._createPreviewNotification = function()
+{
+ if (!Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.getNotificationWithValue(Bandwagon.Controller.CollectionsPane.previewNotificationVal))
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.appendNotification
+ (
+ Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("collectionspane.this.is.only.a.preview"),
+ Bandwagon.Controller.CollectionsPane.previewNotificationVal,
+ null,
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionsNotification.PRIORITY_WARNING_MEDIUM,
+ [
+ {
+ accessKey: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("collectionspane.dont.subscribe.accesskey"),
+ callback: Bandwagon.Controller.CollectionsPane.doCollectionPreviewDontSubscribe,
+ label: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("collectionspane.dont.subscribe"),
+ popup: null
+ },
+ {
+ accessKey: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("collectionspane.subscribe.accesskey"),
+ callback: Bandwagon.Controller.CollectionsPane.doCollectionPreviewSubscribe,
+ label: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("collectionspane.subscribe"),
+ popup: null
+ }
+ ]
+ );
+ }
+}
+*/
+
+/** OBSOLETE
+Bandwagon.Controller.CollectionsPane.doCollectionPreviewDontSubscribe = function()
+{
+ Bandwagon.Logger.debug("in Bandwagon.Controller.CollectionsPane.doCollectionPreviewDontSubscribe()");
+
+ Bandwagon.Controller.CollectionsPane.preferredCollection = null;
+
+ Bandwagon.Controller.CollectionsPane.doRemove();
+}
+*/
+
+/** OBSOLETE
+Bandwagon.Controller.CollectionsPane.doCollectionPreviewSubscribe = function()
+{
+ Bandwagon.Logger.debug("in Bandwagon.Controller.CollectionsPane.doCollectionPreviewSubscribe()");
+
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem == null)
+ return;
+
+ var collection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+
+ if (collection == null)
+ return;
+
+ bandwagonService.subscribe(collection);
+
+ if (Bandwagon.COMMIT_NOW)
+ bandwagonService.commit(collection);
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.preview = false;
+ Bandwagon.Controller.CollectionsPane.doShowCollection();
+}
+*/
+
+/**
+ * Refreshes the collection pane
+ */
+Bandwagon.Controller.CollectionsPane.refresh = function()
+{
+ var selectedElemBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem;
+
+ if (selectedElemBandwagonCollection != null)
+ {
+ collection = selectedElemBandwagonCollection.collection;
+ Bandwagon.Controller.CollectionsPane._repopulateAddonsList(collection);
+ }
+
+ Bandwagon.Controller.CollectionsPane.invalidate();
+}
+
+Bandwagon.Controller.CollectionsPane.prefObserver =
+{
+ observe: function(subject, topic, data)
+ {
+ if (topic != "nsPref:changed")
+ return;
+
+ if (data.match(/addonsperpage/))
+ {
+ Bandwagon.Controller.CollectionsPane.refresh();
+ }
+ }
+}
+
+/**
+ * Function to select a collection ui programmatically based on its collection object.
+ */
+Bandwagon.Controller.CollectionsPane._selectCollection = function(collection)
+{
+ // select the collection and show (collection == null clears the selection)
+
+ if (collection == null)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.clearSelection();
+ Bandwagon.Controller.CollectionsPane.doShowCollection();
+ return;
+ }
+
+ // select the richlistitem
+
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ var elemsBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.getElementsByTagNameNS(XULNS, "bandwagonCollection");
+ var elemBandwagonCollection = null;
+
+ for (var i=0; i<elemsBandwagonCollection.length; i++)
+ {
+ if (elemsBandwagonCollection[i].collection.equals(collection))
+ {
+ elemBandwagonCollection = elemsBandwagonCollection[i];
+ break;
+ }
+ }
+
+ if (elemBandwagonCollection == null)
+ {
+ Bandwagon.Logger.warn("could not find a richlistitem to select");
+ return;
+ }
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectItem(elemBandwagonCollection);
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.ensureElementIsVisible(elemBandwagonCollection);
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.focus();
+}
+
+Bandwagon.Controller.CollectionsPane._selectPreferredCollection = function()
+{
+ // select a collection - last selected or the first one
+ var elemsBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.getElementsByTagName("bandwagonCollection");
+
+ if (Bandwagon.Controller.CollectionsPane.preferredCollection != null && bandwagonService.collections[Bandwagon.Controller.CollectionsPane.preferredCollection.resourceURL] != null)
+ {
+ Bandwagon.Logger.debug("selecting preferred collection (defined)");
+ Bandwagon.Controller.CollectionsPane._selectCollection(Bandwagon.Controller.CollectionsPane.preferredCollection);
+ }
+ else if (elemsBandwagonCollection.length > 0)
+ {
+ Bandwagon.Logger.debug("selecting preferred collection (the first in the list)");
+ Bandwagon.Controller.CollectionsPane._selectCollection(elemsBandwagonCollection[0].collection);
+ }
+ else
+ {
+ Bandwagon.Logger.debug("preferred collection is none");
+ Bandwagon.Controller.CollectionsPane._selectCollection(null);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane._repopulateCollectionsList = function()
+{
+ //Bandwagon.Logger.debug("Bandwagon.Controller.CollectionsPane: about to repopulate the collections list");
+
+ // first clear the list
+
+ while (Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.hasChildNodes())
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.removeChild(Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.firstChild);
+ }
+
+ // repopulate with collections
+
+ for (var id in bandwagonService.collections)
+ {
+ var collection = bandwagonService.collections[id];
+
+ if (collection == null)
+ return;
+
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var elemBandwagonCollection = document.createElementNS(XULNS, "bandwagonCollection");
+ elemBandwagonCollection.collection = collection;
+ elemBandwagonCollection.controller = Bandwagon.Controller.CollectionsPane;
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.appendChild(elemBandwagonCollection);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane._repopulateAddonsList = function(collection)
+{
+ // first clear the list
+
+ while (Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.hasChildNodes())
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.removeChild(Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.firstChild);
+ }
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.clearSelection();
+
+ if (collection == null)
+ return;
+
+ Bandwagon.Logger.debug("Bandwagon.Controller.CollectionsPane: repopulating collection '" + collection.resourceURL + "'");
+
+ // sort by addon.dateAdded
+
+ var addonsSorted = collection.getSortedAddons();
+
+ // repopulate with collection items
+
+ var addonsPerPage = bandwagonService.getAddonsPerPage(collection);
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ for (var i=0; (i<addonsSorted.length&&i<addonsPerPage); i++)
+ {
+ var addon = collection.addons[addonsSorted[i].guid];
+
+ if (addon == null)
+ continue;
+
+ var elemBandwagonAddon = document.createElementNS(XULNS, "bandwagonAddon");
+ elemBandwagonAddon.addon = addon;
+
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.appendChild(elemBandwagonAddon);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane._openURL = function(url)
+{
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var mainWindow = wm.getMostRecentWindow("navigator:browser");
+
+ if (mainWindow)
+ {
+ var tab = mainWindow.getBrowser().addTab(url);
+ mainWindow.getBrowser().selectedTab = tab;
+ mainWindow.focus();
+ }
+ else
+ {
+ window.open(url);
+ }
+}
+
+Bandwagon.Controller.CollectionsPane._openLocalizedURL = function(url)
+{
+ var locale = Bandwagon.Util.getBrowserLocale();
+
+ if (locale && locale != "")
+ url = url.replace(/en-US/, locale, "g");
+
+ Bandwagon.Controller.CollectionsPane._openURL(url);
+}
+
+// when this window closes, we do any uninit stuff
+
+window.addEventListener("unload", Bandwagon.Controller.CollectionsPane.uninit, true);
+
diff --git a/bandwagon/content/ui/dialog.js b/bandwagon/content/ui/dialog.js
index 33e635c..84d096f 100644
--- a/bandwagon/content/ui/dialog.js
+++ b/bandwagon/content/ui/dialog.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
diff --git a/bandwagon/content/ui/feedsPaneController.js b/bandwagon/content/ui/feedsPaneController.js
deleted file mode 100644
index af23cf7..0000000
--- a/bandwagon/content/ui/feedsPaneController.js
+++ /dev/null
@@ -1,779 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bandwagon.
- *
- * The Initial Developer of the Original Code is
- * David McNamara.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-Bandwagon.Controller.FeedsPane = new function()
-{
- this.initialized = false;
- this.initializedBindings = false;
-
- this.preferredFeed = null;
-
- this.elemBandwagonFeeds = null;
- this.elemBandwagonFeedItems = null;
- this.elemBandwagonButtonViewSite = null;
- this.elemBandwagonButtonUpdate = null;
- this.elemBandwagonButtonRemove = null;
- this.elemBandwagonFeedTitle = null;
- this.elemBandwagonFeedDescription = null;
- this.elemBandwagonFeedsNotification = null;
- this.elemBandwagonFeedDeck = null;
- this.elemBandwagonFeedHeader = null;
- this.stringBundle = null;
-
- this.previewNotificationVal = "bandwagon-feed-preview";
-}
-
-Bandwagon.Controller.FeedsPane.init = function()
-{
- if (Bandwagon.Controller.FeedsPane.initialized == true) return;
-
- Bandwagon.Logger.debug("Initializing Bandwagon.Controller.FeedsPane");
-
- this.elemBandwagonFeeds = document.getElementById("bandwagon-feeds-list");
- this.elemBandwagonFeedItems = document.getElementById("bandwagon-feeditems-list");
- this.elemBandwagonButtonViewSite = document.getElementById("bandwagon-button-viewsite");
- this.elemBandwagonButtonUpdate = document.getElementById("bandwagon-button-update");
- this.elemBandwagonButtonRemove = document.getElementById("bandwagon-button-remove");
- this.elemBandwagonFeedTitle = document.getElementById("bandwagon-feed-title");
- this.elemBandwagonFeedDescription = document.getElementById("bandwagon-feed-description");
- this.elemBandwagonFeedsNotification = document.getElementById("bandwagon-feeds-notification");
- this.elemBandwagonFeedDeck = document.getElementById("bandwagon-feed-deck");
- this.elemBandwagonFeedHeader = document.getElementById("bandwagon-feed-header");
-
- Bandwagon.Controller.FeedsPane._repopulateFeedsList();
- Bandwagon.Controller.FeedsPane.invalidate();
-
- this.elemBandwagonFeeds.addEventListener("select", Bandwagon.Controller.FeedsPane.doShowFeed, true);
- this.elemBandwagonFeedItems.addEventListener("select", Bandwagon.Controller.FeedsPane.doExpandFeedItem, true);
-
- bandwagonService.registerFeedUpdateObserver(Bandwagon.Controller.FeedsPane.feedUpdateObserver);
- bandwagonService.registerFeedListChangeObserver(Bandwagon.Controller.FeedsPane.feedListChangeObserver);
-
- Bandwagon.Preferences.addObserver(Bandwagon.Controller.FeedsPane.prefObserver);
- Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService).addObserver(Bandwagon.Controller.FeedsPane.prefObserver, "nsPref:changed", false);
-}
-
-/**
- * Triggered when the user navigates to the feeds pane from a different view in the extensions manager
- */
-Bandwagon.Controller.FeedsPane.onViewSelect = function()
-{
- Bandwagon.Logger.debug("in Bandwagon.Controller.FeedsPane.onViewSelect()");
-
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem != null)
- {
- // make sure the expanded feed item is scrolled into view
- var elemsFeedItemExpanded = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.getElementsByTagName("bandwagonFeedItemExpanded");
-
- if (elemsFeedItemExpanded && elemsFeedItemExpanded[0])
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.ensureElementIsVisible(elemsFeedItemExpanded[0]);
- }
- }
-}
-
-Bandwagon.Controller.FeedsPane.bindingsReady = function()
-{
- // the bindings are ready, do any final initialization
-
- if (Bandwagon.Controller.FeedsPane.initializedBindings == false)
- {
- Bandwagon.Controller.FeedsPane._selectPreferredFeed();
- Bandwagon.Controller.FeedsPane.initializedBindings = true;
- }
-
- Bandwagon.Controller.FeedsPane.initialized = true;
-}
-
-Bandwagon.Controller.FeedsPane.uninit = function()
-{
- if (Bandwagon.Controller.FeedsPane.initialized != true) return;
-
- Bandwagon.Logger.debug("Uninitializing Bandwagon.Controller.FeedsPane");
-
- Bandwagon.Controller.FeedsPane.initialized = false;
-
- bandwagonService.unregisterFeedUpdateObserver(Bandwagon.Controller.FeedsPane.feedUpdateObserver);
- bandwagonService.unregisterFeedListChangeObserver(Bandwagon.Controller.FeedsPane.feedListChangeObserver);
-
- Bandwagon.Preferences.removeObserver(Bandwagon.Controller.FeedsPane.prefObserver);
-
- // now is a good time to save feeds to storage
- if (Bandwagon.COMMIT_NOW)
- bandwagonService.commitAll();
-}
-
-/**
- * Updates the interface disabled-ness based on the state of the selected feed, etc.
- */
-Bandwagon.Controller.FeedsPane.invalidate = function()
-{
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem == null)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonViewSite.disabled = true;
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonUpdate.disabled = true;
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonRemove.disabled = true;
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedHeader.collapsed = true;
-
- Bandwagon.Controller.FeedsPane._repopulateFeedItemsList(null);
-
- var elemsBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed");
-
- if (elemsBandwagonFeed.length == 0)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 1;
- }
- else
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 0;
- }
- }
- else
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonViewSite.disabled = false;
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonUpdate.disabled = false;
- Bandwagon.Controller.FeedsPane.elemBandwagonButtonRemove.disabled = false;
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedHeader.collapsed = false;
-
- var feed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed;
-
- if (feed.status == feed.STATUS_LOADING)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 2;
- }
- else if (feed.status == feed.STATUS_LOADERROR)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 4;
- }
- else if (feed.hasFeedItem() == 0)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 3;
- }
- else
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 0;
- }
- }
-}
-
-Bandwagon.Controller.FeedsPane.feedListChangeObserver = function()
-{
- Bandwagon.Logger.debug("In Bandwagon.Controller.FeedsPane.feedListChangeObserver()");
-
- Bandwagon.Controller.FeedsPane._repopulateFeedsList();
- Bandwagon.Controller.FeedsPane._selectPreferredFeed();
-}
-
-Bandwagon.Controller.FeedsPane.feedUpdateObserver = function(feed)
-{
- if (feed == null)
- {
- Bandwagon.Logger.debug("In Bandwagon.Controller.FeedsPane.feedUpdateObserver() with feed <null>");
- }
- else
- {
- Bandwagon.Logger.debug("In Bandwagon.Controller.FeedsPane.feedUpdateObserver() with feed '" + feed.url + "'");
-
- // update the unread count for this feed
-
- const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var elemsBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.getElementsByTagNameNS(XULNS, "bandwagonFeed");
-
- for (var i=0; i<elemsBandwagonFeed.length; i++)
- {
- if (elemsBandwagonFeed[i].feed.equals(feed))
- {
- elemsBandwagonFeed[i].unread = feed.getUnreadFeedItems().length;
- break;
- }
- }
-
- // if this feed is currently selected, update the view
-
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem && feed.equals(Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed))
- {
- Bandwagon.Controller.FeedsPane._repopulateFeedItemsList(feed);
-
- // if this is a just arrived feed preview, show the notification box
- if (feed.preview)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.notificationsHidden = false;
- setTimeout(Bandwagon.Controller.FeedsPane._createPreviewNotification, 200);
- }
- }
- }
-
- Bandwagon.Controller.FeedsPane.invalidate();
-}
-
-Bandwagon.Controller.FeedsPane.doUpdateAll = function(event)
-{
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 2;
-
- bandwagonService.forceCheckAllForUpdates();
-}
-
-Bandwagon.Controller.FeedsPane.doSubscribe = function(event)
-{
- Bandwagon.Controller.FeedsPane._openURL(Bandwagon.FEEDSPANE_DO_SUBSCRIBE_URL);
-}
-
-Bandwagon.Controller.FeedsPane.doSettings = function(event)
-{
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefService);
- var prefServiceCache = prefSvc.getBranch(null);
- var instantApply = prefServiceCache.getBoolPref("browser.preferences.instantApply");
- var flags = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
-
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var win = wm.getMostRecentWindow("Bandwagon:Settings");
-
- if (win)
- {
- win.focus();
- }
- else
- {
- window.openDialog("chrome://bandwagon/content/ui/settings.xul",
- "bandwagonsettings",
- flags);
- }
-}
-
-Bandwagon.Controller.FeedsPane.doViewSite = function(event)
-{
- // TODO use url from feed
- Bandwagon.Controller.FeedsPane._openURL("http://www.google.com/search?hl=en&q=bandwagon+view+site&btnG=Search");
-}
-
-Bandwagon.Controller.FeedsPane.doUpdate = function(event)
-{
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem == null)
- return;
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 2;
-
- var feed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed;
-
- if (feed == null)
- return;
-
- bandwagonService.forceCheckForUpdates(feed);
-}
-
-Bandwagon.Controller.FeedsPane.doRemove = function(event)
-{
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem == null)
- return;
-
- var feed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed;
-
- if (feed == null)
- return;
-
- bandwagonService.deleteFeed(feed);
-
- if (!feed.preview)
- bandwagonService.unsubscribe(feed);
-}
-
-Bandwagon.Controller.FeedsPane.doShowFeed = function()
-{
- var feed = null;
-
- var selectedElemBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem;
-
- if (selectedElemBandwagonFeed != null)
- {
- feed = selectedElemBandwagonFeed.feed;
- }
-
- // if feed == null, then display will be cleared
-
- // misc. ui
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedTitle.setAttribute("value", (feed?(feed.name?feed.name:feed.url):""));
-
- if (feed && feed.description != "")
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDescription.setAttribute("value", feed.description);
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDescription.removeAttribute("collsaped");
- }
- else
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDescription.setAttribute("collapsed", true);
- }
-
- // feed preview notification box
-
- if (feed && feed.preview && feed.status != feed.STATUS_LOADING)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.notificationsHidden = false;
-
- // this needs to be in a seperate thread
- setTimeout(Bandwagon.Controller.FeedsPane._createPreviewNotification, 500);
- }
- else
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.notificationsHidden = true;
- }
-
- // show items
-
- Bandwagon.Controller.FeedsPane._repopulateFeedItemsList(feed);
-
- // invalidate
-
- Bandwagon.Controller.FeedsPane.invalidate();
-
- // show the loading dialog if needed
-
- if (feed && feed.status == feed.STATUS_LOADING)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedDeck.selectedIndex = 2;
- }
-
- // set all items in this feed to be "read"
- // if we've just opened this dialog, don't update the read count
-
- if (feed)
- {
- feed.setAllRead();
-
- if (Bandwagon.Controller.FeedsPane.initialized)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.unread = 0;
- }
- }
-}
-
-Bandwagon.Controller.FeedsPane.doExpandFeedItem = function(event)
-{
- if (event)
- event.preventDefault();
-
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem && Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem.nodeName == "bandwagonFeedItemExpanded")
- {
- return;
- }
-
- var elemsFeedItemExpanded = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.getElementsByTagName("bandwagonFeedItemExpanded");
-
- for (var i=0; i<elemsFeedItemExpanded.length; i++)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.removeChild(elemsFeedItemExpanded[i]);
- }
-
- var elemsFeedItem = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.childNodes;
-
- for (var i=0; i<elemsFeedItem.length; i++)
- {
- elemsFeedItem[i].collapsed = false;
- }
-
- var selectedElemBandwagonFeedItem = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem;
-
- if (selectedElemBandwagonFeedItem != null && selectedElemBandwagonFeedItem.feedItem != null)
- {
- selectedElemBandwagonFeedItem.read = true;
-
- var feedItem = selectedElemBandwagonFeedItem.feedItem;
- feedItem.read = true;
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.unread = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed.getUnreadFeedItems().length;
-
- // collapse this, show the expanded binding
-
- const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var elemBandwagonFeedItemExpanded = document.createElementNS(XULNS, "bandwagonFeedItemExpanded");
-
- elemBandwagonFeedItemExpanded.feedItem = feedItem;
-
- try
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItemExpanded.setFeedItem(feedItem);
- } catch (e) {}
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.insertBefore(elemBandwagonFeedItemExpanded, selectedElemBandwagonFeedItem);
-
- selectedElemBandwagonFeedItem.collapsed = true;
- }
-}
-
-Bandwagon.Controller.FeedsPane.doMoreInfo = function(event)
-{
- if (event)
- event.preventDefault();
-
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems == null)
- return;
-
- Bandwagon.Controller.FeedsPane._openURL(Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem.feedItem.learnmore);
-}
-
-Bandwagon.Controller.FeedsPane.doAddToFirefox = function()
-{
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem == null)
- return;
-
- var feedItem = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem.feedItem;
-
- if (!isXPInstallEnabled())
- return;
-
- if (feedItem.eula && feedItem.eula != "")
- {
- var eula = {
- name: feedItem.name,
- text: feedItem.eula,
- accepted: false
- };
-
- window.openDialog("chrome://mozapps/content/extensions/eula.xul", "_blank",
- "chrome,dialog,modal,centerscreen,resizable=no", eula);
-
- if (!eula.accepted)
- return;
- }
-
- var installer = feedItem.getInstaller(Bandwagon.Util.getHostEnvironmentInfo().os);
-
- if (!installer)
- {
- Bandwagon.Logger.warn("No compatible os targets found.");
- return;
- }
-
- var params = [];
- params[feedItem.name] = installer;
-
- // TODO do some user feedback here?
-
- var callback = function(url, status)
- {
- Bandwagon.Logger.info("Finished installing '" + url + "'; status = " + status);
-
- // TODO some user feedback here?
- }
-
- InstallTrigger.install(params, callback);
-}
-
-Bandwagon.Controller.FeedsPane.doUpgradeToFirefoxN = function(version)
-{
- Bandwagon.Logger.info("in Bandwagon.Controller.FeedsPane.doUpgradeToFirefoxN() with version = " + version);
-
- Bandwagon.Controller.FeedsPane._openURL("http://www.mozilla.com/en-US/firefox/all.html");
-}
-
-Bandwagon.Controller.FeedsPane.doDownloadFirefoxNBeta = function(version)
-{
- Bandwagon.Logger.info("in Bandwagon.Controller.FeedsPane.doDownloadFirefoxNBeta() with version = " + version);
-
- Bandwagon.Controller.FeedsPane._openURL("http://www.mozilla.com/en-US/firefox/all-beta.html");
-}
-
-Bandwagon.Controller.FeedsPane.doShowFeedPreview = function(feedURL)
-{
- // this is executed when the browser overlay controller opens the EM window to subscribe to a new feed.
- // i.e. after a custom bandwagonSubscribe is detected and handled
-
- Bandwagon.Logger.debug("In Bandwagon.Controller.FeedsPane.doShowFeedPreview() with feedURL = " + feedURL);
-
- // check if we already have this feed
-
- if (bandwagonService.feeds[feedURL])
- {
- var feed = bandwagonService.feeds[feedURL];
- Bandwagon.Controller.FeedsPane.preferredFeed = feed;
- //Bandwagon.Controller.FeedsPane._selectFeed(feed);
- setTimeout(function() { Bandwagon.Controller.FeedsPane._selectFeed(feed); }, 500);
- return;
- }
-
- // add and select the feed
-
- var feed = bandwagonService.addPreviewFeed(feedURL);
- //feed.status = feed.STATUS_LOADING;
-
- Bandwagon.Controller.FeedsPane.preferredFeed = feed;
- setTimeout(function() { Bandwagon.Controller.FeedsPane._selectFeed(feed); }, 500);
-}
-
-Bandwagon.Controller.FeedsPane._createPreviewNotification = function()
-{
- if (!Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.getNotificationWithValue(Bandwagon.Controller.FeedsPane.previewNotificationVal))
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.appendNotification
- (
- Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("feedspane.this.is.only.a.preview"),
- Bandwagon.Controller.FeedsPane.previewNotificationVal,
- null,
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedsNotification.PRIORITY_WARNING_MEDIUM,
- [
- {
- accessKey: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("feedspane.dont.subscribe.accesskey"),
- callback: Bandwagon.Controller.FeedsPane.doFeedPreviewDontSubscribe,
- label: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("feedspane.dont.subscribe"),
- popup: null
- },
- {
- accessKey: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("feedspane.subscribe.accesskey"),
- callback: Bandwagon.Controller.FeedsPane.doFeedPreviewSubscribe,
- label: Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("feedspane.subscribe"),
- popup: null
- }
- ]
- );
- }
-}
-
-Bandwagon.Controller.FeedsPane.doFeedPreviewDontSubscribe = function()
-{
- Bandwagon.Logger.debug("in Bandwagon.Controller.FeedsPane.doFeedPreviewDontSubscribe()");
-
- Bandwagon.Controller.FeedsPane.preferredFeed = null;
-
- Bandwagon.Controller.FeedsPane.doRemove();
-}
-
-Bandwagon.Controller.FeedsPane.doFeedPreviewSubscribe = function()
-{
- Bandwagon.Logger.debug("in Bandwagon.Controller.FeedsPane.doFeedPreviewSubscribe()");
-
- if (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem == null)
- return;
-
- var feed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.feed;
-
- if (feed == null)
- return;
-
- bandwagonService.subscribe(feed);
-
- if (Bandwagon.COMMIT_NOW)
- bandwagonService.commit(feed);
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem.preview = false;
- Bandwagon.Controller.FeedsPane.doShowFeed();
-}
-
-
-/**
- * Refreshes the feed pane
- */
-Bandwagon.Controller.FeedsPane.refresh = function()
-{
- var selectedElemBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectedItem;
-
- if (selectedElemBandwagonFeed != null)
- {
- feed = selectedElemBandwagonFeed.feed;
- Bandwagon.Controller.FeedsPane._repopulateFeedItemsList(feed);
- }
-
- Bandwagon.Controller.FeedsPane.invalidate();
-}
-
-Bandwagon.Controller.FeedsPane.prefObserver =
-{
- observe: function(subject, topic, data)
- {
- if (topic != "nsPref:changed")
- return;
-
- if (data.match(/feeditemsperpage/))
- {
- Bandwagon.Controller.FeedsPane.refresh();
- }
- }
-}
-
-/**
- * Function to select a feed ui programmatically based on its feed object.
- */
-Bandwagon.Controller.FeedsPane._selectFeed = function(feed)
-{
- // select the feed and show (feed == null clears the selection)
-
- if (feed == null)
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.clearSelection();
- Bandwagon.Controller.FeedsPane.doShowFeed();
- return;
- }
-
- // select the richlistitem
-
- const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
- var elemsBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.getElementsByTagNameNS(XULNS, "bandwagonFeed");
- var elemBandwagonFeed = null;
-
- for (var i=0; i<elemsBandwagonFeed.length; i++)
- {
- if (elemsBandwagonFeed[i].feed.equals(feed))
- {
- elemBandwagonFeed = elemsBandwagonFeed[i];
- break;
- }
- }
-
- if (elemBandwagonFeed == null)
- {
- Bandwagon.Logger.warn("could not find a richlistitem to select");
- return;
- }
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.selectItem(elemBandwagonFeed);
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.ensureElementIsVisible(elemBandwagonFeed);
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.focus();
-}
-
-Bandwagon.Controller.FeedsPane._selectPreferredFeed = function()
-{
- // select a feed - last selected or the first one
- var elemsBandwagonFeed = Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed");
-
- if (Bandwagon.Controller.FeedsPane.preferredFeed != null && bandwagonService.feeds[Bandwagon.Controller.FeedsPane.preferredFeed.url] != null)
- {
- Bandwagon.Logger.debug("selecting preferred feed (defined)");
- Bandwagon.Controller.FeedsPane._selectFeed(Bandwagon.Controller.FeedsPane.preferredFeed);
- }
- else if (elemsBandwagonFeed.length > 0)
- {
- Bandwagon.Logger.debug("selecting preferred feed (the first in the list)");
- Bandwagon.Controller.FeedsPane._selectFeed(elemsBandwagonFeed[0].feed);
- }
- else
- {
- Bandwagon.Logger.debug("preferred feed is none");
- Bandwagon.Controller.FeedsPane._selectFeed(null);
- }
-}
-
-Bandwagon.Controller.FeedsPane._repopulateFeedsList = function()
-{
- //Bandwagon.Logger.debug("Bandwagon.Controller.FeedsPane: about to repopulate the feeds list");
-
- // first clear the list
-
- while (Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.hasChildNodes())
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.removeChild(Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.firstChild);
- }
-
- // repopulate with feeds
-
- for (var id in bandwagonService.feeds)
- {
- var feed = bandwagonService.feeds[id];
-
- if (feed == null)
- return;
-
- const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var elemBandwagonFeed = document.createElementNS(XULNS, "bandwagonFeed");
- elemBandwagonFeed.feed = feed;
- elemBandwagonFeed.controller = Bandwagon.Controller.FeedsPane;
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeeds.appendChild(elemBandwagonFeed);
- }
-}
-
-Bandwagon.Controller.FeedsPane._repopulateFeedItemsList = function(feed)
-{
- // first clear the list
-
- while (Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.hasChildNodes())
- {
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.removeChild(Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.firstChild);
- }
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.clearSelection();
-
- if (feed == null)
- return;
-
- Bandwagon.Logger.debug("Bandwagon.Controller.FeedsPane: repopulating feed '" + feed.url + "'");
-
- // sort by feedItem.dateAdded
-
- var feedItemsSorted = feed.getSortedFeedItems();
-
- // repopulate with feed items
-
- var feedItemsPerPage = bandwagonService.getFeedItemsPerPage(feed);
- const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-
- for (var i=0; (i<feedItemsSorted.length&&i<feedItemsPerPage); i++)
- {
- var feedItem = feed.feedItems[feedItemsSorted[i].guid];
-
- if (feedItem == null)
- continue;
-
- var elemBandwagonFeedItem = document.createElementNS(XULNS, "bandwagonFeedItem");
- elemBandwagonFeedItem.feedItem = feedItem;
-
- Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.appendChild(elemBandwagonFeedItem);
- }
-}
-
-Bandwagon.Controller.FeedsPane._openURL = function(url)
-{
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var mainWindow = wm.getMostRecentWindow("navigator:browser");
-
- if (mainWindow)
- {
- var tab = mainWindow.getBrowser().addTab(url);
- mainWindow.getBrowser().selectedTab = tab;
- mainWindow.focus();
- }
- else
- {
- window.open(url);
- }
-}
-
-// when this window closes, we do any uninit stuff
-
-window.addEventListener("unload", Bandwagon.Controller.FeedsPane.uninit, true);
-
diff --git a/bandwagon/content/ui/overlays/browserOverlay.xul b/bandwagon/content/ui/overlays/browserOverlay.xul
index 619b97b..cb9d0e8 100644
--- a/bandwagon/content/ui/overlays/browserOverlay.xul
+++ b/bandwagon/content/ui/overlays/browserOverlay.xul
@@ -19,7 +19,7 @@
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- - Contributor(s): Brian King
+ - Contributor(s): Brian King <brian (at) briks (dot) si>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -35,6 +35,10 @@
-
- ***** END LICENSE BLOCK ***** -->
+<!DOCTYPE overlay SYSTEM "chrome://bandwagon/locale/browserOverlay.dtd" >
+
+<?xml-stylesheet href="chrome://bandwagon/skin/browserOverlay.css" type="text/css"?>
+
<overlay id="bandwagon-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@@ -47,9 +51,10 @@
<script src="chrome://bandwagon/content/scripts/rpc/error.js"/>
<script src="chrome://bandwagon/content/scripts/rpc/event.js"/>
<script src="chrome://bandwagon/content/scripts/rpc/net.js"/>
- <script src="chrome://bandwagon/content/scripts/model/feed.js"/>
- <script src="chrome://bandwagon/content/scripts/model/feedItem.js"/>
- <script src="chrome://bandwagon/content/scripts/factory/feedFactory.js"/>
+ <script src="chrome://bandwagon/content/scripts/model/serviceDocument.js"/>
+ <script src="chrome://bandwagon/content/scripts/model/collection.js"/>
+ <script src="chrome://bandwagon/content/scripts/model/addon.js"/>
+ <script src="chrome://bandwagon/content/scripts/factory/collectionFactory.js"/>
<script src="chrome://bandwagon/content/ui/overlays/browserOverlayController.js"/>
@@ -57,4 +62,13 @@
<stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/browserOverlay.properties"/>
</stringbundleset>
+ <!-- Firefox Toolbar -->
+ <toolbarpalette id="BrowserToolbarPalette">
+ <toolbarbutton id="extensions-bandwagon-button"
+ class="toolbarbutton-1 bandwagon-button"
+ oncommand="Bandwagon.Controller.BrowserOverlay.openAddons();"
+ tooltiptext="&bandwagon.tooltip;"
+ label="&bandwagon.label;" />
+ </toolbarpalette>
+
</overlay>
diff --git a/bandwagon/content/ui/overlays/browserOverlayController.js b/bandwagon/content/ui/overlays/browserOverlayController.js
index d2f3761..868ac37 100644
--- a/bandwagon/content/ui/overlays/browserOverlayController.js
+++ b/bandwagon/content/ui/overlays/browserOverlayController.js
@@ -14,11 +14,11 @@
* The Original Code is bandwagon.
*
* The Initial Developer of the Original Code is
- * David McNamara.
+ * Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s): David McNamara
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
+var bandwagonService;
+
Bandwagon.Controller.BrowserOverlay = new function() {}
Bandwagon.Controller.BrowserOverlay.initBandwagon = function()
@@ -44,7 +46,7 @@ Bandwagon.Controller.BrowserOverlay.initBandwagon = function()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var bandwagonService = Components.classes["@addons.mozilla.org/bandwagonservice;1"]
+ bandwagonService = Components.classes["@addons.mozilla.org/bandwagonservice;1"]
.getService().wrappedJSObject;
// We can safely call init() for each new browser window; the service
@@ -60,10 +62,44 @@ Bandwagon.Controller.BrowserOverlay.initBandwagon = function()
Bandwagon.Logger.error("Error initializing bandwagon: " + e);
}
+ /** OBSOLETE
// add listener to every page loaded in the browser - listen for our custom bandwagonSubscribe event
gBrowser.addEventListener("load", Bandwagon.Controller.BrowserOverlay.addSubscribeEventListenerToDocument, true);
+ */
+
+ gBrowser.addEventListener("load", Bandwagon.Controller.BrowserOverlay.addSubscriptionRefreshEventListenerToDocument, true);
+}
+
+Bandwagon.Controller.BrowserOverlay.addSubscriptionRefreshEventListenerToDocument = function(event)
+{
+ if (event.originalTarget instanceof HTMLDocument)
+ {
+ var doc = event.originalTarget;
+
+ if (event.originalTarget.defaultView.frameElement)
+ {
+ while (doc.defaultView.frameElement)
+ {
+ doc=doc.defaultView.frameElement.ownerDocument;
+ }
+ }
+
+ // TODO only add to AMO
+
+ doc.addEventListener("bandwagonRefresh", Bandwagon.Controller.BrowserOverlay.handleSubscriptionRefreshEvent, true);
+
+ Bandwagon.Logger.debug("added bandwagonRefresh listener");
+ }
}
+Bandwagon.Controller.BrowserOverlay.handleSubscriptionRefreshEvent = function(event)
+{
+ Bandwagon.Logger.info("Received bandwagon subscription refresh event");
+
+ bandwagonService.updateCollectionsList();
+}
+
+/** OBSOLETE
Bandwagon.Controller.BrowserOverlay.addSubscribeEventListenerToDocument = function(event)
{
if (event.originalTarget instanceof HTMLDocument)
@@ -83,24 +119,28 @@ Bandwagon.Controller.BrowserOverlay.addSubscribeEventListenerToDocument = functi
//Bandwagon.Logger.debug("added bandwagonSubscribe listener");
}
}
+*/
+/** OBSOLETE
Bandwagon.Controller.BrowserOverlay.handleSubscribeEvent = function(event)
{
if (event.target && event.target.getAttribute("href"))
{
- var feedURL = event.target.getAttribute("href");
+ var collectionURL = event.target.getAttribute("href");
- Bandwagon.Logger.info("Received subscribe event for feed: " + feedURL);
+ Bandwagon.Logger.info("Received subscribe event for collection: " + collectionURL);
- Bandwagon.Controller.BrowserOverlay._openExtensionManagerFeedsPaneWithSubscribe(feedURL);
+ Bandwagon.Controller.BrowserOverlay._openExtensionManagerCollectionsPaneWithSubscribe(collectionURL);
}
else
{
Bandwagon.Logger.error("Missing data payload in bandwagonSubscribe event");
}
}
+*/
-Bandwagon.Controller.BrowserOverlay._openExtensionManagerFeedsPaneWithSubscribe = function(feedURL)
+/** OBSOLETE
+Bandwagon.Controller.BrowserOverlay._openExtensionManagerCollectionsPaneWithSubscribe = function(collectionURL)
{
const EMTYPE = "Extension:Manager";
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
@@ -109,23 +149,24 @@ Bandwagon.Controller.BrowserOverlay._openExtensionManagerFeedsPaneWithSubscribe
if (theEM)
{
- // extensions manager window already open - focus, show feeds pane, call doShowFeedPreview
+ // extensions manager window already open - focus, show collections pane, call doShowCollectionPreview
theEM.focus();
- theEM.showView('bandwagon-feeds');
+ theEM.showView('bandwagon-collections');
- setTimeout(function() { Bandwagon.Controller.FeedsPane.doShowFeedPreview(feedURL); }, 500);
+ setTimeout(function() { Bandwagon.Controller.CollectionsPane.doShowCollectionPreview(collectionURL); }, 500);
}
else
{
- // extensions manager window NOT already open - open with 'subscribe' argument (this will show feeds pane, call doShowFeedPreview)
+ // extensions manager window NOT already open - open with 'subscribe' argument (this will show collection pane, call doShowCollectionPreview)
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
- window.openDialog(EMURL, "", EMFEATURES, {subscribe: feedURL});
+ window.openDialog(EMURL, "", EMFEATURES, {subscribe: collectionURL});
}
}
+*/
Bandwagon.Controller.BrowserOverlay._removeLoadListener = function()
{
@@ -144,18 +185,26 @@ Bandwagon.Controller.BrowserOverlay.openFirstRunLandingPage = function()
1000);
}
-Bandwagon.Controller.BrowserOverlay.showNewFeedItemsAlert = function(feed)
+/* Toolbar button action - Open add-ons window with Subscriptions tab focused */
+Bandwagon.Controller.BrowserOverlay.openAddons = function()
+{
+ const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
+ const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
+ window.openDialog(EMURL, "", EMFEATURES, "bandwagon-collections");
+}
+
+Bandwagon.Controller.BrowserOverlay.showNewAddonsAlert = function(collection)
{
- Bandwagon.Logger.debug("in showNewFeedItemsAlert()");
+ Bandwagon.Logger.debug("in showNewAddonsAlert()");
var bandwagonStrings = document.getElementById("bandwagon-strings");
var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
.getService(Components.interfaces.nsIAlertsService);
- var unnotifiedCount = feed.getUnnotifiedFeedItems().length;
- var feedName = (feed.name?feed.name:feed.url);
- var feedURL = feed.url;
+ var unnotifiedCount = collection.getUnnotifiedAddons().length;
+ var collectionName = (collection.name?collection.name:collection.resourceURL);
+ var collectionURL = collection.resourceURL;
var listener =
{
@@ -163,7 +212,7 @@ Bandwagon.Controller.BrowserOverlay.showNewFeedItemsAlert = function(feed)
{
if (topic == "alertclickcallback")
{
- var feedURL = data;
+ var collectionURL = data;
const EMTYPE = "Extension:Manager";
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
@@ -173,22 +222,22 @@ Bandwagon.Controller.BrowserOverlay.showNewFeedItemsAlert = function(feed)
if (theEM)
{
theEM.focus();
- theEM.showView('bandwagon-feeds');
+ theEM.showView('bandwagon-collections');
- // if the em is open, select the bandwagon-feeds pane, but don't select the feed itself.
+ // if the em is open, select the bandwagon-collections pane, but don't select the collection itself.
// the user will be notified by the unread count in the left hand side bar
- //theEM.setTimeout(function() { Bandwagon.Controller.FeedsPane._selectFeed(feed); }, 500);
+ //theEM.setTimeout(function() { Bandwagon.Controller.CollectionsPane._selectCollection(collection); }, 500);
}
else
{
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
- // the em is not open - open it, and select this feed
+ // the em is not open - open it, and select this collection
if (window)
- window.openDialog(EMURL, "", EMFEATURES, {selectFeed: feedURL});
+ window.openDialog(EMURL, "", EMFEATURES, {selectCollection: collectionURL});
else
Bandwagon.Logger.error("No browser windows open - can't open EM");
}
@@ -200,11 +249,11 @@ Bandwagon.Controller.BrowserOverlay.showNewFeedItemsAlert = function(feed)
try
{
alertsService.showAlertNotification(
- "chrome://bandwagon/skin/images/tango-addonfeed-32x32.png",
- bandwagonStrings.getString("newfeeditems.alert.title"),
- bandwagonStrings.getFormattedString("newfeeditems.alert.text", [feedName]),
+ "chrome://bandwagon/skin/images/icon32.png",
+ bandwagonStrings.getString("newaddons.alert.title"),
+ bandwagonStrings.getFormattedString("newaddons.alert.text", [collectionName]),
true,
- feedURL,
+ collectionURL,
listener
);
}
diff --git a/bandwagon/content/ui/overlays/extensionsOverlay.xul b/bandwagon/content/ui/overlays/extensionsOverlay.xul
index 0d679f1..6f546dc 100644
--- a/bandwagon/content/ui/overlays/extensionsOverlay.xul
+++ b/bandwagon/content/ui/overlays/extensionsOverlay.xul
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
@@ -15,11 +16,12 @@
- The Original Code is bandwagon.
-
- The Initial Developer of the Original Code is
- - David McNamara.
+ - Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- - Contributor(s): Brian King
+ - Contributor(s): David McNamara
+ - Brian King <brian (at) briks (dot) si>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -46,7 +48,7 @@
<script src="chrome://bandwagon/content/ui/dialog.js"/>
<script src="chrome://bandwagon/content/ui/overlays/extensionsOverlayController.js"/>
- <script src="chrome://bandwagon/content/ui/feedsPaneController.js"/>
+ <script src="chrome://bandwagon/content/ui/collectionsPaneController.js"/>
<stringbundleset>
<stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/extensionOverlay.properties"/>
@@ -55,10 +57,10 @@
<stack id="topStackBar">
<radiogroup id="viewGroup">
- <radio id="bandwagon-feeds-view"
- label="&feeds.label;"
+ <radio id="bandwagon-collections-view"
+ label="&collections.label;"
insertbefore="extensions-view"
- oncommand="showView('bandwagon-feeds');"
+ oncommand="showView('bandwagon-collections');"
persist="last-selected"/>
<radio id="search-view"
label="&search.label.bandwagon;"
@@ -69,65 +71,89 @@
</stack>
<vbox id="extensionsBox">
- <hbox id="bandwagon-feeds-panel" hidden="true" flex="1">
- <vbox id="bandwagon-feeds-list-box" persist="width">
- <richlistbox id="bandwagon-feeds-list"
- seltype="single"
- style="min-width: 14em; width: 16em; max-width: 36em;"
- flex="1"/>
- <toolbox class="bandwagon-feeds-toolbox">
- <toolbar pack="start"
- align="center">
- <toolbarbutton id="bandwagon-button-subscribe"
- tooltiptext="&subscribe.label;"
- oncommand="Bandwagon.Controller.FeedsPane.doSubscribe();"/>
- <toolbarbutton id="bandwagon-button-update-all"
- tooltiptext="&reload.label;"
- oncommand="Bandwagon.Controller.FeedsPane.doUpdateAll();"/>
- <toolbarbutton id="bandwagon-button-settings"
- tooltiptext="&settings.label;"
- oncommand="Bandwagon.Controller.FeedsPane.doSettings();"/>
- </toolbar>
- </toolbox>
- </vbox>
- <splitter id="bandwagon-sidebar-splitter" />
- <notificationbox flex="1" id="bandwagon-feeds-notification">
- <toolbox class="bandwagon-feeds-toolbox">
- <toolbar pack="end">
- <button id="bandwagon-button-viewsite" label="&viewsite.label;" oncommand="Bandwagon.Controller.FeedsPane.doViewSite();"/>
- <button id="bandwagon-button-update" label="&update.label;" oncommand="Bandwagon.Controller.FeedsPane.doUpdate();"/>
- <button id="bandwagon-button-remove" label="&remove.label;" oncommand="Bandwagon.Controller.FeedsPane.doRemove();"/>
- </toolbar>
- </toolbox>
- <vbox id="bandwagon-feed-header">
- <label id="bandwagon-feed-title"/>
- <label id="bandwagon-feed-description"/>
- </vbox>
- <deck id="bandwagon-feed-deck" selectedIndex="0" flex="1">
- <hbox flex="1">
- <richlistbox id="bandwagon-feeditems-list"
+ <vbox id="bandwagon-collections-panel" hidden="true" flex="1">
+ <deck id="bandwagon-extensions-deck" flex="1">
+ <hbox id="bandwagon-subscriptions-panel" flex="1">
+ <vbox id="bandwagon-collections-list-box" persist="width">
+ <richlistbox id="bandwagon-collections-list"
seltype="single"
+ style="min-width: 14em; width: 16em; max-width: 36em;"
flex="1"/>
- </hbox>
- <vbox flex="1" align="center" pack="center">
- <label value="&nofeedssubscribed.label;"/>
- <button label="&clicktosubscribe.label;" oncommand="Bandwagon.Controller.FeedsPane.doSubscribe();"/>
- </vbox>
- <vbox flex="1" align="center" pack="center">
- <label class="userfeedback" value="&feedisloading.label;"/>
- <image src="chrome://bandwagon/skin/images/spinner.gif"/>
- </vbox>
- <vbox flex="1" align="center" pack="center">
- <image src="chrome://bandwagon/skin/images/information.png"/>
- <label class="userfeedback" value="&feedhasnoitems.label;"/>
+ <toolbox class="bandwagon-collections-toolbox">
+ <toolbar pack="start"
+ align="center">
+ <toolbarbutton id="bandwagon-button-subscribe"
+ tooltiptext="&subscribe.label;"
+ oncommand="Bandwagon.Controller.CollectionsPane.doSubscribe();"/>
+ <toolbarbutton id="bandwagon-button-update-all"
+ tooltiptext="&reload.label;"
+ oncommand="Bandwagon.Controller.CollectionsPane.doUpdateAll();"/>
+ <toolbarbutton id="bandwagon-button-settings"
+ tooltiptext="&settings.label;"
+ oncommand="Bandwagon.Controller.CollectionsPane.doSettings();"/>
+ </toolbar>
+ </toolbox>
</vbox>
- <vbox flex="1" align="center" pack="center">
- <image src="chrome://bandwagon/skin/images/error.png"/>
- <label class="userfeedback" value="&feedhaserror.label;"/>
- </vbox>
- </deck>
- </notificationbox>
- </hbox>
+ <splitter id="bandwagon-sidebar-splitter" />
+ <notificationbox flex="1" id="bandwagon-collections-notification">
+ <hbox pack="end">
+ <label id="bandwagon-button-viewsite"
+ value="&view.label;"
+ class="text-link"
+ onclick="Bandwagon.Controller.CollectionsPane.doViewSite();"/>
+ <separator id="bandwagon-link-splitter"/>
+ <label id="bandwagon-button-remove"
+ value="&unsubscribe.label;"
+ class="text-link"
+ onclick="Bandwagon.Controller.CollectionsPane.doRemove();"/>
+ </hbox>
+ <vbox id="bandwagon-collection-header">
+ <label id="bandwagon-collection-title"/>
+ <label id="bandwagon-collection-description"/>
+ </vbox>
+ <deck id="bandwagon-collection-deck" selectedIndex="0" flex="1">
+ <hbox flex="1">
+ <richlistbox id="bandwagon-addons-list"
+ seltype="single"
+ flex="1"/>
+ </hbox>
+ <vbox flex="1" align="center" pack="center">
+ <label class="usercollectionback" value="&collectionisloading.label;"/>
+ <image src="chrome://bandwagon/skin/images/spinner.gif"/>
+ </vbox>
+ <vbox flex="1" align="center" pack="center">
+ <image src="chrome://bandwagon/skin/images/information.png"/>
+ <label class="usercollectionback" value="&collectionhasnoitems.label;"/>
+ </vbox>
+ <vbox flex="1" align="center" pack="center">
+ <image src="chrome://bandwagon/skin/images/error.png"/>
+ <label class="usercollectionback" value="&collectionhaserror.label;"/>
+ </vbox>
+ </deck>
+ </notificationbox>
+ </hbox>
+ <vbox id="nosubs-box" class="fs-info-panel" flex="1" >
+ <label id="nosubs-header" class="fs-info-panel-header" value="&nocollectionstitle.label;"/>
+ <separator/>
+ <description class="fs-info-panel-text">&nocollectionssubscribed.label;</description>
+ <separator/>
+ <hbox pack="center">
+ <button label="&clicktosubscribe.label;"
+ oncommand="Bandwagon.Controller.CollectionsPane.doSubscribe();"/>
+ </hbox>
+ </vbox>
+ <vbox id="no-amo-auth-box" class="fs-info-panel" flex="1" >
+ <label id="no-amo-auth-header" class="fs-info-panel-header" value="&nocollectionstitle.label;"/>
+ <separator/>
+ <description class="fs-info-panel-text">&noamoauth.label;</description>
+ <separator/>
+ <hbox pack="center">
+ <button label="&clicktologin.label;"
+ oncommand="Bandwagon.Controller.CollectionsPane.doLogin();"/>
+ </hbox>
+ </vbox>
+ </deck>
+ </vbox>
</vbox>
</overlay>
diff --git a/bandwagon/content/ui/overlays/extensionsOverlayController.js b/bandwagon/content/ui/overlays/extensionsOverlayController.js
index 3cb08b5..a1faac0 100644
--- a/bandwagon/content/ui/overlays/extensionsOverlayController.js
+++ b/bandwagon/content/ui/overlays/extensionsOverlayController.js
@@ -19,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): David McNamara
- * Brian King
+ * Brian King <brian (at) briks (dot) si>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -54,7 +54,7 @@ Bandwagon.Controller.ExtensionsOverlay.init = function()
// So lets hackily hide ours in that circumstance
var extView = document.getElementById("extensions-view");
- var bfv = document.getElementById("bandwagon-feeds-view");
+ var bfv = document.getElementById("bandwagon-collections-view");
var lsi = extView.ownerDocument.defaultView.getComputedStyle( extView, '' ).getPropertyCSSValue("list-style-image").cssText;
if (lsi == "none")
@@ -82,29 +82,32 @@ Bandwagon.Controller.ExtensionsOverlay.init = function()
if (inArgs)
{
+ /** OBSOLETE
if (inArgs.subscribe)
{
Bandwagon.Logger.debug("Have window argument subscribe = " + inArgs.subscribe);
setTimeout(function()
{
- Bandwagon.Controller.ExtensionsOverlay._showFeedsPaneView();
- Bandwagon.Controller.FeedsPane.doShowFeedPreview(inArgs.subscribe);
+ Bandwagon.Controller.ExtensionsOverlay._showCollectionsPaneView();
+ Bandwagon.Controller.CollectionsPane.doShowCollectionPreview(inArgs.subscribe);
},
500);
}
- else if (inArgs.selectFeed)
+ else
+ */
+ if (inArgs.selectCollection)
{
- Bandwagon.Logger.debug("Have window argument selectFeed = " + inArgs.selectFeed);
+ Bandwagon.Logger.debug("Have window argument selectCollection = " + inArgs.selectCollection);
- if (bandwagonService.feeds[inArgs.selectFeed])
+ if (bandwagonService.collections[inArgs.selectCollection])
{
- Bandwagon.Controller.FeedsPane.preferredFeed = bandwagonService.feeds[inArgs.selectFeed];
+ Bandwagon.Controller.CollectionsPane.preferredCollection = bandwagonService.collections[inArgs.selectCollection];
}
setTimeout(function()
{
- Bandwagon.Controller.ExtensionsOverlay._showFeedsPaneView();
+ Bandwagon.Controller.ExtensionsOverlay._showCollectionsPaneView();
},
500);
}
@@ -112,22 +115,48 @@ Bandwagon.Controller.ExtensionsOverlay.init = function()
}
}
-Bandwagon.Controller.ExtensionsOverlay.doPublishToFeed = function(feed)
+Bandwagon.Controller.ExtensionsOverlay.doPublishToCollection = function(collection)
{
- Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doPublishToFeed() with feed = '" + feed.url + "'");
+ Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doPublishToCollection() with collection = '" + collection.toString() + "'");
var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension();
var params =
{
publishType: 1,
- publishDestination: feed,
+ publishDestination: collection,
publishExtension: extension
};
Bandwagon.Controller.ExtensionsOverlay._openPublishDialog(params);
}
+Bandwagon.Controller.ExtensionsOverlay.doRemoveFromCollection = function(collection)
+{
+ var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension();
+
+ Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doRemoveFromCollection() with collection = '" + collection.toString() + "' and extension: name = '" + extension.name + "', guid = '" + extension.guid + "'");
+
+ var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+ var check = {value: false};
+ var flags = promptService.BUTTON_POS_0 * promptService.BUTTON_TITLE_IS_STRING + promptService.BUTTON_POS_1 * promptService.BUTTON_TITLE_IS_STRING;
+ var button = promptService.confirmEx(
+ window,
+ Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("publish.remove.title"),
+ Bandwagon.Controller.ExtensionsOverlay.stringBundle.getFormattedString("publish.remove.label", [extension.name, collection.name]),
+ flags,
+ Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("publish.remove.button0"),
+ Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("publish.remove.button1"),
+ null,
+ null,
+ check);
+
+ if (button == 0)
+ {
+ bandwagonService.removeAddonFromCollection(extension.guid, collection);
+ }
+}
+
Bandwagon.Controller.ExtensionsOverlay.doShareToEmail = function(emailAddress)
{
Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doShareToEmail() with email = '" + emailAddress + "'");
@@ -150,15 +179,15 @@ Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension = function()
if (document.getElementById("extensionsView").selectedItem)
{
- var selectedFeedItem = document.getElementById("extensionsView").selectedItem;
- extension.guid = selectedFeedItem.getAttribute("addonID");
- extension.name = selectedFeedItem.getAttribute("name");
+ var selectedAddon = document.getElementById("extensionsView").selectedItem;
+ extension.guid = selectedAddon.getAttribute("addonID");
+ extension.name = selectedAddon.getAttribute("name");
}
- else if (Bandwagon.Controller.FeedsPane && Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem)
+ else if (Bandwagon.Controller.CollectionsPane && Bandwagon.Controller.CollectionsPane.elemBandwagonAddons && Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem)
{
- var selectedFeedItem = Bandwagon.Controller.FeedsPane.elemBandwagonFeedItems.selectedItem;
- extension.guid = selectedFeedItem.guid;
- extension.name = selectedFeedItem.name;
+ var selectedAddon = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem;
+ extension.guid = selectedAddon.guid;
+ extension.name = selectedAddon.name;
}
else
{
@@ -168,6 +197,13 @@ Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension = function()
return extension;
}
+Bandwagon.Controller.ExtensionsOverlay.doNewCollection = function()
+{
+ Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doNewCollection()");
+
+ Bandwagon.Controller.CollectionsPane._openLocalizedURL(Bandwagon.COLLECTIONSPANE_DO_NEW_COLLECTION_URL);
+}
+
Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail = function()
{
Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail()");
@@ -241,7 +277,7 @@ Bandwagon.Controller.ExtensionsOverlay._invalidatePublishButton = function()
}
Bandwagon.Controller.ExtensionsOverlay._publishButton.emailAddresses = Bandwagon.Controller.ExtensionsOverlay._getEmailAddresses();
- Bandwagon.Controller.ExtensionsOverlay._publishButton.writableFeeds = Bandwagon.Controller.ExtensionsOverlay._getWritableFeeds();
+ Bandwagon.Controller.ExtensionsOverlay._publishButton.writableCollections = Bandwagon.Controller.ExtensionsOverlay._getWritableCollections();
try
{
@@ -250,21 +286,39 @@ Bandwagon.Controller.ExtensionsOverlay._invalidatePublishButton = function()
catch (e) {}
}
-Bandwagon.Controller.ExtensionsOverlay._getWritableFeeds = function()
+Bandwagon.Controller.ExtensionsOverlay._getWritableCollections = function()
{
- var writableFeeds = [];
+ var writableCollections = [];
+
+ var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension();
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- if (1 || (bandwagonService.feeds[id].editable && !bandwagonService.feeds[id].preview))
+ var collection = bandwagonService.collections[id];
+
+ //if (1 || (bandwagonService.collections[id].writable && !bandwagonService.collections[id].preview))
+
+ if (collection.writable)
{
- writableFeeds.push(bandwagonService.feeds[id]);
+ // Check if extension is in collection
+ collection.__containsCurrentlySelectedExtension = false;
+
+ for (var id in collection.addons)
+ {
+ if (extension.guid == collection.addons[id].guid)
+ {
+ collection.__containsCurrentlySelectedExtension = true;
+ break;
+ }
+ }
+
+ writableCollections.push(collection);
}
}
- writableFeeds.sort();
+ writableCollections.sort();
- return writableFeeds;
+ return writableCollections;
}
Bandwagon.Controller.ExtensionsOverlay._getEmailAddresses = function()
@@ -276,12 +330,12 @@ Bandwagon.Controller.ExtensionsOverlay._getEmailAddresses = function()
return previouslySharedEmailAddresses;
}
-Bandwagon.Controller.ExtensionsOverlay._showFeedsPaneView = function()
+Bandwagon.Controller.ExtensionsOverlay._showCollectionsPaneView = function()
{
- Bandwagon.Logger.debug("in _showFeedsPaneView()");
+ Bandwagon.Logger.debug("in _showCollectionsPaneView()");
- updateLastSelected("bandwagon-feeds");
- gView = "bandwagon-feeds";
+ updateLastSelected("bandwagon-collections");
+ gView = "bandwagon-collections";
document.getElementById("installFileButton").hidden = true;
document.getElementById("checkUpdatesAllButton").hidden = true;
@@ -301,12 +355,12 @@ Bandwagon.Controller.ExtensionsOverlay._showFeedsPaneView = function()
AddonsViewBuilder.clearChildren(gExtensionsView);
- document.getElementById("bandwagon-feeds-panel").hidden = false;
+ document.getElementById("bandwagon-collections-panel").hidden = false;
updateGlobalCommands();
- Bandwagon.Controller.FeedsPane.init();
- Bandwagon.Controller.FeedsPane.onViewSelect();
+ Bandwagon.Controller.CollectionsPane.init();
+ Bandwagon.Controller.CollectionsPane.onViewSelect();
}
// magic
@@ -315,13 +369,13 @@ Bandwagon.Controller.ExtensionsOverlay._defaultShowView = showView;
Bandwagon.Controller.ExtensionsOverlay._showView = function(aView)
{
- if (aView == "bandwagon-feeds")
+ if (aView == "bandwagon-collections")
{
- Bandwagon.Controller.ExtensionsOverlay._showFeedsPaneView();
+ Bandwagon.Controller.ExtensionsOverlay._showCollectionsPaneView();
}
else
{
- document.getElementById("bandwagon-feeds-panel").hidden = true;
+ document.getElementById("bandwagon-collections-panel").hidden = true;
document.getElementById("extensionsView").hidden = false;
document.getElementById("extensionsView").parentNode.hidden = false;
diff --git a/bandwagon/content/ui/publish.xul b/bandwagon/content/ui/publish.xul
index 54e9e83..380a4c2 100644
--- a/bandwagon/content/ui/publish.xul
+++ b/bandwagon/content/ui/publish.xul
@@ -20,7 +20,7 @@
- the Initial Developer. All Rights Reserved.
-
- Contributor(s): David McNamara
- - Brian King
+ - Brian King <brian (at) briks (dot) si>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -45,6 +45,7 @@
windowtype="Bandwagon:Publish"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&window.title;"
+ style="&publish.style;"
buttons="accept,cancel"
buttonlabelcancel="&cancel.label;"
buttonlabelaccept="&publish.label;"
@@ -54,20 +55,18 @@
<script src="chrome://bandwagon/content/ui/dialog.js"/>
<script src="chrome://bandwagon/content/ui/publishController.js"/>
- <stringbundleset>
- <stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/publish.properties"/>
- </stringbundleset>
+ <stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/publish.properties"/>
<vbox>
- <label id="dialog-desc"/>
+ <!--<label id="dialog-desc"/>-->
<deck id="type-deck">
<hbox id="publishing-to-box">
- <label id="publishing-to"/>
+ <label id="publishing-to" class="dialog-header"/>
</hbox>
<hbox id="sharing-with-box">
- <label id="sharing-with"/>
+ <description id="sharing-with" class="dialog-header" flex="1"/>
</hbox>
<groupbox id="new-email-box">
@@ -78,10 +77,14 @@
</groupbox>
</deck>
- <label value="&enter.a.personal.note.label;"/>
+ <separator class="thin"/>
+
+ <description flex="1">&enter.a.personal.note.label;</description>
<textbox id="personal-note" multiline="true"/>
+ <description id="sharing-with-new" flex="1"/>
+
<hbox>
<image id="spinner" src="chrome://bandwagon/skin/images/spinner-small.gif" collapsed="true"/>
<label id="error" style="color: red; visibility: hidden;" value=" "/>
diff --git a/bandwagon/content/ui/publishController.js b/bandwagon/content/ui/publishController.js
index 492d5dc..1ff0d27 100644
--- a/bandwagon/content/ui/publishController.js
+++ b/bandwagon/content/ui/publishController.js
@@ -19,6 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): David McNamara
+ * Brian King <brian (at) briks (dot) si>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -38,13 +39,14 @@ Bandwagon.Controller.Publish = new function()
{
this.stringBundle = null;
this.hasSubmitted = false;
+ this.hasSubmittedWithSuccess = false;
this.publishType = -1; // one of the TYPE_ constants
- this.publishDestination = null; // email address or feed obj
+ this.publishDestination = null; // email address or collection obj
this.publishExtension = null; // the add-on / theme obj to publish
}
-Bandwagon.Controller.Publish.TYPE_FEED = 1;
+Bandwagon.Controller.Publish.TYPE_COLLECTION = 1;
Bandwagon.Controller.Publish.TYPE_EXISTING_EMAIL = 2;
Bandwagon.Controller.Publish.TYPE_NEW_EMAIL = 3;
@@ -62,27 +64,33 @@ Bandwagon.Controller.Publish.init = function()
Bandwagon.Controller.Publish.publishDestination = inArgs.publishDestination;
Bandwagon.Controller.Publish.publishExtension = inArgs.publishExtension;
- document.getElementById("dialog-desc").value = Bandwagon.Controller.Publish.stringBundle.getFormattedString("you.are.sharing.the.add.on", [Bandwagon.Controller.Publish.publishExtension.name]);
+ //document.getElementById("dialog-desc").value = Bandwagon.Controller.Publish.stringBundle.getFormattedString("you.are.sharing.the.add.on", [Bandwagon.Controller.Publish.publishExtension.name]);
document.getElementById("type-deck").selectedIndex = Bandwagon.Controller.Publish.publishType-1;
switch (Bandwagon.Controller.Publish.publishType)
{
- case Bandwagon.Controller.Publish.TYPE_FEED:
- document.getElementById("publishing-to").value = Bandwagon.Controller.Publish.stringBundle.getFormattedString("publishing.to", [(Bandwagon.Controller.Publish.publishDestination.name?Bandwagon.Controller.Publish.publishDestination.name:Bandwagon.Controller.Publish.publishDestination.url)]);
+ case Bandwagon.Controller.Publish.TYPE_COLLECTION:
+ document.getElementById("publishing-to").value = Bandwagon.Controller.Publish.stringBundle.getFormattedString("publishing.to", [Bandwagon.Controller.Publish.publishExtension.name, (Bandwagon.Controller.Publish.publishDestination.name?Bandwagon.Controller.Publish.publishDestination.name:Bandwagon.Controller.Publish.publishDestination.url)]);
document.getElementById("new-email-box").collapsed = true;
document.getElementById("sharing-with-box").collapsed = true;
document.getElementById("publishing-to-box").collapsed = false;
+ document.getElementById("sharing-with-new").collapsed = true;
break;
case Bandwagon.Controller.Publish.TYPE_EXISTING_EMAIL:
- document.getElementById("sharing-with").value = Bandwagon.Controller.Publish.stringBundle.getFormattedString("sharing.with", [Bandwagon.Controller.Publish.publishDestination]);
+ document.getElementById("sharing-with").textContent = Bandwagon.Controller.Publish.stringBundle.getFormattedString("sharing.with", [Bandwagon.Controller.Publish.publishDestination, Bandwagon.Controller.Publish.publishExtension.name]);
document.getElementById("new-email-box").collapsed = true;
document.getElementById("sharing-with-box").collapsed = false;
document.getElementById("publishing-to-box").collapsed = true;
+ document.getElementById("sharing-with-new").collapsed = true;
+ document.getElementById("bandwagon-publish").getButton("accept").label = Bandwagon.Controller.Publish.stringBundle.getString("send.email");
break;
case Bandwagon.Controller.Publish.TYPE_NEW_EMAIL:
+ document.getElementById("sharing-with-new").textContent = Bandwagon.Controller.Publish.stringBundle.getFormattedString("sharing.with.new", [Bandwagon.Controller.Publish.publishExtension.name]);
+ document.getElementById("sharing-with-new").collapsed = false;
document.getElementById("new-email-box").collapsed = false;
document.getElementById("sharing-with-box").collapsed = true;
document.getElementById("publishing-to-box").collapsed = true;
+ document.getElementById("bandwagon-publish").getButton("accept").label = Bandwagon.Controller.Publish.stringBundle.getString("send.email");
break;
}
@@ -93,6 +101,12 @@ Bandwagon.Controller.Publish.doAccept = function()
{
Bandwagon.Logger.debug("In Bandwagon.Controller.Publish.doAccept();");
+ if (Bandwagon.Controller.Publish.hasSubmittedWithSuccess)
+ {
+ document.getElementById("bandwagon-publish").cancelDialog();
+ return true;
+ }
+
if (Bandwagon.Controller.Publish.publishType == Bandwagon.Controller.Publish.TYPE_NEW_EMAIL && document.getElementById("email-address").value == "")
{
Bandwagon.Controller.Publish._showError(Bandwagon.Controller.Publish.stringBundle.getString("please.enter.an.email.address"));
@@ -104,8 +118,8 @@ Bandwagon.Controller.Publish.doAccept = function()
switch (Bandwagon.Controller.Publish.publishType)
{
- case Bandwagon.Controller.Publish.TYPE_FEED:
- Bandwagon.Controller.Publish._publishToFeed();
+ case Bandwagon.Controller.Publish.TYPE_COLLECTION:
+ Bandwagon.Controller.Publish._publishToCollection();
break;
case Bandwagon.Controller.Publish.TYPE_EXISTING_EMAIL:
Bandwagon.Controller.Publish._shareToExistingEmail();
@@ -123,9 +137,9 @@ Bandwagon.Controller.Publish.doCancel = function()
return true;
}
-Bandwagon.Controller.Publish._publishToFeed = function()
+Bandwagon.Controller.Publish._publishToCollection = function()
{
- bandwagonService.publishToFeed(
+ bandwagonService.publishToCollection(
Bandwagon.Controller.Publish.publishExtension,
Bandwagon.Controller.Publish.publishDestination,
document.getElementById("personal-note").value,
@@ -164,22 +178,46 @@ Bandwagon.Controller.Publish.invalidate = function()
Bandwagon.Controller.Publish.finished = function(event)
{
- Bandwagon.Controller.Publish.hasSubmitted = false;
- Bandwagon.Controller.Publish.invalidate();
-
if (event.isError())
{
+ Bandwagon.Controller.Publish.hasSubmitted = false;
+ Bandwagon.Controller.Publish.invalidate();
+
Bandwagon.Controller.Publish._showError(event.getError());
+
return;
}
+ Bandwagon.Controller.Publish.hasSubmittedWithSuccess = true;
+
if (Bandwagon.Controller.Publish.publishType == Bandwagon.Controller.Publish.TYPE_NEW_EMAIL
&& document.getElementById("remember-email").checked)
{
- bandwagonService.addPreviouslySharedEmailAddress(document.getElementById("email-address").value);
+ bandwagonService.addPreviouslySharedEmailAddresses(document.getElementById("email-address").value);
}
- document.getElementById("bandwagon-publish").cancelDialog();
+ if (Bandwagon.Controller.Publish.publishType == Bandwagon.Controller.Publish.TYPE_COLLECTION)
+ {
+ bandwagonService.forceCheckForUpdates(Bandwagon.Controller.Publish.publishDestination);
+
+ document.getElementById("error").value = Bandwagon.Controller.Publish.stringBundle.getString("the.addon.has.been.published");
+ }
+ else
+ {
+ document.getElementById("error").value = Bandwagon.Controller.Publish.stringBundle.getString("the.email.has.been.sent");
+ }
+
+ document.getElementById("error").style.visibility = "visible";
+ document.getElementById("error").style.color = 'green';
+ document.getElementById("spinner").collapsed = true;
+ document.getElementById("email-address").disabled = true;
+ document.getElementById("personal-note").disabled = true;
+ document.getElementById("bandwagon-publish").getButton("cancel").hidden = true;
+ document.getElementById("bandwagon-publish").getButton("accept").disabled = false;
+ document.getElementById("bandwagon-publish").getButton("accept").label = Bandwagon.Controller.Publish.stringBundle.getFormattedString("closing.in", ["2"]);
+
+ setTimeout(function() { document.getElementById("bandwagon-publish").getButton("accept").label = Bandwagon.Controller.Publish.stringBundle.getFormattedString("closing.in", ["1"]); }, 2000);
+ setTimeout(function() { document.getElementById("bandwagon-publish").cancelDialog(); }, 3000);
}
Bandwagon.Controller.Publish._showError = function(message)
diff --git a/bandwagon/content/ui/settings.xul b/bandwagon/content/ui/settings.xul
index 90126ed..3985d6b 100644
--- a/bandwagon/content/ui/settings.xul
+++ b/bandwagon/content/ui/settings.xul
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
@@ -20,7 +21,7 @@
- the Initial Developer. All Rights Reserved.
-
- Contributor(s): David McNamara
- - Brian King
+ - Brian King <brian (at) briks (dot) si>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -37,41 +38,115 @@
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://bandwagon/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://bandwagon/skin/settings.css" type="text/css"?>
-<?xml-stylesheet href="chrome://bandwagon/content/ui/bindings/bandwagon.css" type="text/css"?>
<!DOCTYPE prefwindow SYSTEM "chrome://bandwagon/locale/settings.dtd">
<prefwindow id="bandwagon-settings"
- windowtype="Bandwagon:Settings"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&window.title;"
ondialogaccept="return Bandwagon.Controller.Settings.doAccept();"
- ondialogcancel="return Bandwagon.Controller.Settings.doCancel();">
-
- <script src="chrome://bandwagon/content/ui/dialog.js"/>
- <script src="chrome://bandwagon/content/ui/settingsController.js"/>
-
- <stringbundleset>
- <stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/settings.properties"/>
- </stringbundleset>
+ ondialogcancel="return Bandwagon.Controller.Settings.doCancel();"
+ persist="lastSelected screenX screenY">
- <prefpane id="pane1"
+ <prefpane id="paneManage"
+ label="&manage.label;"
flex="1">
<preferences>
<preference id="extensions.bandwagon.updateall.enabled"
name="extensions.bandwagon.updateall.enabled"
type="bool"/>
- <preference id="extensions.bandwagon.feeditemsperpage.enabled"
- name="extensions.bandwagon.feeditemsperpage.enabled"
+ <preference id="extensions.bandwagon.addonsperpage.enabled"
+ name="extensions.bandwagon.addonsperpage.enabled"
type="bool"/>
- <preference id="extensions.bandwagon.feeditemsperpage"
- name="extensions.bandwagon.feeditemsperpage"
- type="int"/>
<preference id="extensions.bandwagon.notifyall.enabled"
name="extensions.bandwagon.notifyall.enabled"
type="bool"/>
+ </preferences>
+
+ <hbox>
+ <vbox>
+ <label id="collections-list-header" crop="end" value="&subscriptions.header;"/>
+ <richlistbox id="collections-list" flex="1"/>
+ </vbox>
+ <vbox flex="1">
+ <!-- <label id="collection-name" crop="end" value=""/> -->
+
+ <!-- Update Interval Settings -->
+ <groupbox>
+ <caption label="&frequency.label;"/>
+ <radiogroup id="updates-group">
+ <radio id="updates-default" label="&default.label;"/>
+ <hbox align="center">
+ <radio id="updates-custom" label="&custom.label;"/>
+ <label id="checkbox-updateinterval-percollection" value="&updatesingle.label;"/>
+ <textbox id="textbox-updateinterval-quantity-percollection"
+ type="number"
+ min="1"
+ size="3"
+ maxlength="3"
+ value=""/>
+ <menulist id="menulist-updateinterval-units-percollection"
+ class=""
+ crop="none">
+ <menupopup>
+ <menuitem label="&minutes.label;" value="1"/>
+ <menuitem label="&hours.label;" value="2"/>
+ <menuitem label="&days.label;" value="3"/>
+ </menupopup>
+ </menulist>
+ </hbox>
+ </radiogroup>
+ </groupbox>
+
+ <!-- Show Notification Settings -->
+ <groupbox>
+ <caption label="&notifications.label;"/>
+ <radiogroup id="notifications-group">
+ <radio id="notifications-default" label="&default.label;"/>
+ <hbox>
+ <radio id="notifications-custom" label="&custom.label;"/>
+ <radiogroup id="checkbox-shownotifications-percollection"
+ orient="horizontal">
+ <radio id="shownotifications-percollection-on" label="&on.label;"/>
+ <radio id="shownotifications-percollection-off" label="&off.label;"/>
+ </radiogroup>
+ </hbox>
+ </radiogroup>
+ </groupbox>
+
+ <!-- Add-ons Per Page Settings -->
+ <groupbox>
+ <caption label="&perpage.label;"/>
+ <radiogroup id="perpage-group">
+ <radio id="perpage-default" label="&default.label;"/>
+ <hbox align="center">
+ <radio id="perpage-custom" label="&custom.label;"/>
+ <label id="label-addonsshow-percollection"> &addonsleadin.label;</label>
+ <textbox id="textbox-addonsperpage-percollection"
+ type="number"
+ size="3"/>
+ <label id="label-addonsperpage-percollection"> &addonsperpage.label;</label>
+ </hbox>
+ </radiogroup>
+ </groupbox>
+ <hbox align="center" pack="end">
+ <button id="remove-button"
+ label="&remove.label;"
+ oncommand="Bandwagon.Controller.Settings.doRemove();"/>
+ </hbox>
+ </vbox>
+ </hbox>
+
+ </prefpane>
+
+ <prefpane id="paneGeneral"
+ label="&general.label;">
+ <preferences>
+ <preference id="extensions.bandwagon.addonsperpage"
+ name="extensions.bandwagon.addonsperpage"
+ type="int"/>
<preference id="extensions.bandwagon.updateall.interval"
name="extensions.bandwagon.updateall.interval"
type="int"/>
@@ -79,73 +154,130 @@
name="extensions.bandwagon.updateall.units"
type="int"/>
</preferences>
+ <groupbox>
+ <caption label="&subscriptions.label;"/>
+ <hbox align="center">
+ <label id="updateinterval-all" value="&updateall.label;"/>
+ <textbox id="textbox-updateinterval-quantity"
+ type="number"
+ min="1"
+ size="3"
+ maxlength="3"
+ value=""
+ onkeypress=""
+ onchange=""
+ preference="extensions.bandwagon.updateall.interval"/>
+ <menulist id="menulist-updateinterval-units" class="" crop="none" preference="extensions.bandwagon.updateallglobal.units">
+ <menupopup>
+ <menuitem label="&minutes.label;" value="1"/>
+ <menuitem label="&hours.label;" value="2"/>
+ <menuitem label="&days.label;" value="3"/>
+ </menupopup>
+ </menulist>
+ </hbox>
+ <hbox align="center">
+ <label id="notify-all" value="&notifyglobal.label;"/>
+ <radiogroup id="notify-all-group" orient="horizontal">
+ <radio id="notify-all-on" label="&on.label;"/>
+ <radio id="notify-all-off" label="&off.label;"/>
+ </radiogroup>
+ </hbox>
+ <hbox align="center">
+ <label id="label-addonsshow"> &addonsleadin.label;</label>
+ <textbox id="textbox-addonsperpage-global"
+ type="number"
+ size="3"
+ preference="extensions.bandwagon.addonsperpage"/>
+ <label id="label-addonsperpage"> &addonsperpage.label;</label>
+ </hbox>
+ </groupbox>
- <hbox flex="1">
- <vbox>
- <richlistbox id="feeds-list" flex="1"/>
- <toolbox class="bandwagon-feeds-toolbox">
- <toolbar pack="start"
- align="center">
- <toolbarbutton id="add-feed-button"
- tooltiptext="&add.label;"
- oncommand="Bandwagon.Controller.Settings.doAdd();"/>
- <toolbarbutton id="remove-feed-button"
- tooltiptext="&remove.label;"
- oncommand="Bandwagon.Controller.Settings.doRemove();"/>
- </toolbar>
- </toolbox>
- </vbox>
- <vbox flex="1">
- <label id="feed-name" crop="end" value=""/>
-
- <!-- Update Interval Settings -->
-
- <hbox align="center">
- <checkbox id="checkbox-updateinterval-perfeed" label="&updatesingle.label;"/>
- <textbox id="textbox-updateinterval-quantity"
- type="number"
- min="1"
- size="3"
- maxlength="3"
- value=""
- onkeypress=""
- onchange=""
- preference="extensions.bandwagon.updateall.interval"
- />
- <menulist id="menulist-updateinterval-units" class="" crop="none" preference="extensions.bandwagon.updateall.units">
- <menupopup>
- <menuitem label="&minutes.label;" value="1"/>
- <menuitem label="&hours.label;" value="2"/>
- <menuitem label="&days.label;" value="3"/>
- </menupopup>
- </menulist>
- </hbox>
- <checkbox id="checkbox-updateinterval-global" class="all-check" label="&applyall.label;"/>
- <separator class="groove"/>
-
- <!-- Show Notification Settings -->
-
- <checkbox id="checkbox-shownotifications-perfeed" label="&notify.label;"/>
- <checkbox id="checkbox-shownotifications-global" class="all-check" label="&applyall.label;"/>
- <separator class="groove"/>
-
- <!-- Add-ons Per Page Settings -->
-
- <hbox align="center">
- <textbox id="textbox-feeditemsperpage-global"
- type="number"
- size="3"
- preference="extensions.bandwagon.feeditemsperpage"/>
- <label id="label-feeditemsperpage"> &feeditemsperpage.label;</label>
- </hbox>
-
- <!-- Auto-publish Settings -->
+ <groupbox>
+ <caption label="&data.label;"/>
+ <hbox align="center" pack="start">
+ <label id="clear-emails-text" value="" />
+ <button id="clear-emails-button"
+ label="&clearemails.label;"
+ oncommand="Bandwagon.Controller.Settings.doClearEmails();"/>
+ </hbox>
+ <hbox align="center" pack="start">
+ <label id="login-status-text" value="" />
+ <button id="login-button"
+ label="&login.label;"
+ oncommand="Bandwagon.Controller.Settings.doLogin();"/>
+ <button id="logout-button"
+ label="&logout.label;"
+ oncommand="Bandwagon.Controller.Settings.doLogout();"
+ collapsed="true"/>
+ </hbox>
+ </groupbox>
+ </prefpane>
- <checkbox id="checkbox-autopublish-perfeed" label="&autopublish.label;"/>
+ <prefpane id="paneAuto"
+ label="&pub.label;">
+ <!-- Auto-publish Settings -->
+ <!--
+ <checkbox id="checkbox-autopublish-percollection" label="&autopublish.label;"/>
+ -->
+ <groupbox>
+ <caption label="&auto.label;"/>
+ <description>&autoleadin.label;</description>
+ <separator class="thin"/>
+ <grid>
+ <columns>
+ <column/>
+ <column/>
+ </columns>
+ <rows>
+ <row align="center">
+ <label value="&name.label;"/>
+ <textbox id="auto-name"/>
+ </row>
+ <row align="center">
+ <spacer/>
+ <checkbox id="auto-list" label="&list.label;"/>
+ </row>
+ </rows>
+ </grid>
+ <separator class="thin"/>
+ <grid>
+ <columns>
+ <column/>
+ <column/>
+ <column/>
+ </columns>
+ <rows>
+ <row align="center">
+ <label value="&types.label;"/>
+ <checkbox id="auto-type-extensions" label="&type.extensions.label;"/>
+ <checkbox id="auto-type-themes" label="&type.themes.label;"/>
+ </row>
+ <row align="center">
+ <spacer/>
+ <checkbox id="auto-type-dicts" label="&type.dicts.label;"/>
+ <checkbox id="auto-type-langpacks" label="&type.langpacks.label;"/>
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
+ <hbox class="bottomBox" pack="center">
+ <groupbox id="auto-groupbox" orient="horizontal">
+ <button id="auto-create-button"
+ label="&createauto.label;"
+ oncommand="Bandwagon.Controller.Settings.doAutoCreate();"/>
+ <button id="auto-delete-button"
+ label="&deleteauto.label;"
+ oncommand="Bandwagon.Controller.Settings.doAutoDelete();"
+ collapsed="true"/>
+ <image id="auto-spinner" src="chrome://bandwagon/skin/images/spinner-small.gif" collapsed="true"/>
+ </groupbox>
+ </hbox>
+ <label id="auto-error" style="color: red;" value=" " collapsed="true"/>
+ </prefpane>
- </vbox>
- </hbox>
+ <stringbundle id="bandwagon-strings" src="chrome://bandwagon/locale/settings.properties"/>
- </prefpane>
+ <script type="application/x-javascript" src="chrome://bandwagon/content/ui/dialog.js"/>
+ <script type="application/x-javascript" src="chrome://bandwagon/content/ui/settingsController.js"/>
</prefwindow>
diff --git a/bandwagon/content/ui/settingsController.js b/bandwagon/content/ui/settingsController.js
index 34ccb8f..d521d15 100644
--- a/bandwagon/content/ui/settingsController.js
+++ b/bandwagon/content/ui/settingsController.js
@@ -19,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): David McNamara
- * Brian King
+ * Brian King <brian (at) briks (dot) si>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -37,49 +37,56 @@
Bandwagon.Controller.Settings = new function()
{
- this.feeds = {};
+ this.collections = {};
- this.elemBandwagonFeeds = null;
- this.elemFeedName = null;
+ this.elemBandwagonCollections = null;
+ this.elemCollectionName = null;
this.stringBundle = null;
}
Bandwagon.Controller.Settings.init = function()
{
- //alert("Initializing Bandwagon.Controller.Settings");
Bandwagon.Logger.debug("Initializing Bandwagon.Controller.Settings");
Bandwagon.Controller.Settings.stringBundle = document.getElementById("bandwagon-strings");
- Bandwagon.Controller.Settings.elemBandwagonFeeds = document.getElementById("feeds-list");
- Bandwagon.Controller.Settings.elemBandwagonFeeds.addEventListener("select", Bandwagon.Controller.Settings.doShowFeed, true);
+ Bandwagon.Controller.Settings.elemBandwagonCollections = document.getElementById("collections-list");
+ Bandwagon.Controller.Settings.elemBandwagonCollections.addEventListener("select", Bandwagon.Controller.Settings.doShowCollection, true);
- Bandwagon.Controller.Settings.elemFeedName = document.getElementById("feed-name");
+ Bandwagon.Controller.Settings.elemCollectionName = document.getElementById("collection-name");
if (document.getElementById("extensions.bandwagon.updateall.enabled").value)
{
- document.getElementById("checkbox-updateinterval-global").checked = true;
- document.getElementById("checkbox-updateinterval-perfeed").checked = true;
+ document.getElementById("updates-group").selectedIndex = 0;
}
+ else
+ document.getElementById("updates-group").selectedIndex = 1;
- document.getElementById("checkbox-updateinterval-global").addEventListener("command", Bandwagon.Controller.Settings.doUpdateIntervalScopeChange, true);
- document.getElementById("textbox-updateinterval-quantity").addEventListener("input", Bandwagon.Controller.Settings.doSaveFeed, true);
- document.getElementById("textbox-updateinterval-quantity").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, false);
- document.getElementById("menulist-updateinterval-units").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true);
+ document.getElementById("updates-group").addEventListener("command", Bandwagon.Controller.Settings.doUpdateIntervalScopeChange, true);
+ document.getElementById("textbox-updateinterval-quantity").addEventListener("input", Bandwagon.Controller.Settings.doSaveCollection, true);
+ document.getElementById("textbox-updateinterval-quantity").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, false);
+ document.getElementById("textbox-updateinterval-quantity-percollection").addEventListener("input", Bandwagon.Controller.Settings.doSaveCollection, true);
+ document.getElementById("textbox-updateinterval-quantity-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, false);
+ document.getElementById("menulist-updateinterval-units-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true);
if (document.getElementById("extensions.bandwagon.notifyall.enabled").value)
{
- document.getElementById("checkbox-shownotifications-global").checked = true;
- document.getElementById("checkbox-shownotifications-perfeed").checked = true;
+ document.getElementById("notifications-group").selectedIndex = 0;
}
+ else
+ document.getElementById("notifications-group").selectedIndex = 1;
+
+ document.getElementById("notifications-group").addEventListener("command", Bandwagon.Controller.Settings.doShowNotificationsScopeChange, true);
+ document.getElementById("notifications-group").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true);
- document.getElementById("checkbox-shownotifications-global").addEventListener("command", Bandwagon.Controller.Settings.doShowNotificationsScopeChange, true);
- document.getElementById("checkbox-shownotifications-perfeed").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true);
+ //document.getElementById("checkbox-autopublish-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true);
- document.getElementById("checkbox-autopublish-perfeed").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true);
+ bandwagonService.registerCollectionListChangeObserver(Bandwagon.Controller.Settings.collectionListChangeObserver);
- bandwagonService.registerFeedListChangeObserver(Bandwagon.Controller.Settings.feedListChangeObserver);
+ Bandwagon.Controller.Settings.EmailsCheck();
+ Bandwagon.Controller.Settings.LoginCheck();
+ Bandwagon.Controller.Settings.AutoCheck();
setTimeout(function()
{
@@ -90,33 +97,33 @@ Bandwagon.Controller.Settings.init = function()
Bandwagon.Controller.Settings._delayedInit = function()
{
- Bandwagon.Controller.Settings._repopulateFeedsList();
+ Bandwagon.Controller.Settings._repopulateCollectionsList();
Bandwagon.Controller.Settings.invalidate();
}
Bandwagon.Controller.Settings.uninit = function()
{
- bandwagonService.unregisterFeedListChangeObserver(Bandwagon.Controller.Settings.feedListChangeObserver);
+ bandwagonService.unregisterCollectionListChangeObserver(Bandwagon.Controller.Settings.collectionListChangeObserver);
- // now is a good time to save feeds to storage
+ // now is a good time to save collections to storage
if (Bandwagon.COMMIT_NOW)
bandwagonService.commitAll();
}
-Bandwagon.Controller.Settings.feedListChangeObserver = function()
+Bandwagon.Controller.Settings.collectionsListChangeObserver = function()
{
- Bandwagon.Controller.Settings._repopulateFeedsList();
+ Bandwagon.Controller.Settings._repopulateCollectionsList();
- var elemBandwagonFeed = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed")[0];
+ var elemBandwagonCollection = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection")[0];
- if (elemBandwagonFeed)
+ if (elemBandwagonCollection)
{
- Bandwagon.Controller.Settings.elemBandwagonFeeds.selectItem(elemBandwagonFeed);
- Bandwagon.Controller.Settings.elemBandwagonFeeds.focus();
+ Bandwagon.Controller.Settings.elemBandwagonCollections.selectItem(elemBandwagonCollection);
+ Bandwagon.Controller.Settings.elemBandwagonCollections.focus();
}
else
{
- Bandwagon.Controller.Settings.doShowFeed();
+ Bandwagon.Controller.Settings.doShowCollection();
}
Bandwagon.Controller.Settings.invalidate();
@@ -124,92 +131,95 @@ Bandwagon.Controller.Settings.feedListChangeObserver = function()
Bandwagon.Controller.Settings.invalidate = function()
{
- var feedCount = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed").length;
- var feedSelection = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem;
-
- var disabled = (!feedSelection || feedCount == 0);
-
- document.getElementById("remove-feed-button").disabled = disabled;
- document.getElementById("checkbox-updateinterval-perfeed").disabled = disabled;
- document.getElementById("textbox-updateinterval-quantity").disabled = disabled;
- document.getElementById("menulist-updateinterval-units").disabled = disabled;
- document.getElementById("checkbox-updateinterval-global").disabled = disabled;
- document.getElementById("checkbox-shownotifications-perfeed").disabled = disabled;
- document.getElementById("checkbox-shownotifications-global").disabled = disabled;
- document.getElementById("textbox-feeditemsperpage-global").disabled = disabled;
- document.getElementById("checkbox-autopublish-perfeed").disabled = disabled;
- document.getElementById("label-feeditemsperpage").disabled = disabled;
+ var collectionCount = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection").length;
+ var collectionSelection = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem;
+
+ var disabled = (!collectionSelection || collectionCount == 0);
+
+ // XXTODO Disable more controls
+ //document.getElementById("remove-collection-button").disabled = disabled;
+ document.getElementById("updates-group").disabled = disabled;
+ document.getElementById("textbox-updateinterval-quantity-percollection").disabled = disabled;
+ document.getElementById("menulist-updateinterval-units-percollection").disabled = disabled;
+ document.getElementById("notifications-group").disabled = disabled;
+ document.getElementById("label-addonsshow-percollection").disabled = disabled;
+ document.getElementById("label-addonsperpage-percollection").disabled = disabled;
+ document.getElementById("textbox-addonsperpage-percollection").disabled = disabled;
+ //document.getElementById("checkbox-autopublish-percollection").disabled = disabled;
}
-Bandwagon.Controller.Settings.doShowFeed = function()
+Bandwagon.Controller.Settings.doShowCollection = function()
{
- var feed = null;
- var selectedItem = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem;
+ var collection = null;
+ var selectedItem = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem;
- if (selectedItem && Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed)
- feed = Bandwagon.Controller.Settings.feeds[Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed.url];
+ if (selectedItem && Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection)
+ collection = Bandwagon.Controller.Settings.collections[Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection.resourceURL];
- Bandwagon.Logger.debug("showing feed: " + (feed?feed.url:"<none>"));
+ Bandwagon.Logger.debug("showing collection: " + (collection?collection.resourceURL:"<none>"));
- if (!feed)
+ if (!collection)
{
- Bandwagon.Controller.Settings.elemFeedName.value = "";
+ Bandwagon.Controller.Settings.elemCollectionName.value = "";
Bandwagon.Controller.Settings.invalidate();
return;
}
- Bandwagon.Controller.Settings.elemFeedName.value = (feed.name&&feed.name!=""?feed.name:feed.url);
+ if ( Bandwagon.Controller.Settings.elemCollectionName)
+ {
+ Bandwagon.Controller.Settings.elemCollectionName.value = (collection.name&&collection.name!=""?collection.name:collection.resourceURL);
+ }
- if (document.getElementById("checkbox-updateinterval-global").checked)
+ if (document.getElementById("updates-group").selectedIndex == 0) // Hrm, this is not right, is it?
{
- // updateinterval: if "apply to all feeds" is checked - set updateinterval quantity and interval to global
+ // updateinterval: if "default" is selected - set updateinterval quantity and interval in default
document.getElementById("textbox-updateinterval-quantity").valueNumber = parseInt(document.getElementById("extensions.bandwagon.updateall.interval").value);
document.getElementById("menulist-updateinterval-units").selectedIndex = document.getElementById("extensions.bandwagon.updateall.units").value - 1;
}
else
{
- // updateinterval: if "apply to all feeds" is unchecked - set updateinterval quantity and interval to this feed
+ // updateinterval: if "Custom: " is selected - set updateinterval quantity and interval to this collection
- var interval = Bandwagon.Util.intervalMillisecondsToUnits(feed.updateInterval*1000);
+ var interval = Bandwagon.Util.intervalMillisecondsToUnits(collection.updateInterval*1000);
+ document.getElementById("textbox-updateinterval-quantity-percollection").valueNumber = interval.interval;
+ document.getElementById("menulist-updateinterval-units-percollection").selectedIndex = interval.units-1;
- document.getElementById("textbox-updateinterval-quantity").valueNumber = interval.interval;
- document.getElementById("menulist-updateinterval-units").selectedIndex = interval.units-1;
-
- document.getElementById("checkbox-updateinterval-perfeed").checked = true;
+ document.getElementById("updates-group").selectedIndex = 1;
}
- if (document.getElementById("checkbox-shownotifications-global").checked)
+ // Turning off for now, not sure how to handle notifications when a collection is loaded
+ if (true)
{
- // shownotifications: if "apply to all feeds" is checked - set shownotifications to global
- document.getElementById("checkbox-shownotifications-perfeed").checked = document.getElementById("extensions.bandwagon.notifyall.enabled").value;
+ // shownotifications: if "default" is selected - set shownotifications to global
+
}
else
{
- // shownotifications: if "apply to all feeds" not checked - set shownotifications to this feed
- document.getElementById("checkbox-shownotifications-perfeed").checked = feed.showNotifications;
+ // shownotifications: if "Custom" not selected - set shownotifications to this collection
+
}
// autopublish
- document.getElementById("checkbox-autopublish-perfeed").checked = feed.autoPublish;
+ //document.getElementById("checkbox-autopublish-percollection").checked = collection.autoPublish;
Bandwagon.Controller.Settings.invalidate();
}
-Bandwagon.Controller.Settings.doSaveFeed = function()
+Bandwagon.Controller.Settings.doSaveCollection = function()
{
- Bandwagon.Logger.debug("in doSaveFeed()");
+ Bandwagon.Logger.debug("in doSaveCollection()");
- // save settings to local copy of the feed objects
+ // save settings to local copy of the collection objects
- var feed = Bandwagon.Controller.Settings.feeds[Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed.url];
+ var collection = Bandwagon.Controller.Settings.collections[Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection.resourceURL];
- if (!feed)
+ if (!collection)
return;
- feed.updateInterval = Bandwagon.Util.intervalUnitsToMilliseconds(document.getElementById("textbox-updateinterval-quantity").valueNumber, document.getElementById("menulist-updateinterval-units").selectedIndex+1) / 1000;
- feed.showNotifications = document.getElementById("checkbox-shownotifications-perfeed").checked;
- feed.autoPublish = document.getElementById("checkbox-autopublish-perfeed").checked;
+ collection.updateInterval = Bandwagon.Util.intervalUnitsToMilliseconds(document.getElementById("textbox-updateinterval-quantity").valueNumber, document.getElementById("menulist-updateinterval-units").selectedIndex+1) / 1000;
+ collection.showNotifications = (document.getElementById("notifications-group").selectedIndex == 1);
+ //collection.autoPublish = document.getElementById("checkbox-autopublish-percollection").checked;
if (document.getElementById("bandwagon-settings").instantApply)
{
@@ -217,63 +227,211 @@ Bandwagon.Controller.Settings.doSaveFeed = function()
}
}
-Bandwagon.Controller.Settings._repopulateFeedsList = function()
+Bandwagon.Controller.Settings._repopulateCollectionsList = function()
{
// first clear the list
- while (Bandwagon.Controller.Settings.elemBandwagonFeeds.hasChildNodes())
+ while (Bandwagon.Controller.Settings.elemBandwagonCollections.hasChildNodes())
{
- Bandwagon.Controller.Settings.elemBandwagonFeeds.removeChild(Bandwagon.Controller.Settings.elemBandwagonFeeds.firstChild);
+ Bandwagon.Controller.Settings.elemBandwagonCollections.removeChild(Bandwagon.Controller.Settings.elemBandwagonCollections.firstChild);
}
- // repopulate with feeds
+ // repopulate with collections
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- var feed = bandwagonService.feeds[id];
+ var collection = bandwagonService.collections[id];
- if (feed == null)
+ if (collection == null)
return;
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var elemBandwagonFeed = document.createElementNS(XULNS, "bandwagonFeed");
- elemBandwagonFeed.setAttribute("view", "settings");
+ var elemBandwagonCollection = document.createElementNS(XULNS, "bandwagonCollection");
+ elemBandwagonCollection.setAttribute("view", "settings");
- elemBandwagonFeed.feed = feed;
- elemBandwagonFeed.controller = Bandwagon.Controller.Settings;
+ elemBandwagonCollection.collection = collection;
+ elemBandwagonCollection.controller = Bandwagon.Controller.Settings;
- Bandwagon.Controller.Settings.elemBandwagonFeeds.appendChild(elemBandwagonFeed);
+ Bandwagon.Controller.Settings.elemBandwagonCollections.appendChild(elemBandwagonCollection);
}
- // create the local copy of the feeds hash with the properties we need
+ // create the local copy of the collections hash with the properties we need
- Bandwagon.Controller.Settings.feeds = {};
+ Bandwagon.Controller.Settings.collections = {};
- for (var id in bandwagonService.feeds)
+ for (var id in bandwagonService.collections)
{
- var feed = bandwagonService.feeds[id];
+ var collection = bandwagonService.collections[id];
- Bandwagon.Controller.Settings.feeds[id] =
+ Bandwagon.Controller.Settings.collections[id] =
{
- name: feed.name,
- url: feed.url,
- updateInterval: feed.updateInterval,
- showNotifications: feed.showNotifications,
- feedItemsPerPage: feed.feedItemsPerPage,
- autoPublish: feed.autoPublish
+ name: collection.name,
+ url: collection.resourceURL,
+ updateInterval: collection.updateInterval,
+ showNotifications: collection.showNotifications,
+ addonsPerPage: collection.addonsPerPage,
+ autoPublish: collection.autoPublish
};
}
}
Bandwagon.Controller.Settings.bindingsReady = function()
{
- var elemBandwagonFeed = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed")[0];
+ var elemBandwagonCollection = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection")[0];
+
+ if (elemBandwagonCollection)
+ {
+ Bandwagon.Controller.Settings.elemBandwagonCollections.selectItem(elemBandwagonCollection);
+ Bandwagon.Controller.Settings.elemBandwagonCollections.focus();
+ }
+}
+
+/* Startup check */
+Bandwagon.Controller.Settings.LoginCheck = function()
+{
+ var isLoggedIn = false; // XX TODO
+ var loginEmail = "me@example.com"; // XX TODO
+ var textNode = document.getElementById("login-status-text");
+ if (isLoggedIn)
+ {
+ document.getElementById("login-button").collapsed = true;
+ document.getElementById("logout-button").removeAttribute("collapsed");
+ textNode.value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("login.status", [loginEmail]);
+ }
+ else
+ {
+ textNode.value = Bandwagon.Controller.Settings.stringBundle.getString("logout.status");;
+ }
+}
+
+Bandwagon.Controller.Settings.doLogin = function()
+{
+ // XX TODO
+}
+
+Bandwagon.Controller.Settings.doLogout = function()
+{
+ // XX TODO
+}
+
+/* Startup check */
+Bandwagon.Controller.Settings.AutoCheck = function()
+{
+ var hasAuto = false; // XX TODO
+ if (hasAuto)
+ {
+ document.getElementById("auto-create-button").collapsed = true;
+ document.getElementById("auto-delete-button").removeAttribute("collapsed");
+ }
+ else
+ {
+ }
+}
+
+Bandwagon.Controller.Settings.doAutoCreate = function()
+{
+ // check form
+ document.getElementById("auto-error").value = "";
+ document.getElementById("auto-error").collapsed = true;
+
+ var collectionName = document.getElementById("auto-name").value;
- if (elemBandwagonFeed)
+ if (!collectionName || collectionName == "")
{
- Bandwagon.Controller.Settings.elemBandwagonFeeds.selectItem(elemBandwagonFeed);
- Bandwagon.Controller.Settings.elemBandwagonFeeds.focus();
+ document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("auto.invalid.name", [collectionName]);
+ document.getElementById("auto-error").collapsed = false;
+ return;
+ }
+
+ var autoPublishExtensions = document.getElementById("auto-type-extensions").checked;
+ var autoPublishThemes = document.getElementById("auto-type-themes").checked;
+ var autoPublishDicts = document.getElementById("auto-type-dicts").checked;
+ var autoPublishLangPacks = document.getElementById("auto-type-langpacks").checked;
+
+ if (!autoPublishExtensions && !autoPublishThemes && !autoPublishDicts && !autoPublishLangPacks)
+ {
+ document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.please.select.type");
+ document.getElementById("auto-error").collapsed = false;
+ return;
+ }
+
+ // disable ui settings, show throbber
+
+ var toggleUIEnabledState = function(on)
+ {
+ document.getElementById("auto-create-button").disabled = on;
+ document.getElementById("auto-name").disabled = on;
+ document.getElementById("auto-list").disabled = on;
+ document.getElementById("auto-type-extensions").disabled = on;
+ document.getElementById("auto-type-themes").disabled = on;
+ document.getElementById("auto-type-dicts").disabled = on;
+ document.getElementById("auto-type-langpacks").disabled = on;
+ document.getElementById("auto-spinner").collapsed = !on;
+ }
+
+ toggleUIEnabledState(true);
+
+ // create the collection object
+
+ var collection = new Bandwagon.Model.Collection();
+
+ collection.name = collectionName;
+ collection.description = collectionName; // nothing better to put here - api demands it
+ collection.listed = document.getElementById("auto-list").checked;
+ collection.writable = true;
+ collection.autoPublish = true;
+ collection.showNotifications = false;
+ collection.updateInterval = 60 * 60 * 24;
+ collection.addonsPerPage = Bandwagon.DEFAULT_ADDONS_PER_PAGE;
+ collection.status = collection.STATUS_NEW;
+
+ collection.autoPublishExtensions = autoPublishExtensions;
+ collection.autoPublishThemes = autoPublishThemes;
+ collection.autoPublishDicts = autoPublishDicts;
+ collection.autoPublishLangPacks = autoPublishLangPacks;
+
+ // send the api call
+
+ var newCollectionCallback = function(event)
+ {
+ if (event.isError())
+ {
+ document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.internal.error");
+ document.getElementById("auto-error").collapsed = false;
+ toggleUIEnabledState(false);
+ }
+ else
+ {
+ // on callback of above, refresh collection list
+ //bandwagonService.forceCheckAllForUpdatesAndUpdateCollectionsList();
+
+ // on callback of above, tell user we're done
+ document.getElementById("auto-error").style.color = 'green';
+ document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.done");
+ document.getElementById("auto-error").collapsed = false;
+
+ // clean-up
+ document.getElementById("auto-create-button").collapsed = true;
+ document.getElementById("auto-delete-button").collapsed = false;
+ document.getElementById("auto-spinner").collapsed = true;
+ }
}
+
+ bandwagonService.newCollection(collection, newCollectionCallback);
+}
+
+Bandwagon.Controller.Settings.doAutoDelete = function()
+{
+ // XX TODO
+}
+
+/* Startup check */
+Bandwagon.Controller.Settings.EmailsCheck = function()
+{
+ var numEmails = 0; // XX TODO
+ var textNode = document.getElementById("clear-emails-text");
+ textNode.value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("saved.emails.text", [numEmails]);
+ document.getElementById("clear-emails-button").disabled = (numEmails <= 0);
}
Bandwagon.Controller.Settings.doAccept = function()
@@ -282,27 +440,27 @@ Bandwagon.Controller.Settings.doAccept = function()
// called:
// - when user clicks 'Ok' (on systems that show the ok button)
- // - when user changes feed properties (on systems that don't show buttons)
+ // - when user changes collection properties (on systems that don't show buttons)
- // copy the locally update settings over the global feed settings
+ // copy the locally update settings over the global collection settings
- for (var id in Bandwagon.Controller.Settings.feeds)
+ for (var id in Bandwagon.Controller.Settings.collections)
{
- var localFeed = Bandwagon.Controller.Settings.feeds[id];
- var bwFeed = bandwagonService.feeds[id];
+ var localCollection = Bandwagon.Controller.Settings.collections[id];
+ var bwCollection = bandwagonService.collections[id];
- if (!localFeed || !bwFeed)
+ if (!localCollection || !bwCollection)
continue;
- if (bwFeed.feedItemsPerPage != localFeed.feedItemsPerPage)
+ if (bwCollection.addonsPerPage != localCollection.addonsPerPage)
{
- bwFeed.feedItemsPerPage = localFeed.feedItemsPerPage;
- Bandwagon.Preferences.notifyObservers("feeditemsperpage:" + bwFeed.url);
+ bwCollection.addonsPerPage = localCollection.addonsPerPage;
+ Bandwagon.Preferences.notifyObservers("addonsperpage:" + bwCollection.resourceURL);
}
- bwFeed.updateInterval = localFeed.updateInterval;
- bwFeed.showNotifications = localFeed.showNotifications;
- bwFeed.autoPublish = localFeed.autoPublish;
+ bwCollection.updateInterval = localCollection.updateInterval;
+ bwCollection.showNotifications = localCollection.showNotifications;
+ bwCollection.autoPublish = localCollection.autoPublish;
}
}
@@ -314,30 +472,35 @@ Bandwagon.Controller.Settings.doCancel = function()
Bandwagon.Controller.Settings.doChangePassword = function()
{
// TODO
+
+ alert('TBD');
}
+/** OBSOLETE
Bandwagon.Controller.Settings.doAdd = function()
{
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
- var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("add.feed");
- var promptMsg = Bandwagon.Controller.Settings.stringBundle.getString("enter.url.to.add.feed");
+ var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("add.collection");
+ var promptMsg = Bandwagon.Controller.Settings.stringBundle.getString("enter.url.to.add.collection");
var input = {value: "http://"};
var check = {value: false};
var proceed = prompts.prompt(window, promptTitle, promptMsg, input, null, check);
if (proceed)
{
- bandwagonService.addPreviewFeed(input.value);
+ bandwagonService.addPreviewCollection(input.value);
}
}
+*/
+/** OBSOLETE XX Brian, er, I think not, see Remove Subscription button
Bandwagon.Controller.Settings.doRemove = function()
{
- var feed = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed;
+ var collection = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection;
- if (feed == null)
+ if (collection == null)
return;
var promptService;
@@ -348,8 +511,8 @@ Bandwagon.Controller.Settings.doRemove = function()
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
} catch (e) { return; }
- var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("remove.feed");
- var promptMsg = Bandwagon.Controller.Settings.stringBundle.getFormattedString("are.you.sure.you.want.to.remove", [(feed.name?feed.name:feed.url)]);
+ var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("remove.collection");
+ var promptMsg = Bandwagon.Controller.Settings.stringBundle.getFormattedString("are.you.sure.you.want.to.remove", [(collection.name?collection.name:collection.resourceURL)]);
var proceed = promptService.confirm(
window,
promptTitle,
@@ -360,27 +523,41 @@ Bandwagon.Controller.Settings.doRemove = function()
{
// TODO for non-instant-apply dialogs, should we wait until 'Ok' is clicked before removal?
- bandwagonService.deleteFeed(feed);
+ bandwagonService.deleteCollection(collection);
- if (!feed.preview)
- bandwagonService.unsubscribe(feed);
+ if (!collection.preview)
+ bandwagonService.unsubscribe(collection);
}
}
+*/
+
+/* See above */
+Bandwagon.Controller.Settings.doRemove = function()
+{
+ alert("TBD!");
+}
Bandwagon.Controller.Settings.doUpdateIntervalScopeChange = function(event)
{
- document.getElementById("extensions.bandwagon.updateall.interval").value = document.getElementById("textbox-updateinterval-quantity").valueNumber;
- document.getElementById("extensions.bandwagon.updateall.units").value = document.getElementById("menulist-updateinterval-units").selectedIndex + 1;
- document.getElementById("extensions.bandwagon.updateall.enabled").value = (document.getElementById("checkbox-updateinterval-perfeed").checked && document.getElementById("checkbox-updateinterval-global").checked);
+ if (document.getElementById("updates-group").selectedIndex == 0) // Use default
+ {
+ document.getElementById("extensions.bandwagon.updateall.interval").value = document.getElementById("textbox-updateinterval-quantity").valueNumber;
+ document.getElementById("extensions.bandwagon.updateall.units").value = document.getElementById("menulist-updateinterval-units").selectedIndex + 1;
+ }
+ else
+ {
+ // Not sure if anything needs to be done here
+ }
+ document.getElementById("extensions.bandwagon.updateall.enabled").value = (document.getElementById("updates-group").selectedIndex == 0);
- Bandwagon.Controller.Settings.doShowFeed();
+ Bandwagon.Controller.Settings.doShowCollection();
}
Bandwagon.Controller.Settings.doShowNotificationsScopeChange = function(event)
{
- document.getElementById("extensions.bandwagon.notifyall.enabled").value = (document.getElementById("checkbox-shownotifications-perfeed").checked && document.getElementById("checkbox-shownotifications-global").checked);
+ document.getElementById("extensions.bandwagon.notifyall.enabled").value = (document.getElementById("notifications-group").selectedIndex == 0);
- Bandwagon.Controller.Settings.doShowFeed();
+ Bandwagon.Controller.Settings.doShowCollection();
}
diff --git a/bandwagon/defaults/preferences/bandwagon.js b/bandwagon/defaults/preferences/bandwagon.js
index e458a62..7388f3f 100644
--- a/bandwagon/defaults/preferences/bandwagon.js
+++ b/bandwagon/defaults/preferences/bandwagon.js
@@ -43,8 +43,8 @@ pref("extensions.bandwagon.updateall.enabled", true);
pref("extensions.bandwagon.updateall.interval", 2);
pref("extensions.bandwagon.updateall.units", 1);
pref("extensions.bandwagon.updateall.datelastcheck", 0);
-pref("extensions.bandwagon.feeditemsperpage.enabled", true);
-pref("extensions.bandwagon.feeditemsperpage", 20);
+pref("extensions.bandwagon.addonsperpage.enabled", true);
+pref("extensions.bandwagon.addonsperpage", 20);
pref("extensions.bandwagon.publish.shared.emails", "");
pref("extensions.bandwagon.notifyall.enabled", false);
pref("extensions.bandwagon.autopublished.extensions", "");
diff --git a/bandwagon/install.rdf b/bandwagon/install.rdf
index d3d6a47..b984fc1 100644
--- a/bandwagon/install.rdf
+++ b/bandwagon/install.rdf
@@ -5,19 +5,20 @@
<Description about="urn:mozilla:install-manifest">
<em:id>sharing@addons.mozilla.org</em:id>
- <em:name>Bandwagon</em:name>
- <em:version>0.0.7</em:version>
- <em:description>Share and discover Add-ons.</em:description>
+ <em:name>Add-on Collector</em:name>
+ <em:version>0.1</em:version>
+ <em:description>Share and discover add-ons.</em:description>
<em:creator>Mozilla Corporation</em:creator>
<em:contributor>BRIKS Software (http://briks.si)</em:contributor>
+ <em:homepageURL>https://addons.mozilla.org/collections</em:homepageURL>
<em:optionsURL>chrome://bandwagon/content/ui/settings.xul</em:optionsURL>
- <em:iconURL>chrome://bandwagon/skin/images/tango-addonfeed-32x32.png</em:iconURL>
+ <em:iconURL>chrome://bandwagon/skin/images/icon32.png</em:iconURL>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
- <em:minVersion>2.0</em:minVersion>
- <em:maxVersion>3.1b3pre</em:maxVersion>
+ <em:minVersion>3.0</em:minVersion>
+ <em:maxVersion>3.5b4pre</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
diff --git a/bandwagon/locale/en-US/bandwagonAddon.properties b/bandwagon/locale/en-US/bandwagonAddon.properties
new file mode 100644
index 0000000..134478b
--- /dev/null
+++ b/bandwagon/locale/en-US/bandwagonAddon.properties
@@ -0,0 +1,27 @@
+bandwagon.category1=Extension
+
+bandwagon.addon.author=By %S
+bandwagon.addon.category=Category: %S
+bandwagon.addon.added.justnow=Added: Just now
+bandwagon.addon.added.minute=Added: 1 minute ago
+bandwagon.addon.added.minutes=Added: %S minutes ago
+bandwagon.addon.added.hour=Added: 1 hour ago
+bandwagon.addon.added.hours=Added: %S hours ago
+bandwagon.addon.added.day=Added: Yesterday
+bandwagon.addon.added.days=Added: %S days ago
+bandwagon.addon.added.week=Added: 1 week ago
+bandwagon.addon.added.weeks=Added: %S weeks ago
+bandwagon.addon.added.month=Added: 1 month ago
+bandwagon.addon.added.months=Added: %S months ago
+bandwagon.addon.added.year=Added: 1 year ago
+bandwagon.addon.added.years=Added: %S years ago
+bandwagon.addon.moreinfo=More info.
+bandwagon.addon.olderversionsoffirefox=This add-on is for older versions of Firefox.
+bandwagon.addon.upgradetofirefoxn1=Upgrade to Firefox %S
+bandwagon.addon.upgradetofirefoxn2=to use this add-on.
+bandwagon.addon.requiresfirefoxbeta1=This add-on requires Firefox %S, which has not yet been released. To use this add-on, you may
+bandwagon.addon.requiresfirefoxbeta2=download Firefox %S beta.
+bandwagon.addon.notcompatible=This add-on is not compatible with %S.
+bandwagon.addon.comment.description=“%S”
+bandwagon.addon.comment.author=Comment from %S:
+
diff --git a/bandwagon/locale/en-US/bandwagonFeedItem.properties b/bandwagon/locale/en-US/bandwagonFeedItem.properties
deleted file mode 100644
index 72a7b83..0000000
--- a/bandwagon/locale/en-US/bandwagonFeedItem.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-bandwagon.category1=Extension
-
-bandwagon.feeditem.author=By %S
-bandwagon.feeditem.category=Category: %S
-bandwagon.feeditem.added.justnow=Added: Just now
-bandwagon.feeditem.added.minute=Added: 1 minute ago
-bandwagon.feeditem.added.minutes=Added: %S minutes ago
-bandwagon.feeditem.added.hour=Added: 1 hour ago
-bandwagon.feeditem.added.hours=Added: %S hours ago
-bandwagon.feeditem.added.day=Added: Yesterday
-bandwagon.feeditem.added.days=Added: %S days ago
-bandwagon.feeditem.added.week=Added: 1 week ago
-bandwagon.feeditem.added.weeks=Added: %S weeks ago
-bandwagon.feeditem.added.month=Added: 1 month ago
-bandwagon.feeditem.added.months=Added: %S months ago
-bandwagon.feeditem.added.year=Added: 1 year ago
-bandwagon.feeditem.added.years=Added: %S years ago
-bandwagon.feeditem.moreinfo=More info.
-bandwagon.feeditem.olderversionsoffirefox=This add-on is for older versions of Firefox.
-bandwagon.feeditem.upgradetofirefoxn1=Upgrade to Firefox %S
-bandwagon.feeditem.upgradetofirefoxn2=to use this add-on.
-bandwagon.feeditem.requiresfirefoxbeta1=This add-on requires Firefox %S, which has not yet been released. To use this add-on, you may
-bandwagon.feeditem.requiresfirefoxbeta2=download Firefox %S beta.
-bandwagon.feeditem.notcompatible=This add-on is not compatible with %S.
-bandwagon.feeditem.comment.description=“%S”
-bandwagon.feeditem.comment.author=— %S
-
diff --git a/bandwagon/locale/en-US/browserOverlay.dtd b/bandwagon/locale/en-US/browserOverlay.dtd
new file mode 100644
index 0000000..a665207
--- /dev/null
+++ b/bandwagon/locale/en-US/browserOverlay.dtd
@@ -0,0 +1,38 @@
+<!-- ***** BEGIN LICENSE BLOCK *****
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ -
+ - The contents of this file are subject to the Mozilla Public License Version
+ - 1.1 (the "License"); you may not use this file except in compliance with
+ - the License. You may obtain a copy of the License at
+ - http://www.mozilla.org/MPL/
+ -
+ - Software distributed under the License is distributed on an "AS IS" basis,
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ - for the specific language governing rights and limitations under the
+ - License.
+ -
+ - The Original Code is bandwagon.
+ -
+ - The Initial Developer of the Original Code is
+ - Mozilla Corporation.
+ - Portions created by the Initial Developer are Copyright (C) 2008
+ - the Initial Developer. All Rights Reserved.
+ -
+ - Contributor(s): Brian King <brian (at) briks (dot) si>
+ -
+ - Alternatively, the contents of this file may be used under the terms of
+ - either the GNU General Public License Version 2 or later (the "GPL"), or
+ - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ - in which case the provisions of the GPL or the LGPL are applicable instead
+ - of those above. If you wish to allow use of your version of this file only
+ - under the terms of either the GPL or the LGPL, and not to allow others to
+ - use your version of this file under the terms of the MPL, indicate your
+ - decision by deleting the provisions above and replace them with the notice
+ - and other provisions required by the GPL or the LGPL. If you do not delete
+ - the provisions above, a recipient may use your version of this file under
+ - the terms of any one of the MPL, the GPL or the LGPL.
+ -
+ - ***** END LICENSE BLOCK ***** -->
+
+<!ENTITY bandwagon.label "Add-ons">
+<!ENTITY bandwagon.tooltip "Add-ons">
diff --git a/bandwagon/locale/en-US/browserOverlay.properties b/bandwagon/locale/en-US/browserOverlay.properties
index f3f1df5..217a947 100644
--- a/bandwagon/locale/en-US/browserOverlay.properties
+++ b/bandwagon/locale/en-US/browserOverlay.properties
@@ -1,2 +1,2 @@
-newfeeditems.alert.title=New Add-ons
-newfeeditems.alert.text=There are new add-ons in your subscribed feed '%S'.
+newaddons.alert.title=New Add-ons
+newaddons.alert.text=There are new add-ons in your subscription '%S'.
diff --git a/bandwagon/locale/en-US/extensionOverlay.properties b/bandwagon/locale/en-US/extensionOverlay.properties
index 6620b47..4fa83e4 100644
--- a/bandwagon/locale/en-US/extensionOverlay.properties
+++ b/bandwagon/locale/en-US/extensionOverlay.properties
@@ -1,8 +1,12 @@
-feedspane.this.is.only.a.preview=This is only a preview!
-feedspane.if.you.do.not.subscribe=If you do not subscribe, this feed will disappear when you close Firefox.
-feedspane.subscribe=Subscribe
-feedspane.dont.subscribe=Don't Subscribe
-feedspane.subscribe.accesskey=s
-feedspane.dont.subscribe.accesskey=d
+collectionspane.this.is.only.a.preview=This is only a preview!
+collectionspane.if.you.do.not.subscribe=If you do not subscribe, this collection will disappear when you close Firefox.
+collectionspane.subscribe=Subscribe
+collectionspane.dont.subscribe=Don't Subscribe
+collectionspane.subscribe.accesskey=s
+collectionspane.dont.subscribe.accesskey=d
publish.new.email.address.title=New E-mail Address
publish.new.email.address.text=Enter a new e-mail address to share this add-on with:
+publish.remove.title=Confirmation
+publish.remove.label=Are you sure you wish to remove %S from the "%S" collection?
+publish.remove.button1=No, cancel
+publish.remove.button0=Yes, remove the add-on
diff --git a/bandwagon/locale/en-US/extensionsOverlay.dtd b/bandwagon/locale/en-US/extensionsOverlay.dtd
index fcff6ca..29d18ce 100644
--- a/bandwagon/locale/en-US/extensionsOverlay.dtd
+++ b/bandwagon/locale/en-US/extensionsOverlay.dtd
@@ -14,11 +14,12 @@
- The Original Code is bandwagon.
-
- The Initial Developer of the Original Code is
- - Brian King.
+ - Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- - Contributor(s): David McNamara
+ - Contributor(s): Brian King <brian (at) briks (dot) si>
+ - David McNamara
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -34,25 +35,29 @@
-
- ***** END LICENSE BLOCK ***** -->
-<!ENTITY feeds.label "Feeds">
-<!ENTITY search.label.bandwagon "Search">
+<!ENTITY collections.label "Subscriptions">
+<!ENTITY search.label.bandwagon "Search">
-<!ENTITY feeditem.moreinfo "More info.">
-<!ENTITY feeditem.addtofirefox "Add to Firefox">
-<!ENTITY subscribe.label "Subscribe to more Add-ons">
-<!ENTITY reload.label "Reload All">
-<!ENTITY settings.label "Settings">
+<!ENTITY addon.moreinfo "More info.">
+<!ENTITY addon.addtofirefox "Add to Firefox">
+<!ENTITY subscribe.label "Subscribe to more Add-ons">
+<!ENTITY reload.label "Reload All">
+<!ENTITY settings.label "Settings">
-<!ENTITY viewsite.label "View Site">
-<!ENTITY update.label "Update">
-<!ENTITY remove.label "Remove">
+<!ENTITY view.label "View Collection">
+<!ENTITY unsubscribe.label "Unsubscribe">
-<!ENTITY nofeedssubscribed.label "You are not subscribed to any feeds">
-<!ENTITY clicktosubscribe.label "Browse Feeds">
-<!ENTITY feedisloading.label "Retrieving Feed">
-<!ENTITY feedhasnoitems.label "This feed contains no items.">
-<!ENTITY feedhaserror.label "This feed failed to load because it contains errors.">
+<!ENTITY nocollectionstitle.label "Welcome to the Add-ons Collector">
+<!ENTITY nocollectionssubscribed.label "This is where collections you mark as a favorite on Mozilla Add-ons will appear so that you can easily keep track of them. It looks like you haven't yet added any favorites, so why not take a look around our Collection Directory?">
+<!ENTITY noamoauth.label "This is where collections you mark as a favorite on Mozilla Add-ons will appear so that you can easily keep track of them. You must be logged in to addons.mozilla.org to use this feature.">
+<!ENTITY clicktosubscribe.label "Find Collections">
+<!ENTITY clicktologin.label "Login">
+<!ENTITY collectionisloading.label "Retrieving subscription">
+<!ENTITY collectionhasnoitems.label "This collection contains no add-ons.">
+<!ENTITY collectionhaserror.label "This collection cannot be displayed because it contains errors.">
+
+<!ENTITY publishto.label "Publish to">
+<!ENTITY email.address.label "E-mail Address">
+<!ENTITY new.email.address.label "New E-mail Address">
+<!ENTITY new.collection.label "New Collection">
-<!ENTITY publishto.label "Publish to">
-<!ENTITY email.address.label "E-mail Address">
-<!ENTITY new.email.address.label "New E-mail Address">
diff --git a/bandwagon/locale/en-US/publish.dtd b/bandwagon/locale/en-US/publish.dtd
index 288d1e6..0e3ec14 100644
--- a/bandwagon/locale/en-US/publish.dtd
+++ b/bandwagon/locale/en-US/publish.dtd
@@ -19,7 +19,7 @@
- the Initial Developer. All Rights Reserved.
-
- Contributor(s): David McNamara
- - Brian King
+ - Brian King <brian (at) briks (dot) si>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -35,11 +35,14 @@
-
- ***** END LICENSE BLOCK ***** -->
+<!-- For localisers to change the width of the window -->
+<!ENTITY publish.style "width: 35em;">
+
<!ENTITY window.title "Publish">
<!ENTITY cancel.label "Cancel">
<!ENTITY publish.label "Publish">
-<!ENTITY new.email.label "New E-mail">
-<!ENTITY enter.an.email.label "Enter an e-mail address to share this add-on with:">
+<!ENTITY new.email.label "New E-mail Address">
+<!ENTITY enter.an.email.label "Enter one or more e-mail addresses separated by commas:">
<!ENTITY remember.this.email.label "Remember this e-mail address">
-<!ENTITY enter.a.personal.note.label "Enter an optional personal note to accompany this add-on:">
+<!ENTITY enter.a.personal.note.label "Optional: Enter a personal note about this add-on to be included in the e-mail">
diff --git a/bandwagon/locale/en-US/publish.properties b/bandwagon/locale/en-US/publish.properties
index 88b8260..805b9ef 100644
--- a/bandwagon/locale/en-US/publish.properties
+++ b/bandwagon/locale/en-US/publish.properties
@@ -1,4 +1,9 @@
you.are.sharing.the.add.on=You are sharing the add-on '%S'
-publishing.to=Publishing to '%S'
-sharing.with=Sharing with '%S'
+publishing.to=Clicking "Publish" will add %S to the "%S" collection.
+sharing.with=Clicking "Send E-mail" will send %S an e-mail with information about %S
+sharing.with.new=Clicking "Send E-mail" will send the above recipients an e-mail with information about %S
please.enter.an.email.address=Please enter an e-mail address.
+the.addon.has.been.published=The add-on has been published.
+the.email.has.been.sent=The email has been sent.
+closing.in=Closing in %S
+send.email=Send E-mail
diff --git a/bandwagon/locale/en-US/settings.dtd b/bandwagon/locale/en-US/settings.dtd
index 8b4eb90..d67e154 100644
--- a/bandwagon/locale/en-US/settings.dtd
+++ b/bandwagon/locale/en-US/settings.dtd
@@ -18,7 +18,7 @@
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- - Contributor(s): Brian King
+ - Contributor(s): Brian King <brian (at) briks (dot) si>
- David McNamara
-
- Alternatively, the contents of this file may be used under the terms of
@@ -35,15 +35,67 @@
-
- ***** END LICENSE BLOCK ***** -->
-<!ENTITY window.title "Sharing Feed Settings">
-<!ENTITY feeditemsperpage.label "Add-ons displayed per page">
-<!ENTITY updateall.label "Update all add-ons every">
+<!-- For localisers to change the width of the window -->
+<!ENTITY settings.style "width: 42em;">
+
+<!ENTITY window.title "Add-ons Collector Settings">
+
+<!-- Tabs -->
+<!ENTITY manage.label "Manage Subscriptions">
+<!ENTITY general.label "General Settings">
+<!ENTITY pub.label "Auto-publisher Settings">
+
+<!-- Manage Subscriptions -->
+<!ENTITY subscriptions.header "Select a subscription:">
+
+<!-- Groupbox captions in Manage Subscriptions -->
+<!ENTITY frequency.label "Subscription Update Frequency">
+<!ENTITY notifications.label "New Add-on Notifications">
+<!ENTITY perpage.label "Add-ons per Page">
+
+<!ENTITY default.label "Use default setting">
+<!ENTITY custom.label "Custom:">
+
+<!ENTITY addonsleadin.label "Show">
+<!ENTITY addonsperpage.label "add-ons per page">
<!ENTITY updatesingle.label "Update every:">
<!ENTITY minutes.label "Minute(s)">
<!ENTITY hours.label "Hour(s)">
<!ENTITY days.label "Day(s)">
-<!ENTITY autopublish.label "Auto-publish installed add-ons to feed">
+<!ENTITY autopublish.label "Auto-publish installed add-ons to subscription">
<!ENTITY notify.label "Show notifications">
-<!ENTITY applyall.label "Apply to all feeds">
-<!ENTITY add.label "Add">
-<!ENTITY remove.label "Remove">
+<!ENTITY applyall.label "Apply to all subscriptions">
+<!ENTITY remove.label "Remove Subscription">
+<!ENTITY on.label "On">
+<!ENTITY off.label "Off">
+
+<!-- General -->
+
+<!-- Groupbox captions in General -->
+<!ENTITY subscriptions.label "Default Subscription Settings">
+<!ENTITY data.label "Data Management">
+
+<!ENTITY updateall.label "Check subscriptions for update every">
+<!ENTITY notifyglobal.label "Notification me when my subscriptions have new add-ons">
+
+<!ENTITY clearemails.label "Clear">
+<!ENTITY login.label "Login">
+<!ENTITY logout.label "Logout">
+
+<!-- Auto-Publisher Settings -->
+
+<!-- Groupbox captions in Auto-Publisher Settings -->
+<!ENTITY auto.label "Auto-publisher Settings">
+
+<!ENTITY name.label "Collection Name:">
+<!ENTITY list.label "Listed in public Collection Directory">
+
+<!ENTITY autoleadin.label "Auto-publishers are special collections that are automatically updated when you install or uninstall add-ons from Firefox on this computer.">
+<!ENTITY types.label "Auto-published add-on types:">
+<!ENTITY type.extensions.label "Extensions">
+<!ENTITY type.themes.label "Themes">
+<!ENTITY type.dicts.label "Dictionaries">
+<!ENTITY type.langpacks.label "Language Packs">
+
+<!ENTITY createauto.label "Create Auto-publisher">
+<!ENTITY deleteauto.label "Delete Auto-publisher">
diff --git a/bandwagon/locale/en-US/settings.properties b/bandwagon/locale/en-US/settings.properties
index b2426d3..2dfccc2 100644
--- a/bandwagon/locale/en-US/settings.properties
+++ b/bandwagon/locale/en-US/settings.properties
@@ -1,4 +1,11 @@
-add.feed=Add Feed
-enter.url.to.add.feed=Enter the URL of the feed you want to add.
-remove.feed=Remove Feed
-are.you.sure.you.want.to.remove=Are you sure you want to remove '%S' from your feeds?
+add.collection=Add Subscription
+enter.url.to.add.collection=Enter the URL of the subscription you want to add.
+remove.collection=Remove Subscription
+are.you.sure.you.want.to.remove=Are you sure you want to remove '%S' from your subscriptions?
+saved.emails.text=You have %S saved e-mail addresses
+login.status.text=You are logged in as %S
+logout.status=You are not logged in
+auto.invalid.name=The collection name '%S' is not valid.
+auto.please.select.type=Please select at least one auto-publish type.
+auto.internal.error=The collection could not be created (an internal error occurred).
+auto.done=Your auto-publish collection has been created.
diff --git a/bandwagon/skin/extensionsOverlay.css b/bandwagon/skin/extensionsOverlay.css
index ffce753..2581839 100644
--- a/bandwagon/skin/extensionsOverlay.css
+++ b/bandwagon/skin/extensionsOverlay.css
@@ -35,20 +35,27 @@
*
* ***** END LICENSE BLOCK ***** */
-radio#bandwagon-feeds-view {
- list-style-image: url("chrome://bandwagon/skin/images/tango-addonfeed-32x32.png");
+radio#bandwagon-collections-view {
+ list-style-image: url("chrome://bandwagon/skin/images/icon32.png");
-moz-image-region: rect(0px, 32px, 32px, 0px);
}
-radio#bandwagon-feeds-view:hover, radio#bandwagon-feeds-view[selected="true"] {
+radio#bandwagon-collections-view:hover, radio#bandwagon-collections-view[selected="true"] {
-moz-image-region: rect(0px, 32px, 32px, 0px);
}
-radio[noimage="true"]#bandwagon-feeds-view {
+radio[noimage="true"]#bandwagon-collections-view {
list-style-image: none;
-moz-image-region: rect(0 0 0 0);
}
+#bandwagon-link-splitter {
+ border-left: 1px solid #7A8490;
+ border-right: 1px solid #FEFEFE;
+ margin-left: 0.4em;
+ margin-right: 0.4em;
+}
+
#bandwagon-sidebar-splitter {
-moz-border-start: none;
-moz-border-end: 1px solid #404040;
@@ -57,12 +64,12 @@ radio[noimage="true"]#bandwagon-feeds-view {
background-image: none !important;
}
-#bandwagon-feeds-list {
+#bandwagon-collections-list {
margin-top: 0;
margin-left: 0;
}
-#bandwagon-feeditems-list {
+#bandwagon-addons-list {
border: 2px solid;
border-left: 0px !important;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
@@ -72,17 +79,17 @@ radio[noimage="true"]#bandwagon-feeds-view {
/*overflow: auto;*/
}
-#bandwagon-feed-title {
+#bandwagon-collection-title {
font-size: 150%;
}
-#bandwagon-feed-title,
-#bandwagon-feed-description,
-#bandwagon-feed-header {
+#bandwagon-collection-title,
+#bandwagon-collection-description,
+#bandwagon-collection-header {
background: -moz-dialog;
}
-bandwagonFeed {
+bandwagonCollection {
padding-top: 6px;
padding-bottom: 6px;
-moz-padding-start: 7px;
@@ -90,7 +97,7 @@ bandwagonFeed {
min-height: 25px;
}
-bandwagonFeed[view="settings"] {
+bandwagonCollection[view="settings"] {
padding-top: 0;
padding-bottom: 0;
-moz-padding-start: 0;
@@ -98,21 +105,21 @@ bandwagonFeed[view="settings"] {
min-height: 0;
}
-bandwagonFeed[selected="true"] {
+bandwagonCollection[selected="true"] {
background-color: -moz-cellhighlight;
color: -moz-cellhighlighttext;
}
-bandwagonFeed[preview="true"] label[anonid="name"] {
+bandwagonCollection[preview="true"] label[anonid="name"] {
font-style: italic;
}
-richlistbox:focus > bandwagonFeed[selected="true"] {
+richlistbox:focus > bandwagonCollection[selected="true"] {
background-color: Highlight;
color: HighlightText;
}
-bandwagonFeed label[anonid="unread"] {
+bandwagonCollection label[anonid="unread"] {
background-color: blue;
color: white;
min-width: 1.7em;
@@ -120,12 +127,12 @@ bandwagonFeed label[anonid="unread"] {
-moz-border-radius: 40%;
}
-bandwagonFeed[view="settings"] label[anonid="unread"] {
+bandwagonCollection[view="settings"] label[anonid="unread"] {
display: none;
}
-bandwagonFeedItem,
-bandwagonFeedItemExpanded {
+bandwagonAddon,
+bandwagonAddonExpanded {
padding-top: 6px;
padding-bottom: 6px;
-moz-padding-start: 7px;
@@ -134,28 +141,28 @@ bandwagonFeedItemExpanded {
border-bottom: 1px dotted #C0C0C0;
}
-bandwagonFeedItemExpanded {
+bandwagonAddonExpanded {
background-color: -moz-cellhighlight;
color: -moz-cellhighlighttext;
}
-richlistbox:focus > bandwagonFeedItemExpanded {
+richlistbox:focus > bandwagonAddonExpanded {
background-color: Highlight;
color: HighlightText;
}
-bandwagonFeedItem[read="false"] {
+bandwagonAddon[read="false"] {
background-color: #fdf2ab;
color: #585620;
}
-bandwagonFeedItem .right,
-bandwagonFeedItemExpanded .right {
+bandwagonAddon .right,
+bandwagonAddonExpanded .right {
text-align: right;
}
-bandwagonFeedItem .icon,
-bandwagonFeedItemExpanded .icon {
+bandwagonAddon .icon,
+bandwagonAddonExpanded .icon {
width: 32px;
height: 32px;
max-width: 32px;
@@ -164,8 +171,8 @@ bandwagonFeedItemExpanded .icon {
min-height: 32px;
}
-bandwagonFeedItem .name,
-bandwagonFeedItemExpanded .name {
+bandwagonAddon .name,
+bandwagonAddonExpanded .name {
font-size: 110%;
}
@@ -175,7 +182,7 @@ bandwagonFeedItemExpanded .name {
height: 32px;
}
-.feed-item-details {
+.addon-details {
margin-top: 5px;
margin-bottom: 5px;
-moz-margin-start: 6px;
@@ -201,16 +208,15 @@ bandwagonFeedItemExpanded .name {
*/
#bandwagon-button-subscribe {
- list-style-image: url("chrome://bandwagon/skin/images/twisty-clsd.png");
+ list-style-image: url("chrome://bandwagon/skin/images/plus.png");
}
#bandwagon-button-update-all {
- list-style-image: url("chrome://bandwagon/skin/images/Toolbar-small.png");
- -moz-image-region: rect(0px 64px 16px 48px);
+ list-style-image: url("chrome://bandwagon/skin/images/reload.png");
}
#bandwagon-button-settings {
- list-style-image: url("chrome://bandwagon/skin/images/wrench.png");
+ list-style-image: url("chrome://bandwagon/skin/images/gear.png");
}
.publishButton,
@@ -227,3 +233,25 @@ bandwagonFeedItemExpanded .name {
margin-top: 1em;
margin-bottom: 1em;
}
+
+.fs-info-panel
+{
+ margin: 20px;
+}
+
+.fs-info-panel-header
+{
+ margin-left: 0px;
+ font-size: larger;
+ font-weight: bold;
+}
+
+.fs-info-panel-text
+{
+ margin-left: 0px;
+}
+
+bandwagonCollection description[anonid="commentdesc"]
+{
+ font-style: italic;
+}
diff --git a/bandwagon/skin/global.css b/bandwagon/skin/global.css
index bc8df95..461c0cb 100644
--- a/bandwagon/skin/global.css
+++ b/bandwagon/skin/global.css
@@ -34,7 +34,7 @@
*
* ***** END LICENSE BLOCK ***** */
-.bandwagon-feeds-toolbox {
+.bandwagon-collections-toolbox {
-moz-appearance: none;
background-color: transparent !important;
border: 0px;
diff --git a/bandwagon/skin/images/Toolbar-small.png b/bandwagon/skin/images/Toolbar-small.png
deleted file mode 100644
index 423e5a1..0000000
--- a/bandwagon/skin/images/Toolbar-small.png
+++ /dev/null
Binary files differ
diff --git a/bandwagon/skin/images/addon-toolbar.png b/bandwagon/skin/images/addon-toolbar.png
new file mode 100644
index 0000000..a31028a
--- /dev/null
+++ b/bandwagon/skin/images/addon-toolbar.png
Binary files differ
diff --git a/bandwagon/skin/images/gear.png b/bandwagon/skin/images/gear.png
new file mode 100644
index 0000000..735104b
--- /dev/null
+++ b/bandwagon/skin/images/gear.png
Binary files differ
diff --git a/bandwagon/skin/images/icon32.png b/bandwagon/skin/images/icon32.png
new file mode 100644
index 0000000..d2c471b
--- /dev/null
+++ b/bandwagon/skin/images/icon32.png
Binary files differ
diff --git a/bandwagon/skin/images/plus.png b/bandwagon/skin/images/plus.png
new file mode 100644
index 0000000..25f66fe
--- /dev/null
+++ b/bandwagon/skin/images/plus.png
Binary files differ
diff --git a/bandwagon/skin/images/reload.png b/bandwagon/skin/images/reload.png
new file mode 100644
index 0000000..8c24c27
--- /dev/null
+++ b/bandwagon/skin/images/reload.png
Binary files differ
diff --git a/bandwagon/skin/images/star32.png b/bandwagon/skin/images/star32.png
new file mode 100644
index 0000000..378e27c
--- /dev/null
+++ b/bandwagon/skin/images/star32.png
Binary files differ
diff --git a/bandwagon/skin/images/tango-addonfeed-32x32.png b/bandwagon/skin/images/tango-addonfeed-32x32.png
deleted file mode 100644
index ca8da41..0000000
--- a/bandwagon/skin/images/tango-addonfeed-32x32.png
+++ /dev/null
Binary files differ
diff --git a/bandwagon/skin/images/wrench.png b/bandwagon/skin/images/wrench.png
deleted file mode 100644
index 229bb6e..0000000
--- a/bandwagon/skin/images/wrench.png
+++ /dev/null
Binary files differ
diff --git a/bandwagon/skin/platform/linux/browserOverlay.css b/bandwagon/skin/platform/linux/browserOverlay.css
new file mode 100644
index 0000000..deff4d3
--- /dev/null
+++ b/bandwagon/skin/platform/linux/browserOverlay.css
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brian King <brian (at) briks (dot) si>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ToolbarButton */
+#extensions-bandwagon-button {
+ list-style-image: url("chrome://bandwagon/skin/images/addon-toolbar.png");
+}
+
+.bandwagon-button {
+ -moz-image-region: rect(0px, 72px, 24px, 48px);
+}
+
+.bandwagon-button:hover {
+ -moz-image-region: rect(0px, 72px, 24px, 48px);
+}
+
+[iconsize="small"] .bandwagon-button {
+ -moz-image-region: rect(0px, 120px, 16px, 104px);
+}
+
+[iconsize="small"] .bandwagon-button:hover {
+ -moz-image-region: rect(0px, 120px, 16px, 104px);
+}
diff --git a/bandwagon/skin/platform/mac/browserOverlay.css b/bandwagon/skin/platform/mac/browserOverlay.css
new file mode 100644
index 0000000..590dcb2
--- /dev/null
+++ b/bandwagon/skin/platform/mac/browserOverlay.css
@@ -0,0 +1,64 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brian King <brian (at) briks (dot) si>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ToolbarButton */
+#extensions-bandwagon-button {
+ list-style-image: url("chrome://bandwagon/skin/images/addon-toolbar.png");
+}
+
+.bandwagon-button {
+ -moz-image-region: rect(0px, 156px, 23px, 120px);
+}
+
+.bandwagon-button[disabled="true"] {
+ -moz-image-region: rect(23px, 156px, 46px, 120px);
+}
+
+.bandwagon-button:hover:active {
+ -moz-image-region: rect(46px, 156px, 69px, 120px);
+}
+
+[iconsize="small"] .bandwagon-button {
+ -moz-image-region: rect(0px, 156px, 23px, 120px);
+}
+
+[iconsize="small"] .bandwagon-button[disabled="true"] {
+ -moz-image-region: rect(23px, 156px, 46px, 120px);
+}
+
+[iconsize="small"] .bandwagon-button:hover:active {
+ -moz-image-region: rect(46px, 156px, 69px, 120px);
+}
diff --git a/bandwagon/skin/platform/vista/browserOverlay.css b/bandwagon/skin/platform/vista/browserOverlay.css
new file mode 100644
index 0000000..2cc8903
--- /dev/null
+++ b/bandwagon/skin/platform/vista/browserOverlay.css
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brian King <brian (at) briks (dot) si>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ToolbarButton */
+#extensions-bandwagon-button {
+ list-style-image: url("chrome://bandwagon/skin/images/addon-toolbar.png");
+}
+
+.bandwagon-button {
+ -moz-image-region: rect(0px, 24px, 24px, 0px);
+}
+
+.bandwagon-button:hover {
+ -moz-image-region: rect(0px, 24px, 24px, 0px);
+}
+
+[iconsize="small"] .bandwagon-button {
+ -moz-image-region: rect(0px, 88px, 16px, 72px);
+}
+
+[iconsize="small"] .bandwagon-button:hover {
+ -moz-image-region: rect(0px, 88px, 16px, 72px);
+}
diff --git a/bandwagon/skin/platform/xp/browserOverlay.css b/bandwagon/skin/platform/xp/browserOverlay.css
new file mode 100644
index 0000000..4b66025
--- /dev/null
+++ b/bandwagon/skin/platform/xp/browserOverlay.css
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bandwagon.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brian King <brian (at) briks (dot) si>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ToolbarButton */
+#extensions-bandwagon-button {
+ list-style-image: url("chrome://bandwagon/skin/images/addon-toolbar.png");
+}
+
+.bandwagon-button {
+ -moz-image-region: rect(0px, 48px, 24px, 24px);
+}
+
+.bandwagon-button:hover {
+ -moz-image-region: rect(24px, 48px, 48px, 24px);
+}
+
+[iconsize="small"] .bandwagon-button {
+ -moz-image-region: rect(0px, 104px, 16px, 88px);
+}
+
+[iconsize="small"] .bandwagon-button:hover {
+ -moz-image-region: rect(16px, 104px, 32px, 88px);
+}
diff --git a/bandwagon/skin/publish.css b/bandwagon/skin/publish.css
index b471432..e6ffc65 100644
--- a/bandwagon/skin/publish.css
+++ b/bandwagon/skin/publish.css
@@ -33,3 +33,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
+.dialog-header
+{
+ font-weight: bold;
+}
diff --git a/bandwagon/skin/settings.css b/bandwagon/skin/settings.css
index 5646fc4..c9dc228 100644
--- a/bandwagon/skin/settings.css
+++ b/bandwagon/skin/settings.css
@@ -19,6 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): David McNamara
+ * Brian King <brian (at) briks (dot) si>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -34,24 +35,34 @@
*
* ***** END LICENSE BLOCK ***** */
-#feeds-list {
+radio[pane=paneManage] {
+ list-style-image: url("chrome://bandwagon/skin/images/star32.png");
+}
+
+radio[pane=paneGeneral] {
+ list-style-image: url("chrome://bandwagon/skin/images/icon32.png");
+}
+
+radio[pane=paneAuto] {
+ list-style-image: url("chrome://browser/skin/preferences/Options.png");
+ -moz-image-region: rect(0px, 224px, 32px, 192px)
+}
+
+#collections-list {
min-width: 10em;
max-width: 10em;
}
-#feed-name {
+#collection-name {
font-weight: bold;
font-size: larger;
}
-.all-check {
- padding-left: 15px;
-}
-
-#add-feed-button {
- list-style-image: url("chrome://bandwagon/skin/images/twisty-clsd.png");
+prefwindow description {
+ width: 30em;
}
-#remove-feed-button {
- list-style-image: url("chrome://bandwagon/skin/images/twisty-open.png");
+/* No caption for this groupbox (there to fix a clipping issue), so hide the border */
+#auto-groupbox {
+ border: none;
}