Author: ssievers
Date: Fri Mar 9 19:25:52 2012
New Revision: 1298995
URL: http://svn.apache.org/viewvc?rev=1298995&view=rev
Log:
SHINDIG-1725 | osapi.container.util.warn causes errors when used in Internet
Explorer
Modified:
shindig/trunk/content/samplecontainer/examples/commoncontainer/index.html
shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
shindig/trunk/features/src/main/javascript/features/container.util/util.js
shindig/trunk/features/src/test/javascript/features/container/gadget_site_test.js
Modified:
shindig/trunk/content/samplecontainer/examples/commoncontainer/index.html
URL:
http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/index.html?rev=1298995&r1=1298994&r2=1298995&view=diff
==============================================================================
--- shindig/trunk/content/samplecontainer/examples/commoncontainer/index.html
(original)
+++ shindig/trunk/content/samplecontainer/examples/commoncontainer/index.html
Fri Mar 9 19:25:52 2012
@@ -130,8 +130,12 @@
<div style='display: block;'>
<input type="text" name="gadgetUrl" id="gadgetUrl"
- class="text ui-widget-content ui-corner-all"/>
- <button id="addGadget">Add</button>
+ class="text ui-widget-content ui-corner-all"
+ style="width: 100%"/>
+ <br />
+ <button id="preloadAndAddGadget">Preload and
Add</button><br />
+ <button id="addGadget">Add only</button><br />
+ <button id="preloadGadget">Preload only</button><br />
</div>
<p>-OR-</p>
Modified:
shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js?rev=1298995&r1=1298994&r2=1298995&view=diff
==============================================================================
---
shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js
(original)
+++
shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js
Fri Mar 9 19:25:52 2012
@@ -105,20 +105,22 @@ $(function() {
};
getNewGadgetElement = function(result, gadgetURL){
+ result[gadgetURL] = result[gadgetURL] || {};
var gadgetSiteString =
"$(this).closest(\'.portlet\').find(\'.portlet-content\').data(\'gadgetSite\')";
var viewItems = '';
- var gadgetViews = result[gadgetURL].views;
+ var gadgetViews = result[gadgetURL].views || {};
for (var aView in gadgetViews) {
viewItems = viewItems + '<li><a href="#" onclick="navigateView(' +
gadgetSiteString + ',' + '\'' + gadgetURL + '\'' + ',' + '\'' + aView + '\'' +
'); return false;">' + aView + '</a></li>';
}
var newGadgetSite = gadgetTemplate;
newGadgetSite = newGadgetSite.replace(/(gadget-site)/g, '$1-' + curId);
siteToTitleMap['gadget-site-' + curId] = 'gadget-title-' + curId;
+ var gadgetTitle = (result[gadgetURL] && result[gadgetURL]['modulePrefs']
&& result[gadgetURL]['modulePrefs'].title) || 'Title not set';
$(newGadgetSite).appendTo($('#gadgetArea')).addClass('ui-widget
ui-widget-content ui-helper-clearfix ui-corner-all')
.find('.portlet-header')
.addClass('ui-widget-header ui-corner-all')
.text('')
- .append('<span id="gadget-title-' + curId + '">' +
result[gadgetURL]['modulePrefs'].title + '</span>' +
+ .append('<span id="gadget-title-' + curId + '">' + gadgetTitle +
'</span>' +
'<ul id="viewsDropdown">' +
'<li class="li-header">' +
'<a href="#" class="hidden"><span id="dropdownIcon"
class="ui-icon ui-icon-triangle-1-s"></span></a>' +
@@ -136,6 +138,7 @@ $(function() {
//create a gadget with navigation tool bar header enabling gadget
collapse, expand, remove, navigate to view actions.
buildGadget = function(result,gadgetURL){
+ result = result || {};
var element = getNewGadgetElement(result, gadgetURL);
$(element).data('gadgetSite', CommonContainer.renderGadget(gadgetURL,
curId));
@@ -160,8 +163,8 @@ $(function() {
return true;
});
- // Load single gadgets entered by user
- $('#addGadget').click(function() {
+ // Preload then add a single gadget entered by user
+ $('#preloadAndAddGadget').click(function() {
CommonContainer.preloadGadget(newGadgetUrl.val(),
function(result) {
for (var gadgetURL in result) {
if(!result[gadgetURL].error) {
@@ -177,6 +180,33 @@ $(function() {
return true;
});
+ // Preload a single gadget entered by user (don't add it to the page)
+ $('#preloadGadget').click(function() {
+ CommonContainer.preloadGadget(newGadgetUrl.val(), function(result) {
+ for (var gadgetURL in result) {
+ if(!result[gadgetURL].error) {
+ //buildGadget(result, gadgetURL);
+ curId++;
+ }
+ }
+
+ //Clear Values
+ newGadgetUrl.val('');
+ });
+
+ return true;
+ });
+
+ // Add a single gadget entered by user (no preloading)
+ $('#addGadget').click(function() {
+ buildGadget({}, newGadgetUrl.val());
+ curId++;
+
+ //Clear Values
+ newGadgetUrl.val('');
+ return true;
+ });
+
// Load the select collection of gadgets and render them the gadget
test area
$('#addGadgets').click(function() {
Modified:
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js?rev=1298995&r1=1298994&r2=1298995&view=diff
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
(original)
+++
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
Fri Mar 9 19:25:52 2012
@@ -175,7 +175,7 @@ osapi.container.GadgetSite.prototype.nav
var gadgetInfo = response[gadgetUrl];
if (gadgetInfo.error) {
var message = ['Failed to navigate for gadget ', gadgetUrl,
'.'].join('');
- osapi.container.util.warn(message);
+ gadgets.warn(message);
} else {
var moduleId = renderParams[osapi.container.RenderParam.MODULE_ID] || 0;
self.setModuleId_(gadgetUrl, moduleId, function() {
Modified:
shindig/trunk/features/src/main/javascript/features/container.util/util.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.util/util.js?rev=1298995&r1=1298994&r2=1298995&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/container.util/util.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/container.util/util.js
Fri Mar 9 19:25:52 2012
@@ -144,18 +144,6 @@ osapi.container.util.isEmptyJson = funct
return true;
};
-
-/**
- * Put up a warning message to console.
- * @param {String} message to warn with.
- */
-osapi.container.util.warn = function(message) {
- if (console && console.warn) {
- console.warn(message);
- }
-};
-
-
/**
* @return {number} current time in ms.
*/
Modified:
shindig/trunk/features/src/test/javascript/features/container/gadget_site_test.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/container/gadget_site_test.js?rev=1298995&r1=1298994&r2=1298995&view=diff
==============================================================================
---
shindig/trunk/features/src/test/javascript/features/container/gadget_site_test.js
(original)
+++
shindig/trunk/features/src/test/javascript/features/container/gadget_site_test.js
Fri Mar 9 19:25:52 2012
@@ -42,8 +42,8 @@ GadgetSiteTest.prototype.setUp = functio
};
this.util_warn_value = null;
- this.util_warn_func = osapi.container.util.warn;
- osapi.container.util.warn = function(value) {
+ this.util_warn_func = gadgets.warn;
+ gadgets.warn = function(value) {
self.util_warn_value = value;
};
@@ -54,7 +54,7 @@ GadgetSiteTest.prototype.setUp = functio
GadgetSiteTest.prototype.tearDown = function() {
osapi.container.util.getCurrentTimeMs = this.util_getCurrentTimeMs_func;
- osapi.container.util.warn = this.util_warn_func;
+ gadgets.warn = this.util_warn_func;
delete window[this.NAVIGATE_CALLBACK];
};