rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zh...@apache.org
Subject svn commit: r1087520 [13/35] - in /incubator/rave/donations/ogce-gadget-container: ./ config/ config/shindig-1.1-BETA5/ config/shindig-2.0.0/ db-cleaner/ examples/ examples/src/ examples/src/main/ examples/src/main/java/ examples/src/main/java/cgl/ exa...
Date Fri, 01 Apr 2011 00:29:38 GMT
Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/admin.html
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/admin.html?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/admin.html (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/admin.html Fri Apr  1 00:29:22 2011
@@ -0,0 +1,752 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+
+    <link rel="shortcut icon" href="favicon.ico" >
+    <link rel="stylesheet" type="text/css" href="www/extjs/resources/css/ext-all.css">
+
+    <script type="text/javascript" src="www/extjs/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="www/extjs/ext-all.js"></script>
+    <script type="text/javascript" src="www/extjs/radiogroup.js"></script>
+
+    <script type="text/javascript" src="www/js/util.js"></script>
+    <script type="text/javascript" src="www/js/customField.js"></script>
+    <script type="text/javascript" src="www/js/datepicker.js"></script>
+    <script type="text/javascript" src="www/js/languagepicker.js"></script>
+    <script type="text/javascript" src="www/js/countrypicker.js"></script>
+    <script type="text/javascript" src="www/js/timezonepicker.js"></script>
+    <script type="text/javascript" src="www/js/userinfoform.js"></script>
+
+    <script type="text/javascript">
+
+    /** 
+     *set text within status bar.
+     */
+    function showStatusText(statusbarid, text){
+      var statusbar = statusbarid;
+      if( typeof statusbarid == 'string' )
+        statusbar = Ext.getCmp(statusbarid);
+      statusbar.clearStatus({useDefaults:true});
+      statusbar.setText(text);
+    }
+
+    Ext.namespace('Ext.ux');
+    Ext.namespace('cgl.shindig.ui.management.remoteservice');
+    Ext.namespace('cgl.shindig.ui.management.remoteservice.alluserinfo');
+    Ext.namespace('cgl.shindig.ui.management.remoteservice.alluserlayoutinfo');
+
+    cgl.shindig.ui.management.remoteservice.alluserinfo.address =  getBaseURL()+"users/_all_/";
+    cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.address =
+            getBaseURL()+"users/_all_user_layout_/";
+    cgl.shindig.ui.management.remoteservice.alluserinfo.json = "";
+    cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.json = "";
+    cgl.shindig.ui.management.remoteservice.alluserinfo.redirect = "";//relative path
+
+    /** 
+     * Get information of all users.
+     * If the information is retrieved correctly, variable
+     * cgl.shindig.ui.management.remoteservice.alluserinfo.json would be set.
+     * It is an array.
+     */
+    function getInfoAllUsersAndLayout(){
+      if( cgl.shindig.ui.management.remoteservice.connection == null ){ 
+        cgl.shindig.ui.management.remoteservice.connection = new Ext.data.Connection({
+          url: cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.address
+        });     
+      }
+      var times = 0;
+      var statusbar = Ext.getCmp("statusbar");
+      var maxtries = 10;
+      var retrieving = false;
+      retrieveFunc = function(){
+        if( retrieving == true ) return;
+        retrieving = true;
+        ++times;
+        if(times > maxtries) {//we give up
+        window.clearInterval(retrieveHandle);
+        return;
+      }
+      cgl.shindig.ui.management.remoteservice.connection.request({
+        method: 'GET',
+        url: cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.address,
+        success: function( response, options ) {
+          showStatusText(statusbar, "retrieving data. " + (times+1) + "-th try");
+          try{
+            var responseText = response.responseText;
+            responseText = responseText.replace(/\n/g, " ");
+            responseText = responseText.replace(/\r/g, " ");
+            cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.json =  
+            eval('('+responseText+')');
+            showStatusText(statusbar, "retrieve data successfully after " + (times+1) + "trys");
+            times = maxtries;
+          } catch(msg){ 
+            showStatusText(statusbar, "data format may be incorrect.");
+            return;
+          }
+          if( cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.json.error != null ){
+            showStatusText(statusbar, "retrieved data has error:<b style='color:red'>" + 
+            cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.json.error + 
+            ". click <a href=\"adminlogin.html\">here</a> to log in" + "<b>");
+          }else{
+            showStatusText(statusbar, "retrieved data from server.");
+          }
+          retrieving = false;
+        },
+        failure : function( response, options ) {
+          showStatusText(statusbar, "retrieving  exception.");
+          retrieving = false;
+          //window.location.href = getBaseURL()+'www/sahara/sign.jsp';
+        }   
+      });
+    };
+    var retrieveHandle = window.setInterval("retrieveFunc()", 150); 
+  }
+
+  /** 
+   * Get information of all users and all layout data.
+   * If the information is retrieved correctly, variable
+   * cgl.shindig.ui.management.remoteservice.alluserinfo.json would be set.
+   * It is an array.
+   */
+  function getInfoAllUsers(){
+    if( cgl.shindig.ui.management.remoteservice.connection == null ){ 
+      cgl.shindig.ui.management.remoteservice.connection = new Ext.data.Connection({
+        url: cgl.shindig.ui.management.remoteservice.alluserinfo.address
+      });     
+    }
+    var times = 0;
+    var statusbar = Ext.getCmp("statusbar");
+    var maxtries = 10;
+    var retrieving = false;
+    retrieveFunc = function(){
+      if( retrieving == true ) return;
+      retrieving = true;
+      ++times;
+      if(times > maxtries) { //we give up
+        window.clearInterval(retrieveHandle);
+        return;
+      }
+      cgl.shindig.ui.management.remoteservice.connection.request({
+        method: 'GET',
+        url: cgl.shindig.ui.management.remoteservice.alluserinfo.address,
+        success: function( response, options ) {
+          showStatusText(statusbar, "retrieving data. " + (times+1) + "-th try");
+          try{
+            cgl.shindig.ui.management.remoteservice.alluserinfo.json =  
+            eval('('+response.responseText+')');
+            showStatusText(statusbar, "retrieve data successfully after " + (times+1) + "trys");
+            times = maxtries;
+          } catch(msg){ }
+          if( cgl.shindig.ui.management.remoteservice.alluserinfo.json.error != null ){
+            showStatusText(statusbar, "retrieved data has error:<b style='color:red'>" + 
+            cgl.shindig.ui.management.remoteservice.alluserinfo.json.error + "<b>");
+          }else{
+            showStatusText(statusbar, "retrieved data is correct.");
+          }
+          retrieving = false;
+        },
+        failure : function( response, options ) {
+          showStatusText(statusbar, "retrieving  exception.");
+          retrieving = false;
+          //window.location.href = getBaseURL()+'www/sahara/sign.jsp';
+        }   
+      });
+    };
+    var retrieveHandle = window.setInterval("retrieveFunc()", 150); 
+  }
+
+  /**
+   * delete a user.
+   * @param userid        id of the user to be deleted
+   * @param getFormPanel  function which returns form panel
+   * @param getMainPanel  function which returns main panel
+   * @param getTree       function which returns tree panel
+   */
+  function deleteUser(userid, getFormPanel, getMainPanel, getTree){
+    var statusbar = Ext.getCmp("statusbar");
+    if( userid != null ){
+      userid = TrimString(userid);
+    }
+    if( userid == null || userid == '' ){
+      showStatusText(statusbar, "<b style='color:red;'>userid is not correct<b>");
+      return;
+    }
+    if( cgl.shindig.ui.management.remoteservice.connection == null ){
+      cgl.shindig.ui.management.remoteservice.connection = new Ext.data.Connection({});
+    }   
+    statusbar.showBusy();
+    var url = getBaseURL() + "users/"+userid;
+
+    cgl.shindig.ui.management.remoteservice.connection.request({
+      method: 'DELETE',
+      url: url,
+      success: function( response, options ) {
+        try{
+          var obj = eval('('+response.responseText+')');
+          if( obj.error != null ){
+            //window.location.href = getURLWithoutPath()+cgl.shindig.ui.layout.json.redirect;
+            showStatusText(statusbar, obj.error);
+          } else {
+            showStatusText(statusbar, obj.succ);
+            /* reset info form panel */
+            getFormPanel().getForm().reset();
+            /* delete node in the nav tree */
+            deleteNodeByUID(userid, getTree());
+          }
+        }catch(str){
+          showStatusText(statusbar, "Error:" + str);
+        }
+      },
+      failure : function( response, options ) {
+        showStatusText(statusbar, "deletion failed (check your network settings)");
+      }
+    });
+  }
+
+  /** 
+   * update information of a user.
+   *  @param the basic Form from which user's information is gathered.
+   *  @param method 'PUT' or 'POST'. 
+   *      use 'PUT' to update a user's profile.
+   *      use 'POST' to add a new user
+   */
+  function updateUser(form, method, getMainPanel, getTree){
+    var putuserdata = form.getValues(true);
+    var userdataobj = form.getValues(false);
+    var userid = userdataobj.screenname;
+    var url = getBaseURL() + "users/"+userid+"/";
+
+    //var paneltb = mainpanel.getBottomToolbar();
+    var statusbar = Ext.getCmp("statusbar");
+    if( method != 'PUT' && method != 'POST' ){
+      showStatusText(statusbar, 'Update error: method specification is not correct');
+      return;
+    }
+    if( cgl.shindig.ui.management.remoteservice.connection == null ){
+      cgl.shindig.ui.management.remoteservice.connection = new Ext.data.Connection({});
+    }   
+    statusbar.showBusy();
+
+    cgl.shindig.ui.management.remoteservice.connection.request({
+      method: method,
+      url: url,
+      params: putuserdata,
+      success: function( response, options ) {
+        try {
+          var obj = eval('('+response.responseText+')');
+          if( obj.error != null ){
+            //window.location.href = getURLWithoutPath()+cgl.shindig.ui.layout.json.redirect;
+            showStatusText(statusbar, obj.error);
+          } else {
+            updateNodeByUID(userdataobj, method, getTree());
+            showStatusText(statusbar, obj.succ);
+            /*
+             (function(){
+               getMainPanel().getComponent("mainpanelSouth").collapse();
+             }).defer(2000);
+             (function(){statusbar.hide();}).defer(4000);
+             */
+          }
+        } catch(str){
+          showStatusText(statusbar, str);
+        }
+      },
+      failure :function(response, options){
+        showStatusText(statusbar, method+" failed");
+        //(function(){paneltb.hide();}).defer(4000);
+        //window.location.href = getBaseURL()+'www/sahara/sign.jsp';
+      }
+    });
+  }
+
+
+  /** 
+   * Update a node in the tree.
+   *  @param userobj  An object which includes user's information
+   *  @param tree     The tree that would be updated.
+   *  Tech: First delete the original node and then add a new node.
+   */
+  function updateNodeByUID(userobj, method, tree){
+    var userid = userobj.screenname;
+    if( method == 'PUT' ){
+      deleteNodeByUID(userid, tree);
+      add2TreeFromStr(userobj, tree.getRootNode());
+    }else if( method == 'POST' ){
+      add2TreeFromStr(userobj, tree.getRootNode());
+    }
+  }
+  </script>
+
+  <script type="text/javascript">
+  /** get detailed information of a user */
+  function getAllInfoOfUser(userid){
+    var userinfo;
+    userinfo = '{"text":"user1", "children": [{"text":"user2", "leaf":true, "attributes":{"sn":"ddd","email":"avc","dob":"1983"}}]}';
+    return userinfo;
+  }
+
+/** delete the node corresponding to the deleted user from the tree */
+function deleteNodeByUID(userid, treepanel){
+    var node = treepanel.getRootNode();
+    node = node.findChild('id', userid);
+    if(node != null)
+        node.remove();
+}
+
+function add2TreeFromStr( arr, node ){
+    var userinfo = convertRaw2Display(arr);
+    addNodes2Tree(userinfo, node);
+}
+
+
+/**
+ * Convert the element/array received from server to our internal format.
+ * @param json  a json object
+ * @return String internal representation
+ */
+function convertRaw2Display(json){
+    var arr = new Array();
+
+    if( json instanceof Array == false && typeof json == 'object')
+        json = [json];
+
+    if( json instanceof Array ){
+        var i, user;
+        for( i = 0 ; i < json.length ; ++i ) {
+            user = json[i];
+            var obj = {};
+            var subobj = {}
+            obj.text = user.screenname;
+            obj.id = user.screenname;
+            obj.leaf = true;
+            obj.attributes = subobj;
+            subobj.screenname = user.screenname;
+            subobj.password = user.password;
+            subobj.firstname = user.firstname;
+            subobj.lastname = user.lastname;
+            subobj.dobday = user.dobday;
+            subobj.dobmonth = user.dobmonth;
+            subobj.dobyear = user.dobyear;
+            subobj.language = user.language;
+            subobj.timezone = user.timezone;
+            subobj.email = user.email;
+            subobj.gender = user.gender;
+            subobj.openid = user.openid;
+            subobj.nickname = user.nickname;
+            subobj.zipcode = user.zipcode;
+
+            var layoutdata = user.layoutdata;
+            if (layoutdata == null)
+              layoutdata = '';
+            else
+            try{
+                layoutdata = JSON.stringify(JSON.parse(layoutdata), null, 3);
+            }catch(err) {
+            }
+            subobj.layoutdata = layoutdata;
+
+            arr.push(obj);
+        }
+    }
+    return JSON.stringify(arr);
+}
+
+/** 
+ * Add new nodes to the tree.
+ * @param json an object or string that includes information of new nodes.
+ * @param node the node to which new nodes are added.
+ * @return none.
+ *
+ * Note: this function does NOT check whether a duplicate node has existed or
+ * not.
+ */
+
+function addNodes2Tree(json, node){
+    var treeLoader = node.getOwnerTree().getLoader();
+    var o = json;
+    if( typeof json == 'string' )
+        o = eval("("+json+")");
+    if( ! (o instanceof Array ))
+        o = [o];
+    node.beginUpdate();
+    for(var i = 0, len = o.length; i < len; i++){
+        var n = treeLoader.createNode(o[i]);
+        if(n){
+            node.appendChild(n);
+        }
+    }
+    node.endUpdate();
+}
+</script>
+
+
+<script type="text/javascript">
+// Ext.app.layoutloader = Ext.extend(Ext.tree.TreeLoader, {
+/*
+    load: function (node, callback){
+        this.fireEvent("beforeload", this, node);
+        this.fireEvent("load", this, node, "empty");
+    }
+*/
+// });
+
+
+/*
+function initLangCombo(){
+    if(cgl.shindig.ui.management.langarr == null)
+        cgl.shindig.ui.management.langarr = cvtLangString2Arr(language);
+}
+function initCountryCombo(){
+    if(cgl.shindig.ui.management.countryarr == null)
+        cgl.shindig.ui.management.countryarr = cvtCountryString2Arr(country);
+}*/
+
+
+// *****************************************************************
+//  Create tree which lists all users. 
+//  @param  getServerArr  a function which returns the array 
+//          received from server.
+//  @param  getMainPanel  a function which returns the main panel
+//  @param  getFormPanel  a function which returns the form panel
+// *****************************************************************
+function createUserTree(getServerArr, getMainpanel, getFormPanel){
+  var tree = new Ext.tree.TreePanel({
+    useArrows:true,
+    animate:true,
+    border: false,
+    enableDD:false,
+    containerScroll: false,
+
+    root: {
+      nodeType: 'async',
+      text: 'user list',
+      draggable:false,
+      id:'source'
+    },
+            
+    loader: new Ext.tree.TreeLoader({
+      listeners:{
+        beforeload: function(This, node, callback){
+          add2TreeFromStr( getServerArr(), node);
+          return false; //bypass sending request to remote server
+        }
+      }, 
+      dataUrl:'xml-tree-data.xml'//dummy, but necessary
+    }),
+        
+    listeners: {
+      'render': function(tp){
+      tp.getSelectionModel().on('selectionchange', function(tree, node){
+        if(node == null) return;
+          if(node.leaf){
+            var tpl = cgl.shindig.ui.userinfotpl;
+            setUserInfoFields(tpl, node.attributes.attributes, getFormPanel);
+            adjustMainPanelHeight();
+
+            getMainpanel().getComponent("mainpaneleast").expand();
+
+            //update the status bar
+            var statusbar = Ext.getCmp("statusbar");
+            showStatusText(statusbar, 'user ' + tpl.sntpl.apply(node.attributes.attributes) +' is selected');
+          }else{
+            //el.update(detailsText);
+          }
+        })
+      }
+    }
+  });
+
+  function adjustMainPanelHeight() {
+      var panel = getMainpanel();
+      var formpanel = getFormPanel();
+      var formpanelp = formpanel.ownerCt;
+      var formpanelpp = formpanelp.ownerCt;
+      
+      formpanelp.body.setHeight(formpanel.getEl().getHeight());
+      formpanelpp.body.setHeight(formpanelp.getEl().getHeight());
+
+
+      tree.body.setHeight(formpanel.getEl().getHeight());
+      tree.ownerCt.body.setHeight(formpanel.getEl().getHeight());
+  }
+  return tree;
+}
+
+
+/**
+ * Add buttons debug, update, add, delete, reset to the form panel
+ * @param formpanel
+ * @param getMainpanel
+ * @param getTree
+ */
+function addAdminBtns2Form(formpanel, getMainPanel, getTree){
+    formpanel.addButton({
+        text: 'debug',
+        type: 'button',
+        handler: function(){
+            alert(formpanel.getForm().getValues(true));
+        }
+    });
+    formpanel.addButton({
+        text: 'Update',
+        type: 'button',
+        handler: function(){
+            var paneltb = getMainPanel().getBottomToolbar();
+            paneltb.show();
+            updateUser(formpanel.getForm(), 'PUT', getMainPanel, getTree);
+        }
+    });
+    formpanel.addButton({
+        text: 'Add',
+        type: 'button',
+        handler: function(){
+            var paneltb = getMainPanel().getBottomToolbar();
+            paneltb.show();
+            updateUser(formpanel.getForm(), 'POST', getMainPanel, getTree);
+        }
+    });
+    formpanel.addButton({
+        text: 'delete',
+        type: 'button',
+        handler: function(){
+            //TODO
+            //(1) the south region is collapsed only when the deletion succeeds.
+            var paneltb = getMainPanel().getBottomToolbar();
+            paneltb.show();
+            var values = formpanel.getForm().getValues(false);
+            var userid = values.screenname;
+            deleteUser(userid, function(){return formpanel;}, getMainPanel, getTree);
+        }
+    });
+    formpanel.addButton({
+        text: 'reset',
+        type: 'reset',
+        handler: function(){
+            formpanel.getForm().reset();
+        }
+    });
+};
+
+Ext.namespace("cgl.shindig.ui.admin.passwdchange");
+function changeAdminPassword(oldpwd, newpwd, changePasswdWindow) {
+
+  if (cgl.shindig.ui.admin.passwdchange.address == null) {
+    cgl.shindig.ui.admin.passwdchange.address = getBaseURL() + "useradmin/passwdchange";
+  }
+
+  var data = "oldpassword=" + oldpwd + "&newpassword=" + newpwd;
+  if( cgl.shindig.ui.admin.passwdchange.connection == null )
+    cgl.shindig.ui.admin.passwdchange.connection = new Ext.data.Connection({
+        url: cgl.shindig.ui.admin.passwdchange.address
+    });
+
+  cgl.shindig.ui.admin.passwdchange.connection.request({//load initial data
+    method: 'POST',
+    params: data,
+    success: function(response, options) {
+      try {
+        var result = eval('('+response.responseText+')');
+        if( result.error != null )
+          alert(result.error);
+        else{  
+          alert("Your password has been changed successfully");
+          changePasswdWindow.hide();
+        }
+      } catch (msg) {
+        alert("received invalid data from server");
+      }
+    },
+    failure : function(response, options) {
+        alert('failure due to internal system error' + response.responseText);
+    }  
+  });
+}
+
+Ext.onReady(function(){
+    var getMainPanel = function(){ return mainpanel;};
+    var getAllUserData = function(){ return cgl.shindig.ui.management.remoteservice.alluserinfo.json.data; };
+    var getAllUserLayoutData = function(){ return cgl.shindig.ui.management.remoteservice.alluserlayoutinfo.json.data; };
+    var getTree = function(){return usertree;};
+    var getFormPanel = function(){return formpanel;}
+
+    var usertree = createUserTree(getAllUserLayoutData, getMainPanel, getFormPanel);
+    var formpanel = createUserInfoForm(getMainPanel);
+    addAdminBtns2Form(formpanel, getMainPanel, getTree);
+    
+    var changePasswdWindow = new Ext.Window({
+      title    : 'Change your password',
+      closable : true,
+      plain    : true,
+      closeAction: 'hide',
+      items : new Ext.form.FormPanel({
+        frame: true,
+        border: false,
+        footer: false,
+        labelWidth: 125,
+        defaultType: 'field',
+        bodyStyle: {
+          margin: '10px'
+        },
+        defaults: {
+          inputType: 'password'
+        },
+        items: [{
+          fieldLabel: 'Old password',
+          name: 'oldpassword'
+        }, {
+          fieldLabel: 'New password',
+          name: 'newpassword'
+        }, {
+          fieldLabel: 'Confirm password',
+          name: 'newpassword2'
+        }]
+      }),
+      buttons: [{
+        text: 'close',
+        handler: function() {
+          changePasswdWindow.hide();
+        }
+      }, {
+        text: 'update',
+        handler: function() {
+          var oldpwd = changePasswdWindow.getEl().query('[name=oldpassword]');
+          var newpwd = changePasswdWindow.getEl().query('[name=newpassword]');
+          var newpwd2 = changePasswdWindow.getEl().query('[name=newpassword2]');
+          oldpwd = Ext.getCmp(oldpwd[0].id).getValue();
+          newpwd = Ext.getCmp(newpwd[0].id).getValue();
+          newpwd2 = Ext.getCmp(newpwd2[0].id).getValue();
+          if (newpwd != newpwd2) {
+            alert("Password and confirm password do not match");
+            return;
+          }
+          if (newpwd.length == 0) {
+            alert("Password can not be empty");
+            return;
+          }
+          changeAdminPassword(oldpwd, newpwd, changePasswdWindow);
+        }
+      }]
+    });
+
+    var changePasswdBt = new Ext.Button({
+      text: 'Change password',
+      type: 'button',
+      style: 'border:2px outset white',
+      handler: function(){
+        changePasswdWindow.show();
+      }
+    });
+
+    var logoutbt = new Ext.Button({
+      text: 'logout',
+      type: 'button',
+      style: 'border:2px outset white',
+      handler: function(){
+        Ext.namespace('cgl.shindig.ui.admin.logout');
+        cgl.shindig.ui.admin.logout.address = getBaseURL() + "useradmin/logout";
+        if( cgl.shindig.ui.management.remoteservice.connection == null ){
+          cgl.shindig.ui.management.remoteservice.connection = new Ext.data.Connection({});
+        }   
+        cgl.shindig.ui.management.remoteservice.connection.request({
+          method: 'POST',
+          url: cgl.shindig.ui.admin.logout.address,
+          success: function( response, options ) {
+            try{
+              var obj = eval('('+response.responseText+')');
+              if( obj.error != null ){
+                alert(obj.error);
+              }
+              else{
+                window.location.href = "adminlogin.html";
+                //alert(response.responseText);
+              }
+            }catch(str){}
+          },
+          failure : function( response, options ) {
+            alert(response.responseText);
+          }
+        });
+      }
+    });
+    /*
+    var detailedPanel = new Ext.Panel({
+        height: '100%',//1000,
+        items: [formpanel]
+    });
+    */
+
+    var statusBar = new Ext.StatusBar({
+      defaultText: 'Initializing',
+      id: 'statusbar',
+      items: []
+    });
+
+    var mainpanel = new Ext.Panel({
+        // title: "OGCE Layout Manager User Management",
+        layout: "border",
+        renderTo: 'mainBorder',
+        height: 550,
+        id: 'mainpanel_extjs',
+        width:  '100%',
+        border: true,
+        bbar:[statusBar],
+        tbar: new Ext.Toolbar({
+          items: [ new Ext.form.Label({
+              html: '<b>OGCE Layout Manager User Management</b>'
+            }), '->', changePasswdBt, logoutbt]
+        }),
+        items: [{
+            title: 'User info',
+            region: 'east',
+            id: 'mainpaneleast',
+            width: '80%',
+            // margins: '5 0 0 5',
+            border: true,
+            autoScroll: true,
+            collapsible: true,
+            items: [formpanel]
+        }, {
+            title: 'User list',
+            id: 'mainpanelcenter',
+            region:'center',
+            autoScroll: true,
+            border: true,
+            width: '20%',
+            minWidth: 200,
+            // margins: '5 5 0 0',
+            items: [usertree]
+        }]
+    });
+
+    <!-- getInfoAllUsers(); -->
+    getInfoAllUsersAndLayout();
+
+});
+</script>
+</head>
+<body>
+<div id="mainBorder" style="height:90%;width:80%; margin:20px auto 0px auto;"/>
+<div id="logoutdiv"/>
+</body>
+</html>

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/adminlogin.html
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/adminlogin.html?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/adminlogin.html (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/adminlogin.html Fri Apr  1 00:29:22 2011
@@ -0,0 +1,121 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <link rel="shortcut icon" href="favicon.ico" >
+    <!-- <link rel="icon" type="image/gif" href="animated_favicon1.gif" > -->
+
+    <link rel="stylesheet" type="text/css" href="www/extjs/resources/css/ext-all.css">
+
+    <script type="text/javascript" src="www/extjs/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="www/extjs/ext-all.js"></script>
+    <script type="text/javascript" src="www/extjs/radiogroup.js"></script>
+    <script type="text/javascript" src="www/js/util.js"></script>
+
+    <script type="text/javascript">
+        Ext.onReady(function(){
+            var formPanel = new Ext.form.FormPanel({
+                xtype: 'form',
+                bodyStyle: 'padding:5px 5px 0',
+                labelWidth: 70,
+                autoHeight: true,
+                frame: true,
+                defaults: { width: '100%' },  
+                onSubmit: Ext.emptyFn,
+                url: 'test/test.jsp',
+                //standardSubmit: true,
+                autoScroll: true,
+                items:[{
+                    xtype: 'textfield',
+                    fieldLabel: 'user name',
+                    name: 'screenname'
+                },{
+                    xtype: 'textfield',
+                    fieldLabel: 'password',
+                    inputType:'password',
+                    name: 'password'
+                }],
+                buttons:[{
+                    text: 'login',
+                    type: 'button',
+                    handler: function(){
+                        /** this is necessary to fix a bug in extjs.
+                         *  But: when standard submission is used, url is ignored.
+                         *  See http://extjs.com/forum/showthread.php?t=44229
+                         */
+                        /*
+                        var formDom = formPanel.getForm().getEl().dom;
+                        formDom.action = formPanel.url;
+                        formDom.method = 'post';
+                        formDom.submit();
+                        */
+                        var postStr = formPanel.getForm().getValues(true);
+                        Ext.namespace("cgl.shindig.ui.admin.login");
+                        cgl.shindig.ui.admin.login.address = getBaseURL() + "useradmin/signin";
+                        if( cgl.shindig.ui.admin.login.connection == null )
+                            cgl.shindig.ui.admin.login.connection = new Ext.data.Connection({
+                                url: cgl.shindig.ui.admin.login.address
+                            });
+
+                        cgl.shindig.ui.admin.login.connection.request({//load initial data
+                            method: 'POST',
+                            url: cgl.shindig.ui.admin.login.address,
+                            params: postStr,
+                            success: function( response, options ) {
+                                var result = eval('('+response.responseText+')');
+                                if( result.error != null )
+                                    alert(result.error);
+                                else{  
+ //                                   alert(result.succ);
+                                    window.location.href = getAdminBaseURL();
+                                }
+                            },
+                            failure : function( response, options ) {
+                                alert('failure due to internal system error' +response.responseText);
+                            }  
+                        });
+                    }
+                },{
+                    text: 'reset',
+                    type: 'button',
+                    handler: function(){
+                        formPanel.getForm().reset();
+                    }
+                }]
+            });
+            var mainpanel = new Ext.Panel({
+                title: "Administrator login",
+                renderTo: 'div_login',
+                //height: 300,
+                width:  300,
+                items: [formPanel]
+            });
+        });
+    </script>
+</head>
+<body>
+    <center>
+    <div id='div_login' style='margin-top:60px;'></div>
+    </center>
+</body>
+</html>

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/animated_favicon1.gif
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/animated_favicon1.gif?rev=1087520&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/animated_favicon1.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/favicon.ico
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/favicon.ico?rev=1087520&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/favicon.ico
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/cookies.js
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/cookies.js?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/cookies.js (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/cookies.js Fri Apr  1 00:29:22 2011
@@ -0,0 +1,272 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+/**
+ * @fileoverview Functions for setting, getting and deleting cookies
+ */
+
+/**
+ * Namespace for cookie functions
+ */
+
+// TODO: find the official solution for a cookies library
+var shindig = shindig || {};
+shindig.cookies = shindig.cookies || {};
+
+
+shindig.cookies.JsType_ = {
+  UNDEFINED: 'undefined'
+};
+
+shindig.cookies.isDef = function(val) {
+  return typeof val != shindig.cookies.JsType_.UNDEFINED;
+};
+
+
+/**
+ * Sets a cookie.
+ * The max_age can be -1 to set a session cookie. To remove and expire cookies,
+ * use remove() instead.
+ *
+ * @param {string} name The cookie name.
+ * @param {string} value The cookie value.
+ * @param {number} opt_maxAge The max age in seconds (from now). Use -1 to set
+ *                            a session cookie. If not provided, the default is
+ *                            -1 (i.e. set a session cookie).
+ * @param {string} opt_path The path of the cookie, or null to not specify a
+ *                          path attribute (browser will use the full request
+ *                          path). If not provided, the default is '/' (i.e.
+ *                          path=/).
+ * @param {string} opt_domain The domain of the cookie, or null to not specify
+ *                            a domain attribute (browser will use the full
+ *                            request host name). If not provided, the default
+ *                            is null (i.e. let browser use full request host
+ *                            name).
+ */
+shindig.cookies.set = function(name, value, opt_maxAge, opt_path, opt_domain) {
+  // we do not allow '=' or ';' in the name
+  if (/;=/g.test(name)) {
+    throw new Error('Invalid cookie name "' + name + '"');
+  }
+  // we do not allow ';' in value
+  if (/;/g.test(value)) {
+    throw new Error('Invalid cookie value "' + value + '"');
+  }
+
+  if (!shindig.cookies.isDef(opt_maxAge)) {
+    opt_maxAge = -1;
+  }
+
+  var domainStr = opt_domain ? ';domain=' + opt_domain : '';
+  var pathStr = opt_path ? ';path=' + opt_path : '';
+
+  var expiresStr;
+
+  // Case 1: Set a session cookie.
+  if (opt_maxAge < 0) {
+    expiresStr = '';
+
+  // Case 2: Expire the cookie.
+  // Note: We don't tell people about this option in the function doc because
+  // we prefer people to use ExpireCookie() to expire cookies.
+  } else if (opt_maxAge === 0) {
+    // Note: Don't use Jan 1, 1970 for date because NS 4.76 will try to convert
+    // it to local time, and if the local time is before Jan 1, 1970, then the
+    // browser will ignore the Expires attribute altogether.
+    var pastDate = new Date(1970, 1 /*Feb*/, 1);  // Feb 1, 1970
+    expiresStr = ';expires=' + pastDate.toUTCString();
+
+  // Case 3: Set a persistent cookie.
+  } else {
+    var futureDate = new Date((new Date).getTime() + opt_maxAge * 1000);
+    expiresStr = ';expires=' + futureDate.toUTCString();
+  }
+
+  document.cookie = name + '=' + value + domainStr + pathStr + expiresStr;
+};
+
+
+/**
+ * Returns the value for the first cookie with the given name
+ * @param {string} name The name of the cookie to get
+ * @param {string} opt_default If not found this is returned instead.
+ * @return {string|undefined} The value of the cookie. If no cookie is set this
+ *                            returns opt_default or undefined if opt_default is
+ *                            not provided.
+ */
+shindig.cookies.get = function(name, opt_default) {
+  var nameEq = name + "=";
+  var cookie = String(document.cookie);
+  for (var pos = -1; (pos = cookie.indexOf(nameEq, pos + 1)) >= 0;) {
+    var i = pos;
+    // walk back along string skipping whitespace and looking for a ; before
+    // the name to make sure that we don't match cookies whose name contains
+    // the given name as a suffix.
+    while (--i >= 0) {
+      var ch = cookie.charAt(i);
+      if (ch == ';') {
+        i = -1;  // indicate success
+        break;
+      }
+    }
+    if (i == -1) {  // first cookie in the string or we found a ;
+      var end = cookie.indexOf(';', pos);
+      if (end < 0) {
+        end = cookie.length;
+      }
+      return cookie.substring(pos + nameEq.length, end);
+    }
+  }
+  return opt_default;
+};
+
+
+/**
+ * Removes and expires a cookie.
+ *
+ * @param {string} name The cookie name.
+ * @param {string} opt_path The path of the cookie, or null to expire a cookie
+ *                          set at the full request path. If not provided, the
+ *                          default is '/' (i.e. path=/).
+ * @param {string} opt_domain The domain of the cookie, or null to expire a
+ *                            cookie set at the full request host name. If not
+ *                            provided, the default is null (i.e. cookie at
+ *                            full request host name).
+ */
+shindig.cookies.remove = function(name, opt_path, opt_domain) {
+  var rv = shindig.cookies.containsKey(name);
+  shindig.cookies.set(name, '', 0, opt_path, opt_domain);
+  return rv;
+};
+
+
+/**
+ * Gets the names and values for all the cookies
+ * @private
+ * @return {Object} An object with keys and values
+ */
+shindig.cookies.getKeyValues_ = function() {
+  var cookie = String(document.cookie);
+  var parts = cookie.split(/\s*;\s*/);
+  var keys = [], values = [], index, part;
+  for (var i = 0; part = parts[i]; i++) {
+    index = part.indexOf('=');
+
+    if (index == -1) { // empty name
+      keys.push('');
+      values.push(part);
+    } else {
+      keys.push(part.substring(0, index));
+      values.push(part.substring(index + 1));
+    }
+  }
+  return {keys: keys, values: values};
+};
+
+
+/**
+ * Gets the names for all the cookies
+ * @return {Array} An array with the names of the cookies
+ */
+shindig.cookies.getKeys = function() {
+  return shindig.cookies.getKeyValues_().keys;
+};
+
+
+/**
+ * Gets the values for all the cookies
+ * @return {Array} An array with the values of the cookies
+ */
+shindig.cookies.getValues = function() {
+  return shindig.cookies.getKeyValues_().values;
+};
+
+
+/**
+ * Whether there are any cookies for this document
+ * @return {boolean}
+ */
+shindig.cookies.isEmpty = function() {
+  return document.cookie === '';
+};
+
+
+/**
+ * Returns the number of cookies for this document
+ * @return {number}
+ */
+shindig.cookies.getCount = function() {
+  var cookie = String(document.cookie);
+  if (cookie === '') {
+    return 0;
+  }
+  var parts = cookie.split(/\s*;\s*/);
+  return parts.length;
+};
+
+
+/**
+ * Returns whether there is a cookie with the given name
+ * @param {string} key The name of the cookie to test for
+ * @return {boolean}
+ */
+shindig.cookies.containsKey = function(key) {
+  var sentinel = {};
+  // if get does not find the key it returns the default value. We therefore
+  // compare the result with an object to ensure we do not get any false
+  // positives.
+  return shindig.cookies.get(key, sentinel) !== sentinel;
+};
+
+
+/**
+ * Returns whether there is a cookie with the given value. (This is an O(n)
+ * operation.)
+ * @param {string} value The value to check for
+ * @return {boolean}
+ */
+shindig.cookies.containsValue = function(value) {
+  // this O(n) in any case so lets do the trivial thing.
+  var values = shindig.cookies.getKeyValues_().values;
+  for (var i = 0; i < values.length; i++) {
+    if (values[i] == value) {
+      return true;
+    }
+  }
+  return false;
+};
+
+
+/**
+ * Removes all cookies for this document
+ */
+shindig.cookies.clear = function() {
+  var keys = shindig.cookies.getKeyValues_().keys;
+  for (var i = keys.length - 1; i >= 0; i--) {
+    shindig.cookies.remove(keys[i]);
+  }
+};
+
+/**
+ * Static constant for the size of cookies. Per the spec, there's a 4K limit
+ * to the size of a cookie. To make sure users can't break this limit, we
+ * should truncate long cookies at 3950 bytes, to be extra careful with dumb
+ * browsers/proxies that interpret 4K as 4000 rather than 4096
+ * @type number
+ */
+shindig.cookies.MAX_COOKIE_LENGTH = 3950;

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/gadgets.js
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/gadgets.js?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/gadgets.js (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/gadgets.js Fri Apr  1 00:29:22 2011
@@ -0,0 +1,833 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+/**
+ * @fileoverview Open Gadget Container
+ */
+
+var gadgets = gadgets || {};
+
+gadgets.error = {};
+gadgets.error.SUBCLASS_RESPONSIBILITY = 'subclass responsibility';
+gadgets.error.TO_BE_DONE = 'to be done';
+
+/**
+ * This function overwrites gadgets.log in core.log
+ * It makes gadgets.log.warn, gadgets.log.logAtLevel, etc not work!
+ */
+/*
+gadgets.log = function(message) {
+  if (window.console && window.console.log) {
+    window.console.log(message);
+  } else {
+    var logEntry = document.createElement('div');
+    logEntry.className = 'gadgets-log-entry';
+    logEntry.innerHTML = message;
+    document.body.appendChild(logEntry);
+  }
+};
+*/
+
+
+/**
+ * Calls an array of asynchronous functions and calls the continuation
+ * function when all are done.
+ * @param {Array} functions Array of asynchronous functions, each taking
+ *     one argument that is the continuation function that handles the result
+ *     That is, each function is something like the following:
+ *     function(continuation) {
+ *       // compute result asynchronously
+ *       continuation(result);
+ *     }
+ * @param {Function} continuation Function to call when all results are in.  It
+ *     is pass an array of all results of all functions
+ * @param {Object} opt_this Optional object used as "this" when calling each
+ *     function
+ */
+gadgets.callAsyncAndJoin = function(functions, continuation, opt_this) {
+  var pending = functions.length;
+  var results = [];
+  for (var i = 0; i < functions.length; i++) {
+    // we need a wrapper here because i changes and we need one index
+    // variable per closure
+    var wrapper = function(index) {
+      functions[index].call(opt_this, function(result) {
+        results[index] = result;
+        if (--pending === 0) {
+          continuation(results);
+        }
+      });
+    };
+    wrapper(i);
+  }
+};
+
+// ----------
+// Extensible
+
+gadgets.Extensible = function() {
+};
+
+/**
+ * Sets the dependencies.
+ * @param {Object} dependencies Object whose properties are set on this
+ *     container as dependencies
+ */
+gadgets.Extensible.prototype.setDependencies = function(dependencies) {
+  for (var p in dependencies) {
+    this[p] = dependencies[p];
+  }
+};
+
+/**
+ * Returns a dependency given its name.
+ * @param {String} name Name of dependency
+ * @return {Object} Dependency with that name or undefined if not found
+ */
+gadgets.Extensible.prototype.getDependencies = function(name) {
+  return this[name];
+};
+
+
+
+// -------------
+// UserPrefStore
+
+/**
+ * User preference store interface.
+ * @constructor
+ */
+gadgets.UserPrefStore = function() {
+};
+
+/**
+ * Gets all user preferences of a gadget.
+ * @param {Object} gadget Gadget object
+ * @return {Object} All user preference of given gadget
+ */
+gadgets.UserPrefStore.prototype.getPrefs = function(gadget) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+/**
+ * Saves user preferences of a gadget in the store.
+ * @param {Object} gadget Gadget object
+ * @param {Object} prefs User preferences
+ */
+gadgets.UserPrefStore.prototype.savePrefs = function(gadget) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+
+// -------------
+// DefaultUserPrefStore
+
+/**
+ * User preference store implementation.
+ * TODO: Turn this into a real implementation that is production safe
+ * @constructor
+ */
+gadgets.DefaultUserPrefStore = function() {
+  gadgets.UserPrefStore.call(this);
+};
+gadgets.DefaultUserPrefStore.inherits(gadgets.UserPrefStore);
+
+gadgets.DefaultUserPrefStore.prototype.getPrefs = function(gadget) { };
+
+gadgets.DefaultUserPrefStore.prototype.savePrefs = function(gadget) { };
+
+
+// -------------
+// GadgetService
+
+/**
+ * Interface of service provided to gadgets for resizing gadgets,
+ * setting title, etc.
+ * @constructor
+ */
+gadgets.GadgetService = function() {
+};
+
+gadgets.GadgetService.prototype.setHeight = function(elementId, height) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+gadgets.GadgetService.prototype.setTitle = function(gadget, title) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+gadgets.GadgetService.prototype.setUserPref = function(id) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+// ----------------
+// IfrGadgetService
+
+/**
+ * Base implementation of GadgetService.
+ * @constructor
+ */
+gadgets.IfrGadgetService = function() {
+  gadgets.GadgetService.call(this);
+  gadgets.rpc.register('resize_iframe', this.setHeight);
+  gadgets.rpc.register('set_pref', this.setUserPref);
+  gadgets.rpc.register('set_title', this.setTitle);
+  gadgets.rpc.register('requestNavigateTo', this.requestNavigateTo);
+  gadgets.rpc.register('requestSendMessage', this.requestSendMessage);
+};
+
+gadgets.IfrGadgetService.inherits(gadgets.GadgetService);
+
+gadgets.IfrGadgetService.prototype.setHeight = function(height) {
+  if (height > gadgets.container.maxheight_) {
+    height = gadgets.container.maxheight_;
+  }
+
+  var element = document.getElementById(this.f);
+  if (element) {
+    element.style.height = height + 'px';
+  }
+};
+
+gadgets.IfrGadgetService.prototype.setTitle = function(title) {
+  var element = document.getElementById(this.f + '_title');
+  if (element) {
+    element.innerHTML = title.replace(/&/g, '&amp;').replace(/</g, '&lt;');
+  }
+};
+
+/**
+ * Sets one or more user preferences
+ * @param {String} editToken
+ * @param {String} name Name of user preference
+ * @param {String} value Value of user preference
+ * More names and values may follow
+ */
+gadgets.IfrGadgetService.prototype.setUserPref = function(editToken, name,
+    value) {
+  var id = gadgets.container.gadgetService.getGadgetIdFromModuleId(this.f);
+  var gadget = gadgets.container.getGadget(id);
+  var prefs = gadget.getUserPrefs() || {};
+  for (var i = 1, j = arguments.length; i < j; i += 2) {
+    prefs[arguments[i]] = arguments[i + 1];
+  }
+  gadget.setUserPrefs(prefs);
+};
+
+/**
+ * Requests the container to send a specific message to the specified users.
+ * @param {Array.<String>, String} recipients An ID, array of IDs, or a group reference;
+ * the supported keys are VIEWER, OWNER, VIEWER_FRIENDS, OWNER_FRIENDS, or a
+ * single ID within one of those groups
+ * @param {opensocial.Message} message The message to send to the specified users
+ * @param {Function} opt_callback The function to call once the request has been
+ * processed; either this callback will be called or the gadget will be reloaded
+ * from scratch
+ * @param {opensocial.NavigationParameters} opt_params The optional parameters
+ * indicating where to send a user when a request is made, or when a request
+ * is accepted; options are of type  NavigationParameters.DestinationType
+ */
+gadgets.IfrGadgetService.prototype.requestSendMessage = function(recipients,
+    message, opt_callback, opt_params) {
+    if (opt_callback) {
+      window.setTimeout(function() {
+        opt_callback(new opensocial.ResponseItem(
+            null, null, opensocial.ResponseItem.Error.NOT_IMPLEMENTED, null));
+      }, 0);
+    }
+};
+
+/**
+ * Navigates the page to a new url based on a gadgets requested view and
+ * parameters.
+ */
+gadgets.IfrGadgetService.prototype.requestNavigateTo = function(view,
+    opt_params) {
+  var id = gadgets.container.gadgetService.getGadgetIdFromModuleId(this.f);
+  var url = gadgets.container.gadgetService.getUrlForView(view);
+
+  if (opt_params) {
+    var paramStr = gadgets.json.stringify(opt_params);
+    if (paramStr.length > 0) {
+      url += '&appParams=' + encodeURIComponent(paramStr);
+    }
+  }
+
+  if (url && document.location.href.indexOf(url) == -1) {
+    document.location.href = url;
+  }
+};
+
+/**
+ * This is a silly implementation that will need to be overriden by almost all
+ * real containers.
+ * TODO: Find a better default for this function
+ *
+ * @param view The view name to get the url for
+ */
+gadgets.IfrGadgetService.prototype.getUrlForView = function(
+    view) {
+  if (view === 'canvas') {
+    return '/canvas';
+  } else if (view === 'profile') {
+    return '/profile';
+  } else {
+    return null;
+  }
+};
+
+gadgets.IfrGadgetService.prototype.getGadgetIdFromModuleId = function(
+    moduleId) {
+  return moduleId;
+  // Quick hack to extract the gadget id from module id
+  return parseInt(moduleId.match(/_([0-9]+)$/)[1], 10);
+};
+
+// -------------
+// LayoutManager
+
+/**
+ * Layout manager interface.
+ * @constructor
+ */
+gadgets.LayoutManager = function() {
+};
+
+/**
+ * Gets the HTML element that is the chrome of a gadget into which the content
+ * of the gadget can be rendered.
+ * @param {Object} gadget Gadget instance
+ * @return {Object} HTML element that is the chrome for the given gadget
+ */
+gadgets.LayoutManager.prototype.getGadgetChrome = function(gadget) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+// -------------------
+// StaticLayoutManager
+
+/**
+ * Static layout manager where gadget ids have a 1:1 mapping to chrome ids.
+ * @constructor
+ */
+gadgets.StaticLayoutManager = function() {
+  gadgets.LayoutManager.call(this);
+};
+
+gadgets.StaticLayoutManager.inherits(gadgets.LayoutManager);
+
+/**
+ * Sets chrome ids, whose indexes are gadget instance ids (starting from 0).
+ * @param {Array} gadgetChromeIds Gadget id to chrome id map
+ */
+gadgets.StaticLayoutManager.prototype.setGadgetChromeIds =
+    function(gadgetChromeIds) {
+  this.gadgetChromeIds_ = gadgetChromeIds;
+};
+
+gadgets.StaticLayoutManager.prototype.getGadgetChrome = function(gadget) {
+  var chromeId = this.gadgetChromeIds_[gadget.id];
+  return chromeId ? document.getElementById(chromeId) : null;
+};
+
+
+// ----------------------
+// FloatLeftLayoutManager
+
+/**
+ * FloatLeft layout manager where gadget ids have a 1:1 mapping to chrome ids.
+ * @constructor
+ * @param {String} layoutRootId Id of the element that is the parent of all
+ *     gadgets.
+ */
+gadgets.FloatLeftLayoutManager = function(layoutRootId) {
+  gadgets.LayoutManager.call(this);
+  this.layoutRootId_ = layoutRootId;
+};
+
+gadgets.FloatLeftLayoutManager.inherits(gadgets.LayoutManager);
+
+gadgets.FloatLeftLayoutManager.prototype.getGadgetChrome =
+    function(gadget) {
+  var layoutRoot = document.getElementById(this.layoutRootId_);
+  if (layoutRoot) {
+    var chrome = document.createElement('div');
+    chrome.className = 'gadgets-gadget-chrome';
+    chrome.style.cssFloat = 'left';
+    layoutRoot.appendChild(chrome);
+    return chrome;
+  } else {
+    return null;
+  }
+};
+
+// ------
+// Gadget
+
+/**
+ * Creates a new instance of gadget.  Optional parameters are set as instance
+ * variables.
+ * @constructor
+ * @param {Object} params Parameters to set on gadget.  Common parameters:
+ *    "specUrl": URL to gadget specification
+ *    "private": Whether gadget spec is accessible only privately, which means
+ *        browser can load it but not gadget server
+ *    "spec": Gadget Specification in XML
+ *    "viewParams": a javascript object containing attribute value pairs
+ *        for this gadgets
+ *    "secureToken": an encoded token that is passed on the URL hash
+ *    "hashData": Query-string like data that will be added to the
+ *        hash portion of the URL.
+ *    "specVersion": a hash value used to add a v= param to allow for better caching
+ *    "title": the default title to use for the title bar.
+ *    "height": height of the gadget
+ *    "width": width of the gadget
+ *    "debug": send debug=1 to the gadget server, gets us uncompressed
+ *        javascript
+ */
+gadgets.Gadget = function(params) {
+  this.userPrefs_ = {};
+
+  if (params) {
+    for (var name in params)  if (params.hasOwnProperty(name)) {
+      this[name] = params[name];
+    }
+  }
+  if (!this.secureToken) {
+    // Assume that the default security token implementation is
+    // in use on the server.
+    this.secureToken = 'john.doe:john.doe:appid:cont:url:0:default';
+  }
+};
+
+gadgets.Gadget.prototype.getUserPrefs = function() {
+  return this.userPrefs_;
+};
+
+gadgets.Gadget.prototype.setUserPrefs = function(userPrefs) {
+  this.userPrefs_ = userPrefs;
+  gadgets.container.userPrefStore.savePrefs(this);
+};
+
+gadgets.Gadget.prototype.getUserPref = function(name) {
+  return this.userPrefs_[name];
+};
+
+gadgets.Gadget.prototype.setUserPref = function(name, value) {
+  this.userPrefs_[name] = value;
+  gadgets.container.userPrefStore.savePrefs(this);
+};
+
+gadgets.Gadget.prototype.render = function(chrome) {
+  if (chrome) {
+    var gadget = this;
+    this.getContent(function(content) {
+      chrome.innerHTML = content;
+      window.frames[gadget.getIframeId()].location = gadget.getIframeUrl(); 
+    });
+  }
+};
+
+gadgets.Gadget.prototype.getContent = function(continuation) {
+  gadgets.callAsyncAndJoin([
+      this.getTitleBarContent, this.getUserPrefsDialogContent,
+      this.getMainContent], function(results) {
+        continuation(results.join(''));
+      }, this);
+};
+
+/**
+ * Gets title bar content asynchronously or synchronously.
+ * @param {Function} continuation Function that handles title bar content as
+ *     the one and only argument
+ */
+gadgets.Gadget.prototype.getTitleBarContent = function(continuation) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+/**
+ * Gets user preferences dialog content asynchronously or synchronously.
+ * @param {Function} continuation Function that handles user preferences
+ *     content as the one and only argument
+ */
+gadgets.Gadget.prototype.getUserPrefsDialogContent = function(continuation) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+/**
+ * Gets gadget content asynchronously or synchronously.
+ * @param {Function} continuation Function that handles gadget content as
+ *     the one and only argument
+ */
+gadgets.Gadget.prototype.getMainContent = function(continuation) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+/*
+ * Gets additional parameters to append to the iframe url
+ * Override this method if you need any custom params.
+ */
+gadgets.Gadget.prototype.getAdditionalParams = function() {
+  return '';
+};
+
+
+// ---------
+// IfrGadget
+
+gadgets.IfrGadget = function(opt_params) {
+  gadgets.Gadget.call(this, opt_params);
+  this.serverBase_ = '../../'; // default gadget server
+};
+
+gadgets.IfrGadget.inherits(gadgets.Gadget);
+
+gadgets.IfrGadget.prototype.GADGET_IFRAME_PREFIX_ = 'remote_iframe_';
+
+gadgets.IfrGadget.prototype.CONTAINER = 'default';
+
+gadgets.IfrGadget.prototype.cssClassGadget = 'gadgets-gadget';
+gadgets.IfrGadget.prototype.cssClassTitleBar = 'gadgets-gadget-title-bar';
+gadgets.IfrGadget.prototype.cssClassTitle = 'gadgets-gadget-title';
+gadgets.IfrGadget.prototype.cssClassTitleButtonBar =
+    'gadgets-gadget-title-button-bar';
+gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialog =
+    'gadgets-gadget-user-prefs-dialog';
+gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialogActionBar =
+    'gadgets-gadget-user-prefs-dialog-action-bar';
+gadgets.IfrGadget.prototype.cssClassTitleButton = 'gadgets-gadget-title-button';
+gadgets.IfrGadget.prototype.cssClassGadgetContent = 'gadgets-gadget-content';
+gadgets.IfrGadget.prototype.rpcToken = (0x7FFFFFFF * Math.random()) | 0;
+gadgets.IfrGadget.prototype.rpcRelay = 'files/container/rpc_relay.html';
+
+gadgets.IfrGadget.prototype.getTitleBarContent = function(continuation) {
+  continuation('<div id="' + this.cssClassTitleBar + '-' + this.id +
+      '" class="' + this.cssClassTitleBar + '"><span id="' +
+      this.getIframeId() + '_title" class="' +
+      this.cssClassTitle + '">' + (this.title ? this.title : 'Title') + '</span> | <span class="' +
+      this.cssClassTitleButtonBar +
+      '"><a href="#" onclick="gadgets.container.getGadget(' + this.id +
+      ').handleOpenUserPrefsDialog();return false;" class="' + this.cssClassTitleButton +
+      '">settings</a> <a href="#" onclick="gadgets.container.getGadget(' +
+      this.id + ').handleToggle();return false;" class="' + this.cssClassTitleButton +
+      '">toggle</a></span></div>');
+};
+
+gadgets.IfrGadget.prototype.getUserPrefsDialogContent = function(continuation) {
+  continuation('<div id="' + this.getUserPrefsDialogId() + '" class="' +
+      this.cssClassGadgetUserPrefsDialog + '"></div>');
+};
+
+gadgets.IfrGadget.prototype.setServerBase = function(url) {
+  this.serverBase_ = url;
+};
+
+gadgets.IfrGadget.prototype.getServerBase = function() {
+  return this.serverBase_;
+};
+
+gadgets.IfrGadget.prototype.getMainContent = function(continuation) {
+  var iframeId = this.getIframeId();
+  gadgets.rpc.setRelayUrl(iframeId, this.serverBase_ + this.rpcRelay);
+  gadgets.rpc.setAuthToken(iframeId, this.rpcToken);
+  continuation('<div class="' + this.cssClassGadgetContent + '"><iframe id="' +
+      iframeId + '" name="' + iframeId + '" class="' + this.cssClassGadget +
+      '" src="about:blank' +
+      '" frameborder="no" scrolling="no"' +
+      (this.height ? ' height="' + this.height + '"' : '') +
+      (this.width ? ' width="' + this.width + '"' : '') +
+      '></iframe></div>');
+};
+
+gadgets.IfrGadget.prototype.getIframeId = function() {
+  return this.GADGET_IFRAME_PREFIX_ + this.id;
+};
+
+gadgets.IfrGadget.prototype.getUserPrefsDialogId = function() {
+  return this.getIframeId() + '_userPrefsDialog';
+};
+
+gadgets.IfrGadget.prototype.getIframeUrl = function() {
+  return this.serverBase_ + 'ifr?' +
+      'container=' + this.CONTAINER +
+      '&mid=' +  this.id +
+      '&nocache=' + gadgets.container.nocache_ +
+      '&country=' + gadgets.container.country_ +
+      '&lang=' + gadgets.container.language_ +
+      '&view=' + gadgets.container.view_ +
+      (this.specVersion ? '&v=' + this.specVersion : '') +
+      (gadgets.container.parentUrl_ ? '&parent=' + encodeURIComponent(gadgets.container.parentUrl_) : '') +
+      (this.debug ? '&debug=1' : '') +
+      this.getAdditionalParams() +
+      this.getUserPrefsParams() +
+      (this.secureToken ? '&st=' + this.secureToken : '') +
+      '&url=' + encodeURIComponent(this.specUrl) +
+      '#rpctoken=' + this.rpcToken +
+      (this.viewParams ?
+          '&view-params=' +  encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
+      (this.hashData ? '&' + this.hashData : '');
+};
+
+gadgets.IfrGadget.prototype.getUserPrefsParams = function() {
+  var params = '';
+  if (this.getUserPrefs()) {
+    for(var name in this.getUserPrefs()) {
+      var value = this.getUserPref(name);
+      params += '&up_' + encodeURIComponent(name) + '=' +
+          encodeURIComponent(value);
+    }
+  }
+  return params;
+};
+
+gadgets.IfrGadget.prototype.handleToggle = function() {
+  var gadgetIframe = document.getElementById(this.getIframeId());
+  if (gadgetIframe) {
+    var gadgetContent = gadgetIframe.parentNode;
+    var display = gadgetContent.style.display;
+    gadgetContent.style.display = display ? '' : 'none';
+  }
+};
+
+gadgets.IfrGadget.prototype.handleOpenUserPrefsDialog = function() {
+  if (this.userPrefsDialogContentLoaded) {
+    this.showUserPrefsDialog();
+  } else {
+    var gadget = this;
+    var igCallbackName = 'ig_callback_' + this.id;
+    window[igCallbackName] = function(userPrefsDialogContent) {
+      gadget.userPrefsDialogContentLoaded = true;
+      gadget.buildUserPrefsDialog(userPrefsDialogContent);
+      gadget.showUserPrefsDialog();
+    };
+
+    var script = document.createElement('script');
+    script.src = 'http://gmodules.com/ig/gadgetsettings?mid=' + this.id +
+        '&output=js' + this.getUserPrefsParams() +  '&url=' + this.specUrl;
+    document.body.appendChild(script);
+  }
+};
+
+gadgets.IfrGadget.prototype.buildUserPrefsDialog = function(content) {
+  var userPrefsDialog = document.getElementById(this.getUserPrefsDialogId());
+  userPrefsDialog.innerHTML = content +
+      '<div class="' + this.cssClassGadgetUserPrefsDialogActionBar +
+      '"><input type="button" value="Save" onclick="gadgets.container.getGadget(' +
+      this.id +').handleSaveUserPrefs()"> <input type="button" value="Cancel" onclick="gadgets.container.getGadget(' +
+      this.id +').handleCancelUserPrefs()"></div>';
+  userPrefsDialog.childNodes[0].style.display = '';
+};
+
+gadgets.IfrGadget.prototype.showUserPrefsDialog = function(opt_show) {
+  var userPrefsDialog = document.getElementById(this.getUserPrefsDialogId());
+  userPrefsDialog.style.display = (opt_show || opt_show === undefined)
+      ? '' : 'none';
+};
+
+gadgets.IfrGadget.prototype.hideUserPrefsDialog = function() {
+  this.showUserPrefsDialog(false);
+};
+
+gadgets.IfrGadget.prototype.handleSaveUserPrefs = function() {
+  this.hideUserPrefsDialog();
+
+  var prefs = {};
+  var numFields = document.getElementById('m_' + this.id +
+      '_numfields').value;
+  for (var i = 0; i < numFields; i++) {
+    var input = document.getElementById('m_' + this.id + '_' + i);
+    if (input.type != 'hidden') {
+      var userPrefNamePrefix = 'm_' + this.id + '_up_';
+      var userPrefName = input.name.substring(userPrefNamePrefix.length);
+      var userPrefValue = input.value;
+      prefs[userPrefName] = userPrefValue;
+    }
+  }
+
+  this.setUserPrefs(prefs);
+  this.refresh();
+};
+
+gadgets.IfrGadget.prototype.handleCancelUserPrefs = function() {
+  this.hideUserPrefsDialog();
+};
+
+gadgets.IfrGadget.prototype.refresh = function() {
+  var iframeId = this.getIframeId();
+  document.getElementById(iframeId).src = this.getIframeUrl();
+};
+
+
+// ---------
+// Container
+
+/**
+ * Container interface.
+ * @constructor
+ */
+gadgets.Container = function() {
+  this.gadgets_ = {};
+  this.parentUrl_ = 'http://' + document.location.host;
+  this.country_ = 'ALL';
+  this.language_ = 'ALL';
+  this.view_ = 'default';
+  this.nocache_ = 1;
+
+  // signed max int
+  this.maxheight_ = 0x7FFFFFFF;
+};
+
+gadgets.Container.inherits(gadgets.Extensible);
+
+/**
+ * Known dependencies:
+ *     gadgetClass: constructor to create a new gadget instance
+ *     userPrefStore: instance of a subclass of gadgets.UserPrefStore
+ *     gadgetService: instance of a subclass of gadgets.GadgetService
+ *     layoutManager: instance of a subclass of gadgets.LayoutManager
+ */
+
+gadgets.Container.prototype.gadgetClass = gadgets.Gadget;
+
+gadgets.Container.prototype.userPrefStore = new gadgets.DefaultUserPrefStore();
+
+gadgets.Container.prototype.gadgetService = new gadgets.GadgetService();
+
+gadgets.Container.prototype.layoutManager =
+    new gadgets.StaticLayoutManager();
+
+gadgets.Container.prototype.setParentUrl = function(url) {
+  this.parentUrl_ = url;
+};
+
+gadgets.Container.prototype.setCountry = function(country) {
+  this.country_ = country;
+};
+
+gadgets.Container.prototype.setNoCache = function(nocache) {
+  this.nocache_ = nocache;
+};
+
+gadgets.Container.prototype.setLanguage = function(language) {
+  this.language_ = language;
+};
+
+gadgets.Container.prototype.setView = function(view) {
+  this.view_ = view;
+};
+
+gadgets.Container.prototype.setMaxHeight = function(maxheight) {
+  this.maxheight_ = maxheight;
+};
+
+gadgets.Container.prototype.getGadgetKey_ = function(instanceId) {
+  return 'gadget_' + instanceId;
+};
+
+gadgets.Container.prototype.getGadget = function(instanceId) {
+  return this.gadgets_[this.getGadgetKey_(instanceId)];
+};
+
+gadgets.Container.prototype.createGadget = function(opt_params) {
+  return new this.gadgetClass(opt_params);
+};
+
+gadgets.Container.prototype.addGadget = function(gadget) {
+  gadget.id = this.getNextGadgetInstanceId();
+  gadget.setUserPrefs(this.userPrefStore.getPrefs(gadget));
+  this.gadgets_[this.getGadgetKey_(gadget.id)] = gadget;
+};
+
+gadgets.Container.prototype.addGadgets = function(gadgets) {
+  for (var i = 0; i < gadgets.length; i++) {
+    this.addGadget(gadgets[i]);
+  }
+};
+
+/**
+ * Renders all gadgets in the container.
+ */
+gadgets.Container.prototype.renderGadgets = function() {
+  for (var key in this.gadgets_) {
+    this.renderGadget(this.gadgets_[key]);
+  }
+};
+
+/**
+ * Renders a gadget.  Gadgets are rendered inside their chrome element.
+ * @param {Object} gadget Gadget object
+ */
+gadgets.Container.prototype.renderGadget = function(gadget) {
+  throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
+};
+
+gadgets.Container.prototype.nextGadgetInstanceId_ = 0;
+
+gadgets.Container.prototype.getNextGadgetInstanceId = function() {
+  return this.nextGadgetInstanceId_++;
+};
+
+/**
+ * Refresh all the gadgets in the container.
+ */
+gadgets.Container.prototype.refreshGadgets = function() {
+  for (var key in this.gadgets_) {
+    this.gadgets_[key].refresh();
+  }
+};
+
+
+// ------------
+// IfrContainer
+
+/**
+ * Container that renders gadget using ifr.
+ * @constructor
+ */
+gadgets.IfrContainer = function() {
+  gadgets.Container.call(this);
+};
+
+gadgets.IfrContainer.inherits(gadgets.Container);
+
+gadgets.IfrContainer.prototype.gadgetClass = gadgets.IfrGadget;
+
+gadgets.IfrContainer.prototype.gadgetService = new gadgets.IfrGadgetService();
+
+gadgets.IfrContainer.prototype.setParentUrl = function(url) {
+  if (!url.match(/^http[s]?:\/\//)) {
+    url = document.location.href.match(/^[^?#]+\//)[0] + url;
+  }
+
+  this.parentUrl_ = url;
+};
+
+/**
+ * Renders a gadget using ifr.
+ * @param {Object} gadget Gadget object
+ */
+gadgets.IfrContainer.prototype.renderGadget = function(gadget) {
+  var chrome = this.layoutManager.getGadgetChrome(gadget);
+  gadget.render(chrome);
+};
+
+/**
+ * Default container.
+ */
+gadgets.container = new gadgets.IfrContainer();
+

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/rpc_relay.uncompressed.html
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/rpc_relay.uncompressed.html?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/rpc_relay.uncompressed.html (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/rpc_relay.uncompressed.html Fri Apr  1 00:29:22 2011
@@ -0,0 +1,32 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<script>
+var url = location.href,
+    hashParams = url.substr(url.indexOf('#') + 1).split('&'),
+    targetFrame, receive;
+
+try {
+  targetFrame = hashParams[0] === '..' ? parent.parent
+                                       : parent.frames[hashParams[0]];
+  receive = targetFrame.gadgets.rpc.receive;
+} catch (e) {
+}
+
+receive && receive(hashParams);
+</script>

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/util.js
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/util.js?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/util.js (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/gadgetcontainer/util.js Fri Apr  1 00:29:22 2011
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+/**
+ * @fileoverview Utility functions for the Open Gadget Container
+ */
+
+Function.prototype.inherits = function(parentCtor) {
+  function tempCtor() {};
+  tempCtor.prototype = parentCtor.prototype;
+  this.superClass_ = parentCtor.prototype;
+  this.prototype = new tempCtor();
+  this.prototype.constructor = this;
+};
\ No newline at end of file

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/index.jsp?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/index.jsp (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/index.jsp Fri Apr  1 00:29:22 2011
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+          xmlns:c="http://java.sun.com/jsp/jstl/core">
+  <jsp:directive.page contentType="text/html;charset=utf-8"/>
+
+  <!-- judge whether the user has signed in -->
+  <c:if test="${empty sessionScope.userId}">
+    <c:redirect url="/www/sign.jsp" />
+  </c:if>
+
+  <c:if test="${empty requestScope[&quot;next&quot;]}">
+      <c:redirect url="/www/ishindig.html" />
+  </c:if>
+
+  <c:redirect url="${requestScope[&quot;next&quot;]}" />
+</jsp:root>
+

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/authorization.html
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/authorization.html?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/authorization.html (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/authorization.html Fri Apr  1 00:29:22 2011
@@ -0,0 +1,61 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
+    "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+  <head>
+    <script type="text/javascript">
+      function twitterOAuthStart() {
+      }
+    </script>
+
+    <style type="text/css">
+      div.authsec {
+        border-bottom: 1px solid black;
+      }
+      span.fieldName {
+        width: 10em;
+      }
+    </style>
+  </head>
+
+  <body>
+    <div class="authsec">
+      <h2>Twitter OAuth</h2>
+      <input type="button" onclick="javascript:twitterOAuthStart();"
+             value="Start">
+    </div>
+
+    <div class="authsec">
+      <h2>MyProxy</h2>
+      <form method="POST" action="/ishindig-webapp/authn/myproxy">
+        <span class="fieldName">Host: </span><input type="text" name="myproxy_host"><br>
+        <span class="fieldName">User name: </span><input type="text" name="myproxy_username"> <br>
+        <span class="fieldName">Password: </span><input type="password" name="myproxy_password"><br>
+        <input type="submit" onclick="javascript:return true;" value="Submit">
+      </form>
+    </div>
+
+  </body>
+</html>
+

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/default.css
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/default.css?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/default.css (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/default.css Fri Apr  1 00:29:22 2011
@@ -0,0 +1,169 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+a {
+	color: #8DA359;
+	text-decoration: underline;
+}
+
+a:hover {
+	text-decoration: none;
+}
+
+body {
+	font-family: georgia;
+	font-size: 10pt;
+}
+
+#outer
+{
+	width: 760px;
+	margin-left: auto;
+	margin-right: auto;
+    margin-top: 1.0em;
+}
+
+#outer2 {
+    background-color: #DFE8F6;	
+    border:2px solid #99BBE8;
+    -moz-border-radius-bottomleft: 0.6em;
+    -moz-border-radius-bottomright: 0.6em;
+    -moz-border-radius-topleft: 0.6em;
+    -moz-border-radius-topright: 0.6em;
+}
+
+div#footer {
+    margin: 0px;
+    padding: 0px;
+}
+
+#header
+{
+    margin: 0px;
+	padding: 0.8em 1.2em 1.2em 1.2em;
+    background: transparent url(../extjs/resources/images/default/panel/white-top-bottom.gif) repeat-x scroll 0 -1px;
+    border: 0px solid black;
+}
+
+#header h1
+{
+	margin:0px;
+    padding: 0px;
+	font-size: 2.5em;
+	font-weight: normal;
+}
+
+#header h2
+{
+	padding: 0px;
+	margin: 0px;
+	font-size: 1.0em;
+}
+
+#menu
+{
+	line-height: 1.4em;
+	padding: 0.8em;
+    /* border-bottom: solid 1px #ffffff; */
+	border-top: dashed 1px #6D7B34;
+}
+
+
+#footer
+{
+	border-top: dashed 1px #EFEFD6;
+	padding-top: 1.0em;
+	font-size: 1.0em;
+	color: #AFA162;
+	padding-left: 1.2em;
+	clear: both;
+}
+
+#column1
+{
+	/*width: 530px;*/
+	float: left;
+    /* position: relative; */
+}
+
+#column1 p
+{
+	text-align: justify;
+	margin-bottom: 2.0em;
+	color: #4F4F2B;
+}
+
+#column1 h3
+{
+	font-size: 1.2em;
+	border-bottom: dashed 1px #CECF8F;
+	margin-bottom: 1.0em;
+}
+
+#column2
+{
+	/* width: 145px; */
+	float: right;
+    /* position: relative; */
+	margin-left: auto;
+}
+
+#column2 p
+{
+	text-align: justify;
+	margin-bottom: 2.0em;
+	color: #4F4F2B;
+	font-size: 1.0em;
+}
+
+#column2 h3
+{
+	font-size: 1.1em;
+	border-bottom: dashed 1px #CECF8F;
+	margin-bottom: 1.0em;
+}
+
+#column2 ul
+{
+	list-style: none;
+	line-height: 2.0em;
+	margin-bottom: 2.0em;
+}
+
+#column2 li
+{
+	border-bottom: dashed 1px #EFEFD6;
+}
+
+#menu hr{
+	background-color: #aaaaaa;
+	height:1px;
+	border: 0px;
+}
+
+input.openid {
+    background: url("http://www.plaxo.com/images/openid/login-bg.gif") no-repeat;
+    background-color: #fff;
+    background-position: 0 50%;
+    color: #000;
+    padding-left: 20px;
+    font-size:12px;
+}

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/style_form.css
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/style_form.css?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/style_form.css (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/css/style_form.css Fri Apr  1 00:29:22 2011
@@ -0,0 +1,125 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+input {
+	margin: 0.1em;
+}
+
+input.invalid, textarea.invalid {
+	background-color: #FFE813;
+	border: 0.1em;
+	border-color: #BB0000 !important;
+	border-style: solid;
+	margin: 0.1em !important;
+}
+
+input.invalid:focus, textarea.invalid:focus {
+	background-color: #FFE813;
+	border: 0.2em;
+	border-color: #BB0000 !important;
+	border-style: solid;
+	margin: 0 !important;
+}
+
+input:focus, textarea:focus {
+	background-image: none;
+	border: 0.2em;
+	border-color: #7E9FDA;
+	border-style: solid;
+	margin: 0;
+}
+
+input[type="checkbox"]:focus, input[type="radio"]:focus {
+	border: 0;
+	margin: 0.1em;
+}
+
+input[type="submit"] {
+	border-style: outset;
+	border-width: 0.2em;
+	margin: 0em;
+}
+
+input[type="submit"]:active {
+	border-style: inset;
+	border-width: 0.2em;
+	margin: 0em;
+}
+
+input[type="submit"]:focus {
+	border-style: outset;
+	border-width: 0.2em;
+	margin: 0em;
+}
+
+legend {
+	background-color: #FFFFFF;
+	border: 0.1em;
+	border-color: #7E9FDA;
+	border-style: solid;
+	color: #3362B4;
+	font-weight: bold;
+	padding: 0.5em;
+}
+
+.boxes {
+	border: none;
+}
+
+.required {
+	background-image: url(../images/required.gif);
+	background-position: right;
+	background-repeat: no-repeat;
+}
+
+/* Form message boxes */
+
+div.tmtFormMessage,
+div.tmtFormErrorMessage {
+	border: 1px;
+	border-style: solid;
+	padding: 5px;
+	margin: 10px;
+}
+
+div.tmtFormMessage {
+	background-color: #A4BFF0;
+	border-color: #12387A;
+}
+
+div.tmtFormErrorMessage {
+	background-color: #F9D400;
+	background-image:url(../images/field-alert.gif);
+	background-position: 5px 4px;
+	background-repeat: no-repeat;	
+	border-color: #BB0000;
+	padding-left: 30px;
+}
+
+div.tmtFormMessage ul,
+div.tmtFormErrorMessage ul {
+	list-style-type: square;
+	margin-top: 0px;
+	margin-bottom: 0px;
+	margin-left: 10px;
+	padding-left: 10px;
+}
+

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/data-format.txt
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/data-format.txt?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/data-format.txt (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/data-format.txt Fri Apr  1 00:29:22 2011
@@ -0,0 +1,113 @@
+
+/**
+ * http://www.labpixies.com/campaigns/todo/todo.xml
+ * http://gadget_server_url/gadgets/metadata
+ */
+
+/**
+ * Sample request
+ */
+{
+    context:{
+        container:"default", view:"home"
+    },
+    gadgets:[{
+        url:"http://www.google.com/ig/modules/datetime_v2/datetime_v2.xml",
+        language:"en",
+        country:"US"
+    }]
+}
+
+
+/**
+ * Retrieve metatada of a gadget from server.
+ * Format of the returned data is important for function *getGadgetMetadata*.
+ * Sample response from server:
+ */
+{
+   "gadgets":[
+      {
+         "showInDirectory":false,
+         "width":0,
+         "title":"ToDo",
+         "singleton":false,
+         "categories":[
+            "",
+            ""
+         ],
+         "views":{
+            "canvas":{
+               "preferredWidth":0,
+               "preferredHeight":0,
+               "type":"html",
+               "quirks":true
+            },
+            "default":{
+               "preferredWidth":0,
+               "preferredHeight":0,
+               "type":"html",
+               "quirks":true
+            },
+            "profile":{
+               "preferredWidth":0,
+               "preferredHeight":0,
+               "type":"html",
+               "quirks":true
+            },
+            "home":{
+               "preferredWidth":0,
+               "preferredHeight":0,
+               "type":"html",
+               "quirks":true
+            }
+         },
+         "screenshot":"http://www.labpixies.com/campaigns/todo/images/screenshot.png",
+         "links":{
+
+         },
+         "authorLink":"",
+         "thumbnail":"http://www.labpixies.com/campaigns/todo/images/thumbnail.jpg",
+         "height":270,
+         "scaling":false,
+         "moduleId":0,
+         "features":[
+            "analytics",
+            "setprefs",
+            "views",
+            "dynamic-height"
+         ],
+         "showStats":false,
+         "authorPhoto":"",
+         "scrolling":false,
+         "url":"http://www.labpixies.com/campaigns/todo/todo.xml",
+         "authorEmail":"info@labpixies.com",
+         "titleUrl":"http://www.labpixies.com",
+         "directoryTitle":"ToDo",
+         "iframeUrl":"?container=&v=c05e672784bcc3009bd61cc8d26d8&lang=&country=&view=&up_todos=&up_saved_tasks=&url=http%3A%2F%2Fwww.labpixies.com%2Fcampaigns%2Ftodo%2Ftodo.xml",
+         "userPrefs":{
+            "saved_tasks":{
+               "orderedEnumValues":[
+
+               ],
+               "enumValues":{
+
+               },
+               "type":"hidden",
+               "default":"",
+               "displayName":"saved_tasks"
+            },
+            "todos":{
+               "orderedEnumValues":[
+
+               ],
+               "enumValues":{
+
+               },
+               "type":"hidden",
+               "default":"",
+               "displayName":"todos"
+            }
+         }
+      }
+   ]
+}

Added: incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/extjs/README
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/extjs/README?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/extjs/README (added)
+++ incubator/rave/donations/ogce-gadget-container/ishindig-webapp/src/main/webapp/www/extjs/README Fri Apr  1 00:29:22 2011
@@ -0,0 +1,9 @@
+Place the EXT-JS 2.2 libraries in this directory.  See INSTALL.README in the main project
+directory. The following links (from ishindig.html) must work.
+		  
+<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
+<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
+<script type="text/javascript" src="extjs/ext-all.js"></script> 
+<script type="text/javascript" src="extjs/radiogroup.js"></script>
+
+



Mime
View raw message