[Cosmo-dev] Re: [commits-cosmo] (br) [4567] this is a better way not to clobber namespaces.

Matthew Eernisse mde at osafoundation.org
Mon Jun 4 17:48:27 PDT 2007


Travis,

Not being familiar with dojo.lang.mixin, I just want to confirm my 
understanding of this.

Obviously what it was doing before was mixing all that stuff into 
cosmo.view.cal (but doing it in some other scope -- window scope, I'm 
assuming), so 'this' was not pointing correctly at cosmo.view.cal.

Is what it's doing now mixing the cosmo.view.cal namespace object into 
window-level scope and then returning it? If so, is it possible to pass 
window explicitly so it's a little more obvious what it's doing there?

Thanks for coming up with solutions for this irritating stuff.


Matthew

svncheckin at osafoundation.org wrote:
> Revision
>     4567 <http://cvs.osafoundation.org/viewcvs.cgi?rev=4567&view=rev>
> Author
>     br
> Date
>     2007-06-04 12:50:07 -0700 (Mon, 04 Jun 2007)
> 
> 
>       Log Message
> 
> this is a better way not to clobber namespaces.
> 
> 
>       Modified Paths
> 
>     * cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal.js
>       <#cosmotrunkcosmosrcmainwebappjscosmoviewcaljs>
> 
> 
>       Diff
> 
> 
>         Modified: cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal.js
>         (4566 => 4567)
> 
> --- cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal.js	2007-06-04 19:49:51 UTC (rev 4566)
> +++ cosmo/trunk/cosmo/src/main/webapp/js/cosmo/view/cal.js	2007-06-04 19:50:07 UTC (rev 4567)
> @@ -25,7 +25,7 @@
>  dojo.require("cosmo.datetime.util");
>  dojo.require('cosmo.view.cal.dialog');
>  
> -dojo.lang.mixin(cosmo.view.cal, new function(){
> +cosmo.view.cal = dojo.lang.mixin(new function(){
>  
>      var self = this;
>      var ranges = {
> @@ -79,10 +79,9 @@
>              delta.applyChangeType(change);
>              dojo.event.topic.publish('/calEvent', {action:'save', data:ev});
>          } else {
> +          dojo.debug("ELSE!");
>            cosmo.app.showDialog(cosmo.view.cal.dialog.getProps('saveRecurConfirm', opts));
>          }
> -        
> -        
>      }
>      
>      /**
> @@ -1001,6 +1000,7 @@
>      };
>      
>      this.triggerLoadEvents = function (o) {
> +        dojo.debug("trigger!");
>          var opts = {};
>          var collection = opts.collection;
>          var goTo = o.goTo;
> @@ -1015,6 +1015,7 @@
>          // Changing dates
>          // --------
>          if (goTo) {
> +            dojo.debug("goto");
>              // param is 'back' or 'next'
>              if (typeof goTo == 'string') {
>                  var key = goTo.toLowerCase();
> @@ -1069,6 +1070,8 @@
>          // Load the array of events
>          // ======================
>          try {
> +            dojo.debug("start:" + start);
> +            dojo.debug("end:" + end);
>              var deferred = cosmo.app.pim.serv.getItems(collection, 
>                  { start: start, end: end }, { sync: true });
>              eventLoadList = deferred.results[0];
> @@ -1103,8 +1106,13 @@
>       * Eventually this will change depending on what type of view is selected
>       */
>      this.setQuerySpan = function (dt) {
> +        dojo.debug("this? " + this == self);
> +        xxx = this;
> +        yyy = self;
>          this.viewStart = cosmo.datetime.util.getWeekStart(dt);
> +        dojo.debug("viewSTart: " + this.viewStart)
>          this.viewEnd = cosmo.datetime.util.getWeekEnd(dt);
> +        dojo.debug("viewEnd: " + this.viewEnd)
>          return true;
>  };
>      /**
> @@ -1125,5 +1133,5 @@
>              dojo.date.dateParts.WEEK, incr);
>          return queryDate;
>      };
> -});
> +}, cosmo.view.cal);
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo



More information about the cosmo-dev mailing list