Author: solomax
Date: Thu Sep 20 17:15:41 2012
New Revision: 1388118

URL: http://svn.apache.org/viewvc?rev=1388118&view=rev
Log:
Wicket:
        Rows on users panel are now clickable (with cursor change);
        Selects on Admin Form are limited in size;
        Basic form with event details is added to the calendar + on-click and 
click-and-drag events

Modified:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css
    
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.html
    
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.java
    
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
    
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css?rev=1388118&r1=1388117&r2=1388118&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css 
(original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css 
Thu Sep 20 17:15:41 2012
@@ -114,4 +114,12 @@ table.adminListTable tr.odd {
 
 .adminForm {
        
-}
\ No newline at end of file
+}
+
+.clickable {
+       cursor: pointer;
+}
+
+.adminForm select {
+       width: 200px;
+}

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.html
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.html?rev=1388118&r1=1388117&r2=1388118&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.html
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.html
 Thu Sep 20 17:15:41 2012
@@ -47,7 +47,7 @@
                                    <br/>
                                    <wicket:ommessage key="133" />: <input 
type="password" />
                                    <br/>
-                                   <wicket:ommessage key="135" />: <select 
wicket:id="salutations_id"/> <input type="text" wicket:id="firstname"/>
+                                   <wicket:ommessage key="135" />: <select 
wicket:id="salutations_id" style="width: 70px;"/> <input type="text" 
wicket:id="firstname"/>
                                    <br/>
                                    <wicket:ommessage key="136" />: <input 
type="text" wicket:id="lastname"/>
                                    <br/>

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.java?rev=1388118&r1=1388117&r2=1388118&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/users/UsersPanel.java
 Thu Sep 20 17:15:41 2012
@@ -24,6 +24,7 @@ import org.apache.openmeetings.web.compo
 import org.apache.openmeetings.web.components.admin.PagedEntityListPanel;
 import org.apache.openmeetings.web.data.OmDataProvider;
 import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
@@ -51,7 +52,15 @@ public class UsersPanel extends AdminPan
                                item.add(new Label("firstName", fName));
                                final String lName = u.getLastname();
                                item.add(new Label("lastName", lName));
-                               item.add(AttributeModifier.replace("class", 
(item.getIndex() % 2 == 1) ? "even" : "odd"));
+                               item.add(AttributeModifier.append("class", 
"clickable " + ((item.getIndex() % 2 == 1) ? "even" : "odd")));
+                               item.add(new AjaxEventBehavior("onclick") {
+                                       private static final long 
serialVersionUID = -8069413566800571061L;
+
+                                       protected void 
onEvent(AjaxRequestTarget target) {
+                                               form.setModelObject(u);
+                                               target.add(form);
+                                       }
+                               });
                        }
                };
                final WebMarkupContainer listContainer = new 
WebMarkupContainer("listContainer");

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html?rev=1388118&r1=1388117&r2=1388118&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
 Thu Sep 20 17:15:41 2012
@@ -42,6 +42,7 @@
                                        , editable: true
                                        , allDaySlot: false
                                        , axisFormat: 'HH(:mm)'
+                                       , selectable: true
                                        , defaultEventMinutes: 60
                                        , timeFormat: {
                                                agenda: 'HH:mm{ - HH:mm}'
@@ -54,6 +55,8 @@
                                        }
                                        , eventDrop: dropEventFunc //TODO 
confirm ??
                                        , eventResize: resizeEventFunc //TODO 
confirm ??
+                                       , eventClick: eventClickFunc
+                                       , select: selectFunc
                                        , eventSources: [
                                                {
                                                        events: fetchEventsFunc
@@ -68,7 +71,29 @@
                                });
                                */
                                
window.setInterval(function(){$('#calendar').fullCalendar('refetchEvents');}, 
10 * 1000); //FIXME refresh calendar every XX seconds
+                               
+                               $('#appointment').dialog({
+                                       closeOnEscape: true
+                                       , resizable: true
+                                       , width: 400
+                                       , autoOpen: false
+                                       , modal: true
+                               });
                        });
                </script>
+               <div id="appointment" wicket:ommessage="title:815">
+                       <form wicket:id="appointment">
+                               <table>
+                                       <tr>
+                                               <td><wicket:ommessage key="572" 
/></td>
+                                               <td><input type="text" 
wicket:id="appointmentName" /></td>
+                                       </tr>
+                                       <tr>
+                                               <td><wicket:ommessage key="573" 
/></td>
+                                               <td><input type="text" 
wicket:id="appointmentDescription" /></td>
+                                       </tr>
+                               </table>
+                       </form>
+               </div>
        </wicket:panel>
 </html>

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java?rev=1388118&r1=1388117&r2=1388118&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
 Thu Sep 20 17:15:41 2012
@@ -40,6 +40,10 @@ import org.apache.wicket.ajax.json.JSONO
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.request.handler.TextRequestHandler;
 
 public class CalendarPanel extends UserPanel {
@@ -52,6 +56,18 @@ public class CalendarPanel extends UserP
                calendar.setOutputMarkupId(true);
                calendar.setMarkupId("calendar");
                add(calendar);
+               
+               final Form<Appointment> form = new 
Form<Appointment>("appointment", new CompoundPropertyModel<Appointment>(new 
Appointment())){
+                       private static final long serialVersionUID = 
192883745414475639L;
+
+                       {
+                               setOutputMarkupId(true);
+                               add(new 
RequiredTextField<String>("appointmentName"));
+                               add(new 
TextArea<String>("appointmentDescription"));
+                       }
+               };
+               add(form);
+               
                //fetchEvents
                add(new AbstractDefaultAjaxBehavior() {
                        private static final long serialVersionUID = 
6880514947331946407L;
@@ -91,6 +107,7 @@ public class CalendarPanel extends UserP
                                                events.put(new JSONObject()
                                                        .put("id", 
a.getAppointmentId())
                                                        .put("title", 
a.getAppointmentName())
+                                                       .put("description", 
a.getAppointmentDescription())
                                                        .put("start", 
WebSession.getDateFormat().format(a.getAppointmentStarttime()))
                                                        .put("end", 
WebSession.getDateFormat().format(a.getAppointmentEndtime()))
                                                        .put("allDay", false));
@@ -106,6 +123,79 @@ public class CalendarPanel extends UserP
                add(new DropResizeBehavior(true, "dropEventFunc"));
                //resizeEvent
                add(new DropResizeBehavior(false, "resizeEventFunc"));
+               //create on click-and-drag
+               add(new AbstractDefaultAjaxBehavior() {
+                       private static final long serialVersionUID = 
6880514947331946407L;
+
+                       @Override
+                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                               super.updateAjaxAttributes(attributes);
+                               attributes.getAjaxCallListeners().add(new 
AjaxCallListener().onSuccess("$('#appointment').dialog('open');"));
+                       }
+                       
+                       @Override
+                       public void renderHead(Component component, 
IHeaderResponse response) {
+                               super.renderHead(component, response);
+                               response.render(JavaScriptHeaderItem.forScript(
+                                       "var selectFunc = "
+                                               + this.getCallbackFunction(
+                                                       context("start")
+                                                       , context("end")
+                                                       , context("allDay")
+                                                       , context("jsEvent")
+                                                       , context("view")
+                                                       , resolved("_start", 
"start.getTime()")
+                                                       , resolved("_end", 
"end.getTime()")) + ";"
+                                       , "selectFunc"));
+                       }
+
+                       @Override
+                       protected void respond(AjaxRequestTarget target) {
+                               Calendar start = WebSession.getCalendar();
+                               
start.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_start").toLong());
+                               Calendar end = WebSession.getCalendar();
+                               
end.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_end").toLong());
+                               
+                               Appointment a = new Appointment();
+                               a.setAppointmentStarttime(start.getTime());
+                               a.setAppointmentEndtime(end.getTime());
+                               form.setModelObject(a);
+                               
+                               target.add(form);
+                       }
+               });
+               //eventClick
+               add(new AbstractDefaultAjaxBehavior() {
+                       private static final long serialVersionUID = 
6880514947331946407L;
+
+                       @Override
+                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                               super.updateAjaxAttributes(attributes);
+                               attributes.getAjaxCallListeners().add(new 
AjaxCallListener().onSuccess("$('#appointment').dialog('open');"));
+                       }
+                       
+                       @Override
+                       public void renderHead(Component component, 
IHeaderResponse response) {
+                               super.renderHead(component, response);
+                               response.render(JavaScriptHeaderItem.forScript(
+                                       "var eventClickFunc = "
+                                               + this.getCallbackFunction(
+                                                       context("event")
+                                                       , context("jsEvent")
+                                                       , context("view")
+                                                       , resolved("_id", 
"event.id")) + ";"
+                                       , "eventClickFunc"));
+                       }
+
+                       @Override
+                       protected void respond(AjaxRequestTarget target) {
+                               Appointment a = 
Application.getBean(AppointmentDaoImpl.class).getAppointmentById(
+                                               
getRequestCycle().getRequest().getRequestParameters().getParameterValue("_id").toLong());
+                               form.setModelObject(a);
+                               
+                               target.add(form);
+                       }
+               });
        }
 
        private class DropResizeBehavior extends AbstractDefaultAjaxBehavior {


Reply via email to