Revision: 2578
Author: seba.wagner
Date: Tue Nov  3 12:07:22 2009
Log: Fix: Move Calendar Event from one day to another by Drag N Drop
http://code.google.com/p/openmeetings/source/detail?r=2578

Modified:
   
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
   
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx
   
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/daos/AppointmentDaoImpl.java
   
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
   
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/CalendarService.java

=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
         
Tue Nov  3 11:34:57 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/eventselector.lzx
         
Tue Nov  3 12:07:22 2009
@@ -381,15 +381,82 @@
                                
this.endDate2.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);
+
                            if ($debug) Debug.write("startDate2 
",this.startDate2);
                            if ($debug) Debug.write("endDate2 ",this.endDate2);

+                           if (this.startDate.getTime() == 
this.startDate2.getTime() &&  
this.endDate.getTime() == this.endDate2.getTime()) {
+
+                               if ($debug) Debug.write("NO Changes");
+
+                           } else {
+
+                               if ($debug) Debug.write("DO Update  
Changes ",appointementId);
+
+                               if (Number(appointementId) == 0) {
+
+                                       if ($debug) Debug.write("Do not store 
its non saved item  
yet");
+
+                               } else {
+
+                                       if ($debug) Debug.write("Do save and 
update  
item ",appointementId);
+
+                                       //Point URL to actual File
+                                           var urlObject =  
lz.Browser.getBaseURL();
+                                                       //If Port is Null or 
undefinied use port 80
+                                                       if 
(urlObject.port!=null && urlObject.port!=undefined){
+                                                               var port = 
urlObject.port;
+
+                                                               if (port != 80) 
{
+                                                                       
this.updateAppointmentTimeOnly.baseUrl =  
urlObject.protocol+"://"+urlObject.host+":"+port+urlObject.path+urlObject.file;
+                                                               } else {
+                                                                       
this.updateAppointmentTimeOnly.baseUrl =  
urlObject.protocol+"://"+urlObject.host+urlObject.path+urlObject.file;
+                                                               }
+                                                       } else {
+                                                               
this.updateAppointmentTimeOnly.baseUrl =  
urlObject.protocol+"://"+urlObject.host+urlObject.path+urlObject.file;
+                                                       }
+
+                                       
this.updateAppointmentTimeOnly.appointementId =  
Number(appointementId);
+
+                                       this.updateAppointmentTimeOnly.doCall();
+                               }
+
+                           }
+
                    } else {
                        lz.Timer.removeTimer( this.startDragDel );
                    }
              ]]>
          </method>
-
+
+        <!--
+               public Long updateAppointmentTimeOnly(String SID, Long  
appointmentId,
+                                                       Date appointmentstart, 
Date appointmentend, String baseurl)
+                -->
+
+       <netRemoteCallHib name="updateAppointmentTimeOnly"  
funcname="calendarservice.updateAppointmentTimeOnly"
+                                                 remotecontext="$once{ 
canvas.thishib }" >
+                       <attribute name="appointementId" value="0" 
type="number" />
+                       <attribute name="baseUrl" value="" type="string" />
+                       <netparam><method name="getValue">return 
canvas.sessionId;  
</method></netparam>
+                       <netparam><method name="getValue">return  
parent.appointementId;</method></netparam>
+                       <netparam><method name="getValue">return  
parent.parent.startDate2;</method></netparam>
+                       <netparam><method name="getValue">return  
parent.parent.endDate2;</method></netparam>
+                       <netparam><method name="getValue">return  
parent.baseUrl;</method></netparam>
+
+               <handler name="ondata" args="value">
+                       <![CDATA[
+                               if ($debug) 
Debug.write("updateAppointmentTimeOnly ",value);
+
+                               parent.parent.calgrid.reloadAll();
+
+                        ]]>
+               </handler>
+           </netRemoteCallHib>
+
          <method name="updateEventTime" args="d">
              //called by day (d);
              var h = d.calcHourFromY( bar.getAttributeRelative( 'y' , d) );
=======================================
---  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx   
 
Tue Nov  3 11:34:57 2009
+++  
/trunk/singlewebapp/WebContent/openmeetings/modules/lzcalendar/lzCalendar.lzx   
 
Tue Nov  3 12:07:22 2009
@@ -17,29 +17,13 @@

        <dateSelector name="_calendar" y="0" x="2">
                <handler name="ondoubleselect">
-                       //var selectDate = new Date();
-                       //if ($debug) Debug.write("##### dateselect ", 
this.selecteddate);
-                       parent._startDate = this.selecteddate;
-                       
//Date(now.getFullYear(),now.getMonth(),now.getDate()+1,0,0,0);
-                       parent._endDate  = new 
Date(this.selecteddate.getFullYear(),  
this.selecteddate.getMonth(), this.selecteddate.getDate()+1,0,0,0);
-                       //if ($debug) 
Debug.write("startDateValue",parent._startDate);
-                        
parent._tabslider._daytab._dayview._tagesansicht._list._outlist.clearContent();
-
-                       //weekcontroll
-                       if(parent._tabslider._week['selected'] == true){
-                                
//parent._tabslider._week._weekView._monday._tagesansicht._list._outlist.clearContent();
-                               
parent._tabslider._week._weekView.initWeekByDate(this.selecteddate);
-                               
parent._tabslider._week._weekView.getAppointmentByRangeWeek.doCall();
-                       }else if(parent._tabslider._month['selected'] == true){
-                               parent._tabslider._month._monthView.showingdate 
= this.selecteddate;
-                                
//parent._tabslider._month._monthView.initMonthByDate(this.selecteddate);
-                               parent._tabslider._month._monthview.init();
-                                
//parent._tabslider._month._monthView.getAppointmentByRangeMonth.doCall();
-                       }else {
-                               
//parent._tagesansicht._list._innerlist.clearContent();
-                               //parent._termin.setCalendarItem(24);
-                               parent.getAppointmentByRange.doCall();
-                       }
+                       if 
(parent.lzCalendarContent.eventselector.checkSaved()) {
+                                
parent.lzCalendarContent.calgrid.setMonthAndYear(this.selecteddate.getMonth(),this.selecteddate.getFullYear());
+                       } else {
+                               //Check Warning
+                       if ($debug) Debug.warn("Unsaved Item - Show warning");
+                       new lz.labelerrorPopup(canvas,{errorlabelid:794});
+                       }
                </handler>
        </dateSelector>

=======================================
---  
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/daos/AppointmentDaoImpl.java
      
Mon Oct 26 08:27:13 2009
+++  
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/daos/AppointmentDaoImpl.java
      
Tue Nov  3 12:07:22 2009
@@ -312,6 +312,52 @@
                return null;

        }
+
+
+       public Long updateAppointmentByTime(Long appointmentId,
+                       Date appointmentstart, Date appointmentend, Long 
users_id, String  
baseUrl) {
+
+                       log.debug("AppointmentDAOImpl.updateAppointment");
+               try {
+
+
+                       Appointment ap = this.getAppointmentById(appointmentId);
+
+                       ap.setAppointmentStarttime(appointmentstart);
+                       ap.setAppointmentEndtime(appointmentend);
+                       ap.setUpdatetime(new Date());
+
+                       Object idf = HibernateUtil.createSession();
+                       Session session = HibernateUtil.getSession();
+                       Transaction tx = session.beginTransaction();
+
+                       session.update(ap);
+
+                       tx.commit();
+                   HibernateUtil.closeSession(idf);
+
+
+                   List<MeetingMember> meetingsRemoteMembers =  
MeetingMemberDaoImpl.getInstance().getMeetingMemberByAppointmentId(ap.getAppointmentId());
+
+
+                   //Send notification of updated Event
+                   for (MeetingMember memberRemote : meetingsRemoteMembers) {
+
+                       // Notify member of changes
+                       Invitationmanagement.getInstance().updateInvitation(ap, 
 
memberRemote, users_id);
+
+                   }
+
+                   return appointmentId;
+               } catch (HibernateException ex) {
+                       log.error("[updateAppointmentByTime]: ",ex);
+               } catch (Exception ex2) {
+                       log.error("[updateAppointmentByTime]: ",ex2);
+               }
+               return null;
+
+       }
+
         
//----------------------------------------------------------------------------------------------------------

        public Long deleteAppointement(Long appointmentId) {
=======================================
---  
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
  
Mon Oct 26 08:27:13 2009
+++  
/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
  
Tue Nov  3 12:07:22 2009
@@ -351,7 +351,17 @@
                return null;
        }

-
+       public Long updateAppointmentByTime(Long appointmentId,
+                       Date appointmentstart, Date appointmentend, Long 
user_id, String  
baseUrl){
+
+               try {
+                       return  
AppointmentDaoImpl.getInstance().updateAppointmentByTime(appointmentId,
+                                       appointmentstart, appointmentend, 
user_id, baseUrl);
+               } catch (Exception err) {
+                       log.error("[updateAppointment]",err);
+               }
+               return null;
+       }

        /**
         *Updating AppointMent object
=======================================
---  
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/CalendarService.java    
 
Mon Nov  2 12:40:59 2009
+++  
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/CalendarService.java    
 
Tue Nov  3 12:07:22 2009
@@ -18,9 +18,10 @@
  import org.openmeetings.app.hibernate.beans.rooms.Rooms;

  public class CalendarService {
-
-       private static final Logger log =  
Red5LoggerFactory.getLogger(CalendarService.class, "openmeetings");
-
+
+       private static final Logger log = Red5LoggerFactory.getLogger(
+                       CalendarService.class, "openmeetings");
+
        private static CalendarService instance = null;

        public static synchronized CalendarService getInstance() {
@@ -31,163 +32,194 @@
                return instance;
        }

-       public List<Appointment> getAppointmentByRange(String SID, Date  
starttime, Date endtime) {
-               log.debug("getAppointmentByRange : startdate - " + starttime + 
",  
enddate - " + endtime);
+       public List<Appointment> getAppointmentByRange(String SID, Date 
starttime,
+                       Date endtime) {
+               log.debug("getAppointmentByRange : startdate - " + starttime
+                               + ", enddate - " + endtime);
                try {
                        Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
-               Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-               if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level))  
{
-
-                       return  
AppointmentLogic.getInstance().getAppointmentByRange(users_id ,starttime,  
endtime);
-               }
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               return 
AppointmentLogic.getInstance().getAppointmentByRange(
+                                               users_id, starttime, endtime);
+                       }
                } catch (Exception err) {
-                       log.error("[getAppointmentByRange]",err);
+                       log.error("[getAppointmentByRange]", err);
                }
                return null;
        }
-
-
-
-       public Appointment getNextAppointment(String SID){
-
-               try{
-
+
+       public Appointment getNextAppointment(String SID) {
+
+               try {
+
                        Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
-               Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-               if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level))  
{
-
-                       return 
AppointmentLogic.getInstance().getNextAppointment();
-               }
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               return 
AppointmentLogic.getInstance().getNextAppointment();
+                       }
                } catch (Exception err) {
-                       log.error("[getNextAppointmentById]",err);
+                       log.error("[getNextAppointmentById]", err);
                }
                return null;
-
-               }
-
-       public List<Appointment> searchAppointmentByName(String SID, String  
appointmentName){
-
-                       try{
-
-                               Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
-                       Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-                       if  
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
-
-                               return  
AppointmentLogic.getInstance().searchAppointmentByName(appointmentName);
-                       }
-                       } catch (Exception err) {
-                               log.error("[searchAppointmentByName]",err);
-                       }
-                       return null;
-
-                       }
-
-       public Long saveAppointment(String SID, String appointmentName, String  
appointmentLocation,String appointmentDescription,
-                       Date appointmentstart, Date appointmentend,
-                       Boolean isDaily, Boolean isWeekly, Boolean isMonthly, 
Boolean isYearly,  
Long categoryId,
-                       Long remind, Long roomType, String baseUrl){
-
+
+       }
+
+       public List<Appointment> searchAppointmentByName(String SID,
+                       String appointmentName) {
+
+               try {
+
+                       Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               return 
AppointmentLogic.getInstance().searchAppointmentByName(
+                                               appointmentName);
+                       }
+               } catch (Exception err) {
+                       log.error("[searchAppointmentByName]", err);
+               }
+               return null;
+
+       }
+
+       public Long saveAppointment(String SID, String appointmentName,
+                       String appointmentLocation, String 
appointmentDescription,
+                       Date appointmentstart, Date appointmentend, Boolean 
isDaily,
+                       Boolean isWeekly, Boolean isMonthly, Boolean isYearly,
+                       Long categoryId, Long remind, Long roomType, String 
baseUrl) {
+
                log.debug("saveAppointMent SID:" + SID + ", baseUrl : " + 
baseUrl);
-
-               try{
+
+               try {
                        Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
                        log.debug("saveAppointMent users_id:" + users_id);
-               Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-
-               if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level))  
{
-
-                       Long id =  
AppointmentLogic.getInstance().saveAppointment(appointmentName, users_id,  
appointmentLocation,
-                                       appointmentDescription, 
appointmentstart, appointmentend,  
isDaily, isWeekly, isMonthly,
-                                       isYearly, categoryId, remind, roomType, 
baseUrl);
-
-                       return id;
-               }
-               else{
-                       log.error("saveAppointment : wrong user level");
-               }
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               Long id = 
AppointmentLogic.getInstance().saveAppointment(
+                                               appointmentName, users_id, 
appointmentLocation,
+                                               appointmentDescription, 
appointmentstart,
+                                               appointmentend, isDaily, 
isWeekly, isMonthly, isYearly,
+                                               categoryId, remind, roomType, 
baseUrl);
+
+                               return id;
+                       } else {
+                               log.error("saveAppointment : wrong user level");
+                       }
                } catch (Exception err) {
-                       log.error("[saveAppointment]",err);
+                       log.error("[saveAppointment]", err);
                }
                return null;
-
-
-               }
-
-       public Long updateAppointment(String SID,
-                       Long appointmentId ,
-                       String appointmentName,
-                       String appointmentLocation,
-                       String appointmentDescription,
-                       Date appointmentstart,
-                       Date appointmentend,
-                       Boolean isDaily,
-                       Boolean isWeekly,
-                       Boolean isMonthly,
-                       Boolean isYearly,
-                       Long categoryId,
-                       Long remind,
-                       List mmClient,
-                       Long roomType, String baseurl){
-               try{
-
+
+       }
+
+       public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
+                       Date appointmentstart, Date appointmentend, String 
baseurl) {
+               try {
+
                        Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
-               Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-               if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level))  
{
-
-                       log.debug("updateAppointment");
-
-                       System.out.println("appointmentId "+appointmentId);
-
-                       RoomTypes rt =  
Roommanagement.getInstance().getRoomTypesById(roomType);
-
-                       Appointment app =  
AppointmentLogic.getInstance().getAppointMentById(appointmentId);
-
-                       Rooms room = app.getRoom();
-                       if (room != null) {
-
-                               room.setComment(appointmentDescription);
-                               room.setName(appointmentName);
-                               room.setRoomtype(rt);
-
-                               
Roommanagement.getInstance().updateRoomObject(room);
-                       }
-                       System.out.println("mmClient "+mmClient);
-
-                       return  
AppointmentLogic.getInstance().updateAppointment(appointmentId,  
appointmentName,
-                                       appointmentDescription, 
appointmentstart, appointmentend,  
isDaily, isWeekly, isMonthly,
-                                       isYearly, categoryId, remind, mmClient, 
users_id, baseurl);
-               }
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               log.debug("updateAppointment");
+
+                               System.out.println("appointmentId " + 
appointmentId);
+
+                               Appointment app = AppointmentLogic.getInstance()
+                                               
.getAppointMentById(appointmentId);
+
+                               return 
AppointmentLogic.getInstance().updateAppointmentByTime(
+                                               appointmentId,
+                                               appointmentstart, 
appointmentend,
+                                               users_id, baseurl);
+                       }
                } catch (Exception err) {
-                       log.error("[updateAppointment]",err);
+                       log.error("[updateAppointment]", err);
                        err.printStackTrace();
                }
                return null;
-
-
-               }
-
-       public Long deleteAppointment(String SID,Long appointmentId){
-
+
+       }
+
+       public Long updateAppointment(String SID, Long appointmentId,
+                       String appointmentName, String appointmentLocation,
+                       String appointmentDescription, Date appointmentstart,
+                       Date appointmentend, Boolean isDaily, Boolean isWeekly,
+                       Boolean isMonthly, Boolean isYearly, Long categoryId, 
Long remind,
+                       List mmClient, Long roomType, String baseurl) {
+               try {
+
+                       Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               log.debug("updateAppointment");
+
+                               RoomTypes rt = 
Roommanagement.getInstance().getRoomTypesById(
+                                               roomType);
+
+                               Appointment app = AppointmentLogic.getInstance()
+                                               
.getAppointMentById(appointmentId);
+
+                               Rooms room = app.getRoom();
+                               if (room != null) {
+
+                                       room.setComment(appointmentDescription);
+                                       room.setName(appointmentName);
+                                       room.setRoomtype(rt);
+
+                                       
Roommanagement.getInstance().updateRoomObject(room);
+                               }
+
+                               return 
AppointmentLogic.getInstance().updateAppointment(
+                                               appointmentId, appointmentName, 
appointmentDescription,
+                                               appointmentstart, 
appointmentend, isDaily, isWeekly,
+                                               isMonthly, isYearly, 
categoryId, remind, mmClient,
+                                               users_id, baseurl);
+                       }
+               } catch (Exception err) {
+                       log.error("[updateAppointment]", err);
+                       err.printStackTrace();
+               }
+               return null;
+
+       }
+
+       public Long deleteAppointment(String SID, Long appointmentId) {
+
                log.debug("deleteAppointment : " + appointmentId);
-
-               try{
-
+
+               try {
+
                        Long users_id = 
Sessionmanagement.getInstance().checkSession(SID);
-               Long user_level =  
Usermanagement.getInstance().getUserLevelByID(users_id);
-               if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level))  
{
-
-                       Appointment app =  
AppointmentLogic.getInstance().getAppointMentById(appointmentId);
-                       Roommanagement.getInstance().deleteRoom(app.getRoom());
-
-                       return  
AppointmentLogic.getInstance().deleteAppointment(appointmentId, users_id);
-               }
-
+                       Long user_level = 
Usermanagement.getInstance().getUserLevelByID(
+                                       users_id);
+                       if 
(AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
+
+                               Appointment app = AppointmentLogic.getInstance()
+                                               
.getAppointMentById(appointmentId);
+                               
Roommanagement.getInstance().deleteRoom(app.getRoom());
+
+                               return 
AppointmentLogic.getInstance().deleteAppointment(
+                                               appointmentId, users_id);
+                       }
+
                } catch (Exception err) {
-                       log.error("[deleteAppointment]",err);
+                       log.error("[deleteAppointment]", err);
                }
                return null;
-
-
-               }
-
-}
+
+       }
+
+}

--~--~---------~--~----~------------~-------~--~----~
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