Revision: 2576
Author: seba.wagner
Date: Mon Nov  2 14:57:37 2009
Log: Fix Reload of Calendar Events
http://code.google.com/p/openmeetings/source/detail?r=2576

Modified:
  /trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/cal-data.lzx
   
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
   
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/infopanel.lzx
   
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx

=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/cal-data.lzx     
 
Mon Nov  2 13:43:40 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/cal-data.lzx     
 
Mon Nov  2 14:57:37 2009
@@ -99,13 +99,30 @@
                      this.setPointer ( op );
                      break;
                  }
-                ptr.selectChild()
+                ptr.selectChild();
              }

              var t = LzTimeKernel.getTimer();
              this.addNodeFromPointer( ptr );
              if ($debug) Debug.write( "time to addNode: " + (  
LzTimeKernel.getTimer() - t ) );
          </method>
+
+        <method name="clearDataPointer">
+               <![CDATA[
+
+                       if ($debug) Debug.info("clearDataPointer ");
+
+                       this.deleteNode();
+
+                       //while ( this.getNodeCount() == 1 ){
+                       //
+                       //
+                       //
+                       //}
+
+
+               ]]>
+        </method>
      </datapointer>


@@ -258,25 +275,41 @@
              updateEventDate(currenteventDP,year,month,day);
              //Make node attributes match dataset location

+                       if ($debug) Debug.write("moveEvent :: alleventsDP 
",alleventsDP);
+
              alleventsDP.setXPath('eventdata:/vcalendar[1]');

              // Create the node tree for this event
+            if ($debug) Debug.write("FILL YEAR ");
              getNewNode(alleventsDP,'year'+year);
+            if ($debug) Debug.write("FILL MONTH ");
              getNewNode(alleventsDP,'month'+month);
+            if ($debug) Debug.write("FILL DAY ");
              getNewNode(alleventsDP,'day'+day);

+            if ($debug) Debug.write("tempDP ");
              tempDP.setFromPointer( currenteventDP );
+
+            if ($debug) Debug.write("tempDP ");
              tempDP.setNodeAttribute('selected', 'false');
+
              // Copy current data to new location
              // If the record being moved is selected (usually the case,
              // currenteventDP changes after this call
+            if ($debug) Debug.write("addNodeFromPointer ");
              var newPoint = alleventsDP.addNodeFromPointer(currenteventDP);
+
+            if ($debug) Debug.write("setFromPointer ");
              currenteventDP.setFromPointer(newPoint);

+            if ($debug) Debug.write("deleteNode ");
              //Delete the original node
              tempDP.deleteNode();
+
+            if ($debug) Debug.write("setNodeAttribute ");
              currenteventDP.setNodeAttribute('selected', 'true');

+            if ($debug) Debug.write("alleventsDP :: eventdata ");
              // Set the event data pointer to the top of the event data
              alleventsDP.setXPath('eventdata:/vcalendar[1]');

@@ -345,6 +378,7 @@

          <method name="getNewNode" args="dp,node">    <![CDATA[
              //Returns the pointer to the requested node and makes one if  
needed
+                       if ($debug) Debug.write("getNewNode ",dp,node);

              if ( dp.xpathQuery(node+'/name()') == null){
                  dp.addNode(node);
=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
         
Mon Nov  2 13:43:40 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
         
Mon Nov  2 14:57:37 2009
@@ -29,6 +29,12 @@
          <attribute name="hidedel" value="null" />
          <attribute name="mdel" value="null" />
          <attribute name="startDragDel" value="null" />
+
+        <attribute name="startDate" value="null" />
+        <attribute name="endDate" value="null" />
+
+        <attribute name="startDate2" value="null" />
+        <attribute name="endDate2" value="null" />

          <view name="bar" pixellock="false" bgcolor="white" visible="false"
                onmousedown="parent.domousedown()"
@@ -260,7 +266,32 @@
              this.obarx = this.x + bar.x;
              this.xoff = bar.getMouse( 'x' );
              this.yoff = bar.getMouse( 'y' );
-
+
+            var appointementId =  
this.followview.datapath.xpathQuery("appointementId/@value");
+
+               var tStartObj = this.datapath.xpathQuery("start[1]");
+               var tEndObj = this.datapath.xpathQuery("end[1]");
+
+               this.startDate = new Date();
+               this.startDate.setDate(Number(tStartObj.attributes.day));
+               this.startDate.setMonth(Number(tStartObj.attributes.month)-1);
+               this.startDate.setFullYear(Number(tStartObj.attributes.year));
+               this.startDate.setSeconds(0);
+               this.startDate.setHours(Number(tStartObj.attributes.hour));
+               this.startDate.setMinutes(Number(tStartObj.attributes.minute));
+
+               this.endDate = new Date();
+               this.endDate.setDate(Number(tEndObj.attributes.day));
+               this.endDate.setMonth(Number(tEndObj.attributes.month)-1);
+               this.endDate.setFullYear(Number(tEndObj.attributes.year));
+               this.endDate.setSeconds(0);
+               this.endDate.setHours(Number(tEndObj.attributes.hour));
+               this.endDate.setMinutes(Number(tEndObj.attributes.minute));
+
+            if ($debug) Debug.write("appointementId ",appointementId);
+            if ($debug) Debug.write("startDate ",this.startDate);
+            if ($debug) Debug.write("endDate ",this.endDate);
+
              lz.Timer.resetTimer( this.startDragDel , 150 );
              ]]>
          </method>
@@ -301,9 +332,35 @@
                        //this may be already applied, but it can't hurt
                        this.bar.followstate.apply();

+                        
this.setAttribute('freedragging', !this['followview'].classroot.opened );
+
                        if ($debug) Debug.warn("ON MOUSE UP => Update Cal  
Event ",this['followview']);

-                        
this.setAttribute('freedragging', !this['followview'].classroot.opened );
+                       var appointementId =  
this.followview.datapath.xpathQuery("appointementId/@value");
+
+                               var tStartObj = 
this.datapath.xpathQuery("start[1]");
+                               var tEndObj = 
this.datapath.xpathQuery("end[1]");
+
+                       this.startDate2 = new Date();
+                               
this.startDate2.setDate(Number(tStartObj.attributes.day));
+                               
this.startDate2.setMonth(Number(tStartObj.attributes.month)-1);
+                               
this.startDate2.setFullYear(Number(tStartObj.attributes.year));
+                               this.startDate2.setSeconds(0);
+                               
this.startDate2.setHours(Number(tStartObj.attributes.hour));
+                               
this.startDate2.setMinutes(Number(tStartObj.attributes.minute));
+
+                               this.endDate2 = new Date();
+                               
this.endDate2.setDate(Number(tEndObj.attributes.day));
+                               
this.endDate2.setMonth(Number(tEndObj.attributes.month)-1);
+                               
this.endDate2.setFullYear(Number(tEndObj.attributes.year));
+                               this.endDate2.setSeconds(0);
+                               
this.endDate2.setHours(Number(tEndObj.attributes.hour));
+                               
this.endDate2.setMinutes(Number(tEndObj.attributes.minute));
+
+                           if ($debug) Debug.write("appointementId 
",appointementId);
+                           if ($debug) Debug.write("startDate2 
",this.startDate2);
+                           if ($debug) Debug.write("endDate2 ",this.endDate2);
+
                    } else {
                        lz.Timer.removeTimer( this.startDragDel );
                    }
=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/infopanel.lzx    
 
Mon Nov  2 12:40:59 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/infopanel.lzx    
 
Mon Nov  2 14:57:37 2009
@@ -173,12 +173,14 @@
                        <![CDATA[
                                if ($debug) Debug.write("saveAppointment 
",value);

-                               var tStartObj = 
parent.datapath.xpathQuery("start[1]");
+                               //var tStartObj = 
parent.datapath.xpathQuery("start[1]");

                                //attributes: {day: '2', hour: '15', minute: 
'14', month: '11',  
year: '2009'}
-                               if ($debug) Debug.write("tStartObj 
",tStartObj.attributes);
-
-                               dataloader.loadData( 
Number(tStartObj.attributes.month) ,  
Number(tStartObj.attributes.year) );
+                               //if ($debug) Debug.write("tStartObj 
",tStartObj.attributes);
+
+                               //dataloader.loadData( 
Number(tStartObj.attributes.month) ,  
Number(tStartObj.attributes.year) );
+
+                               parent.parent.parent.calgrid.reloadAll();
                         ]]>
                </handler>
            </netRemoteCallHib>
@@ -208,12 +210,15 @@
                        <![CDATA[
                                if ($debug) Debug.write("updateAppointment 
",value);

-                               var tStartObj = 
parent.datapath.xpathQuery("start[1]");
+                               //var tStartObj = 
parent.datapath.xpathQuery("start[1]");

                                //attributes: {day: '2', hour: '15', minute: 
'14', month: '11',  
year: '2009'}
-                               if ($debug) Debug.write("tStartObj 
",tStartObj.attributes);
-
-                               dataloader.loadData( 
Number(tStartObj.attributes.month) ,  
Number(tStartObj.attributes.year) );
+                               //if ($debug) Debug.write("tStartObj 
",tStartObj.attributes);
+
+                               //dataloader.loadData( 
Number(tStartObj.attributes.month) ,  
Number(tStartObj.attributes.year) );
+
+                               parent.parent.parent.calgrid.reloadAll();
+
                         ]]>
                </handler>
            </netRemoteCallHib>
@@ -447,7 +452,7 @@
                        <labelText name="_roomtype" y="44" x="10" labelid="619" 
width="60"/>

                                <resetCombobox name="_roomtype_edit" x="10"
-                                                 width="176" editable="false" 
shownitems="2" y="64">
+                                                 width="176" editable="false" 
shownitems="3" y="64">
                                        <handler name="onvalue" args="v">
                                                parent.parent.parent.roomtype = 
Number(this.getValue());
                                                if ($debug) 
Debug.write("roomtype: ",parent.parent.parent.roomtype);
@@ -553,6 +558,10 @@
                                        for (var eg in this.subviews){
                                                this.subviews[eg].destroy();
                                        }
+
+                                       if (data == null) {
+                                               return;
+                                       }

                                        for (var 
i=0;i<data.childNodes.length;i++){

=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx   
 
Mon Nov  2 12:40:59 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx   
 
Mon Nov  2 14:57:37 2009
@@ -432,6 +432,10 @@
                 loaded for all visible months -->
            <method name="setDates" > <![CDATA[
                this.calcBoundaryDates();
+
+              //Empty Data
+                 localdatacontroller.clearDataPointer();
+

                var k=0;
                var firstDay="";
@@ -478,6 +482,32 @@
                    if ($debug) Debug.write( "request mo " + mo +" yr " +  
yr);
                    dataloader.loadData( mo+1 , yr );
                }
+
+              // point to the new 1st day of the month
+              this.daySelectionMgr.select( firstDay );
+              ]]>
+          </method>
+
+          <method name="reloadAll">
+                 <![CDATA[
+
+                 //Empty Data
+                 localdatacontroller.clearDataPointer();
+
+                 var i = this.startdate.getFullYear() * 100 +
+                      this.startdate.getMonth();
+              var en= this.enddate.getFullYear() * 100 +
+                      this.enddate.getMonth();
+              //now request all the months that are visible onscreen from
+              //the data loader
+              while (  i <= en  ){
+                  var mo = i%100;
+                  var yr = Math.floor( i/100 );
+                  if ( mo < 11 ) i++
+                  else           i += ( 100 - 11 );
+                  if ($debug) Debug.write( "request mo " + mo +" yr " +  
yr);
+                  dataloader.loadData( mo+1 , yr );
+              }

                // point to the new 1st day of the month
                this.daySelectionMgr.select( firstDay );

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to