You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Arun Kumar <ar...@gmail.com> on 2008/11/05 22:49:42 UTC

Gadget settings

I think widget settings related part in the shindig code depends on
http://www.gmodules.com/ site. When user clicks on the settings link in the
gadget, handleOpenUserPrefsDialog() function will be called.

This function is including a script, which will be generated by
http://www.gmodules.com/. Script source path will look like:

http://gmodules.com/ig/gadgetsettings?url=http://hosting.gmodules.com/ig/gadgets/file/110155793148601977194/Views.xml&mid=SQsojzFoFu2uTAGXXWG-8w&output=js

Which is returning


----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var ig_html_0= '\x3cdiv id\x3dig_edit_div0
style\x3d\x22display:none\x22\x3e\x3ctable\x3e\x3ctr\x3e\x3ctd
class\x3dm_fieldname_0\x3eName\x3cdiv   id\x3dm_required_0_0
class\x3dc_required_0 name\x3dm_required_0_up_MyName\x3e\x3cfont
color\x3d#ff0000\x3e\x3csup\x3e*\x3c/sup\x3e\x3c/font\x3e\x3c/div\x3e\x3c/td\x3e\x3ctd
colspan\x3d2\x3e\x26nbsp;\x3cinput type\x3d\x22text\x22 id\x3dm_0_0
name\x3dm_0_up_MyName class\x3dc_text_0 value\x3d\x22\x22 \x3e
\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd class\x3dm_fieldname_0\x3eFavorite
Color\x3c/td\x3e\x3ctd colspan\x3d2\x3e\x26nbsp;\x3cselect id\x3dm_0_1
name\x3dm_0_up_FavColor class\x3dc_enum_0 \x3e\x3coption
value\x3d\x22Blue\x22\x3eBlue\x3coption
value\x3d\x22Yellow\x22\x3eYellow\x3coption SELECTED
value\x3d\x22Pink\x22\x3ePink\x3coption
value\x3d\x22Gray\x22\x3eGray\x3c/select\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr
id\x3drequired_0\x3e\x3ctd
colspan\x3d2\x3e\x3csup\x3e*\x3c/sup\x3e\x26nbsp;required\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cinput
id\x3dm_0_numfields type\x3dhidden value\x3d2\x3e\x3c/div\x3e\n';

/* PNC edit window -- leave in this line for testing */
function _gel(n)
{
        return document.getElementById ? document.getElementById(n) : null;
}

/* collect the userprefs into a ampersand-separate string, suitable for
appending to a URL *//* note: this doesn't gather the locale */
function gatherUserprefs_0()
{
        var res = "";
        var num_fields = document.getElementById("m_0_numfields").value;
        for (var i = 0; i < num_fields; i++)
        {
               var obj = document.getElementById("m_0_"+i);
               /* stop at the end-- should be num_fields, but you never know
*/

               if (obj == null)
               {
                       continue;
               }


               /* strip module IDs */
               var name = obj.name.replace(/^m_.*?_/, "");

               /* separate by ampersands */
               if (res != "")
               {
                       res += "&";
               }
               res += name + "=" + encodeURIComponent(obj.value);
        }
        return res;
}

if (ig_callback_0)
            ig_callback_0(ig_html_0);

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When we decrypt the ig_html_0, it contains the html part for displaying
gadget settings part and is given below:

<div id=ig_edit_div0 style="display: none">
<table>
    <tr>
        <td class=m_fieldname_0>Name
        <div id=m_required_0_0 class=c_required_0
name=m_required_0_up_MyName><font
            color=#ff0000><sup>*</sup></font></div>
        </td>
        <td colspan=2>&nbsp;<input type="text" id=m_0_0 name=m_0_up_MyName
            class=c_text_0 value=""></td>
    </tr>
    <tr>
        <td class=m_fieldname_0>Favorite Color</td>
        <td colspan=2>&nbsp;<select id=m_0_1 name=m_0_up_FavColor
            class=c_enum_0>
            <option value="Blue">Blue
            <option value="Yellow">Yellow
            <option SELECTED value="Pink">Pink
            <option value="Gray">Gray
       </select></td>
    </tr>
    <tr id=required_0>
        <td colspan=2><sup>*</sup>&nbsp;required</td>
    </tr>
</table>
<input id=m_0_numfields type=hidden value=2></div>


In the similar way, do we have any gadgetsettings like servlet in Shindig
gadgets server, so that we can use that instead of gmodules.com?

Re: Gadget settings

Posted by Chris Chabot <ch...@google.com>.
The whole settings UI is a container (social network site) related affair,
and not in the realm of shindig, who's aim it is to offer a opensocial and
gadget rendering server, but not be a social network site :)

The static html/js based examples do have a basic sample/demo implementation
that demo how something like that *could* work and look, but are not meant
for anything but just that, serving as a demo.

You could take a look at partuza (code.google.com/p/partuza), sun socialsite
and other such opensource social network site projects who use shindig to
get more practical examples for this

   -- Chris



On Wed, Nov 5, 2008 at 10:49 PM, Arun Kumar <arunkumar.boppudi.514@gmail.com
> wrote:

> I think widget settings related part in the shindig code depends on
> http://www.gmodules.com/ site. When user clicks on the settings link in
> the
> gadget, handleOpenUserPrefsDialog() function will be called.
>
> This function is including a script, which will be generated by
> http://www.gmodules.com/. Script source path will look like:
>
>
> http://gmodules.com/ig/gadgetsettings?url=http://hosting.gmodules.com/ig/gadgets/file/110155793148601977194/Views.xml&mid=SQsojzFoFu2uTAGXXWG-8w&output=js
>
> Which is returning
>
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> var ig_html_0= '\x3cdiv id\x3dig_edit_div0
> style\x3d\x22display:none\x22\x3e\x3ctable\x3e\x3ctr\x3e\x3ctd
> class\x3dm_fieldname_0\x3eName\x3cdiv   id\x3dm_required_0_0
> class\x3dc_required_0 name\x3dm_required_0_up_MyName\x3e\x3cfont
>
> color\x3d#ff0000\x3e\x3csup\x3e*\x3c/sup\x3e\x3c/font\x3e\x3c/div\x3e\x3c/td\x3e\x3ctd
> colspan\x3d2\x3e\x26nbsp;\x3cinput type\x3d\x22text\x22 id\x3dm_0_0
> name\x3dm_0_up_MyName class\x3dc_text_0 value\x3d\x22\x22 \x3e
> \x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd class\x3dm_fieldname_0\x3eFavorite
> Color\x3c/td\x3e\x3ctd colspan\x3d2\x3e\x26nbsp;\x3cselect id\x3dm_0_1
> name\x3dm_0_up_FavColor class\x3dc_enum_0 \x3e\x3coption
> value\x3d\x22Blue\x22\x3eBlue\x3coption
> value\x3d\x22Yellow\x22\x3eYellow\x3coption SELECTED
> value\x3d\x22Pink\x22\x3ePink\x3coption
> value\x3d\x22Gray\x22\x3eGray\x3c/select\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr
> id\x3drequired_0\x3e\x3ctd
>
> colspan\x3d2\x3e\x3csup\x3e*\x3c/sup\x3e\x26nbsp;required\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cinput
> id\x3dm_0_numfields type\x3dhidden value\x3d2\x3e\x3c/div\x3e\n';
>
> /* PNC edit window -- leave in this line for testing */
> function _gel(n)
> {
>        return document.getElementById ? document.getElementById(n) : null;
> }
>
> /* collect the userprefs into a ampersand-separate string, suitable for
> appending to a URL *//* note: this doesn't gather the locale */
> function gatherUserprefs_0()
> {
>        var res = "";
>        var num_fields = document.getElementById("m_0_numfields").value;
>        for (var i = 0; i < num_fields; i++)
>        {
>               var obj = document.getElementById("m_0_"+i);
>               /* stop at the end-- should be num_fields, but you never know
> */
>
>               if (obj == null)
>               {
>                       continue;
>               }
>
>
>               /* strip module IDs */
>               var name = obj.name.replace(/^m_.*?_/, "");
>
>               /* separate by ampersands */
>               if (res != "")
>               {
>                       res += "&";
>               }
>               res += name + "=" + encodeURIComponent(obj.value);
>        }
>        return res;
> }
>
> if (ig_callback_0)
>            ig_callback_0(ig_html_0);
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> When we decrypt the ig_html_0, it contains the html part for displaying
> gadget settings part and is given below:
>
> <div id=ig_edit_div0 style="display: none">
> <table>
>    <tr>
>        <td class=m_fieldname_0>Name
>        <div id=m_required_0_0 class=c_required_0
> name=m_required_0_up_MyName><font
>            color=#ff0000><sup>*</sup></font></div>
>        </td>
>        <td colspan=2>&nbsp;<input type="text" id=m_0_0 name=m_0_up_MyName
>            class=c_text_0 value=""></td>
>    </tr>
>    <tr>
>        <td class=m_fieldname_0>Favorite Color</td>
>        <td colspan=2>&nbsp;<select id=m_0_1 name=m_0_up_FavColor
>            class=c_enum_0>
>            <option value="Blue">Blue
>            <option value="Yellow">Yellow
>            <option SELECTED value="Pink">Pink
>            <option value="Gray">Gray
>       </select></td>
>    </tr>
>    <tr id=required_0>
>        <td colspan=2><sup>*</sup>&nbsp;required</td>
>    </tr>
> </table>
> <input id=m_0_numfields type=hidden value=2></div>
>
>
> In the similar way, do we have any gadgetsettings like servlet in Shindig
> gadgets server, so that we can use that instead of gmodules.com?
>