Author: erinnp
Date: Fri Jun 28 15:34:08 2013
New Revision: 1497816
URL: http://svn.apache.org/r1497816
Log:
clean up TODOs that have been handled, add some comments, check core
dependencies
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_ajax.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
Fri Jun 28 15:34:08 2013
@@ -260,7 +260,6 @@
<portal:register-init-script location="${'AFTER_RAVE'}">
<script>
require(["rave", "ui", "portal/rave_display", "portal/rave_store",
"jquery"], function(rave, ui, raveDisplay, raveStore, $){
- //TODO: Ask Erin about duplicate code, put it in a module?
//Helper function for callback below
function addWidgetToPageCallback (result){
var widgetTitle = ui.getClientMessage("widget.add_prefix");
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
Fri Jun 28 15:34:08 2013
@@ -28,7 +28,6 @@
<%-- check to see if the javaScriptDebugMode is on, if so render the
individual JS files, otherwise render the minified single file --%>
<c:choose>
<c:when test="${jsDebugMode == '1'}">
- <!--TODO: figure out js debug mode -->
<script src="<spring:url
value="/static/script/requireConfig.js"/>"></script>
<script>
requirejs.config({baseUrl:"/portal/static/script"});
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_ajax.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_ajax.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_ajax.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_ajax.js
Fri Jun 28 15:34:08 2013
@@ -17,6 +17,11 @@
* under the License.
*/
+
+/*
+ By default rave uses jquery as its ajax library. If you want to use
another ajax library overlay this file
+ and return a function that conforms with the api of jquery's ajax()
function - http://api.jquery.com/jQuery.ajax/
+ */
define(['jquery'], function($){
return $.ajax;
})
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
Fri Jun 28 15:34:08 2013
@@ -17,7 +17,6 @@
* under the License.
*/
-//TODO: jquery dependency should not be here.
define(['underscore', 'core/rave_ajax', 'core/rave_state_manager',
'core/rave_event_manager'],
function (_, ajax, stateManager, eventManager) {
//stores virtual host context of application execution
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js
Fri Jun 28 15:34:08 2013
@@ -27,12 +27,10 @@ define(['underscore', 'core/rave_log', '
}
openAjaxHub = new OpenAjax.hub.ManagedHub({
onSubscribe:function (topic, container) {
- //TODO:ask erin about changing rave to exports
log((container == null ? "Container" :
container.getClientID()) + " subscribes to this topic '" + topic + "'");
return true;
},
onUnsubscribe:function (topic, container) {
- //TODO:ask erin about changing rave to exports
log((container == null ? "Container" :
container.getClientID()) + " unsubscribes from this topic '" + topic + "'");
return true;
},
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
Fri Jun 28 15:34:08 2013
@@ -142,7 +142,6 @@ define(['underscore', 'core/rave_view_ma
}
}
-
exports.initWidget = function (widget) {
widget.error = getMetadataErrors(widget.metadata);
if (!widget.error) {
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js
Fri Jun 28 15:34:08 2013
@@ -17,10 +17,12 @@
* under the License.
*/
+
+/*
+ This determines which providers the client supports. If you need only os
or wookie, overlay this file.
+ Providers should be registered with ALL LOWERCASE keys
+ */
define(['core/rave_wookie', 'core/rave_opensocial'], function(wookie, os){
- /*
- All providers should be registered with ALL LOWERCASE keys
- */
return{
w3c:wookie,
opensocial:os
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
Fri Jun 28 15:34:08 2013
@@ -17,117 +17,118 @@
* under the License.
*/
-define(['underscore', 'core/rave_api', 'core/rave_view_manager',
'core/rave_providers'], function(_, api, viewManager, providers){
+define(['underscore', 'core/rave_api', 'core/rave_view_manager',
'core/rave_providers'],
+ function (_, api, viewManager, providers) {
- function getProvider(name) {
- return providers[name.toLowerCase()];
- }
-
- /*
- rave widget constructor
- */
- var Widget = function (definition) {
- var provider = definition.type;
-
- _.extend(this, definition);
-
- this._provider = getProvider(provider);
-
- if (!this._provider) {
- throw new Error('Cannot render widget ' + definition.widgetUrl +
'. ' +
- 'Provider ' + provider + ' is not registered.');
- }
-
- this._provider.initWidget(this);
- }
-
- Widget.extend = function (mixin) {
- _.extend(this.prototype, mixin);
- }
-
- Widget.prototype.render = function (el, opts) {
- //if we receive only one argument, and the first arg is not a string
or dom element, assume it is an opts object
- //and el should default to the widgets current render element
- if (!opts && !(_.isString(el) || (el instanceof HTMLElement))) {
- opts = el;
- el = this._el;
- }
- //if el is a string, go to rave's view system
- if (_.isString(el)) {
- //TODO: potential memory leak - rendering a widget into new views
does not force cleanup of current view
- var view = viewManager.renderView(el, this);
- el = view.getWidgetSite();
- this._view = view;
- }
- //at this point el must be a valid dom element. if not, throw an error
- if (!(el instanceof HTMLElement)) {
- throw new Error('Cannot render widget. You must provide an el to
render the view into');
- }
- this._el = el;
- this._provider.renderWidget(this, el, opts);
- return this;
- }
-
- Widget.prototype.renderError = function (el, errors) {
- el.innerHTML = 'Error rendering widget.' + "<br /><br />" + errors;
- }
-
- Widget.prototype.hide = function () {
- this.collapsed = true;
-
- api.rest.saveWidgetCollapsedState({
- regionWidgetId: this.regionWidgetId,
- collapsed: this.collapsed
- });
- }
-
- Widget.prototype.show = function () {
- this.collapsed = false;
-
- api.rest.saveWidgetCollapsedState({
- regionWidgetId: this.regionWidgetId,
- collapsed: this.collapsed
- });
- }
-
- Widget.prototype.close = function (opts) {
- this._provider.closeWidget(this, opts);
- if (this._view) {
- viewManager.destroyView(this._view);
- }
-
- api.rpc.removeWidget({
- regionWidgetId: this.regionWidgetId
- });
- }
-
- Widget.prototype.moveToPage = function (toPageId, cb) {
- api.rpc.moveWidgetToPage({
- toPageId: toPageId,
- regionWidgetId: this.regionWidgetId,
- successCallback: cb
- });
- }
-
- Widget.prototype.moveToRegion = function (fromRegionId, toRegionId,
toIndex) {
- api.rpc.moveWidgetToRegion({
- regionWidgetId: this.regionWidgetId,
- fromRegionId: fromRegionId,
- toRegionId: toRegionId,
- toIndex: toIndex
- });
- }
-
- Widget.prototype.savePreference = function (name, val) {
- this.userPrefs[name] = val;
- api.rest.saveWidgetPreference({regionWidgetId: this.regionWidgetId,
prefName: name, prefValue: val});
- }
-
- Widget.prototype.savePreferences = function (updatedPrefs) {
- this.userPrefs = updatedPrefs;
- api.rest.saveWidgetPreferences({regionWidgetId: this.regionWidgetId,
userPrefs: updatedPrefs});
- }
+ function getProvider(name) {
+ return providers[name.toLowerCase()];
+ }
+
+ /*
+ rave widget constructor
+ */
+ var Widget = function (definition) {
+ var provider = definition.type;
+
+ _.extend(this, definition);
+
+ this._provider = getProvider(provider);
+
+ if (!this._provider) {
+ throw new Error('Cannot render widget ' + definition.widgetUrl
+ '. ' +
+ 'Provider ' + provider + ' is not registered.');
+ }
+
+ this._provider.initWidget(this);
+ }
+
+ Widget.extend = function (mixin) {
+ _.extend(this.prototype, mixin);
+ }
+
+ Widget.prototype.render = function (el, opts) {
+ //if we receive only one argument, and the first arg is not a
string or dom element, assume it is an opts object
+ //and el should default to the widgets current render element
+ if (!opts && !(_.isString(el) || (el instanceof HTMLElement))) {
+ opts = el;
+ el = this._el;
+ }
+ //if el is a string, go to rave's view system
+ if (_.isString(el)) {
+ //TODO: potential memory leak - rendering a widget into new
views does not force cleanup of current view
+ var view = viewManager.renderView(el, this);
+ el = view.getWidgetSite();
+ this._view = view;
+ }
+ //at this point el must be a valid dom element. if not, throw an
error
+ if (!(el instanceof HTMLElement)) {
+ throw new Error('Cannot render widget. You must provide an el
to render the view into');
+ }
+ this._el = el;
+ this._provider.renderWidget(this, el, opts);
+ return this;
+ }
+
+ Widget.prototype.renderError = function (el, errors) {
+ el.innerHTML = 'Error rendering widget.' + "<br /><br />" + errors;
+ }
+
+ Widget.prototype.hide = function () {
+ this.collapsed = true;
+
+ api.rest.saveWidgetCollapsedState({
+ regionWidgetId: this.regionWidgetId,
+ collapsed: this.collapsed
+ });
+ }
+
+ Widget.prototype.show = function () {
+ this.collapsed = false;
+
+ api.rest.saveWidgetCollapsedState({
+ regionWidgetId: this.regionWidgetId,
+ collapsed: this.collapsed
+ });
+ }
+
+ Widget.prototype.close = function (opts) {
+ this._provider.closeWidget(this, opts);
+ if (this._view) {
+ viewManager.destroyView(this._view);
+ }
+
+ api.rpc.removeWidget({
+ regionWidgetId: this.regionWidgetId
+ });
+ }
+
+ Widget.prototype.moveToPage = function (toPageId, cb) {
+ api.rpc.moveWidgetToPage({
+ toPageId: toPageId,
+ regionWidgetId: this.regionWidgetId,
+ successCallback: cb
+ });
+ }
+
+ Widget.prototype.moveToRegion = function (fromRegionId, toRegionId,
toIndex) {
+ api.rpc.moveWidgetToRegion({
+ regionWidgetId: this.regionWidgetId,
+ fromRegionId: fromRegionId,
+ toRegionId: toRegionId,
+ toIndex: toIndex
+ });
+ }
+
+ Widget.prototype.savePreference = function (name, val) {
+ this.userPrefs[name] = val;
+ api.rest.saveWidgetPreference({regionWidgetId:
this.regionWidgetId, prefName: name, prefValue: val});
+ }
+
+ Widget.prototype.savePreferences = function (updatedPrefs) {
+ this.userPrefs = updatedPrefs;
+ api.rest.saveWidgetPreferences({regionWidgetId:
this.regionWidgetId, userPrefs: updatedPrefs});
+ }
- return Widget;
-})
\ No newline at end of file
+ return Widget;
+ })
\ No newline at end of file
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
Fri Jun 28 15:34:08 2013
@@ -61,8 +61,5 @@ define(['underscore', 'core/rave_widget'
return widgets;
}
- //TODO: I killed registerInitHandlers! Tell people.
-
- //TODO: reset isn't going to work well with individual modules holding
private data
return rave;
})
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
Fri Jun 28 15:34:08 2013
@@ -37,7 +37,6 @@ define(['core/rave_openajax_hub', 'core/
IframeContainer: {
parent: el,
iframeAttrs: {
- //TODO: hardcoding numbers, should come from
regionWidget?
height: widget.height ||
stateManager.getDefaultHeight(),
width: widget.width ||
stateManager.getDefaultWidth(),
frameborder: 0
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
Fri Jun 28 15:34:08 2013
@@ -131,11 +131,6 @@ define(["underscore", "portal/rave_backb
members: {}
},
- /*
- TODO: currently this is used to silently bootstrap the page model
from the page view. Once
- the jsp views are lightened up we should be able to provide a full
representation of the page
- model to pass to .set() and this should not be needed.
- */
addInitData: function (userId, isEditor) {
var members = this.get('members');
@@ -180,7 +175,6 @@ define(["underscore", "portal/rave_backb
/*
The model does not manage or care about views. Instead it
fires events
that views can subscribe to for ui representation.
- TODO: solidify and document eventing model
*/
self.trigger('share', 'member:add', userId);
}
@@ -255,11 +249,6 @@ define(["underscore", "portal/rave_backb
rave.api.rpc.clonePageForUser({pageId: this.get('id'), userId:
userId, pageName: pageName,
successCallback: function(result){
if(result.error) {
- /*
- TODO: this is a weird error handling condition used
by clone to catch duplicate
- named pages. Firing an event and letting the view
handle for now, but the api
- should be managing errors better.
- */
return self.trigger('error', result.errorCode, userId);
}
self.trigger('share', 'clone', userId);
Modified:
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js?rev=1497816&r1=1497815&r2=1497816&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
(original)
+++
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
Fri Jun 28 15:34:08 2013
@@ -28,7 +28,6 @@ define(["jquery", "underscore", "rave",
*/
var views = exports.views = {};
- //TODO: root app view, will be expanded significantly
var App = raveBackbone.View.extend({
models: {
page: raveModels.currentPage
@@ -393,7 +392,6 @@ define(["jquery", "underscore", "rave",
}
}
- //TODO: this is a travesty for now but will be replaced by views
function showWidgetPrefs(widget) {
var WIDGET_PREFS_INPUT_REQUIRED_CLASS =
"widget-prefs-input-required";
var WIDGET_PREFS_INPUT_FAILED_VALIDATION =
"widget-prefs-input-failed-validation";
@@ -750,7 +748,6 @@ define(["jquery", "underscore", "rave",
function openFullScreenOverlay(widgetId) {
addCanvasOverlay($("#pageContent"));
- //TODO: make this work
getNonLockedRegions().sortable("option", "disabled", true);
$("#widget-" + widgetId +
"-wrapper").removeClass("widget-wrapper").addClass("widget-wrapper-canvas");
// hide the widget menu