Calendar zh-tw

From FollowTheScore
Revision as of 13:16, 10 December 2007 by Roc michael (talk | contribs)
Jump to: navigation, search

English 中文(Chinese)

This is the homepage of the DPL Calendar application.

Concept

If you combine the power of some popular extensions it is possible to write a calendaring application completely in wiki code. This is very flexible compared to php programming.

Architecture

{{#wgraph: svg| thumb=90 |

node Current_events {type cal}
node 2007-09-28-Event_A {}
node YYYY-10-04-Event_B   {}
node 2007-10-19-Event_C   {}
node Event                                     {type tpl}
node CatEvent                                  {type category label Events}
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 YYYY-10-04-Event_B   Event                {type incl}
edge YYYY-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       YYYY-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       YYYY-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}
node.fontname helvR10

}}

  • Templates are in yellow.
  • The pages describing an event are in red. Their names must start with the date of the event (format: YYYY-MM-DD) or with 'YYYY-' plus month and day (for recurring yearly events).
  • 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. There are more parameters for Current events - see the explanation below.
  3. Template 'Calendar month' ...
    • shows the calendar box. The calendar box contains the titles of the event pages (the first part of the titles´ names which contain the resp. date is suppressed). Below the calendar there is an optional event list which shows either all events of the current month or all events regardless of month.
    • expects a 'purpose' parameter. If this parameter is set it acts as a filter, i.e. only events will be shown which belong to a category with the name of the 'purpose'. This allows you to have several calendars in parallel
    • 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 a link to create new events (using the edit template "Event template")


Installation

Install extensions

You need

  1. from this website (via Download and unzip)
    • DPL extension
    • Call extension
    • Inputbox extension (this is slightly modified compared to the official release)
  2. from mediawiki.org:

The process of installation is the same as always: create a directory per extension in the 'extension' folder and put a 'require_once' statement into your LocalSettings.php.

Install Calendar Templates

複製(Copy) / 貼上(paste)以下的頁面至Special:export 然後將此頁所產出的 XML 文字檔 匯入您的wiki:

Current events zh-tw
Template:Calendar month zh-tw
Template:CalendarSingle zh-tw
Template:Calendar link
Template:Calendar/MonthStartMon
Template:Calendar/MonthStartTue
Template:Calendar/MonthStartWed
Template:Calendar/MonthStartThu
Template:Calendar/MonthStartFri
Template:Calendar/MonthStartSat
Template:Calendar/MonthStartSun
Template:!
Template:(!
Template:!)
Event template
Event intro
Template:Event

Current events
Template:Calendar month
Template:CalendarSingle
Template:Calendar link
Template:Calendar/MonthStartMon
Template:Calendar/MonthStartTue
Template:Calendar/MonthStartWed
Template:Calendar/MonthStartThu
Template:Calendar/MonthStartFri
Template:Calendar/MonthStartSat
Template:Calendar/MonthStartSun
Template:!
Template:(!
Template:!)
Event template
Event intro
Template:Event
Template:Create Event

使用方式(Using the calendar)

建立一個用以描述紀事(events)的新文件,您可以點選行事曆上的日期數字或是以其他方式自行建置一個符合行事曆命名規範的文件。

  • 請依照下列的命名規範:頁面名稱須以日期(date)為起首 (如"YYYY-MM-DD"其後再加些簡短的描述。
    例如: "2007-10-31 一些重要的事情"
  • 請記得該文件須隸屬於'Events'此一分類(category),如果您在文件的第一行使用了"Event"樣板,則其自動完成此一設定。
  • 當然,您也可以將您的文件加入其他的分類,這樣的話該資訊亦會顯示於行事曆下方的表格(event table)之中。
  • 您可以'YYYY'的方式來定義每年一度重複性(yearly recurring events)的紀事。
    例如"YYYY-12-24 耶誕夜"
  • 同樣的您可以'YYYY-MM'的方式來定義每個月重複性(yearly recurring events)的紀事。
    例如"YYYY-MM-05 領薪水"

目前尚無法以其他方式定義經常性的紀事。

客製化Customizing

如您想要客製化此一行事曆,請您撥冗查閱一下DPL的使用手冊(DPL manual)特別是include 參數及format 參數。在我們的範例中Template:calendar month zh-tw, 設有:

#Summary,#Participants,#Location

which means to take the content of Summary, Participants and Location sections. 分別處理 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

您可以如下的方式使用{{:Current events zh-tw|namespace=Test|purpose=Michael's events¦dpl group's event|width=500px}} 此行事曆有如下的參數(parameters):

  • year - 預設值為今年。
  • month - 預設值為本月。
  • purpose - 可不設定本參數,一經設定本參數後,則僅屬於指定分類(category)的紀事(events)才會被顯示出來,本項目可以設定多個項目,以管線符號(¦)來分隔多項。
  • namespace - 可不設定本參數,一經設定本參數後,則僅屬於指定名字空間(namespace)的紀事(events)才會被顯示出來,且新增紀事時該頁面名稱也會配套的使用該名字空間。
  • show - 可不設定本參數,或設定纪事頁面中的章節名稱(chpater name),而該章節的內容則會在行事曆中被顯示出來,若內容含有圖片(images)時,該圖片亦會被顯示出來。
  • eventList = {no|current|all}, 預設值為'current';可產生一可表格式的報表來呈現您所指定的紀事(events)。
  • width = 可不設定本參數,或指定一寬度值像是'500px' 或 '100%'; 預設值為將使您的行事曆以最小面積的方式來呈現。
  • noadd = 可不設定本參數或可設為 '1'; 當您設定此一參數為'1'時,則此一行事曆將不會顯示可用於新增紀事的超連結(link)。
  • nolink = 可不設定本參數或可設為 '1'; 當您設定此一參數為'1'時,則此一行事曆上的紀事將不會顯示可連到該頁面的超連結(link)而是由該日的日期提供您連至頁面所需的超連結,使用此一參數配合"eventList=no" 則是不合理的使用方式。如果此參數設為'1'則noadd參數也就設為'1'了。

{{#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