You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Paul Lindner (JIRA)" <ji...@apache.org> on 2009/09/02 10:54:33 UTC

[jira] Commented: (SHINDIG-1161) Multi MediaItems request failed.

    [ https://issues.apache.org/jira/browse/SHINDIG-1161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750338#action_12750338 ] 

Paul Lindner commented on SHINDIG-1161:
---------------------------------------

This appears to be an endemic problem in much of the JS code.  There are many instances where we make store a reference to opt_params and later on set values on it.



> Multi MediaItems request failed.
> --------------------------------
>
>                 Key: SHINDIG-1161
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1161
>             Project: Shindig
>          Issue Type: Bug
>          Components: Javascript 
>    Affects Versions: 1.0, 1.1-BETA1
>         Environment: All browsers and both PHP and Java implementations.
>            Reporter: Yoichiro Tanaka
>             Fix For: 1.1-BETA3
>
>         Attachments: mediaitem.patch
>
>
> Activity object can have some MediaItem objects as opensocial.Activity.Field.MEDIA_ITEMS. You can create the MediaItem object using opensocial.newMediaItem() function.
> This function has three arguments:
>   mime_type, url, opt_params
> The opt_params is Map.<opensocial.MediaItem.Field, Object>. Then, we write the following code for posting activity which has two MediaItem objects:
> var mp = {};
> mp[opensocial.MediaItem.Field.TYPE] = opensocial.MediaItem.Type.IMAGE;
> var mi1 = opensocial.newMediaItem("image/gif", "http://example.com/image1.gif", mp);
> var mi2 = opensocial.newMediaItem("image/gif", "http://example.com/image2.gif", mp);
> var data = {};
> data[opensocial.Activity.Field.TITLE] = title;
> data[opensocial.Activity.Field.BODY] = body;
> data[opensocial.Activity.Field.MEDIA_ITEMS] = [mi1, mi2];
> var activity = opensocial.newActivity(data);
> opensocial.requestCreateActivity(activity, ...);
> The result of this code is fail. Posted two images are both "image2.gif". I think that a constructor of MediaItem class has mistake. Because the opt_params argument is used as MediaItem.fields_ object. It is correct to be copied properties of opt_params to fields_ object, I guess.
> I attach a patch to fix this problem.

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