Author: sebawagner
Date: Sun Mar 25 11:19:04 2012
New Revision: 1305005
URL: http://svn.apache.org/viewvc?rev=1305005&view=rev
Log:
IN PROGRESS - issue OPENMEETINGS-7: Replace lzCalendar with non CPL
implementation
https://issues.apache.org/jira/browse/OPENMEETINGS-7 - Fixes: Loading and view
of user contacts and their events in the calendar UI, include standard buttons
and actions for contects, add check to not allow access to not-authorizedd
contacts
Added:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/arrow_undo.png
(with props)
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/calendar.png
(with props)
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/languages/deutsch.xml
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/layouts/dragEvent.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/library.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/userContactsCalendar.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/settings/privatemessages/newPrivateMessage.lzx
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/user/dao/UserContactsDaoImpl.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/CalendarWebService.java
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/languages/deutsch.xml
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/languages/deutsch.xml?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/languages/deutsch.xml
(original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/languages/deutsch.xml
Sun Mar 25 11:19:04 2012
@@ -5120,7 +5120,7 @@ see http://incubator.apache.org/openmeet
</string>
<string id="1274" name="user contacts">
- <value>Meine Kotakte dürfen meinen Kalender einsehen (nur Ansicht)</value>
+ <value>Dieser Kontakt darfen meinen Kalender einsehen (nur Ansicht)</value>
</string>
<string id="1275" name="user contacts">
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/layouts/dragEvent.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/layouts/dragEvent.lzx?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/layouts/dragEvent.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/layouts/dragEvent.lzx
Sun Mar 25 11:19:04 2012
@@ -165,6 +165,16 @@
this.dragger.remove();
if (appointmentId > 0) {
+
+ if
(this.calendarViewRef.parent.parent.requestUserId != canvas.user_id) {
+ new
lz.labelerrorPopup(canvas,{errorlabelid:1278});
+ lz.Cursor.showHandCursor(true);
+
lz.ModeManager.globalUnlockMouseEvents();
+
this.eventRef.setAttribute("visibility","visible");
+ this.destroy();
+ return;
+ }
+
this.updateObj = new Object();
//Point URL to actual File
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/library.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/library.lzx?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/library.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/library.lzx
Sun Mar 25 11:19:04 2012
@@ -29,6 +29,8 @@
<resource name="single_event_popup_background_rsc"
src="resources/single_event_popup_background.swf" />
<resource name="calendar_resultset_next_rsc"
src="resources/resultset_next.png" />
<resource name="calendar_resultset_previous_rsc"
src="resources/resultset_previous.png" />
+ <resource name="calendar_contact_calendar_rsc"
src="resources/calendar.png" />
+ <resource name="calendar_revert_to_own_undo_rsc"
src="resources/arrow_undo.png" />
<include href="layouts/" />
<include href="addAttendee.lzx" />
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=1305005&r1=1305004&r2=1305005&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
Sun Mar 25 11:19:04 2012
@@ -43,6 +43,10 @@
<attribute name="isConnectedEvent" value="false" type="boolean"
/>
<handler name="oninit">
+ if (this.lzCalendarRef.requestUserId != canvas.user_id)
{
+
this._saveEvent.setAttribute("visibility","hidden");
+
this._deleteEvent.setAttribute("visibility","hidden");
+ }
this.getAppointmentReminderTypList.setData(this.remindertypes.data);
</handler>
Added:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/arrow_undo.png
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/arrow_undo.png?rev=1305005&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/arrow_undo.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/calendar.png
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/calendar.png?rev=1305005&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/resources/calendar.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/userContactsCalendar.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/userContactsCalendar.lzx?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/userContactsCalendar.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/userContactsCalendar.lzx
Sun Mar 25 11:19:04 2012
@@ -20,37 +20,74 @@
-->
<library>
- <class name="userContactsCalendar" extends="list" fontsize="11"
- bordersize="1" itemclassname="textlistitem"
scrollbarclassname="om_vscrollbar">
+ <class name="userContactsCalendarItem" extends="view" width="$once{
parent.width }" height="40" bgcolor="0xCCCCCC">
+
+ <attribute name="tUserName" value="" type="string" />
+
+ <attribute name="tUserId" value="-1" type="number" />
+
+ <text text="$once{ parent.tUserName }"
+ width="$once{ parent.width - 60 }" multiline="true"
height="40" />
+
+
+ <miniIcons name="private_message_add"
resource="private_message_add_rsc" width="16" height="16"
+ y="20" x="$once{ parent.width - 60 }" showhandcursor="true">
+ <handler name="onclick">
+ new lz.newPrivateMessage(canvas,{
+ x:200,y:120,
+ refObj:null,
+ minimizable:true,
+ maximizable:true,
+ userObject:null,
+ isdragable:true,
+ user_id:parent.tUserId,
+ width:canvas.width-300,
+ height:canvas.height-130,
+ saveRefObj:this
+ });
+ </handler>
+ <method name="saveNotification" args="roomBooked">
+
parent.parent.parent.parent.onSaveNewMessage.sendEvent(roomBooked);
+ </method>
+ <labelTooltip labelid="1253" />
+ </miniIcons>
+
+ <miniIcons resource="user_profile_rsc" width="16" height="16"
+ y="20" x="$once{ parent.width - 40 }"
showhandcursor="true">
+ <handler name="onclick">
+ new lz.viewUserProfileWindow(canvas,{
+ userId:parent.tUserId
+ });
+ </handler>
+ <labelTooltip labelid="1236" />
+ </miniIcons>
+
+ <miniIcons resource="calendar_contact_calendar_rsc" width="16"
height="16"
+ y="20" x="$once{ parent.width - 20 }"
showhandcursor="true">
+ <handler name="onclick">
+ parent.parent.parent.parent.selectContact(parent);
+ </handler>
+ <labelTooltip labelid="1447" />
+ </miniIcons>
+
+ </class>
+
+ <class name="userContactsCalendar" extends="view" bgcolor="0xE0E0E0">
+
+ <event name="onSaveNewMessage" />
+
+ <attribute name="selectedItem" value="null" />
<handler name="oninit">
- this._setbordercolor = true;
- this.setAttribute('bgcolor', 0xE0E0E0);
- this._setbordercolor = false;
this.getUserContactsWithShareCalendar.doCall();
</handler>
- <handler name="onselect" args="sel">
- <![CDATA[
- if ($debug) Debug.write("onselect :: ",sel);
-
- canvas.contactUser = Number(sel.value);
-
- //parent.lzCalendarContent.calgrid.reloadAll();
-
- ]]>
- </handler>
-
- <!--
- public List<UserContacts>
getUserContactsWithShareCalendar(String SID)
- -->
<netRemoteCallHib name="getUserContactsWithShareCalendar"
funcname="userservice.getUserContactsWithShareCalendar"
remotecontext="$once{ canvas.thishib }" >
<netparam><method name="getValue">return
canvas.sessionId;</method></netparam>
<handler name="ondata" args="valueList">
<![CDATA[
if ($debug) Debug.write("getUserContactsWithShareCalendar
",valueList);
- parent.removeAllItems();
for (var i=0;i<valueList.length;i++) {
parent.addItem(valueList[i].owner.firstname + ' ' +
valueList[i].owner.lastname,valueList[i].owner.user_id);
}
@@ -58,6 +95,25 @@
</handler>
</netRemoteCallHib>
+ <method name="addItem" args="tUserName,tUserId">
+ new lz.userContactsCalendarItem(this._list.scrollContent,{
+ tUserName:tUserName,
+ tUserId:tUserId
+ });
+ </method>
+
+ <method name="selectContact" args="tSel">
+ this.setAttribute("selectedItem",tSel);
+ </method>
+
+ <view name="_list" x="1" y="1" width="$once{ parent.width-1 }"
height="${ parent.height-1 }" bgcolor="0xFFFFFF">
+
+ <view name="scrollContent" layout="axis:y;spacing:1"
width="$once{ parent.width-10 }"/>
+
+ <om_vscrollbar />
+
+ </view>
+
</class>
</library>
\ No newline at end of file
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=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/lzCalendar.lzx
Sun Mar 25 11:19:04 2012
@@ -109,7 +109,7 @@
+'SID='+canvas.sessionId
+'&firstDayInWeek='+canvas.firstdayinweek
+'&startDate='+this.currentDate.getFullYear()+"-"+tMonth+"-"+tDay
- +'&requestUserId=' + requestUserId
+ +'&requestUserId=' + this.requestUserId
+'&omTimeZoneId=' + canvas.timeZoneId
+'&javaTimeZoneName=';
@@ -123,6 +123,10 @@
<![CDATA[
var dataElement = null;
if (appointment == null) {
+ if (this.requestUserId != canvas.user_id) {
+ new
lz.labelerrorPopup(canvas,{errorlabelid:1278});
+ return;
+ }
appointment = this.generateBlankEvent();
dataElement =
LzDataElement.valueToElement(appointment);
} else {
@@ -253,16 +257,26 @@
<labelText labelid="1277" x="24" y="296" multiline="true" width="166" />
- <miniIcons x="172" y="336"
resource="user_contact_calendar_system_undo_rsc" width="16" height="16"
+ <miniIcons x="172" y="336" resource="calendar_revert_to_own_undo_rsc"
width="16" height="16"
showhandcursor="true">
<handler name="onclick">
- canvas.contactUser = 0;
- parent.lzCalendarContent.calgrid.reloadAll();
+ parent.requestUserId = canvas.user_id;
+ parent.loadCalendarData();
</handler>
<labelTooltip labelid="1279" />
</miniIcons>
- <userContactsCalendar name="_userContacts" y="354" x="4" height="${
parent.height - 374 }" width="186" />
+ <userContactsCalendar name="_userContacts" y="354" x="4" height="${
parent.height - 358 }" width="186">
+ <handler name="onselectedItem" args="sel">
+ if ($debug) Debug.write("onselectedItem
",sel.tUserId,sel);
+ parent.requestUserId = sel.tUserId;
+ parent.loadCalendarData();
+ </handler>
+ <handler name="onSaveNewMessage" args="roomBooked">
+ if ($debug) Debug.write("onSaveNewMessage ",roomBooked);
+ parent.reload();
+ </handler>
+ </userContactsCalendar>
<view name="_lzCalendarTobBar" width="${ parent.width - 204 }" x="204"
height="40">
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/settings/privatemessages/newPrivateMessage.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/settings/privatemessages/newPrivateMessage.lzx?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/settings/privatemessages/newPrivateMessage.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/settings/privatemessages/newPrivateMessage.lzx
Sun Mar 25 11:19:04 2012
@@ -34,6 +34,8 @@
<attribute name="receipents" value="null" />
+ <attribute name="saveRefObj" value="null" />
+
<handler name="oninit">
<![CDATA[
if (this.userObject != null) {
@@ -134,6 +136,9 @@
<![CDATA[
//The onResult-Handler will be called be the
rtmpconnection
if ($debug) Debug.write("sendInvitationHash : ",value);
+ if (parent.saveRefObj != null) {
+
parent.saveRefObj.saveNotification(parent._bookRoom.getValue());
+ }
parent.close();
]]>
</handler>
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/user/dao/UserContactsDaoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/user/dao/UserContactsDaoImpl.java?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/user/dao/UserContactsDaoImpl.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/user/dao/UserContactsDaoImpl.java
Sun Mar 25 11:19:04 2012
@@ -79,13 +79,13 @@ public class UserContactsDaoImpl {
return null;
}
- public Integer deleteUserContact(Long userContactId) {
+ public Integer deleteUserContact(Long userContactDeleteId) {
try {
- String hql = "delete from UserContacts where
userContactId = :userContactId";
+ String hql = "delete from UserContacts u where
u.userContactId = :userContactDeleteId";
Query query = em.createQuery(hql);
- query.setParameter("userContactId",userContactId);
+ query.setParameter("userContactDeleteId",
userContactDeleteId);
int rowCount = query.executeUpdate();
return rowCount;
@@ -98,7 +98,7 @@ public class UserContactsDaoImpl {
public Integer deleteAllUserContacts(Long ownerId) {
try {
- String hql = "delete from UserContacts where
owner.user_id = :ownerId";
+ String hql = "delete from UserContacts u where
u.owner.user_id = :ownerId";
Query query = em.createQuery(hql);
query.setParameter("ownerId",ownerId);
@@ -174,6 +174,33 @@ public class UserContactsDaoImpl {
return null;
}
+ public UserContacts getUserContactByShareCalendar(Long contactId,
+ Boolean shareCalendar, Long userId) {
+ try {
+
+ String hql = "select c from UserContacts c "
+ + "where c.contact.user_id = :userId "
+ + "AND c.owner.user_id = :contactId "
+ + "AND c.shareCalendar = :shareCalendar
"
+ + "AND c.contact.deleted <> 'true'";
+
+ TypedQuery<UserContacts> query = em.createQuery(hql,
+ UserContacts.class);
+ query.setParameter("contactId", contactId);
+ query.setParameter("userId", userId);
+ query.setParameter("shareCalendar", shareCalendar);
+ List<UserContacts> ll = query.getResultList();
+
+ if (ll.size() > 0) {
+ return ll.get(0);
+ }
+
+ } catch (Exception e) {
+ log.error("[getUserContactByShareCalendar]", e);
+ }
+ return null;
+ }
+
public List<UserContacts> getContactsByShareCalendar(Long contactId,
Boolean shareCalendar) {
try {
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/CalendarWebService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/CalendarWebService.java?rev=1305005&r1=1305004&r2=1305005&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/CalendarWebService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/CalendarWebService.java
Sun Mar 25 11:19:04 2012
@@ -39,11 +39,13 @@ import org.openmeetings.app.data.calenda
import org.openmeetings.app.data.calendar.management.AppointmentLogic;
import org.openmeetings.app.data.conference.Roommanagement;
import org.openmeetings.app.data.user.Usermanagement;
+import org.openmeetings.app.data.user.dao.UserContactsDaoImpl;
import org.openmeetings.app.persistence.beans.calendar.Appointment;
import org.openmeetings.app.persistence.beans.calendar.AppointmentCategory;
import org.openmeetings.app.persistence.beans.calendar.AppointmentReminderTyps;
import org.openmeetings.app.persistence.beans.rooms.RoomTypes;
import org.openmeetings.app.persistence.beans.rooms.Rooms;
+import org.openmeetings.app.persistence.beans.user.UserContacts;
import org.openmeetings.app.persistence.beans.user.Users;
import org.openmeetings.utils.math.TimezoneUtil;
import org.red5.logging.Red5LoggerFactory;
@@ -80,6 +82,8 @@ public class CalendarWebService {
private AppointmentReminderTypDaoImpl appointmentReminderTypDaoImpl;
@Autowired
private TimezoneUtil timezoneUtil;
+ @Autowired
+ private UserContactsDaoImpl userContactsDaoImpl;
/**
* Load appointments by a start / end range for the current SID
@@ -686,6 +690,16 @@ public class CalendarWebService {
Long users_id = sessionManagement.checkSession(SID);
Long user_level =
userManagement.getUserLevelByID(users_id);
if (authLevelManagement.checkUserLevel(user_level)) {
+
+ if (!requestUserId.equals(users_id)) {
+ UserContacts userContacts =
userContactsDaoImpl
+
.getUserContactByShareCalendar(requestUserId, true,
+
users_id);
+ if (userContacts == null) {
+ throw new Exception(
+ "Your are not
allowed to see this calendar");
+ }
+ }
TimeZone timezone = null;
@@ -795,6 +809,7 @@ public class CalendarWebService {
} catch (Exception err) {
log.error("[getAppointmentReminderTypList]", err);
+ throw new AxisFault(err.getMessage());
}
return null;
}