Difference between revisions of "Test calendar"

From FollowTheScore
Jump to: navigation, search
Line 7: Line 7:
 
{{#wgraph: svg| thumb=90 |
 
{{#wgraph: svg| thumb=90 |
 
  node Current_events {type cal}
 
  node Current_events {type cal}
node Current_events_September_2007 {type cal}
 
node Current_events_October_2007 {type cal}
 
  
 
  node 2007-09-28-Event_A {}
 
  node 2007-09-28-Event_A {}
Line 14: Line 12:
 
  node 2007-10-19-Event_C  {}
 
  node 2007-10-19-Event_C  {}
  
  node Event           {type tpl}
+
  node Event                                     {type tpl}
  node CatEvent         {type category}
+
  node CatEvent                                 {type category label Event}
  edge Event CatEvent   {type cat}
+
node CatHoliday                                {type category label Holiday}
  node Event_template   {type editsample}
+
  edge Event CatEvent                           {type cat}
  edge 2007-09-28-Event_A Event {type incl}
+
  node Event_template                           {type editsample}
  edge 2007-10-04-Event_B  Event {type incl}
+
node Event_intro                              {type editintro}
  edge 2007-10-19-Event_C  Event {type incl}
+
edge Event_intro          Event_template      {kind rightnear type editintro}
  edge Event_template 2007-09-28-Event_A {type edit}
+
  edge 2007-09-28-Event_A   Event               {type incl}
  edge Event_template 2007-10-04-Event_B  {type edit}
+
  edge 2007-10-04-Event_B  Event               {type incl}
  edge Event_template 2007-10-19-Event_C  {type edit}
+
edge 2007-10-04-Event_B  CatHoliday          {type catgeory}
  edge Event_template Event                {type incl}
+
  edge 2007-10-19-Event_C  Event               {type incl}
 +
  edge Event_template       2007-09-28-Event_A   {type edit}
 +
  edge Event_template       2007-10-04-Event_B  {type edit}
 +
  edge Event_template       2007-10-19-Event_C  {type edit}
 +
  edge Event_template       Event                {type incl}
  
  edge Current_events Current_events_September_2007 {type incl}
+
  edge Current_events       Calendar_month       {type incl}
edge Current_events_September_2007 Calendar_month {type incl}
 
edge Current_events Current_events_October_2007  {type incl}
 
edge Current_events_October_2007  Calendar_month {type incl}
 
  
  node CalendarSingle {type tpl}
+
  node Calendar_month                            {type tpl}
  node Calendar_month {type tpl}
+
  node CalendarSingle                            {type tpl}
  node Calendar_link {type tpl}
+
  node Calendar_link                             {type tpl}
edge CalendarSingle Calendar_link    {type incl}
+
  edge Calendar_month       2007-09-28-Event_A   {type dpl}
edge Calendar_month CalendarSingle  {type incl}
+
  edge Calendar_month       2007-10-04-Event_B  {type dpl}
  edge Calendar_month 2007-09-28-Event_A {type dpl}
+
  edge Calendar_month       2007-10-19-Event_C  {type dpl}
  edge Calendar_month 2007-10-04-Event_B  {type dpl}
+
edge Calendar_month      CalendarSingle      {type incl}
  edge Calendar_month 2007-10-19-Event_C  {type dpl}
+
edge CalendarSingle      Calendar_link        {type incl}
 +
edge CalendarSingle      Current_events      {type link label 'next month<br>prev. month' }
  
  node Calendar/MonthStartMon {type tpl}
+
  node Calendar/MonthStartMon                   {type tpl}
  node Calendar/MonthStartTue {type tpl}
+
  node Calendar/MonthStartTue                   {type tpl}
 +
 
 +
edge CalendarSingle    Calendar/MonthStartMon  {type incl}
 +
edge CalendarSingle    Calendar/MonthStartTue  {type incl}
  
 
  nodetype tpl        {color yellow    }
 
  nodetype tpl        {color yellow    }
 
  nodetype category  {color lightgreen}
 
  nodetype category  {color lightgreen}
 
  nodetype cal        {color lightblue }
 
  nodetype cal        {color lightblue }
  nodetype editsample {color #ffeeee  }
+
  nodetype editsample {color lightcyan }
 +
nodetype editintro  {color lightcyan }
 
  nodetype *          {color #ffdddd bordercolor darkgray}
 
  nodetype *          {color #ffdddd bordercolor darkgray}
  
  edge CalendarSingle Calendar/MonthStartMon {type incl}
+
  edgetype incl  {color darkgray}
  edge CalendarSingle Calendar/MonthStartTue {type incl}
+
  edgetype link  {color blue}
 
+
  edgetype cat   {color darkgreen}
  edgetype incl {color darkgray}
+
  edgetype dpl   {color red thickness 4 label 'DPL query'}
  edgetype cat {color darkgreen}
+
  edgetype edit {linestyle dotted color blue}
  edgetype dpl {color red thickness 4}
 
  edgetype edit {linestyle dotted color blue}
 
  
 
}}
 
}}
 
* Templates are in yellow.
 
* Templates are in yellow.
* The pages describing an event are in red; in principle you can name them as you want. But it is quite useful to start their name with YYYY-MM-DD because then the natural sort order will correspond to the date.
+
* The pages describing an event are in red. Their names must start with YYYY-MM-DD.
* We use an edit template (in lightred) when event pages are created. It contains a reference to the template "Event" which is used as a selection criterion by the DPL query contained in template "Calendar month".
+
* We use two edit helpers (in cyan) when event pages are created.
* The pages which provide access to the calendar are in blue. You must adapt them to your needs.  
+
* The entry page for the calendar (''Current events'') is in blue.  
* categories are in green
+
* Categories are in green.
  
 
The design is as follows:
 
The design is as follows:
# The user calls the entry page (e.g. "Current events"). We call this page the ''basepage'' and you can choose its name freely. But be careful: The basepage name appears inside the month-related calendar articles. You must change the name there as well if you choose another name.
+
# The user calls the entry page("Current events"). Be careful if you change its name: The name of this page must be passed as an argument (named 'basepage') to the template 'Calendar month'.
# The basepage uses a date function to calculate the current month and then calls the calendar page for that month.
+
# The basepage can be called by the user without any arguments. Then it uses a date function to calculate the current month. It can also be called from another calendar page - in which case the desired year & month are passed as parameters via the [[Call extension]].
# The calendar page for the selected month calls a standard template ("Calendar month") which
+
# Template 'Calendar month' ...
#* shows the calendar box
+
#* shows the calendar box. The calendar box contains links to the adjoining months. Days link to their event in the event list. You could change that to make the links point directrly to the event definitions.
#* finds all events of the current month and shows them (it uses the category "Event" as a selection condition)
+
#* uses a DPL query to find all articles in category 'Event' which belong to the selected year/month
 +
#* shows the selected articles in a list, together with some selected chapters (like Participants ..) and with their categories
 
#* offers an edit box to create a new event (using the edit template "Event template")
 
#* offers an edit box to create a new event (using the edit template "Event template")
The calendar box contains links to its neighboring months. Days link to their event in the list. You could easily change that to make the links point directrly to the event definitions.
 
  
  
 
== Steps needed to install the DPL calendar ==
 
== Steps needed to install the DPL calendar ==
  
===Download the following templates, and create them into your wiki===
+
=== Install extensions ===
 
 
These templates are needed to know how to display properly the month calendar. Months are categorized by the day of the week of the first day:
 
*[[Template:Calendar/MonthStartMon]] // all months that start on a Monday
 
*[[Template:Calendar/MonthStartTue]] // etc...
 
*[[Template:Calendar/MonthStartWed]]
 
*[[Template:Calendar/MonthStartThu]]
 
*[[Template:Calendar/MonthStartFri]]
 
*[[Template:Calendar/MonthStartSat]]
 
*[[Template:Calendar/MonthStartSun]]
 
*[[Template:!]] //a template used for special for cell separation
 
 
 
This template calls the proper template above, with a parameter input for each day:
 
*[[Template:CalendarSingle]]
 
 
 
===Download the following templates, and customize them===
 
  
This is the template that needs to be called to create each month's page: [[Template:calendar month]]. Call it this way:
+
You need
<pre>
 
{{calendar month|year=YYYY|month=MM|basepage=your base page name}}
 
</pre>
 
This is the template that calculates the parameter for each day for above template (based on DPL):
 
*[[Template:Calendar link]]
 
 
 
The next templates are not mandatory, they were designed to ease the creation of an event, although this can be done by other means:
 
*[[Event template]]
 
*[[Template:Event]] (used by 'Event Template')
 
 
 
===Download additional extensions===
 
 
Download the following extensions:
 
Download the following extensions:
 
#[http://meta.wikimedia.org/wiki/ParserFunctions parserfunctions] from MW   
 
#[http://meta.wikimedia.org/wiki/ParserFunctions parserfunctions] from MW   
 
#[http://meta.wikimedia.org/wiki/Help:Inputbox inputbox] from MW
 
#[http://meta.wikimedia.org/wiki/Help:Inputbox inputbox] from MW
#[[DPL:Manual - Source_and Installation|DPL extension]] from this site.
+
# StringFunctions extension from MW
 +
#[[Download|DPL extension]] from this site.
 +
# Call extension from this site (part of the above download).
  
===Create the base page===
+
===Download the following templates, and create them into your wiki===
Now, create the base page where the current month calendar will be created (like "Current events"), and insert below code in it:
 
<pre>
 
__NOTOC__
 
{{:Test calendar {{#time: F Y}}}}
 
</pre>
 
The name of your basepage is important as it must be used as aprefix for each month´s calendar page later. Our base page is named "Test calendar" and as you see its only purpose is to call the specific page for the current month. If you call your basepage 'Current events' then the above example has to changed to
 
<pre>
 
__NOTOC__
 
{{:Current events {{#time: F Y}}}}
 
</pre>
 
 
 
===Create a page for each month===
 
Finally, create one page per month with the format "basepage Month year" (example: "Current events April 2007"), insert below code and make sure to replace:
 
#YYYY by the year (ex: 2007)
 
#mm by the month (ex:06)
 
#pageXYZ by the base page name (example: "Current events")
 
<pre>
 
{{calendar month|year=YYYY|month=mm|basepage=pageXYZ}}
 
</pre>
 
Note: In this wiki we use "Test calendar" as basepage, so the articles are called "Test calendar September 2007" and so on.
 
  
 +
Download from this wiki and create identical pages in your wiki:
  
=== Customizing the event pages and event presentation===
+
* [[Current events]]
To customize the type of page the calendar application needs to look for, just modify the '''titlematch''' parameter in the [[Template:Calendar link]] template, as well as in the DPL in the above [[Template:calendar month]] template.
+
* [[Template:Calendar month]]
 +
* [[Template:CalendarSingle]]
 +
* [[Template:Calendar link]]
 +
* Seven templates (for each start day of a month)
 +
** <small>[[Template:Calendar/MonthStartMon]]</small>
 +
** <small>[[Template:Calendar/MonthStartTue]]</small>
 +
** <small>[[Template:Calendar/MonthStartWed]]</small>
 +
** <small>[[Template:Calendar/MonthStartThu]]</small>
 +
** <small>[[Template:Calendar/MonthStartFri]]</small>
 +
** <small>[[Template:Calendar/MonthStartSat]]</small>
 +
** <small>[[Template:Calendar/MonthStartSun]]</small>
 +
* Little helpers
 +
** [[Template:!]]  //a template used for table formatting within #if
 +
** [[Template:(!]] //a template used for table formatting within #if
 +
** [[Template:!)]] //a template used for table formatting within #if
 +
* [[Event template]]
 +
* [[Event intro]]
 +
* [[Template:Event]]
  
 +
=== Customizing ===
  
To customize the list of events that are displayed below each calendar, take a close look in the DPL manual at the '''include''' parameter ([[include|see here]]). In our example in template [[Template:calendar month]], we have:
+
To customize the list of events that are displayed below each calendar, take a close look in the DPL manual at the [[include]] parameter and the [[format]] parameter. In our example in template [[Template:calendar month]], we have:
 
<pre>
 
<pre>
#Summary,#Participants
+
#Summary,#Participants,#Location
 
</pre>
 
</pre>
which means take the content of summary and participants sections.
+
which means to take the content of ''Summary'', ''Participants'' and ''Location'' sections.
 +
 
 +
You could modify the name of sections, the number of sections or even take the parameters of a template inside the event page. Again, see the DPL manual.
  
We could modify the name of sections, the number of sections or even take the parameters of a template inside the event page. Again, see the DPL manual.
 
 
==Demo==
 
==Demo==
{{:Current events {{#time: F Y}}}}
+
Now we are going to include ''Current events'' which will give us the actual calendar right here:
 +
{{:Current events}}
 
[[Category:Test]]
 
[[Category:Test]]

Revision as of 11:57, 1 October 2007

Installation

This is a calendaring application based on DPL functionality. It is very flexible because it is based on templates which you can modify and adapt to your needs.

Architecture

{{#wgraph: svg| thumb=90 |

node Current_events {type cal}
node 2007-09-28-Event_A {}
node 2007-10-04-Event_B   {}
node 2007-10-19-Event_C   {}
node Event                                     {type tpl}
node CatEvent                                  {type category label Event}
node CatHoliday                                {type category label Holiday}
edge Event CatEvent                            {type cat}
node Event_template                            {type editsample}
node Event_intro                               {type editintro}
edge Event_intro          Event_template       {kind rightnear type editintro}
edge 2007-09-28-Event_A   Event                {type incl}
edge 2007-10-04-Event_B   Event                {type incl}
edge 2007-10-04-Event_B   CatHoliday           {type catgeory}
edge 2007-10-19-Event_C   Event                {type incl}
edge Event_template       2007-09-28-Event_A   {type edit}
edge Event_template       2007-10-04-Event_B   {type edit}
edge Event_template       2007-10-19-Event_C   {type edit}
edge Event_template       Event                {type incl}
edge Current_events       Calendar_month       {type incl}
node Calendar_month                            {type tpl}
node CalendarSingle                            {type tpl}
node Calendar_link                             {type tpl}
edge Calendar_month       2007-09-28-Event_A   {type dpl}
edge Calendar_month       2007-10-04-Event_B   {type dpl}
edge Calendar_month       2007-10-19-Event_C   {type dpl}
edge Calendar_month       CalendarSingle       {type incl}
edge CalendarSingle       Calendar_link        {type incl}
edge CalendarSingle       Current_events       {type link label 'next month
prev. month' }
node Calendar/MonthStartMon                    {type tpl}
node Calendar/MonthStartTue                    {type tpl}
edge CalendarSingle    Calendar/MonthStartMon  {type incl}
edge CalendarSingle    Calendar/MonthStartTue  {type incl}
nodetype tpl        {color yellow    }
nodetype category   {color lightgreen}
nodetype cal        {color lightblue }
nodetype editsample {color lightcyan }
nodetype editintro  {color lightcyan }
nodetype *          {color #ffdddd bordercolor darkgray}
edgetype incl  {color darkgray}
edgetype link  {color blue}
edgetype cat   {color darkgreen}
edgetype dpl   {color red thickness 4 label 'DPL query'}
edgetype edit  {linestyle dotted color blue}

}}

  • Templates are in yellow.
  • The pages describing an event are in red. Their names must start with YYYY-MM-DD.
  • We use two edit helpers (in cyan) when event pages are created.
  • The entry page for the calendar (Current events) is in blue.
  • Categories are in green.

The design is as follows:

  1. The user calls the entry page("Current events"). Be careful if you change its name: The name of this page must be passed as an argument (named 'basepage') to the template 'Calendar month'.
  2. The basepage can be called by the user without any arguments. Then it uses a date function to calculate the current month. It can also be called from another calendar page - in which case the desired year & month are passed as parameters via the Call extension.
  3. Template 'Calendar month' ...
    • shows the calendar box. The calendar box contains links to the adjoining months. Days link to their event in the event list. You could change that to make the links point directrly to the event definitions.
    • uses a DPL query to find all articles in category 'Event' which belong to the selected year/month
    • shows the selected articles in a list, together with some selected chapters (like Participants ..) and with their categories
    • offers an edit box to create a new event (using the edit template "Event template")


Steps needed to install the DPL calendar

Install extensions

You need Download the following extensions:

  1. parserfunctions from MW
  2. inputbox from MW
  3. StringFunctions extension from MW
  4. DPL extension from this site.
  5. Call extension from this site (part of the above download).

Download the following templates, and create them into your wiki

Download from this wiki and create identical pages in your wiki:

Customizing

To customize the list of events that are displayed below each calendar, take a close look in the DPL manual at the include parameter and the format parameter. In our example in template Template:calendar month, we have:

#Summary,#Participants,#Location

which means to take the content of Summary, Participants and Location sections.

You could modify the name of sections, the number of sections or even take the parameters of a template inside the event page. Again, see the DPL manual.

Demo

Now we are going to include Current events which will give us the actual calendar right here: {{#vardefine:year|2024}}{{#vardefine:month|11}} {{#vardefine:width|}}{{#vardefine:noadd|}}{{#vardefine:nolink|}}{{#vardefine:purpose|}}{{#vardefine:show|}}{{#vardefine:namespace|}}

{{Calendar/MonthStartError: Invalid time.
[[Special:Call/:Current events,year=Error: Invalid time.,month=Error: Invalid time.,basepage=Current events,eventList=current,purpose={{#var:purpose}},nolink={{#var:nolink}},noadd={{#var:noadd}},show={{#var:show}},namespace={{#var:namespace}},width={{#var:width}}|<<]]

Error: Invalid time.
{{#replace:{{#replace:{{#replace:²²:Category:{{#var:purpose}}³³|¦|³³, ²²:Category:}}|²|[}}|³|]}}

[[Special:Call/:Current events,year=Error: Invalid time.,month=Error: Invalid time.,basepage=Current events,eventList=current,purpose={{#var:purpose}},nolink={{#var:nolink}},noadd={{#var:noadd}},show={{#var:show}},namespace={{#var:namespace}},width={{#var:width}}|>>]]
Mo Tu We Th Fr Sa Su
01=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

01
02=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

02
03=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

03
04=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

04
05=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

05
06=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

06
07=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

07
08=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

08
09=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

09
10=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

10
11=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

11
12=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

12
13=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

13
14=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

14
15=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

15
16=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

16
17=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

17
18=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

18
19=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

19
20=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

20
21=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

21
22=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

22
23=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

23
24=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

24
25=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

25{{{#var:show.default|%PAGE%=YYYY-MM-25 prepare plan for next month|%TITLE%=YYYY-MM-25 prepare plan for next month|%DATE%=|%USER%=}}
26=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

26
27=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

27{{{#var:show.default|%PAGE%=YYYY-MM-27 Test calendar|%TITLE%=YYYY-MM-27 Test calendar|%DATE%=|%USER%=}}
28=

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:purpose}}' for parameter 'category'.

28
29=Expression error: Unexpected < operator. 30=Expression error: Unexpected < operator. 31=Expression error: Unexpected < operator. year={{#var:year}}

}}

{{#var:year}}
   

[[Special:Call/Calendar month,eventList=all,basepage=Current events,year={{#var:year}},month={{#var:month}},purpose={{#var:purpose}}|all events]]

There are 2 events planned this month.

Date / Event name Event summary Participants Location Categories
YYYY-MM-25 prepare plan for next month

By the 25th of each month we have to publish the planned excursions for next month

blackboard in the entrance hall

Events
YYYY-MM-27 Test calendar

Describe the event here lit...

Enter the participants here ...

Enter the place here ...

Events