Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave@33eels.com <dave@33eels.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2009-03-06 17:15:40 (GMT)
committer dave@33eels.com <dave@33eels.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2009-03-06 17:15:40 (GMT)
commitf2e9cbdbbac9f125059674e8a1c082c080047614 (patch)
tree4a7b56665cae9c0f51ccf7dddf1e98e3ccac3b7f
parenta0c46488e860ead82ac18b8bfedc16daa6b79a43 (diff)
- Started migration to new REST API.
- Change of terminology: - "feed" -> "collection" - "feedItem" -> "addon" git-svn-id: http://svn.mozilla.org/addons/trunk@22931 4eb1ac78-321c-0410-a911-ec516a8615a5
-rw-r--r--bandwagon/components/bandwagon-service.js280
-rw-r--r--bandwagon/content/scripts/bandwagon.js16
-rw-r--r--bandwagon/content/scripts/factory/collectionFactory.js (renamed from bandwagon/content/scripts/factory/feedFactory.js)282
-rw-r--r--bandwagon/content/scripts/model/addon.js (renamed from bandwagon/content/scripts/model/feedItem.js)70
-rw-r--r--bandwagon/content/scripts/model/collection.js (renamed from bandwagon/content/scripts/model/feed.js)115
-rw-r--r--bandwagon/content/scripts/model/serviceDocument.js65
-rw-r--r--bandwagon/content/scripts/rpc/constants.js9
-rw-r--r--bandwagon/content/scripts/rpc/service.js67
-rw-r--r--bandwagon/content/scripts/util.js35
-rw-r--r--bandwagon/content/ui/collectionsPaneController.js780
-rw-r--r--bandwagon/content/ui/feedsPaneController.js780
-rw-r--r--bandwagon/content/ui/overlays/browserOverlay.xul7
-rw-r--r--bandwagon/content/ui/publishController.js14
-rw-r--r--bandwagon/content/ui/settings.xul32
-rw-r--r--bandwagon/content/ui/settingsController.js224
-rw-r--r--bandwagon/defaults/preferences/bandwagon.js4
-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.properties4
-rw-r--r--bandwagon/locale/en-US/extensionOverlay.properties12
-rw-r--r--bandwagon/locale/en-US/extensionsOverlay.dtd14
-rw-r--r--bandwagon/locale/en-US/settings.dtd4
-rw-r--r--bandwagon/locale/en-US/settings.properties6
23 files changed, 1503 insertions, 1371 deletions
diff --git a/bandwagon/components/bandwagon-service.js b/bandwagon/components/bandwagon-service.js
index 3a773fc..5978383 100644
--- a/bandwagon/components/bandwagon-service.js
+++ b/bandwagon/components/bandwagon-service.js
@@ -68,15 +68,15 @@ 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,
init: function()
@@ -103,9 +103,9 @@ BandwagonService.prototype = {
this._service = new Bandwagon.RPC.Service();
this._service.registerLogger(Bandwagon.Logger);
- this._service.registerObserver(this._getFeedObserver);
+ this._service.registerObserver(this._getCollectionObserver);
- this.registerFeedUpdateObserver(this._feedUpdateObserver);
+ this.registerCollectionUpdateObserver(this._collectionUpdateObserver);
// init sqlite storage (also creating tables in sqlite if needed). create factory objects.
@@ -119,15 +119,15 @@ 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);
}
// start the update timer
@@ -147,10 +147,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 +169,7 @@ BandwagonService.prototype = {
uninit: function()
{
- this._feedUpdateTimer = null;
+ this._collectionUpdateTimer = null;
this.commitAll();
},
@@ -205,14 +205,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.url + "'");
var extension =
{
@@ -220,7 +220,7 @@ BandwagonService.prototype = {
name: willAutopublishExtensions[i].name
}
- bandwagonService.publishToFeed(extension, feed, "", null);
+ bandwagonService.publishToCollection(extension, collection, "", null);
}
// add to autopublish
@@ -231,13 +231,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 +246,84 @@ BandwagonService.prototype = {
}
else
{
- if (feed != null && feed.url != null)
+ if (collection != null && collection.url != 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.url + "'");
+ bandwagonService.collections[collection.url] = collection;
}
}
// we want to notify the observers even if there's been an error
- bandwagonService._notifyFeedUpdateObservers(feed);
+ bandwagonService._notifyCollectionUpdateObservers(collection);
}
},
- _notifyFeedUpdateObservers: function(feed)
+ _notifyCollectionUpdateObservers: function(collection)
{
- Bandwagon.Logger.debug("Notifying feed update observers");
+ Bandwagon.Logger.debug("Notifying collection update observers");
- for (var i=0; i<bandwagonService._feedUpdateObservers.length; i++)
+ for (var i=0; i<bandwagonService._collectionUpdateObservers.length; i++)
{
- if (bandwagonService._feedUpdateObservers[i])
+ if (bandwagonService._collectionUpdateObservers[i])
{
- bandwagonService._feedUpdateObservers[i](feed);
+ bandwagonService._collectionUpdateObservers[i](collection);
}
}
},
- registerFeedUpdateObserver: function(observer)
+ registerCollectionUpdateObserver: function(observer)
{
- Bandwagon.Logger.debug("Registering feed update observer");
- this._feedUpdateObservers.push(observer);
+ Bandwagon.Logger.debug("Registering collection update observer");
+ this._collectionUpdateObservers.push(observer);
},
- unregisterFeedUpdateObserver: function(observer)
+ unregisterCollectionUpdateObserver: function(observer)
{
- Bandwagon.Logger.debug("Unregistering feed update observer");
+ Bandwagon.Logger.debug("Unregistering collection update observer");
- for (var i=0; i<this._feedUpdateObservers.length; i++)
+ 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)
+ checkForUpdates: function(collection)
{
var doCheck = false;
var now = new Date();
@@ -334,15 +334,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 +357,14 @@ BandwagonService.prototype = {
}
else
{
- Bandwagon.Logger.warn(feed.url + ": no global update interval nor feed update interval -- won't update");
+ Bandwagon.Logger.warn(collection.url + ": 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,62 +388,62 @@ 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)
+ subscribe: function(collection)
{
- feed.preview = false;
- feed.setAllNotified();
+ collection.preview = false;
+ collection.setAllNotified();
- this._service.subscribeFeed(feed);
+ this._service.subscribeCollection(collection);
},
- unsubscribe: function(feed)
+ 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
+ // set up and save default collections
- this._addDefaultFeed(Bandwagon.DEFAULT_FEED1_URL, Bandwagon.DEFAULT_FEED1_NAME);
- this._addDefaultFeed("http://www.33eels.com/clients/briks/bandwagon/testfeed.xml", "test feed");
+ this._addDefaultCollection(Bandwagon.DEFAULT_COLLECTION1_URL, Bandwagon.DEFAULT_COLLECTION1_NAME);
+ this._addDefaultCollection("http://www.33eels.com/clients/briks/bandwagon/testcollection.xml", "test collection");
- // check for cookie to see if we have to add a feed like that
+ // check for cookie to see if we have to add a collection like that
- var addFeedCookieValue = Bandwagon.Util.getCookie(Bandwagon.MAGIC_ADD_FEED_COOKIE_HOST, Bandwagon.MAGIC_ADD_FEED_COOKIE_NAME);
+ var addCollectionCookieValue = Bandwagon.Util.getCookie(Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_HOST, Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_NAME);
- if (addFeedCookieValue)
+ 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?
}
@@ -458,34 +458,34 @@ 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.url = url;
+ collection.name = name;
+ collection.showNotifications = false;
- this.feeds[feed.url] = feed;
+ this.collections[collection.url] = 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)
+ 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.url = url;
+ collection.preview = true;
+ this.collections[collection.url] = collection;
- this.forceCheckForUpdates(feed);
+ this.forceCheckForUpdates(collection);
bandwagonService._notifyListChangeObservers();
- return feed;
+ return collection;
},
uninstall: function()
@@ -493,40 +493,40 @@ BandwagonService.prototype = {
// TODO
},
- commit: function(feed)
+ commit: function(collection)
{
- if (!bandwagonService._feedFactory)
+ if (!bandwagonService._collectionFactory)
return;
- if (feed.preview)
+ if (collection.preview)
return;
- Bandwagon.Logger.debug("In commit() with feed: " + feed.url);
+ Bandwagon.Logger.debug("In commit() with collection: " + collection.url);
- 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);
}
},
- 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 +535,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()
@@ -578,9 +578,9 @@ BandwagonService.prototype = {
Bandwagon.Preferences.setPreferenceList("publish.shared.emails", previouslySharedEmailAddresses);
},
- publishToFeed: function(extension, feed, personalNote, callback)
+ publishToCollection: function(extension, collection, personalNote, callback)
{
- this._service.publishToFeed(extension, feed, personalNote, callback);
+ this._service.publishToCollection(extension, collection, personalNote, callback);
},
shareToEmail: function(extension, emailAddress, personalNote, callback)
@@ -588,36 +588,36 @@ BandwagonService.prototype = {
this._service.shareToEmail(extension, emailAddress, personalNote, callback);
},
- _feedUpdateObserver: function(feed)
+ _collectionUpdateObserver: function(collection)
{
- // called when a feed is updated
+ // 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 feed
+ // 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 _feedUpdateObserver() with feed '" + feed + "', unnotified feed items = " + feed.getUnnotifiedFeedItems().length)
+ 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 +644,7 @@ BandwagonService.prototype = {
return;
}
- this._feedFactory = new Bandwagon.Factory.FeedFactory(this._storageConnection);
+ this._collectionFactory = new Bandwagon.Factory.CollectionFactory(this._storageConnection);
this._initStorageTables();
},
@@ -659,7 +659,7 @@ BandwagonService.prototype = {
try
{
this._storageConnection.executeSimpleSQL(
- "CREATE TABLE IF NOT EXISTS feeds "
+ "CREATE TABLE IF NOT EXISTS collections "
+ "(id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "url TEXT NOT NULL UNIQUE, "
+ "name TEXT NOT NULL, "
@@ -670,12 +670,12 @@ BandwagonService.prototype = {
+ "showNotifications INTEGER NOT NULL, "
+ "autoPublish INTEGER NOT NULL, "
+ "active INTEGER NOT NULL DEFAULT 1, "
- + "feedItemsPerPage INTEGER NOT NULL)"
+ + "addonsPerPage INTEGER NOT NULL)"
);
this._storageConnection.executeSimpleSQL(
- "CREATE TABLE IF NOT EXISTS feedItems "
+ "CREATE TABLE IF NOT EXISTS addons "
+ "(id INTEGER PRIMARY KEY AUTOINCREMENT, "
- + "feed INTEGER NOT NULL, "
+ + "collection INTEGER NOT NULL, "
+ "addon INTEGER NOT NULL, "
+ "read INTEGER NOT NULL DEFAULT 0)"
);
diff --git a/bandwagon/content/scripts/bandwagon.js b/bandwagon/content/scripts/bandwagon.js
index 2da5dfd..1532c58 100644
--- a/bandwagon/content/scripts/bandwagon.js
+++ b/bandwagon/content/scripts/bandwagon.js
@@ -42,15 +42,15 @@ 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 need 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;
+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.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 = "https://bandwagon.stage.mozilla.com/en-US/collections"; // TODO
-Bandwagon.MAGIC_ADD_FEED_COOKIE_HOST = "www.33eels.com"; // TODO
-Bandwagon.MAGIC_ADD_FEED_COOKIE_NAME = "bandwagon_addfeed";
+Bandwagon.COLLECTIONSPANE_DO_SUBSCRIBE_URL = "https://bandwagon.stage.mozilla.com/en-US/collections"; // TODO
+Bandwagon.MAGIC_ADD_COLLECTION_COOKIE_HOST = "www.33eels.com"; // TODO
+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/feedFactory.js b/bandwagon/content/scripts/factory/collectionFactory.js
index b58823b..0b2c4e7 100644
--- a/bandwagon/content/scripts/factory/feedFactory.js
+++ b/bandwagon/content/scripts/factory/collectionFactory.js
@@ -34,69 +34,69 @@
*
* ***** END LICENSE BLOCK ***** */
-Bandwagon.Factory.FeedFactory = function(connection)
+Bandwagon.Factory.CollectionFactory = function(connection)
{
this.Bandwagon = Bandwagon;
this.connection = connection;
}
-Bandwagon.Factory.FeedFactory.prototype.newFeed = function()
+Bandwagon.Factory.CollectionFactory.prototype.newCollection = function()
{
- return new this.Bandwagon.Model.Feed();
+ return new this.Bandwagon.Model.Collection();
}
-Bandwagon.Factory.FeedFactory.prototype.openFeed = function(feed_id)
+Bandwagon.Factory.CollectionFactory.prototype.openCollection = function(collection_id)
{
if (!this.connection)
return null;
- var feeds = {};
+ var collections = {};
- var statement = this.connection.createStatement("SELECT * FROM feeds where id = ?1");
+ var statement = this.connection.createStatement("SELECT * FROM collections where id = ?1");
try
{
- statement.bindInt32Parameter(0, feed_id);
+ statement.bindInt32Parameter(0, collection_id);
statement.execute();
- var feed = this._openFeedFromRS(statement);
+ var collection = this._openCollectionFromRS(statement);
- if (!feed)
+ if (!collection)
return null;
- feed.feedItems = this._openFeedItems(feed);
+ collection.addons = this._openCollectionItems(collection);
- feeds[feed.url] = feed;
+ collections[collection.url] = collection;
}
finally
{
statement.reset();
}
- return feed;
+ return collection;
}
-Bandwagon.Factory.FeedFactory.prototype.openFeeds = function()
+Bandwagon.Factory.CollectionFactory.prototype.openCollections = function()
{
if (!this.connection)
return null;
- var feeds = {};
+ var collections = {};
- var statement = this.connection.createStatement("SELECT * FROM feeds");
+ var statement = this.connection.createStatement("SELECT * FROM collections");
try
{
while (statement.executeStep())
{
- var feed = this._openFeedFromRS(statement);
+ var collection = this._openCollectionFromRS(statement);
- if (!feed)
+ if (!collection)
continue;
- feed.feedItems = this._openFeedItems(feed);
+ collection.addons = this._openCollectionItems(collection);
- feeds[feed.url] = feed;
+ collections[collection.url] = collection;
}
}
finally
@@ -104,29 +104,29 @@ Bandwagon.Factory.FeedFactory.prototype.openFeeds = function()
statement.reset();
}
- return feeds;
+ return collections;
}
-Bandwagon.Factory.FeedFactory.prototype.commitFeed = function(feed)
+Bandwagon.Factory.CollectionFactory.prototype.commitCollection = function(collection)
{
if (!this.connection)
return;
- var statement = this.connection.createStatement("REPLACE INTO feeds VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11)");
+ var statement = this.connection.createStatement("REPLACE INTO collections 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);
+ (collection.id==-1?statement.bindNullParameter(0):statement.bindInt32Parameter(0, collection.id));
+ statement.bindUTF8StringParameter(1, collection.url);
+ 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.execute();
}
@@ -135,43 +135,43 @@ Bandwagon.Factory.FeedFactory.prototype.commitFeed = function(feed)
statement.reset();
}
- if (feed.id == -1)
+ if (collection.id == -1)
{
- feed.id = this.connection.lastInsertRowID;
+ collection.id = this.connection.lastInsertRowID;
}
- for (var id in feed.feedItems)
+ for (var id in collection.addons)
{
- this._commitFeedItem(feed, feed.feedItems[id]);
+ this._commitCollectionItem(collection, collection.addons[id]);
}
return true;
}
-Bandwagon.Factory.FeedFactory.prototype.commitFeeds = function(feeds)
+Bandwagon.Factory.CollectionFactory.prototype.commitCollections = function(collections)
{
- for (var id in feeds)
+ for (var id in collections)
{
- this.commitFeed(feeds[id]);
+ this.commitCollection(collections[id]);
}
}
-Bandwagon.Factory.FeedFactory.prototype.deleteFeed = function(feed)
+Bandwagon.Factory.CollectionFactory.prototype.deleteCollection = function(collection)
{
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");
+ var statement1 = this.connection.createStatement("DELETE FROM collections where id = ?1");
+ var statement2 = this.connection.createStatement("DELETE FROM addons where collection = ?1");
try
{
// TODO transaction here?
- statement1.bindInt32Parameter(0, feed.id);
+ statement1.bindInt32Parameter(0, collection.id);
statement1.execute();
- statement2.bindInt32Parameter(0, feed.id);
+ statement2.bindInt32Parameter(0, collection.id);
statement2.execute();
}
finally
@@ -185,67 +185,67 @@ Bandwagon.Factory.FeedFactory.prototype.deleteFeed = function(feed)
// private methods
-Bandwagon.Factory.FeedFactory.prototype._openFeedFromRS = function(resultset)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionFromRS = 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);
+ var collection = new this.Bandwagon.Model.Collection();
+ collection.id = resultset.getInt32(0);
+ collection.url = 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))
- feed.dateLastCheck = new Date(resultset.getInt32(5)*1000);
+ collection.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);
+ 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);
- return feed;
+ return collection;
}
-Bandwagon.Factory.FeedFactory.prototype._openFeedItems = function(feed)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionItems = function(collection)
{
- var feedItems = {};
+ var addons = {};
- 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");
+ var statement = this.connection.createStatement("SELECT addons.*, addons.id, addons.read FROM addons LEFT JOIN addons ON addons.id = addons.addon WHERE addons.collection = ?1 LIMIT ?2");
try
{
- statement.bindInt32Parameter(0, feed.id);
- statement.bindInt32Parameter(1, this.Bandwagon.DEFAULT_FEED_ITEMS_PER_PAGE);
+ statement.bindInt32Parameter(0, collection.id);
+ statement.bindInt32Parameter(1, this.Bandwagon.DEFAULT_ADDONS_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;
+ var addon = new this.Bandwagon.Model.CollectionItem();
+ addon.Bandwagon = this.Bandwagon;
+
+ addon.id = 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.addonId = statement.getInt32(15);
+ addon.read = (statement.getInt32(16)==1?true:false);
+
+ addon.compatibleApplications = this._openCollectionItemCompatibleApplications(addon);
+ addon.compatibleOS = this._openCollectionItemCompatibleOS(addon);
+ addon.installs = this._openCollectionItemInstalls(addon);
+ addon.comments = this._openCollectionItemComments(addon);
+
+ addons[addon.guid] = addon;
}
}
finally
@@ -253,10 +253,10 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItems = function(feed)
statement.reset();
}
- return feedItems;
+ return addons;
}
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleApplications = function(feedItem)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionItemCompatibleApplications = function(addon)
{
var compatibleApplications = {};
@@ -264,7 +264,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleApplications = fu
try
{
- statement.bindInt32Parameter(0, feedItem.id);
+ statement.bindInt32Parameter(0, addon.id);
while (statement.executeStep())
{
@@ -288,7 +288,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleApplications = fu
return compatibleApplications;
}
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleOS = function(feedItem)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionItemCompatibleOS = function(addon)
{
var compatibleOS = {};
@@ -296,7 +296,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleOS = function(fee
try
{
- statement.bindInt32Parameter(0, feedItem.id);
+ statement.bindInt32Parameter(0, addon.id);
while (statement.executeStep())
{
@@ -313,7 +313,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemCompatibleOS = function(fee
return compatibleOS;
}
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemInstalls = function(feedItem)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionItemInstalls = function(addon)
{
var installs = {};
@@ -321,7 +321,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemInstalls = function(feedIte
try
{
- statement.bindInt32Parameter(0, feedItem.id);
+ statement.bindInt32Parameter(0, addon.id);
while (statement.executeStep())
{
@@ -343,7 +343,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemInstalls = function(feedIte
return installs;
}
-Bandwagon.Factory.FeedFactory.prototype._openFeedItemComments = function(feedItem)
+Bandwagon.Factory.CollectionFactory.prototype._openCollectionItemComments = function(addon)
{
var comments = [];
@@ -351,7 +351,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemComments = function(feedIte
try
{
- statement.bindInt32Parameter(0, feedItem.id);
+ statement.bindInt32Parameter(0, addon.id);
while (statement.executeStep())
{
@@ -372,7 +372,7 @@ Bandwagon.Factory.FeedFactory.prototype._openFeedItemComments = function(feedIte
return comments;
}
-Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedItem)
+Bandwagon.Factory.CollectionFactory.prototype._commitCollectionItem = function(collection, addon)
{
if (!this.connection)
return;
@@ -386,7 +386,7 @@ Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedIte
try
{
- statement.bindUTF8StringParameter(0, feedItem.guid);
+ statement.bindUTF8StringParameter(0, addon.guid);
while (statement.executeStep())
{
@@ -404,13 +404,13 @@ Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedIte
{
if (addonid != null)
{
- // addon already exists (in another feed, or from previous commit of this feed)
+ // addon already exists (in another collection, or from previous commit of this collection)
statement2.bindInt32Parameter(0, addonid);
}
- else if (feedItem.id != -1)
+ else if (addon.id != -1)
{
- // addon doesn't already exist, but exists from a previous commit of this feed (?)
- statement2.bindInt32Parameter(0, feedItem.id);
+ // addon doesn't already exist, but exists from a previous commit of this collection (?)
+ statement2.bindInt32Parameter(0, addon.id);
}
else
{
@@ -418,20 +418,20 @@ Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedIte
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.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();
}
@@ -440,51 +440,51 @@ Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedIte
statement2.reset();
}
- if (feedItem.id == -1 && addonid == null)
+ if (addon.id == -1 && addonid == null)
{
addonid = this.connection.lastInsertRowID;
}
// add the other addon bits
- for (var id in feedItem.compatibleApplications)
+ for (var id in addon.compatibleApplications)
{
- this._commitAddonCompatibleApplication(addonid, feedItem.compatibleApplications[id]);
+ this._commitAddonCompatibleApplication(addonid, addon.compatibleApplications[id]);
}
- for (var id in feedItem.compatibleOS)
+ for (var id in addon.compatibleOS)
{
- this._commitAddonCompatibleOS(addonid, feedItem.compatibleOS[id]);
+ this._commitAddonCompatibleOS(addonid, addon.compatibleOS[id]);
}
- for (var id in feedItem.installs)
+ for (var id in addon.installs)
{
- this._commitAddonInstall(addonid, feedItem.installs[id]);
+ this._commitAddonInstall(addonid, addon.installs[id]);
}
- for (var i=0; i<feedItem.comments.length; i++)
+ for (var i=0; i<addon.comments.length; i++)
{
- this._commitAddonComment(addonid, feedItem.comments[i]);
+ this._commitAddonComment(addonid, addon.comments[i]);
}
- // add the feedItem connector
+ // add the addon connector
- var statement3 = this.connection.createStatement("REPLACE INTO feedItems VALUES (?1, ?2, ?3, ?4)");
+ var statement3 = this.connection.createStatement("REPLACE INTO addons VALUES (?1, ?2, ?3, ?4)");
try
{
- if (feedItem.feedItemId == -1)
+ if (addon.addonId == -1)
{
statement3.bindNullParameter(0);
}
else
{
- statement3.bindInt32Parameter(0, feedItem.feedItemId);
+ statement3.bindInt32Parameter(0, addon.addonId);
}
- statement3.bindInt32Parameter(1, feed.id);
+ statement3.bindInt32Parameter(1, collection.id);
statement3.bindInt32Parameter(2, addonid);
- statement3.bindInt32Parameter(3, (feedItem.read?1:0));
+ statement3.bindInt32Parameter(3, (addon.read?1:0));
statement3.execute();
}
@@ -493,15 +493,15 @@ Bandwagon.Factory.FeedFactory.prototype._commitFeedItem = function(feed, feedIte
statement3.reset();
}
- if (feedItem.feedItemId == -1)
+ if (addon.addonId == -1)
{
- feedItem.feedItemId = this.connection.lastInsertRowID;
+ addon.addonId = this.connection.lastInsertRowID;
}
return true;
}
-Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleApplication = function(addonid, application)
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonCompatibleApplication = function(addonid, application)
{
var statement = this.connection.createStatement("DELETE FROM addonCompatibleApplications WHERE addon = ?1");
@@ -534,7 +534,7 @@ Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleApplication = func
}
}
-Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleOS = function(addonid, os)
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonCompatibleOS = function(addonid, os)
{
var statement = this.connection.createStatement("DELETE FROM addonCompatibleOS WHERE addon = ?1");
@@ -563,7 +563,7 @@ Bandwagon.Factory.FeedFactory.prototype._commitAddonCompatibleOS = function(addo
}
}
-Bandwagon.Factory.FeedFactory.prototype._commitAddonInstall = function(addonid, install)
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonInstall = function(addonid, install)
{
var statement = this.connection.createStatement("DELETE FROM addonInstalls WHERE addon = ?1");
@@ -594,7 +594,7 @@ Bandwagon.Factory.FeedFactory.prototype._commitAddonInstall = function(addonid,
}
}
-Bandwagon.Factory.FeedFactory.prototype._commitAddonComment = function(addonid, comment)
+Bandwagon.Factory.CollectionFactory.prototype._commitAddonComment = function(addonid, comment)
{
var statement = this.connection.createStatement("DELETE FROM addonComments WHERE addon = ?1");
diff --git a/bandwagon/content/scripts/model/feedItem.js b/bandwagon/content/scripts/model/addon.js
index b71a592..aed41b1 100644
--- a/bandwagon/content/scripts/model/feedItem.js
+++ b/bandwagon/content/scripts/model/addon.js
@@ -34,7 +34,7 @@
*
* ***** END LICENSE BLOCK ***** */
-Bandwagon.Model.FeedItem = function()
+Bandwagon.Model.Addon = function()
{
try
{
@@ -45,9 +45,6 @@ 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.name = "";
this.type = -1;
this.guid = "";
@@ -65,12 +62,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 +75,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 +89,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 +106,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 +127,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 +135,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 +149,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 +160,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 +190,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 +210,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 +258,22 @@ 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
- */
+ for each (var xauthor in xaddon.authors.author)
+ {
+ this.authors.push(xauthor.text().toString());
+ }
- if (xaddon.dateadded && xaddon.dateadded.text().toString() != "")
+ for each (var xcategory in xaddon.categories.category)
{
- this.dateAdded = new Date(xaddon.dateadded.text().toString());
+ this.categories.push(xcategory.text().toString());
}
- else if (this.dateAdded == null)
+
+ this.dateAdded = this.Bandwagon.Util.ISO8601toDate(xaddon.meta.added.text().toString());
+
+ for each (var xcomment in xaddon.meta.comments.comment)
{
- this.dateAdded = new Date();
+ this.comments.push(xcomment.text().toString());
}
+
}
diff --git a/bandwagon/content/scripts/model/feed.js b/bandwagon/content/scripts/model/collection.js
index 412ee4a..18a0535 100644
--- a/bandwagon/content/scripts/model/feed.js
+++ b/bandwagon/content/scripts/model/collection.js
@@ -34,92 +34,100 @@
*
* ***** END LICENSE BLOCK ***** */
-Bandwagon.Model.Feed = function()
+Bandwagon.Model.Collection = function()
{
this.Bandwagon = Bandwagon;
- this.id = -1; // internal bandwagon id
+ this.resourceURL = "";
- this.url = "";
this.name = "";
this.description = "";
+ this.creator = "";
+ this.listed = false;
+ this.writable = false;
+ this.subscribed = false;
+ this.lastModified = new Date();
+
+ this.id = -1; // internal bandwagon id
+ this.url = "";
+
this.password = null;
this.dateAdded = new Date();
this.dateLastCheck = null;
- this.updateInterval = this.Bandwagon.DEFAULT_FEED_UPDATE_INTERVAL; // in seconds
+ this.updateInterval = this.Bandwagon.DEFAULT_COLLECTION_UPDATE_INTERVAL; // in seconds
this.showNotifications = true;
this.autoPublish = false;
this.active = true;
- this.feedItemsPerPage = this.Bandwagon.DEFAULT_FEED_ITEMS_PER_PAGE;
+ this.addonsPerPage = this.Bandwagon.DEFAULT_ADDONS_PER_PAGE;
this.preview = false;
this.editable = false;
this.status = this.STATUS_NEW;
- this.feedItems = {};
+ this.addons = {};
}
-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.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.Feed.prototype.getUnreadFeedItems = function()
+Bandwagon.Model.Collection.prototype.getUnreadAddons = function()
{
- var unreadFeedItems = [];
+ var unreadAddons = [];
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- if (!this.feedItems[id].read)
+ if (!this.addons[id].read)
{
- unreadFeedItems.push(this.feedItems[id]);
+ unreadAddons.push(this.addons[id]);
}
}
- return unreadFeedItems;
+ return unreadAddons;
}
-Bandwagon.Model.Feed.prototype.setAllRead = function()
+Bandwagon.Model.Collection.prototype.setAllRead = function()
{
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- this.feedItems[id].read = true;
+ this.addons[id].read = true;
}
}
-Bandwagon.Model.Feed.prototype.getUnnotifiedFeedItems = function()
+Bandwagon.Model.Collection.prototype.getUnnotifiedAddons = function()
{
- var unnotifiedFeedItems = [];
+ var unnotifiedAddons = [];
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- if (!this.feedItems[id].notified)
+ if (!this.addons[id].notified)
{
- unnotifiedFeedItems.push(this.feedItems[id]);
+ unnotifiedAddons.push(this.addons[id]);
}
}
- return unnotifiedFeedItems;
+ return unnotifiedAddons;
}
-Bandwagon.Model.Feed.prototype.setAllNotified = function()
+Bandwagon.Model.Collection.prototype.setAllNotified = function()
{
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- this.feedItems[id].notified = true;
+ this.addons[id].notified = true;
}
}
-Bandwagon.Model.Feed.prototype.getSortedFeedItems = function()
+Bandwagon.Model.Collection.prototype.getSortedAddons = function()
{
- var sortedFeedItems = [];
+ var sortedAddons = [];
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- sortedFeedItems.push(this.feedItems[id]);
+ sortedAddons.push(this.addons[id]);
}
- sortedFeedItems.sort(function(a, b)
+ sortedAddons.sort(function(a, b)
{
// sorting is unread, then dateadded
@@ -129,14 +137,14 @@ Bandwagon.Model.Feed.prototype.getSortedFeedItems = function()
return (a.dateAdded.getTime() < b.dateAdded.getTime()?1:-1);
});
- return sortedFeedItems;
+ return sortedAddons;
}
-Bandwagon.Model.Feed.prototype.hasFeedItem = function()
+Bandwagon.Model.Collection.prototype.hasAddon = function()
{
- for (var id in this.feedItems)
+ for (var id in this.addons)
{
- if (this.feedItems[id] && this.feedItems[id].guid)
+ if (this.addons[id] && this.addons[id].guid)
{
return true;
}
@@ -145,45 +153,40 @@ Bandwagon.Model.Feed.prototype.hasFeedItem = function()
return false;
}
-Bandwagon.Model.Feed.prototype.toString = function()
+Bandwagon.Model.Collection.prototype.toString = function()
{
- return this.name + " (" + this.url + ")";
+ return this.name + " (" + this.resourceURL + ")";
}
-Bandwagon.Model.Feed.prototype.equals = function(other)
+Bandwagon.Model.Collection.prototype.equals = function(other)
{
if (other == null)
return false;
- return (this.url == other.url);
+ return (this.resourceURL == other.resourceURL);
}
-Bandwagon.Model.Feed.prototype.unserialize = function(xaddons)
+Bandwagon.Model.Collection.prototype.unserialize = function(xcollection)
{
- for each (var xaddon in xaddons.addon)
+ for each (var xaddon in xcollection.addons.addon)
{
- var feedItem = new this.Bandwagon.Model.FeedItem();
- feedItem.Bandwagon = this.Bandwagon;
+ var addon = new this.Bandwagon.Model.Addon();
+ addon.Bandwagon = this.Bandwagon;
- feedItem.unserialize(xaddon);
+ addon.unserialize(xaddon);
- if (feedItem.guid && feedItem.guid != "" && feedItem.name && feedItem.name != "")
+ if (addon.guid && addon.guid != "" && addon.name && addon.name != "")
{
- if (this.feedItems[feedItem.guid])
+ if (this.addons[addon.guid])
{
// "merge" with existing item
- this.feedItems[feedItem.guid].unserialize(xaddon);
+ this.addons[addon.guid].unserialize(xaddon);
}
else
{
- this.feedItems[feedItem.guid] = feedItem;
+ this.addons[addon.guid] = addon;
}
}
}
-
- /* 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..e405f6d
--- /dev/null
+++ b/bandwagon/content/scripts/model/serviceDocument.js
@@ -0,0 +1,65 @@
+/* ***** 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.ServiceDocument = function()
+{
+ this.Bandwagon = Bandwagon;
+
+ this.collections = {};
+}
+
+Bandwagon.Model.ServiceDocument.prototype.unserialize = function(xsharing)
+{
+ // 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");
+
+ 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());
+
+ this.collections.push(collection);
+ }
+}
diff --git a/bandwagon/content/scripts/rpc/constants.js b/bandwagon/content/scripts/rpc/constants.js
index 7f6e7da..b558245 100644
--- a/bandwagon/content/scripts/rpc/constants.js
+++ b/bandwagon/content/scripts/rpc/constants.js
@@ -37,11 +37,12 @@
Bandwagon.RPC.Constants = new function()
{
- this.BANDWAGON_RPC_BASE_URL = "https://preview.addons.mozilla.org/en-US/";
+ this.BANDWAGON_RPC_SERVICE_DOCUMENT = "https://bandwagon.stage.mozilla.org/en-US/firefox/api/1.3/sharing";
this.BANDWAGON_RPC_EVENT_TYPE_BANDWAGON_RPC_SHARE_TO_EMAIL_ACTION = "firefox/api/recommend_email";
- 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;
// xhr layer constants
@@ -63,7 +64,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/service.js b/bandwagon/content/scripts/rpc/service.js
index 3d86270..b425721 100644
--- a/bandwagon/content/scripts/rpc/service.js
+++ b/bandwagon/content/scripts/rpc/service.js
@@ -46,7 +46,7 @@ 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._serviceRootURL = this.Bandwagon.RPC.Constants.BANDWAGON_RPC_SERVICE_DOCUMENT;
this.rpcComplete = function(rpcnet, result, response, type, callback)
{
@@ -189,30 +189,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,16 +249,16 @@ 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.subscribeCollection = function(collection, callback)
{
- Bandwagon.Logger.debug("Bandwagon.RPC.Service.subscribeFeed: TBD");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.subscribeCollection: TBD");
// TODO
@@ -237,9 +266,9 @@ Bandwagon.RPC.Service.prototype.subscribeFeed = function(feed, callback)
callback(new this.Bandwagon.RPC.Event());
}
-Bandwagon.RPC.Service.prototype.unsubscribeFeed = function(feed, callback)
+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
@@ -247,10 +276,10 @@ Bandwagon.RPC.Service.prototype.unsubscribeFeed = function(feed, callback)
callback(new this.Bandwagon.RPC.Event());
}
-Bandwagon.RPC.Service.prototype.publishToFeed = function(extension, feed, personalNote, callback)
+Bandwagon.RPC.Service.prototype.publishToCollection = function(extension, collection, personalNote, 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");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToCollection: extension.guid = '" + extension.guid + "', extension.name = '" + extension.name + "', collection = '" + collection.resourceURL + "', personalNote = '" + personalNote + "'");
+ Bandwagon.Logger.debug("Bandwagon.RPC.Service.publishToCollection: TBD");
// TODO
@@ -264,7 +293,7 @@ Bandwagon.RPC.Service.prototype.shareToEmail = function(extension, emailAddress,
{
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 == "")
{
diff --git a/bandwagon/content/scripts/util.js b/bandwagon/content/scripts/util.js
index 9dde8bb..ca11d81 100644
--- a/bandwagon/content/scripts/util.js
+++ b/bandwagon/content/scripts/util.js
@@ -249,3 +249,38 @@ 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;
+};
+
diff --git a/bandwagon/content/ui/collectionsPaneController.js b/bandwagon/content/ui/collectionsPaneController.js
new file mode 100644
index 0000000..3ec81db
--- /dev/null
+++ b/bandwagon/content/ui/collectionsPaneController.js
@@ -0,0 +1,780 @@
+/* ***** 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.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-collectionitems-list");
+ this.elemBandwagonButtonViewSite = document.getElementById("bandwagon-button-viewsite");
+ //this.elemBandwagonButtonUpdate = document.getElementById("bandwagon-button-update");
+ this.elemBandwagonButtonRemove = document.getElementById("bandwagon-button-remove");
+ 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);
+
+ var elemsBandwagonCollection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.getElementsByTagName("bandwagonCollection");
+
+ if (elemsBandwagonCollection.length == 0)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 1;
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 0;
+ }
+ }
+ 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 = 2;
+ }
+ else if (collection.status == collection.STATUS_LOADERROR)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 4;
+ }
+ else if (collection.hasAddon() == 0)
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 3;
+ }
+ else
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonCollectionDeck.selectedIndex = 0;
+ }
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.collectionListChangeObserver = function()
+{
+ Bandwagon.Logger.debug("In Bandwagon.Controller.CollectionsPane.collectionListChangeObserver()");
+
+ Bandwagon.Controller.CollectionsPane._repopulateCollectionsList();
+ Bandwagon.Controller.CollectionsPane._selectPreferredCollection();
+}
+
+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.url + "'");
+
+ // 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);
+
+ // 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 = 2;
+
+ bandwagonService.forceCheckAllForUpdates();
+}
+
+Bandwagon.Controller.CollectionsPane.doSubscribe = function(event)
+{
+ // TODO Build the url with correct locale. See bug 470254
+ Bandwagon.Controller.CollectionsPane._openURL(Bandwagon.COLLECTIONSPANE_DO_SUBSCRIBE_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 = 2;
+
+ var collection = Bandwagon.Controller.CollectionsPane.elemBandwagonCollections.selectedItem.collection;
+
+ if (collection == null)
+ return;
+
+ bandwagonService.forceCheckForUpdates(collection);
+}
+
+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.url):""));
+
+ 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);
+ }
+
+ // 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 = 2;
+ }
+
+ // 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.collectionItem != null)
+ {
+ selectedElemBandwagonAddon.read = true;
+
+ var collectionItem = selectedElemBandwagonAddon.collectionItem;
+ collectionItem.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.collectionItem = collectionItem;
+
+ try
+ {
+ Bandwagon.Controller.CollectionsPane.elemBandwagonAddonExpanded.setAddon(collectionItem);
+ } 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.collectionItem.learnmore);
+}
+
+Bandwagon.Controller.CollectionsPane.doAddToFirefox = function()
+{
+ if (Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem == null)
+ return;
+
+ var collectionItem = Bandwagon.Controller.CollectionsPane.elemBandwagonAddons.selectedItem.collectionItem;
+
+ if (!isXPInstallEnabled())
+ return;
+
+ if (collectionItem.eula && collectionItem.eula != "")
+ {
+ var eula = {
+ name: collectionItem.name,
+ text: collectionItem.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 = collectionItem.getInstaller(Bandwagon.Util.getHostEnvironmentInfo().os);
+
+ if (!installer)
+ {
+ Bandwagon.Logger.warn("No compatible os targets found.");
+ return;
+ }
+
+ var params = [];
+ params[collectionItem.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");
+}
+
+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);
+}
+
+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
+ }
+ ]
+ );
+ }
+}
+
+Bandwagon.Controller.CollectionsPane.doCollectionPreviewDontSubscribe = function()
+{
+ Bandwagon.Logger.debug("in Bandwagon.Controller.CollectionsPane.doCollectionPreviewDontSubscribe()");
+
+ Bandwagon.Controller.CollectionsPane.preferredCollection = null;
+
+ Bandwagon.Controller.CollectionsPane.doRemove();
+}
+
+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(/collectionitemsperpage/))
+ {
+ 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.url] != 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.url + "'");
+
+ // sort by collectionItem.dateAdded
+
+ var collectionItemsSorted = collection.getSortedAddons();
+
+ // repopulate with collection items
+
+ var collectionItemsPerPage = bandwagonService.getAddonsPerPage(collection);
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ for (var i=0; (i<collectionItemsSorted.length&&i<collectionItemsPerPage); i++)
+ {
+ var collectionItem = collection.collectionItems[collectionItemsSorted[i].guid];
+
+ if (collectionItem == null)
+ continue;
+
+ var elemBandwagonAddon = document.createElementNS(XULNS, "bandwagonAddon");
+ elemBandwagonAddon.collectionItem = collectionItem;
+
+ 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);
+ }
+}
+
+// when this window closes, we do any uninit stuff
+
+window.addEventListener("unload", Bandwagon.Controller.CollectionsPane.uninit, true);
+
diff --git a/bandwagon/content/ui/feedsPaneController.js b/bandwagon/content/ui/feedsPaneController.js
deleted file mode 100644
index f3746e4..0000000
--- a/bandwagon/content/ui/feedsPaneController.js
+++ /dev/null
@@ -1,780 +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)
-{
- // TODO Build the url with correct locale. See bug 470254
- 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..3e1ca4c 100644
--- a/bandwagon/content/ui/overlays/browserOverlay.xul
+++ b/bandwagon/content/ui/overlays/browserOverlay.xul
@@ -47,9 +47,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"/>
diff --git a/bandwagon/content/ui/publishController.js b/bandwagon/content/ui/publishController.js
index 492d5dc..05bc8e6 100644
--- a/bandwagon/content/ui/publishController.js
+++ b/bandwagon/content/ui/publishController.js
@@ -40,11 +40,11 @@ Bandwagon.Controller.Publish = new function()
this.hasSubmitted = 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;
@@ -67,7 +67,7 @@ Bandwagon.Controller.Publish.init = function()
switch (Bandwagon.Controller.Publish.publishType)
{
- case Bandwagon.Controller.Publish.TYPE_FEED:
+ case Bandwagon.Controller.Publish.TYPE_COLLECTION:
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)]);
document.getElementById("new-email-box").collapsed = true;
document.getElementById("sharing-with-box").collapsed = true;
@@ -104,8 +104,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 +123,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,
diff --git a/bandwagon/content/ui/settings.xul b/bandwagon/content/ui/settings.xul
index bb7266d..98bb28e 100644
--- a/bandwagon/content/ui/settings.xul
+++ b/bandwagon/content/ui/settings.xul
@@ -65,11 +65,11 @@
<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"
+ <preference id="extensions.bandwagon.addonsperpage"
+ name="extensions.bandwagon.addonsperpage"
type="int"/>
<preference id="extensions.bandwagon.notifyall.enabled"
name="extensions.bandwagon.notifyall.enabled"
@@ -84,15 +84,15 @@
<hbox flex="1">
<vbox>
- <richlistbox id="feeds-list" flex="1"/>
+ <richlistbox id="collections-list" flex="1"/>
<!--
- <toolbox class="bandwagon-feeds-toolbox">
+ <toolbox class="bandwagon-collections-toolbox">
<toolbar pack="start"
align="center">
- <toolbarbutton id="add-feed-button"
+ <toolbarbutton id="add-collection-button"
tooltiptext="&add.label;"
oncommand="Bandwagon.Controller.Settings.doAdd();"/>
- <toolbarbutton id="remove-feed-button"
+ <toolbarbutton id="remove-collection-button"
tooltiptext="&remove.label;"
oncommand="Bandwagon.Controller.Settings.doRemove();"/>
</toolbar>
@@ -100,7 +100,7 @@
-->
</vbox>
<vbox flex="1">
- <!-- <label id="feed-name" crop="end" value=""/> -->
+ <!-- <label id="collection-name" crop="end" value=""/> -->
<!-- Update Interval Settings -->
@@ -110,7 +110,7 @@
<radio id="updates-default" label="&default.label;"/>
<hbox align="center">
<radio id="updates-custom" label="&custom.label;"/>
- <label id="checkbox-updateinterval-perfeed" value="&updatesingle.label;"/>
+ <label id="checkbox-updateinterval-percollection" value="&updatesingle.label;"/>
<textbox id=""
type="number"
min="1"
@@ -143,7 +143,7 @@
<radio id="notifications-default" label="&default.label;"/>
<hbox>
<radio id="notifications-custom" label="&custom.label;"/>
- <checkbox id="checkbox-shownotifications-perfeed" label="&notify.label;"/>
+ <checkbox id="checkbox-shownotifications-percollection" label="&notify.label;"/>
</hbox>
</radiogroup>
</groupbox>
@@ -160,12 +160,12 @@
<radio id="perpage-default" label="&default.label;"/>
<hbox align="center">
<radio id="perpage-custom" label="&custom.label;"/>
- <label id="label-feeditemsperpage"> &feeditemsleadin.label;</label>
- <textbox id="textbox-feeditemsperpage-global"
+ <label id="label-addonsperpage"> &addonsleadin.label;</label>
+ <textbox id="textbox-addonsperpage-global"
type="number"
size="3"
- preference="extensions.bandwagon.feeditemsperpage"/>
- <label id="label-feeditemsperpage"> &feeditemsperpage.label;</label>
+ preference="extensions.bandwagon.addonsperpage"/>
+ <label id="label-addonsperpage"> &addonsperpage.label;</label>
</hbox>
</radiogroup>
</groupbox>
@@ -225,7 +225,7 @@
flex="1">
<!-- Auto-publish Settings -->
<!--
- <checkbox id="checkbox-autopublish-perfeed" label="&autopublish.label;"/>
+ <checkbox id="checkbox-autopublish-percollection" label="&autopublish.label;"/>
-->
<groupbox id="auto-box">
<caption label="&auto.label;"/>
diff --git a/bandwagon/content/ui/settingsController.js b/bandwagon/content/ui/settingsController.js
index 297367a..9d130b5 100644
--- a/bandwagon/content/ui/settingsController.js
+++ b/bandwagon/content/ui/settingsController.js
@@ -37,10 +37,10 @@
Bandwagon.Controller.Settings = new function()
{
- this.feeds = {};
+ this.collections = {};
- this.elemBandwagonFeeds = null;
- this.elemFeedName = null;
+ this.elemBandwagonCollections = null;
+ this.elemCollectionName = null;
this.stringBundle = null;
}
@@ -52,34 +52,34 @@ Bandwagon.Controller.Settings.init = function()
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("checkbox-updateinterval-percollection").checked = true;
}
//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("textbox-updateinterval-quantity").addEventListener("input", Bandwagon.Controller.Settings.doSaveCollection, true);
+ document.getElementById("textbox-updateinterval-quantity").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, false);
+ document.getElementById("menulist-updateinterval-units").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("checkbox-shownotifications-percollection").checked = 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-shownotifications-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true);
- //document.getElementById("checkbox-autopublish-perfeed").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true);
+ //document.getElementById("checkbox-autopublish-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true);
- bandwagonService.registerFeedListChangeObserver(Bandwagon.Controller.Settings.feedListChangeObserver);
+ bandwagonService.registerCollectionListChangeObserver(Bandwagon.Controller.Settings.collectionListChangeObserver);
setTimeout(function()
{
@@ -90,33 +90,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,94 +124,94 @@ 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 collectionCount = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection").length;
+ var colllectionSelection = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem;
- var disabled = (!feedSelection || feedCount == 0);
+ var disabled = (!collectionSelection || collectionCount == 0);
- document.getElementById("remove-feed-button").disabled = disabled;
- //document.getElementById("checkbox-updateinterval-perfeed").disabled = disabled;
+ document.getElementById("remove-collection-button").disabled = disabled;
+ //document.getElementById("checkbox-updateinterval-percollection").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-percollection").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;
+ document.getElementById("textbox-addonsperpage-global").disabled = disabled;
+ //document.getElementById("checkbox-autopublish-percollection").disabled = disabled;
+ document.getElementById("label-addonsperpage").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.url];
- Bandwagon.Logger.debug("showing feed: " + (feed?feed.url:"<none>"));
+ Bandwagon.Logger.debug("showing collection: " + (collection?collection.url:"<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);
+ Bandwagon.Controller.Settings.elemCollectionName.value = (collection.name&&collection.name!=""?collection.name:collection.url);
//if (document.getElementById("checkbox-updateinterval-global").checked)
if (true)
{
- // updateinterval: if "apply to all feeds" is checked - set updateinterval quantity and interval to global
+ // updateinterval: if "apply to all collections" is checked - set updateinterval quantity and interval to global
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 "apply to all collections" is unchecked - 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").valueNumber = interval.interval;
document.getElementById("menulist-updateinterval-units").selectedIndex = interval.units-1;
- //document.getElementById("checkbox-updateinterval-perfeed").checked = true;
+ //document.getElementById("checkbox-updateinterval-percollection").checked = true;
}
//if (document.getElementById("checkbox-shownotifications-global").checked)
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 "apply to all collections" is checked - set shownotifications to global
+ document.getElementById("checkbox-shownotifications-percollection").checked = document.getElementById("extensions.bandwagon.notifyall.enabled").value;
}
else
{
- // shownotifications: if "apply to all feeds" not checked - set shownotifications to this feed
- document.getElementById("checkbox-shownotifications-perfeed").checked = feed.showNotifications;
+ // shownotifications: if "apply to all collections" not checked - set shownotifications to this collection
+ document.getElementById("checkbox-shownotifications-percollection").checked = collection.showNotifications;
}
// 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.url];
- 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("checkbox-shownotifications-percollection").checked;
+ //collection.autoPublish = document.getElementById("checkbox-autopublish-percollection").checked;
if (document.getElementById("bandwagon-settings").instantApply)
{
@@ -219,62 +219,62 @@ 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.url,
+ 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 (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();
}
}
@@ -284,27 +284,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.url);
}
- bwFeed.updateInterval = localFeed.updateInterval;
- bwFeed.showNotifications = localFeed.showNotifications;
- bwFeed.autoPublish = localFeed.autoPublish;
+ bwCollection.updateInterval = localCollection.updateInterval;
+ bwCollection.showNotifications = localCollection.showNotifications;
+ bwCollection.autoPublish = localCollection.autoPublish;
}
}
@@ -323,23 +323,23 @@ 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);
}
}
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;
@@ -350,8 +350,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.url)]);
var proceed = promptService.confirm(
window,
promptTitle,
@@ -362,10 +362,10 @@ 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);
}
}
@@ -373,17 +373,17 @@ 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);
+ //document.getElementById("extensions.bandwagon.updateall.enabled").value = (document.getElementById("checkbox-updateinterval-percollection").checked && document.getElementById("checkbox-updateinterval-global").checked);
document.getElementById("extensions.bandwagon.updateall.enabled").value = document.getElementById("checkbox-updateinterval-global").checked;
- 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("checkbox-shownotifications-percollection").checked && document.getElementById("checkbox-shownotifications-global").checked);
- 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/locale/en-US/bandwagonAddon.properties b/bandwagon/locale/en-US/bandwagonAddon.properties
new file mode 100644
index 0000000..72a3b44
--- /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=— %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.properties b/bandwagon/locale/en-US/browserOverlay.properties
index 5f3badb..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 subscription '%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 0d25dc0..ec7b639 100644
--- a/bandwagon/locale/en-US/extensionOverlay.properties
+++ b/bandwagon/locale/en-US/extensionOverlay.properties
@@ -1,8 +1,8 @@
-feedspane.this.is.only.a.preview=This is only a preview!
-feedspane.if.you.do.not.subscribe=If you do not subscribe, this subscription 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 subscription 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:
diff --git a/bandwagon/locale/en-US/extensionsOverlay.dtd b/bandwagon/locale/en-US/extensionsOverlay.dtd
index 8d0deaf..135ab14 100644
--- a/bandwagon/locale/en-US/extensionsOverlay.dtd
+++ b/bandwagon/locale/en-US/extensionsOverlay.dtd
@@ -34,11 +34,11 @@
-
- ***** END LICENSE BLOCK ***** -->
-<!ENTITY feeds.label "Subscriptions">
+<!ENTITY collections.label "Subscriptions">
<!ENTITY search.label.bandwagon "Search">
-<!ENTITY feeditem.moreinfo "More info.">
-<!ENTITY feeditem.addtofirefox "Add to Firefox">
+<!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">
@@ -46,11 +46,11 @@
<!ENTITY view.label "View Collection">
<!ENTITY unsubscribe.label "Unsubscribe">
-<!ENTITY nofeedssubscribed.label "You are not subscribed to any subscriptions">
+<!ENTITY nocollectionssubscribed.label "You are not subscribed to any subscriptions">
<!ENTITY clicktosubscribe.label "Browse subscriptions">
-<!ENTITY feedisloading.label "Retrieving subscription">
-<!ENTITY feedhasnoitems.label "This feed contains no items.">
-<!ENTITY feedhaserror.label "This feed failed to load because it contains errors.">
+<!ENTITY collectionisloading.label "Retrieving subscription">
+<!ENTITY collectionhasnoitems.label "This feed contains no items.">
+<!ENTITY collectionhaserror.label "This feed failed to load because it contains errors.">
<!ENTITY publishto.label "Publish to">
<!ENTITY email.address.label "E-mail Address">
diff --git a/bandwagon/locale/en-US/settings.dtd b/bandwagon/locale/en-US/settings.dtd
index c39e593..302f561 100644
--- a/bandwagon/locale/en-US/settings.dtd
+++ b/bandwagon/locale/en-US/settings.dtd
@@ -52,8 +52,8 @@
<!ENTITY default.label "Use default setting">
<!ENTITY custom.label "Custom:">
-<!ENTITY feeditemsleadin.label "Show">
-<!ENTITY feeditemsperpage.label "add-ons per page">
+<!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)">
diff --git a/bandwagon/locale/en-US/settings.properties b/bandwagon/locale/en-US/settings.properties
index 0970aae..12c8fe7 100644
--- a/bandwagon/locale/en-US/settings.properties
+++ b/bandwagon/locale/en-US/settings.properties
@@ -1,4 +1,4 @@
-add.feed=Add Subscription
-enter.url.to.add.feed=Enter the URL of the subscription you want to add.
-remove.feed=Remove Subscription
+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?