Hi Arne:

Still doesn't work.

the container.js:
  "opensocial-0.8" : {
    // Path to fetch opensocial data from
    // Must be on the same domain as the gadget rendering server
    "impl" : "rest",  //Use "rpc" to enable JSON-RPC, "rest' for REST
    "path" : "http://%host%/social";,
    "domain" : "shindig",
    "enableCaja" : false,
    "supportedFields" : {
       "person" : ["id", {"name" : ["familyName", "givenName",
"unstructured"]}, "thumbnailUrl", "profileUrl"],
       "activity" : ["id", "title"]
    }

the app xml:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Environment">
        <Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html">
        <![CDATA[

                <script>
                        gadgets.util.registerOnLoadHandler(init);

                        function init() {
                          var env = opensocial.getEnvironment();

                          var html = "";
                          html += "env.getDomain():"+env.getDomain();
                          html += "<br>";
                          html += "<br>";

                          html += "supportsField";
                          html += "<br>";

                          var name = env.supportsField
(opensocial.Environment.ObjectType.PERSON,opensocial.Name.Field);
                          html += "opensocial.Person.Field.NAME:"+name;
                          html += "<br>";


                          var FAMILY_NAME =env.supportsField
(opensocial.Environment.ObjectType.NAME,opensocial.Name.Field.FAMILY_NAME);
                          html += 
"opensocial.Name.Field.FAMILY_NAME:"+FAMILY_NAME;
                          html += "<br>";

                          var THUMBNAIL_URL = env.supportsField
(opensocial.Environment.ObjectType.PERSON,opensocial.Person.Field.THUMBNAIL_URL);
                          html += 
"opensocial.Person.Field.THUMBNAIL_URL:"+THUMBNAIL_URL;
                          html += "<br>";

                          document.getElementById('main').innerHTML = html;
                        }

                </script>

                <div id='main'>
                </div>

        ]]>
        </Content>
</Module>


the screen:
env.getDomain():shindig

supportsField
opensocial.Person.Field.NAME:true
opensocial.Name.Field.FAMILY_NAME:false
opensocial.Person.Field.THUMBNAIL_URL:true


when change the container.js to
       "person" : ["id", {"name" : ["familyName", "givenName",
"unstructured"]}, "profileUrl"],
delete thumbnailUrl

the screen:
env.getDomain():shindig

supportsField
opensocial.Person.Field.NAME:true
opensocial.Name.Field.FAMILY_NAME:false
opensocial.Person.Field.THUMBNAIL_URL:false


James



On Feb 12, 2:27 am, Arne Roomann-Kurrik <api.kur...@google.com> wrote:
> Hi James,
>
> You would make a call like:
>
> env.supportsField(
>     opensocial.Environment.ObjectType.NAME,
>     opensocial.Name.Field.FAMILY_NAME);
>
> Hope this helps,
> ~Arne
>
> On Feb 2, 11:43 pm, James Zhang <jmszh...@gmail.com> wrote:
>
> > the config/container.js is:
>
> >     "supportedFields" : {
> >        "person" : ["id", {"name" : ["familyName", "givenName",
> > "unstructured"]}, "thumbnailUrl", "profileUrl"],
> >        "activity" : ["id", "title"]
>
> > I konw  how to detect id、thumbnail_url、profile_url,use:
>
> > var id = env.supportsField
> > (opensocial.Environment.ObjectType.PERSON,opensocial.Person.Field.ID);
>
> > and detect name use:
> > var name = env.supportsField
> > (opensocial.Environment.ObjectType.PERSON,opensocial.Name.Field);
>
> > but who can tell me how to detect  name:familyName、
> > name:givenName,name:unstructured using supportsField methods.
>
> > because my gadget server's container only implement name:unstructured.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to 
opensocial-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to