1 2 3 4 5 6 Previous Next 129 Replies Latest reply on Nov 7, 2013 2:30 AM by blabno Go to original post
      • 45. Re: Schedule
        elfrasco

        Thank you Bernard and Nick!

        I did a checkout from your repository and I have the schedule and the notify working :-)

        • 46. Re: Schedule
          blabno

          Posting latest version of schedule for RF 3.3.3-Final.

          • 47. Re: Schedule
            eunnini

            Thanks for posting. Can I somewhere see online demo or some documentation about schedule

            • 48. Re: Schedule
              blabno
              • 49. Re: Schedule
                quinindiola

                Hi,

                 

                I've updated to the latest release of the code and think I have found a bug - it's on your sample page too - . When you set showWeekends to "true" and firstDay to MONDAY , Sunday remains as first day in week.

                 

                I'm going to take a look to fullcalendar.js and check if the bug is there.

                 

                EDIT : fullcalendar.js works ok , so I'm going to check where the error is in the component.

                 

                Ciao.

                • 50. Re: Schedule
                  blabno

                  Hello Quinin!

                  That is a bug indeed. And it's in my component, not fullcalendar.js. I've identified it and will fix it today.

                  • 51. Re: Schedule
                    quinindiola

                    Hi,

                     

                    I found it, should be fixed if you change, on SchedulerRenderedBase , in line 65

                     

                    defaults.put("firstDay", UISchedule.DEFAULT_FIRST_DAY);

                     

                    by

                     

                    defaults.put("firstDay", UISchedule.DEFAULT_FIRST_DAY - 1 );

                     


                    Because you are internally managing 'fullcalendar' dates but UISchedule.DEFAULT_FIRST_DAYis in 'scheduler' format , and when adding options,

                     

                    addOptionIfSetAndNotDefault("firstDay", firstDay - 1, options);

                     

                    so when firstDay = UISchedule.MONDAY (=2) , UISchedule.DEFAULT_FIRST_DAY (=1 , =UISchedule.SUNDAY)  and addOption does not adds the non-default value.

                    • 52. Re: Schedule
                      blabno

                      That's correct.

                      • 53. Schedule
                        moha1984

                        Hi Bernard ,

                         

                        how I can color some schedule task  ?

                        I saw in the example (http://bernard.labno.pl/schedule-sample/) that it's possible to color tasks..but I dont find a solution.... 

                        Can you tell me how to do this?

                        Thanks

                        • 54. Schedule
                          quinindiola


                          You can set a custom CSS class to a given task with styleClass attribute on  <schedule:scheduleItem>

                           

                          <schedule:scheduleItem eventId="#{event.id}" startDate="#{event.startDate}" title="#{event.title}"

                                                             endDate="#{event.endDate}" allDay="#{event.allDay}"

                                                             styleClass="#{event.id == 1 ? 'first' : null}" data="#{event.data}"/>

                          • 55. Re: Schedule
                            blabno

                            As for now fullCalendar (the jQuery plugin the schedule is based on) does not support coloring individual items. The only way to change colors of some tasks is CSS. You can provide "styleClass" attribute for scheduleItem component (the one nested within schedule). I'm having the same problem in my current project where we want to assign color to each item individually. So what I do is generating stylesheet where class names are like "course"+course.id.

                             

                            Coloring of individual items has been submitted to plugin's bugtracker and should be implemented in 2-3 months.

                             

                            Here is the code:

                            {code}@BypassInterceptors

                            @Scope(ScopeType.APPLICATION)

                            @Name("classStylesheetGenerator")

                            public class ClassStylesheetGenerator extends AbstractResource {

                             

                                public static final String RESOURCE_PATH = "pl.schoolmanager.ClassStylesheetGenerator.RESOURCE_PATH";

                             

                                @Override

                               public void getResource(final HttpServletRequest request, finalHttpServletResponse response) throws ServletException, IOException {

                                    new ContextualHttpServletRequest(request) {

                                        @Override

                                        public void process() throws IOException {

                                            doWork(request, response);

                                        }

                                    }.run();

                             

                                }

                             

                                private void doWork(HttpServletRequest request, HttpServletResponse response) throws IOException {

                                    Map<Long, String> courseColors = new HashMap<Long, String>();

                                    Map<Long, String> individualClassColors = new HashMap<Long, String>();

                                    final EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");

                                    @SuppressWarnings("unchecked")

                                    List<Clazz> clazzList = entityManager

                                       .createQuery("select clazz from Clazz clazz whereclazz.location.school.network=#{networkSelector.selectedNetwork} andclazz.course is null")

                                        .getResultList();

                                    for (Clazz clazz : clazzList) {

                                        individualClassColors.put(clazz.getId(), clazz.getColor());

                                    }

                                    @SuppressWarnings("unchecked")

                                    List<Course> courseList = entityManager

                                        .createQuery("select course from Course course where course.school.network=#{networkSelector.selectedNetwork}")

                                        .getResultList();

                                    for (Course course : courseList) {

                                        courseColors.put(course.getId(), course.getColor());

                                    }

                                    final OutputStreamWriter writer = new OutputStreamWriter(response.getOutputStream());

                                    encodeClasses(courseColors, "course", writer);

                                    encodeClasses(individualClassColors, "individualClass", writer);

                                    writer.flush();

                                }

                             

                                private void encodeClasses(Map<Long, String> colorMap, String classPrevix, Writer writer) throws IOException {

                                    for (Map.Entry<Long, String> entry : colorMap.entrySet()) {

                                        writer.write(".");

                                        writer.write(classPrevix);

                                        writer.write(entry.getKey().toString());

                                        writer.write(",");

                             

                                        writer.write(".fc-agenda");

                                        writer.write(".");

                                        writer.write(classPrevix);

                                        writer.write(entry.getKey().toString());

                                        writer.write(".fc-event-time,");

                             

                                        writer.write(".");

                                        writer.write(classPrevix);

                                        writer.write(entry.getKey().toString());

                             

                                        writer.write(" a {");

                                        writer.write("background-color:");

                                        writer.write(entry.getValue());

                                        writer.write(";");

                                        writer.write("border-color:");

                                        writer.write(entry.getValue());

                                        writer.write(";");

                                        writer.write("}\n");

                                    }

                                }

                             

                                @Override

                                public String getResourcePath() {

                                    return getServletContext().getInitParameter(RESOURCE_PATH);

                                }

                            }{code}

                             

                            {code:xml}<link href="#{request.contextPath}/seam/resource/classStylesheetGenerator" rel="stylesheet" type="text/css"/>{code:xml}

                             

                             

                            {code:xml}<schedule:schedule id="schedule" value="#{currentClassList.scheduleDataModel}" var="class" switchType="ajax"

                                                               headerRight="agendaDay,agendaWeek month today prev,next" allDayByDefault="false" allDaySlot="false"

                                                               itemSelectListener="#{currentClassesView.itemSelected}" reRender="modals">

                                                <schedule:scheduleItem eventId="#{class.id}" startDate="#{class.date}" endDate="#{class.endDate}" allDay="false"

                                                                       styleClass="#{empty class.course ? 'individualClass'.concat(class.id) : 'course'.concat(class.course.id)}"

                                                                       title="#{empty class.course ? messages['pl.schoolmanager.domain.Clazz.individualClass'] : class.course.name}"/>

                                            </schedule:schedule>{code:xml}

                            • 56. Schedule
                              moha1984

                              Thank you Bernard and Quinin for the responces !

                              I will try to do this with CSS...

                              • 57. Schedule
                                moha1984

                                Hello ,

                                 

                                I have a problem diplaying long events in basicWeek view ; if an event duration exeed the displayed week duration ; the event is shown only in this week (the week that contains the start date (if i pass to the next week with scroller i don't see the event) ) !! ( with the month view it's ok  ) .

                                There's a solution for this problem ? i saw on the fullCalendar example (http://arshaw.com/js/fullcalendar_views/basicWeek.html)  that one event can be displayed on more thant one week ...

                                • 58. Schedule
                                  blabno

                                  99% chance that it is your datamodel or configuration problem. Do you use ajax,server or client switch? It is hart to tell anything without sources (java and facelet).

                                  • 59. Schedule
                                    moha1984

                                    I use the same configuration and datamodel of schedule-sample example ... does it work with you? ( the problem is only on the basicWeek view ).

                                    1 2 3 4 5 6 Previous Next