You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Damian Biollo (JIRA)" <ji...@apache.org> on 2010/07/26 23:05:16 UTC

[jira] Created: (SHINDIG-1398) Shindig feature has Javascript error in setUserPref

Shindig feature has Javascript error in setUserPref
---------------------------------------------------

                 Key: SHINDIG-1398
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1398
             Project: Shindig
          Issue Type: Bug
          Components: Javascript 
    Affects Versions: 2.0.0
            Reporter: Damian Biollo


This can be reproduced very easily. Try the sample container, pointing to the Pixies Lab TODO list.
(http://localhost:8080/samplecontainer/samplecontainer.html with "Displaying gadget" = http://www.labpixies.com/campaigns/todo/todo.xml)
Then, with Firebug open, simply add a new TODO item.

You will see a JS error in the following code from shindig-container.js (from the shindig-container feature).
It happens on the line "this.userPrefs[...] = ... (see code below).


The GadgetService doesn't have a userPrefs member. Instead, it should be calling the function on the gadget.


shindig.IfrGadgetService.prototype.setUserPref = function(editToken, name,
    value) {
  var id = shindig.container.gadgetService.getGadgetIdFromModuleId(this.f);
  var gadget = shindig.container.getGadget(id);
  for (var i = 1, j = arguments.length; i < j; i += 2) {
    this.userPrefs[arguments[i]].value = arguments[i + 1];
  }
  gadget.saveUserPrefs();
};


Changing the line inside the loop to this fixes the problem:
gadget.userPrefs[arguments[i]].value = arguments[i + 1];

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SHINDIG-1398) Shindig feature has Javascript error in setUserPref

Posted by "Damian Biollo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892523#action_12892523 ] 

Damian Biollo edited comment on SHINDIG-1398 at 7/26/10 7:12 PM:
-----------------------------------------------------------------

Additionally, even with this fix, the sample1 container is broken:
http://localhost:4242/container/sample1.html

You get a javascript error when adding TODO's in the gadget:
gadget.userPrefs[arguments[i]] is undefined
anonymous("383154205", "saved_tasks", "_#$LAB_MATAN$#_0_#$LAB_UDI$#_adf_#$LAB_UDI$#_black")shindig-...nocache=1 (line 5114)
process()shindig-...nocache=1 (line 2820)
anonymous()

In the samplecontainer.html, this problem doesn't occur because the metadata, including userPrefs, is initialized on startup.

Perhaps there should be a check to allow the gadget to work without user preferences?

Ex:

      if (gadget.userPrefs[arguments[i]]) {
          gadget.userPrefs[arguments[i]].value = arguments[i + 1];
      } else {
          gadgets.warn("User preference does not exist: " + arguments[i] + " for gadget: " + gadget.specUrl);
      }

      was (Author: damian.biollo):
    Additionally, even with this fix, the sample1 container is broken:
http://localhost:4242/container/sample1.html

You get a javascript error when adding TODO's in the gadget:
gadget.userPrefs[arguments[i]] is undefined
anonymous("383154205", "saved_tasks", "_#$LAB_MATAN$#_0_#$LAB_UDI$#_adf_#$LAB_UDI$#_black")shindig-...nocache=1 (line 5114)
process()shindig-...nocache=1 (line 2820)
anonymous()

In the samplecontainer.html, this problem doesn't occur because the metadata, including userPrefs, is initialized on startup.

Perhaps there should be a check to allow the gadget to work without user preferences?
  
> Shindig feature has Javascript error in setUserPref
> ---------------------------------------------------
>
>                 Key: SHINDIG-1398
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1398
>             Project: Shindig
>          Issue Type: Bug
>          Components: Javascript 
>    Affects Versions: 2.0.0
>            Reporter: Damian Biollo
>
> This can be reproduced very easily. Try the sample container, pointing to the Pixies Lab TODO list.
> (http://localhost:8080/samplecontainer/samplecontainer.html with "Displaying gadget" = http://www.labpixies.com/campaigns/todo/todo.xml)
> Then, with Firebug open, simply add a new TODO item.
> You will see a JS error in the following code from shindig-container.js (from the shindig-container feature).
> It happens on the line "this.userPrefs[...] = ... (see code below).
> The GadgetService doesn't have a userPrefs member. Instead, it should be calling the function on the gadget.
> shindig.IfrGadgetService.prototype.setUserPref = function(editToken, name,
>     value) {
>   var id = shindig.container.gadgetService.getGadgetIdFromModuleId(this.f);
>   var gadget = shindig.container.getGadget(id);
>   for (var i = 1, j = arguments.length; i < j; i += 2) {
>     this.userPrefs[arguments[i]].value = arguments[i + 1];
>   }
>   gadget.saveUserPrefs();
> };
> Changing the line inside the loop to this fixes the problem:
> gadget.userPrefs[arguments[i]].value = arguments[i + 1];

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1398) Shindig feature has Javascript error in setUserPref

Posted by "Damian Biollo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892523#action_12892523 ] 

Damian Biollo commented on SHINDIG-1398:
----------------------------------------

Additionally, even with this fix, the sample1 container is broken:
http://localhost:4242/container/sample1.html

You get a javascript error when adding TODO's in the gadget:
gadget.userPrefs[arguments[i]] is undefined
anonymous("383154205", "saved_tasks", "_#$LAB_MATAN$#_0_#$LAB_UDI$#_adf_#$LAB_UDI$#_black")shindig-...nocache=1 (line 5114)
process()shindig-...nocache=1 (line 2820)
anonymous()

In the samplecontainer.html, this problem doesn't occur because the metadata, including userPrefs, is initialized on startup.

Perhaps there should be a check to allow the gadget to work without user preferences?

> Shindig feature has Javascript error in setUserPref
> ---------------------------------------------------
>
>                 Key: SHINDIG-1398
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1398
>             Project: Shindig
>          Issue Type: Bug
>          Components: Javascript 
>    Affects Versions: 2.0.0
>            Reporter: Damian Biollo
>
> This can be reproduced very easily. Try the sample container, pointing to the Pixies Lab TODO list.
> (http://localhost:8080/samplecontainer/samplecontainer.html with "Displaying gadget" = http://www.labpixies.com/campaigns/todo/todo.xml)
> Then, with Firebug open, simply add a new TODO item.
> You will see a JS error in the following code from shindig-container.js (from the shindig-container feature).
> It happens on the line "this.userPrefs[...] = ... (see code below).
> The GadgetService doesn't have a userPrefs member. Instead, it should be calling the function on the gadget.
> shindig.IfrGadgetService.prototype.setUserPref = function(editToken, name,
>     value) {
>   var id = shindig.container.gadgetService.getGadgetIdFromModuleId(this.f);
>   var gadget = shindig.container.getGadget(id);
>   for (var i = 1, j = arguments.length; i < j; i += 2) {
>     this.userPrefs[arguments[i]].value = arguments[i + 1];
>   }
>   gadget.saveUserPrefs();
> };
> Changing the line inside the loop to this fixes the problem:
> gadget.userPrefs[arguments[i]].value = arguments[i + 1];

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.