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. 

 
http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_holder.js
Diff Revision 2 Diff Revision 4
[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
  var lang = osapi.container.Service.prototype.getLanguage();
269
  var lang = this.site_.service_.getLanguage();
270
  var country = osapi.container.Service.prototype.getCountry();
270
  var country = this.site_.service_.getCountry();
271
  var templateLang = uri.getQP('lang'), templateCountry = uri.getQP('country');
271
  var templateLang = uri.getQP('lang'), templateCountry = uri.getQP('country');
272
  if(templateLang.indexOf('%') != -1){
272
  if(templateLang.indexOf('%') != -1){
273
    uri.setQP('lang', lang);
273
    uri.setQP('lang', lang);
274
  }
274
  }
275
  if(templateCountry.indexOf('%') != -1){
275
  if(templateCountry.indexOf('%') != -1){
[+20] [20] 39 lines
http://svn.apache.org/repos/asf/shindig/trunk/features/src/test/javascript/features/container/gadget_holder_test.js
Diff Revision 2 Diff Revision 4
 
  1. http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_holder.js: Loading...
  2. http://svn.apache.org/repos/asf/shindig/trunk/features/src/test/javascript/features/container/gadget_holder_test.js: Loading...