Author: sebawagner
Date: Thu Mar 15 16:49:54 2012
New Revision: 1301081

URL: http://svn.apache.org/viewvc?rev=1301081&view=rev
Log:
OPENMEETINGS-7 save operation for new events

Modified:
    incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/functions.lzx
    incubator/openmeetings/trunk/singlewebapp/WebContent/src/main.lzx
    incubator/openmeetings/trunk/singlewebapp/WebContent/src/maindebug.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
    
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
    
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebService.java
    
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebServiceFacade.java

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/functions.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/functions.lzx?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/functions.lzx 
(original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/functions.lzx 
Thu Mar 15 16:49:54 2012
@@ -402,6 +402,29 @@ function parseDateTimeFromXmlString(str)
        return new Date(tYear,Number(tMonth)-1,tDay,tHour,tMin,0);
 }
 
+/**
+ * Correct REST format for java.util.Calendar is: yyyy-mm-ddTHH:MM:SS
+ *
+ *
+ */
+function parseDateToRestDateCalendar(dateObj){
+    if($debug) Debug.write("FUNC/parseDateToStringTime 1",dateObj);
+    if (dateObj==null) return "";
+    var d = dateObj.getDate();
+    if (d<10) d = "0"+d;
+    var mo = dateObj.getMonth()+1;
+    if (mo<10) mo = "0"+mo;
+    var y = dateObj.getFullYear();
+    var h = dateObj.getHours();
+    if (h<10) h = "0"+h;    
+    var m = dateObj.getMinutes();
+    if (m<10) m = "0"+m; 
+    var s = dateObj.getSeconds();
+    if (s<10) s = "0"+s; 
+    if($debug) Debug.write("FUNC/parseDateToStringTime 
2",""+y+"-"+mo+"-"+d+"T"+h+":"+m+":"+s);
+    return ""+y+"-"+mo+"-"+d+"T"+h+":"+m+":"+s;
+}
+
 ]]>
 </script>
                

Modified: incubator/openmeetings/trunk/singlewebapp/WebContent/src/main.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/main.lzx?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/src/main.lzx (original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/src/main.lzx Thu Mar 
15 16:49:54 2012
@@ -170,7 +170,7 @@
 <!-- View for "Loading" -->
 <view name="_loadingAll" visible="false" opacity="0.7" 
     width="${ canvas.width }" height="${ canvas.height }" 
-    bgcolor="0xFFFFFF" clickable="true" >
+    bgcolor="0xFFFFFF" clickable="true" showhandcursor="false">
     <method name="hideContentOnly">
         this.setAttribute("visibility","visible");
         this._text.setAttribute("visibility","hidden");

Modified: incubator/openmeetings/trunk/singlewebapp/WebContent/src/maindebug.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/maindebug.lzx?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/src/maindebug.lzx 
(original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/src/maindebug.lzx Thu 
Mar 15 16:49:54 2012
@@ -171,7 +171,7 @@
 <!-- View for "Loading" -->
 <view name="_loadingAll" visible="false" opacity="0.7" 
     width="${ canvas.width }" height="${ canvas.height }" 
-    bgcolor="0xFFFFFF" clickable="true" >
+    bgcolor="0xFFFFFF" clickable="true" showhandcursor="false">
     <method name="hideContentOnly">
         this.setAttribute("visibility","visible");
         this._text.setAttribute("visibility","hidden");

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
 Thu Mar 15 16:49:54 2012
@@ -20,38 +20,142 @@
 -->
 <library>
 
-       <class name="lzEditCalendarEvent" extends="labelExplorerBox" 
labelid="815" allowDragging="false" 
-                   x="$once{ parent.width/2 - 300 }" y="100" docking="true" 
resizeable="false" 
-                   closable="true" width="600" height="480">
+       <class name="lzEditCalendarEvent" extends="labelExplorerBox" 
labelid="815" allowDragging="true" 
+                   x="$once{ parent.width/2 - 300 }" y="100" docking="false" 
resizeable="false" 
+                   closable="true" width="600" height="500">
                    
                <attribute name="reminderTypeId" value="0" type="number" />
                
                <attribute name="dataElement" value="null" />
                
+               <attribute name="baseUrl" value="" type="string" />
+               
                <dataset name="eventDS" />
                    
                <handler name="oninit">
-                       canvas._loadingAll.hideContentOnly();
-                       var downloadurl = canvas.protocol + 
'://'+canvas.rtmphostlocal+':'+canvas.red5httpport
-                               
+canvas.httpRootKey+'services/CalendarService/getAppointmentReminderTypList?'
-                               +'SID='+canvas.sessionId;
-               
-            this.getAppointmentReminderTypList.setAttribute("src",downloadurl);
-            this.getAppointmentReminderTypList.doRequest();
-            
-            if ($debug) Debug.write("this.dataElement ",this.dataElement);
-            
-            this.eventDS.setData(this.dataElement.childNodes);
-            
-            if ($debug) Debug.write("this.eventDS ",this.eventDS);
-            
-            lz.Focus.setFocus(this._title, false);
+                       <![CDATA[
+                               canvas._loadingAll.hideContentOnly();
+                               
+                               //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.baseUrl = 
urlObject.protocol+"://"+urlObject.host+":"+port+urlObject.path;
+                                       } else {
+                                               this.baseUrl = 
urlObject.protocol+"://"+urlObject.host+urlObject.path;
+                                       }
+                               } else {
+                                       this.baseUrl = 
urlObject.protocol+"://"+urlObject.host+urlObject.path;
+                               }
+                                               
+                               if ($debug) Debug.write("urlObject ",urlObject);
+                   if ($debug) Debug.write("this.baseUrl ",this.baseUrl);
+                       
+                               var downloadurl = canvas.protocol + 
'://'+canvas.rtmphostlocal+':'+canvas.red5httpport
+                                      
+canvas.httpRootKey+'services/CalendarService/getAppointmentReminderTypList?'
+                                      +'SID='+canvas.sessionId;
+                      
+                   
this.getAppointmentReminderTypList.setAttribute("src",downloadurl);
+                   this.getAppointmentReminderTypList.doRequest();
+                   
+                   if ($debug) Debug.write("this.dataElement 
",this.dataElement);
+                   
+                   this.eventDS.setData(this.dataElement.childNodes);
+                   
+                   if ($debug) Debug.write("this.eventDS ",this.eventDS);
+                   
+                   lz.Focus.setFocus(this._title, false);
+            ]]>
                </handler>
                
                <handler name="onclose">
                        canvas._loadingAll.hideLoading();
                </handler>
                
+               <method name="saveAndClose">
+                       <![CDATA[
+                               var tMemberArgs = 
this._participentList.getMemberArrayValue();
+                               
+                               var tAppointmentStartDate = 
this._dateStart.getDate();
+                               if ($debug) Debug.write("tAppointmentStartDate 
",tAppointmentStartDate);
+                               var tTimeStart = this._timeStart.getText();
+                               var hours = Number(tTimeStart.substr(0,2));
+                               var mins = Number(tTimeStart.substr(4,2));
+                               if ($debug) 
Debug.write("hours:mins",hours,mins,tTimeStart.substr(4,2));
+                               tAppointmentStartDate.setHours(hours);
+                               tAppointmentStartDate.setMinutes(mins);
+                               
+                               var tAppointmentEndDate = 
this._dateEnd.getDate();
+                               var tTimeEnd = this._timeEnd.getText();
+                               var hours = Number(tTimeEnd.substr(0,2));
+                               var mins = Number(tTimeEnd.substr(4,2));
+                               tAppointmentEndDate.setHours(hours);
+                               tAppointmentEndDate.setMinutes(mins);
+                               
+                               var updateurl = canvas.protocol + 
'://'+canvas.rtmphostlocal+':'+canvas.red5httpport
+                               
+canvas.httpRootKey+'services/CalendarService/saveAppointment';
+                var queryString = 'SID='+canvas.sessionId
+                               
+'&appointmentName='+encodeURIComponent(this._title.getText())
+                               
+'&appointmentLocation='+encodeURIComponent(this._location.getText())
+                               
+'&appointmentDescription='+encodeURIComponent(this._descr.getText())
+                               
+'&appointmentstart='+parseDateToRestDateCalendar(tAppointmentStartDate)
+                               
+'&appointmentend='+parseDateToRestDateCalendar(tAppointmentEndDate)
+                               +'&isDaily='+false
+                               +'&isYearly='+false
+                               +'&categoryId='+1
+                               +'&remind='+this._reminderType.getValue()
+                               ;
+                               
+                for (var i=0;i<tMemberArgs.length;i++) {
+                       
+                       var tObject = tMemberArgs[i];
+                       queryString += '&mmClient=' + 
+                                                               
encodeURIComponent(
+                                                                       
tObject.meetingMemberId + ','
+                                                                       + 
tObject.firstname + ','
+                                                                       + 
tObject.lastname + ','
+                                                                       + 
tObject.email + ','
+                                                                       + 
tObject.userId + ','
+                                                                       + 
tObject.jNameTimeZone
+                                                               );
+                       
+                }
+                
+                queryString += +'&roomType='+this._roomType.getValue()
+                             +'&baseUrl='+this.baseUrl
+                             +'&languageId='+hib.userlang
+                
+                if ($debug) Debug.write(updateurl);
+                if ($debug) Debug.write(queryString);
+                               
+                               
this.saveNewAppointment.setAttribute("src",updateurl);
+                               
this.saveNewAppointment.setAttribute("querystring",queryString);
+                               this.saveNewAppointment.doRequest();
+                       ]]>
+               </method>
+               
+               <!-- 
+               String SID, String appointmentName,
+                       String appointmentLocation, String 
appointmentDescription,
+                       Date appointmentstart, Date appointmentend, Boolean 
isDaily,
+                       Boolean isWeekly, Boolean isMonthly, Boolean isYearly,
+                       Long categoryId, Long remind,
+                       String[] mmClient, Long roomType,
+                       String baseUrl, Long languageId
+                -->
+               <dataset name="saveNewAppointment" type="http" querytype="POST">
+                       <handler name="ondata" args="d">
+                               if ($debug) Debug.write("saveNewAppointment 
",d);
+                               var tPointer = new lz.datapointer();
+                               tPointer.setPointer(d);
+                               var returnValue = 
tPointer.xpathQuery('saveAppointmentResponse/return/text()');
+                               if ($debug) Debug.write("returnValue 
"+returnValue);
+                       </handler>
+               </dataset>
+               
                <dataset name="getAppointmentReminderTypList" type="http" />
                
                <labelText name="_titleLabel" x="4" y="24" labelid="572" 
fontstyle="bold" /> 
@@ -191,7 +295,31 @@
                                                        
width:this._content.width-10
                                                });
                ]]>
-            </method>    
+            </method>  
+            
+            <method name="getMemberArrayValue">
+               <![CDATA[
+                       var tArray = new Array();
+                       
+                       for (var 
i=0;i<this._content._inner.subviews.length;i++) {
+                       
+                               var tViewObj = this._content._inner.subviews[i];
+                               
+                               var tObject = new Object();
+                               tObject.meetingMemberId = tViewObj.memberId;
+                                       tObject.firstname = tViewObj.firstName;
+                                       tObject.lastname = tViewObj.lastName;
+                                       tObject.email = tViewObj.email;
+                                       tObject.userId = tViewObj.userId;
+                                       tObject.jNameTimeZone = 
tViewObj.jNameTimeZone;
+                                       
+                                       tArray.push(tObject);
+                       }
+                       
+                       return tArray;
+               ]]>
+            </method>
+              
                <view name="_content" bgcolor="0xFFFFFF" x="1" y="1" clip="true"
                                width="$once{ parent.width-1 }" height="$once{ 
parent.height-1 }">
                        <view name="_inner">
@@ -200,21 +328,25 @@
                        <om_vscrollbar />
                </view>
         </view>
+        
+        <!-- Location -->
+        <labelText name="_locationLabel" x="4" y="304" labelid="569" 
fontstyle="bold" /> 
+        
+        <customEdittext name="_location" width="$once{ parent.width-110 }" 
x="100" y="304" />
                
-               <!-- Kommentar -->
-               <labelText name="_descrLabel" x="4" y="304" labelid="573" 
fontstyle="bold" /> 
+               <!-- Comment -->
+               <labelText name="_descrLabel" x="4" y="330" labelid="573" 
fontstyle="bold" /> 
        
-               <customScrollEdittext name="_descr" y="304" x="100" 
width="$once{ parent.width-110 }" 
+               <customScrollEdittext name="_descr" y="330" x="100" 
width="$once{ parent.width-110 }" 
                        height="124" text="" /> 
                        
                <simpleLabelButton labelid="813" width="100" x="$once{ 
parent.width-315 }" 
-                  y="$once{ parent.height-24 }" 
-                  onclick="this.parent.closeAndSave();">
+                  y="$once{ parent.height-24 }" >
                <handler name="onclick">
-                       if (canvas.contactUser != 0) {
-                    new lz.labelerrorPopup(canvas,{errorlabelid:1278});
-                    return;
-                }
+                    //new lz.labelerrorPopup(canvas,{errorlabelid:1278});
+                    //return;
+                    
+                parent.saveAndClose();
                </handler>
         </simpleLabelButton>
                

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
 Thu Mar 15 16:49:54 2012
@@ -116,8 +116,9 @@
                        newAppointment.comment = "";
                        newAppointment.reminderId = 3;
                        newAppointment.roomsId = 0;
+                       newAppointment.location = "";
                        newAppointment.meetingMember = new Array();
-                       newAppointment.isPasswordProtected = true;
+                       newAppointment.isPasswordProtected = false;
                        
                        var dataElement = 
LzDataElement.valueToElement(newAppointment);
                        
@@ -135,7 +136,7 @@
        <!-- 176 pixels is the width of the mini calendar -->
        <simpleLabelButton labelid="1444" height="24" width="176" x="12" y="10" 
>
         <handler name="onclick">
-            parent.currentDate = null;
+            parent.newCalendarEvent();
         </handler>
     </simpleLabelButton>
        

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
 Thu Mar 15 16:49:54 2012
@@ -21,6 +21,7 @@ package org.openmeetings.app.data.calend
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TimeZone;
 
 import org.openmeetings.app.data.basic.Configurationmanagement;
@@ -234,6 +235,12 @@ public class AppointmentLogic {
 
                                        log.debug("clientMember.get('userId') "
                                                        + 
clientMember.get("userId"));
+                                       
+                                       for (Object tString : 
clientMember.entrySet()) {
+                                               log.debug("tString " + tString);
+                                       }
+                                       
log.debug("clientMember.get('meetingMemberId') "
+                                                       + 
clientMember.get("meetingMemberId"));
 
                                        // We need two different timeZones, the 
internal Java Object
                                        // TimeZone, and
@@ -284,7 +291,8 @@ public class AppointmentLogic {
                                                        
clientMember.get("email").toString(), baseUrl,
                                                        userId, // 
meeting_organizer
                                                        new Boolean(false), // 
invitor
-                                                       language_id, false, // 
isPasswordProtected
+                                                       language_id, 
//language_id
+                                                       false, // 
isPasswordProtected
                                                        "", // password
                                                        timezoneMember, 
omTimeZone, invitorName);
 

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebService.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebService.java?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebService.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebService.java
 Thu Mar 15 16:49:54 2012
@@ -21,7 +21,9 @@ package org.openmeetings.axis.services;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.basic.AuthLevelmanagement;
@@ -50,13 +52,13 @@ import org.springframework.beans.factory
  * 
  * @author sebawagner
  * @webservice CalendarService
- *
+ * 
  */
 public class CalendarWebService {
 
        private static final Logger log = Red5LoggerFactory.getLogger(
                        CalendarWebService.class, 
OpenmeetingsVariables.webAppRootKey);
-       
+
        @Autowired
        private AppointmentDaoImpl appointmentDao;
        @Autowired
@@ -77,9 +79,12 @@ public class CalendarWebService {
        /**
         * Load appointments by a start / end range for the current SID
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
-        * @param starttime start time, yyyy-mm-dd
-        * @param endtime end time, yyyy-mm-dd
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
+        * @param starttime
+        *            start time, yyyy-mm-dd
+        * @param endtime
+        *            end time, yyyy-mm-dd
         * @return
         */
        public List<Appointment> getAppointmentByRange(String SID, Date 
starttime,
@@ -99,18 +104,22 @@ public class CalendarWebService {
                }
                return null;
        }
-       
+
        /**
         * Load appointments by a start / end range for the userId
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
-        * @param userId the userId the calendar events should be loaded
-        * @param starttime start time, yyyy-mm-dd
-        * @param endtime end time, yyyy-mm-dd
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
+        * @param userId
+        *            the userId the calendar events should be loaded
+        * @param starttime
+        *            start time, yyyy-mm-dd
+        * @param endtime
+        *            end time, yyyy-mm-dd
         * @return
         */
-       public List<Appointment> getAppointmentByRangeForUserId(String SID, 
long userId, Date starttime,
-                       Date endtime) {
+       public List<Appointment> getAppointmentByRangeForUserId(String SID,
+                       long userId, Date starttime, Date endtime) {
                log.debug("getAppointmentByRange : startdate - " + starttime
                                + ", enddate - " + endtime);
                try {
@@ -130,7 +139,8 @@ public class CalendarWebService {
        /**
         * Get the next Calendar event for the current user of the SID
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
         * @return
         */
        public Appointment getNextAppointment(String SID) {
@@ -149,11 +159,12 @@ public class CalendarWebService {
                return null;
 
        }
-       
+
        /**
         * Get the next Calendar event for userId
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
         * @return
         */
        public Appointment getNextAppointmentForUserId(String SID, long userId) 
{
@@ -176,8 +187,10 @@ public class CalendarWebService {
        /**
         * Search a calendar event for the current SID
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
-        * @param appointmentName the search string
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
+        * @param appointmentName
+        *            the search string
         * @return
         */
        public List<Appointment> searchAppointmentByName(String SID,
@@ -202,30 +215,56 @@ public class CalendarWebService {
        /**
         * Save an appointment
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
-        * @param appointmentName name of the calendar event
-        * @param appointmentLocation location info text of the calendar event
-        * @param appointmentDescription description test of the calendar event
-        * @param appointmentstart start as Date yyyy-mm-dd
-        * @param appointmentend end as Date yyyy-mm-dd
-        * @param isDaily if the calendar event should be repeated daily (not 
implemented)
-        * @param isWeekly if the calendar event should be repeated weekly (not 
implemented)
-        * @param isMonthly if the calendar event should be repeated monthly 
(not implemented)
-        * @param isYearly if the calendar event should be repeated yearly (not 
implemented)
-        * @param categoryId the category id of the calendar event
-        * @param remind the reminder type of the calendar event
-        * @param mmClient List of clients
-        * @param roomType the room type for the calendar event
-        * @param baseUrl the base URL for the invitations
-        * @param language_id the language id of the calendar event
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
+        * @param appointmentName
+        *            name of the calendar event
+        * @param appointmentLocation
+        *            location info text of the calendar event
+        * @param appointmentDescription
+        *            description test of the calendar event
+        * @param appointmentstart
+        *            start as Date yyyy-mm-ddThh:mm:ss
+        * @param appointmentend
+        *            end as Date yyyy-mm-ddThh:mm:ss
+        * @param isDaily
+        *            if the calendar event should be repeated daily (not
+        *            implemented)
+        * @param isWeekly
+        *            if the calendar event should be repeated weekly (not
+        *            implemented)
+        * @param isMonthly
+        *            if the calendar event should be repeated monthly (not
+        *            implemented)
+        * @param isYearly
+        *            if the calendar event should be repeated yearly (not
+        *            implemented)
+        * @param categoryId
+        *            the category id of the calendar event
+        * @param remind
+        *            the reminder type of the calendar event
+        * @param mmClient
+        *            List of clients, comma separated string, <br/>
+        *            sample: 
1,firstname,lastname,[email protected],1,Etc/GMT+1
+        *            to add multiple clients you can use the same GET 
parameter in
+        *            the URL multiple times, for example:
+        *            &mmClient=1,firstname,lastname,hans
+        *            [email protected],1,Etc/GMT+1&mmClient
+        *            =2,firstname,lastname,[email protected],1,Etc/GMT+1
+        * @param roomType
+        *            the room type for the calendar event
+        * @param baseUrl
+        *            the base URL for the invitations
+        * @param languageId
+        *            the language id of the calendar event
         * @return
         */
        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, 
@SuppressWarnings("rawtypes") List mmClient, Long roomType,
-                       String baseUrl, Long language_id) {
+                       Calendar appointmentstart, Calendar appointmentend,
+                       Boolean isDaily, Boolean isWeekly, Boolean isMonthly,
+                       Boolean isYearly, Long categoryId, Long remind, 
String[] mmClient,
+                       Long roomType, String baseUrl, Long languageId) {
 
                log.debug("saveAppointMent SID:" + SID + ", baseUrl : " + 
baseUrl);
 
@@ -236,14 +275,28 @@ public class CalendarWebService {
                        Long user_level = 
userManagement.getUserLevelByID(users_id);
 
                        if (authLevelManagement.checkUserLevel(user_level)) {
-                               
-                               //FIXME: Check if the event is also the event 
of the current SID
+
+                               List<Map<String, String>> newList = new 
ArrayList<Map<String, String>>();
+
+                               for (String singleClient : mmClient) {
+                                       String[] params = 
singleClient.split(",");
+                                       Map<String, String> map = new 
HashMap<String, String>();
+                                       map.put("meetingMemberId", params[0]);
+                                       map.put("firstname", params[1]);
+                                       map.put("lastname", params[2]);
+                                       map.put("email", params[3]);
+                                       map.put("userId", params[4]);
+                                       map.put("jNameTimeZone", params[5]);
+                                       newList.add(map);
+                               }
+
+                               // FIXME: Check if the event is also the event 
of the current
 
                                Long id = 
appointmentLogic.saveAppointment(appointmentName,
                                                users_id, appointmentLocation, 
appointmentDescription,
-                                               appointmentstart, 
appointmentend, isDaily, isWeekly,
-                                               isMonthly, isYearly, 
categoryId, remind, mmClient,
-                                               roomType, baseUrl, language_id);
+                                               appointmentstart.getTime(), 
appointmentend.getTime(),
+                                               isDaily, isWeekly, isMonthly, 
isYearly, categoryId,
+                                               remind, newList, roomType, 
baseUrl, languageId);
 
                                return id;
                        } else {
@@ -259,17 +312,23 @@ public class CalendarWebService {
        /**
         * Update an calendar event time only
         * 
-        * @param SID The SID of the User. This SID must be marked as Loggedin
-        * @param appointmentId the calendar event that should be updated
-        * @param appointmentstart start yyyy-mm-dd
-        * @param appointmentend end yyyy-mm-dd
-        * @param baseurl the base URL for the invitations that will be send by 
email
-        * @param language_id the language id
+        * @param SID
+        *            The SID of the User. This SID must be marked as Loggedin
+        * @param appointmentId
+        *            the calendar event that should be updated
+        * @param appointmentstart
+        *            start yyyy-mm-dd
+        * @param appointmentend
+        *            end yyyy-mm-dd
+        * @param baseurl
+        *            the base URL for the invitations that will be send by 
email
+        * @param languageId
+        *            the language id
         * @return
         */
        public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
                        Date appointmentstart, Date appointmentend, String 
baseurl,
-                       Long language_id) {
+                       Long languageId) {
                try {
 
                        Long users_id = sessionManagement.checkSession(SID);
@@ -277,18 +336,18 @@ public class CalendarWebService {
                        if (authLevelManagement.checkUserLevel(user_level)) {
 
                                log.debug("updateAppointment");
-                               //FIXME: Check if the event is also the event 
of the current SID
+                               // FIXME: Check if the event is also the event 
of the current
+                               // SID
 
                                log.debug("appointmentId " + appointmentId);
 
-                               appointmentLogic
-                                               
.getAppointMentById(appointmentId);
+                               
appointmentLogic.getAppointMentById(appointmentId);
 
                                Users user = 
userManagement.getUserById(users_id);
 
                                return 
appointmentLogic.updateAppointmentByTime(appointmentId,
                                                appointmentstart, 
appointmentend, users_id, baseurl,
-                                               language_id, 
user.getOmTimeZone().getIcal());
+                                               languageId, 
user.getOmTimeZone().getIcal());
                        }
                } catch (Exception err) {
                        log.error("[updateAppointment]", err);
@@ -318,7 +377,7 @@ public class CalendarWebService {
         * @param mmClient
         * @param roomType
         * @param baseurl
-        * @param language_id
+        * @param languageId
         * @return
         */
        public Long updateAppointment(String SID, Long appointmentId,
@@ -326,7 +385,7 @@ public class CalendarWebService {
                        String appointmentDescription, Date appointmentstart,
                        Date appointmentend, Boolean isDaily, Boolean isWeekly,
                        Boolean isMonthly, Boolean isYearly, Long categoryId, 
Long remind,
-                       List<?> mmClient, Long roomType, String baseurl, Long 
language_id) {
+                       List<?> mmClient, Long roomType, String baseurl, Long 
languageId) {
                try {
 
                        Long users_id = sessionManagement.checkSession(SID);
@@ -356,7 +415,7 @@ public class CalendarWebService {
                                                appointmentName, 
appointmentDescription,
                                                appointmentstart, 
appointmentend, isDaily, isWeekly,
                                                isMonthly, isYearly, 
categoryId, remind, mmClient,
-                                               users_id, baseurl, language_id, 
false, "", user
+                                               users_id, baseurl, languageId, 
false, "", user
                                                                
.getOmTimeZone().getIcal());
                        }
                } catch (Exception err) {
@@ -432,7 +491,7 @@ public class CalendarWebService {
                }
                return null;
        }
-       
+
        /**
         * Get all categories of calendar events
         * 
@@ -472,7 +531,7 @@ public class CalendarWebService {
                return null;
 
        }
-       
+
        /**
         * Get all reminder types for calendar events
         * 
@@ -507,72 +566,78 @@ public class CalendarWebService {
                }
                return null;
        }
-       
+
        public static void main(String... args) {
-               
-               Calendar cal =Calendar.getInstance();
+
+               Calendar cal = Calendar.getInstance();
                cal.set(Calendar.MONTH, 1);
-               
-               new CalendarWebService().getAppointmentsByWeekCalendar(1, 
cal.getTime());
-               
-       }
-       
-       public List<Week> getAppointmentsByWeekCalendar(int firstDayInWeek, 
Date startDate) {
-               
+
+               new CalendarWebService()
+                               .getAppointmentsByWeekCalendar(1, 
cal.getTime());
+
+       }
+
+       public List<Week> getAppointmentsByWeekCalendar(int firstDayInWeek,
+                       Date startDate) {
+
                // Calculate the first day of a calendar based on the first 
showing day
                // of the week
                List<Week> weeks = new ArrayList<Week>(6);
                Calendar currentDate = Calendar.getInstance();
                currentDate.setTime(startDate);
                currentDate.set(Calendar.DATE, 1);
-               
+
                int currentWeekDay = currentDate.get(Calendar.DAY_OF_WEEK);
-               
+
                Calendar startWeekDay = Calendar.getInstance();
-               startWeekDay.setTimeInMillis((currentDate.getTimeInMillis() - 
((currentWeekDay-1) * 86400000)));
-               
-               log.debug("startWeekDay 1" +startWeekDay.getTime());
-               
+               startWeekDay
+                               .setTimeInMillis((currentDate.getTimeInMillis() 
- ((currentWeekDay - 1) * 86400000)));
+
+               log.debug("startWeekDay 1" + startWeekDay.getTime());
+
                if (currentWeekDay == 1) {
-                       
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis() - ((7 - 
firstDayInWeek) * 86400000));
+                       
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis()
+                                       - ((7 - firstDayInWeek) * 86400000));
                } else {
-                       
+
                        if (currentWeekDay > firstDayInWeek) {
-                               
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis() + (firstDayInWeek * 
86400000));
+                               
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis()
+                                               + (firstDayInWeek * 86400000));
                        } else {
-                               
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis() - (firstDayInWeek * 
86400000));
+                               
startWeekDay.setTimeInMillis(startWeekDay.getTimeInMillis()
+                                               - (firstDayInWeek * 86400000));
                        }
-                       
+
                }
-               
+
                Calendar calStart = Calendar.getInstance();
                calStart.setTime(startWeekDay.getTime());
-               
+
                Calendar calEnd = Calendar.getInstance();
                // every month page in our calendar shows 42 days
                calEnd.setTime(new Date(startWeekDay.getTime().getTime()
                                + (42L * 86400000L)));
-                                                                               
-               
-               List<Appointment> appointments = 
appointmentDao.getAppointmentsByRange(1L, calStart.getTime(), calEnd.getTime());
-               
-               log.debug("startWeekDay 2"+startWeekDay.getTime());
-               log.debug("startWeekDay Number of appointments 
"+appointments.size());
-               
+
+               List<Appointment> appointments = 
appointmentDao.getAppointmentsByRange(
+                               1L, calStart.getTime(), calEnd.getTime());
+
+               log.debug("startWeekDay 2" + startWeekDay.getTime());
+               log.debug("startWeekDay Number of appointments " + 
appointments.size());
+
                long z = 0;
-               
+
                for (int k = 0; k < 6; k++) { // 6 weeks per monthly summary
-                       
+
                        Week week = new Week();
-                       
+
                        for (int i = 0; i < 7; i++) { // 7 days a week
-                               
+
                                Calendar tCal = Calendar.getInstance();
                                
tCal.setTimeInMillis(startWeekDay.getTimeInMillis()
                                                + (z * 86400000L));
-                               
+
                                Day day = new Day(tCal.getTime());
-                               
+
                                for (Appointment appointment : appointments) {
                                        if 
(appointment.appointmentStartAsCalendar().get(
                                                        Calendar.MONTH) == 
tCal.get(Calendar.MONTH)
@@ -582,15 +647,14 @@ public class CalendarWebService {
                                                                new 
AppointmentDTO(appointment));
                                        }
                                }
-                               
-                               
+
                                week.getDays().add(day);
                                z++;
                        }
-                       
+
                        weeks.add(week);
                }
-               
+
                return weeks;
        }
 

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebServiceFacade.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebServiceFacade.java?rev=1301081&r1=1301080&r2=1301081&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebServiceFacade.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/calendarservice/org/openmeetings/axis/services/CalendarWebServiceFacade.java
 Thu Mar 15 16:49:54 2012
@@ -18,6 +18,7 @@
  */
 package org.openmeetings.axis.services;
 
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -88,23 +89,23 @@ public class CalendarWebServiceFacade {
 
        public Long saveAppointment(String SID, String appointmentName,
                        String appointmentLocation, String 
appointmentDescription,
-                       Date appointmentstart, Date appointmentend, Boolean 
isDaily,
+                       Calendar appointmentstart, Calendar appointmentend, 
Boolean isDaily,
                        Boolean isWeekly, Boolean isMonthly, Boolean isYearly,
                        Long categoryId, Long remind,
-                       Long roomType,
-                       String baseUrl, Long language_id) throws AxisFault {
+                       String[] mmClient, Long roomType,
+                       String baseUrl, Long languageId) throws AxisFault {
                return getCalendarServiceProxy().saveAppointment(SID, 
appointmentName,
                                appointmentLocation, appointmentDescription, 
appointmentstart,
                                appointmentend, isDaily, isWeekly, isMonthly, 
isYearly,
-                               categoryId, remind, null, roomType, baseUrl, 
language_id);
+                               categoryId, remind, mmClient, roomType, 
baseUrl, languageId);
        }
 
        public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
                        Date appointmentstart, Date appointmentend, String 
baseurl,
-                       Long language_id) throws AxisFault {
+                       Long languageId) throws AxisFault {
                return getCalendarServiceProxy().updateAppointmentTimeOnly(SID,
                                appointmentId, appointmentstart, 
appointmentend, baseurl,
-                               language_id);
+                               languageId);
        }
 
        public Long updateAppointment(String SID, Long appointmentId,
@@ -112,13 +113,13 @@ public class CalendarWebServiceFacade {
                        String appointmentDescription, Date appointmentstart,
                        Date appointmentend, Boolean isDaily, Boolean isWeekly,
                        Boolean isMonthly, Boolean isYearly, Long categoryId, 
Long remind,
-                       Long roomType, String baseurl, Long language_id)
+                       Long roomType, String baseurl, Long languageId)
                        throws AxisFault {
                return getCalendarServiceProxy().updateAppointment(SID, 
appointmentId,
                                appointmentName, appointmentLocation, 
appointmentDescription,
                                appointmentstart, appointmentend, isDaily, 
isWeekly, isMonthly,
                                isYearly, categoryId, remind, null, roomType, 
baseurl,
-                               language_id);
+                               languageId);
        }
 
        public Long deleteAppointment(String SID, Long appointmentId,


Reply via email to