Review Board 1.7.22


Add lang and country substitution for ifr in client side

Review Request #4906 - Created April 27, 2012 and submitted

qiaoyun sun
SHINDIG-1763
Reviewers
shindig
ddumont, rbaxter, ssievers
shindig
If we don't set this property in shindig.properties: shindig.urlgen.use-templates-default=false, the lang and country info will not pass to the ifr url, so the lang and country are ignored.
For example: the ifr is like :
http://localhost:8080/shindig/gadgets/ifr?url=http%3A%2F%2Flocalhost%3A8080%2Fshindig%2Fsamplecontainer%2Fexamples%2FSocialHelloWorld.xml&container=default&view=default&lang=%25lang%25&country=%25country%25&debug=1&nocache=1&sanitize=%25sanitize%25&v=0a811629d8d99f87d3544b65058211fe&st=john.doe%3Ajohn.doe%3Ahttp%253A%252F%252Flocalhost%253A8080%252Fshindig%252Fsamplecontainer%252Fexamples%252FSocialHelloWorld.xml%3Acont%3Ahttp%253A%252F%252Flocalhost%253A8080%252Fshindig%252Fsamplecontainer%252Fexamples%252FSocialHelloWorld.xml%3A0%3Adefault%3A1335423393&testmode=0&parent=http%3A%2F%2Flocalhost%3A8080&mid=0

They should be substituted by the browser's setting in client side. 

 

Diff revision 2

This is not the most recent revision of the diff. The latest diff is revision 4. See what's changed.

1 2 3 4
1 2 3 4

  1. http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_holder.js: Loading...
http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_holder.js
Revision 1331177 New Change
[20] 263 lines
[+20] [+] onConnect: function(container) {
264
  // add rpctoken fragment to support flash transport if not in the uri
264
  // add rpctoken fragment to support flash transport if not in the uri
265
  if(typeof(uri.getFP('rpctoken')) === 'undefined' ) {
265
  if(typeof(uri.getFP('rpctoken')) === 'undefined' ) {
266
    var rpcToken = (0x7FFFFFFF * Math.random()) | 0;
266
    var rpcToken = (0x7FFFFFFF * Math.random()) | 0;
267
    uri.setFP('rpctoken', rpcToken);
267
    uri.setFP('rpctoken', rpcToken);
268
  }
268
  }
269

    
   
269
  var lang = osapi.container.Service.prototype.getLanguage();

    
   
270
  var country = osapi.container.Service.prototype.getCountry();

    
   
271
  var templateLang = uri.getQP('lang'), templateCountry = uri.getQP('country');

    
   
272
  if(templateLang.indexOf('%') != -1){

    
   
273
    uri.setQP('lang', lang);

    
   
274
  }

    
   
275
  if(templateCountry.indexOf('%') != -1){

    
   
276
    uri.setQP('country', country);

    
   
277
  }
270
  return uri.toString();
278
  return uri.toString();
271
};
279
};
272

    
   
280

   
273

    
   
281

   
274
/**
282
/**
[+20] [20] 32 lines
  1. http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_holder.js: Loading...