Extension talk:Semantic Result Formats/calendar format

From mediawiki.org

Date shown incorrectly[edit]

Hi, I'm setting a date with the calendar into a semantic property that gets saved as 'YYYY/mm/dd'. All works fine, but then I'm performing a semantic query on that property, and the result shows the date the other way around. For example, the date that gets saved is 2016/11/05 but the result of the query shows 11th of May, 2016 instead of 5th of November, 2016. What could be the problem?

EDIT: Fixed in https://github.com/SemanticMediaWiki/SemanticMediaWiki/commit/a133c1f31e216a78fdf40676f363d8214bf037e9

change date format[edit]

is it possible to display the date in European format:dd-mm-yyyy not mm-dd-yyyy? european people can be disinformed when they see date 03.04.2011

more than one[edit]

Hi! Is it somehow possible to have a calendar entry for more than one day? Right now it seems that one wiki page can have only one date that is displayed in the calendar. If the property date is used several times (each with different dates) on that page, only the last entry is used for the calendar. So can I somehow either give the page several date entries or a "from...to", so that it is displayed for several days in the calendar? I also tried using two properties, start date and end date, and querying for both, but then again the calendar uses only the last date it finds on the page. - FR

That sounds like a bug; you should be able to specify more than one day. To use more than one property, though, you have to use this format within Semantic Compound Queries. Yaron Koren 14:00, 24 September 2009 (UTC)Reply
Thanks for the fast reply. I have to admit that I am currently still using the old semantic calendar extension. However I could not find any information that the behavior changed (in contrast to the semantic google maps, where the changelog points out that just in the newer versions a page can have more than one set of coordinates). Will try with the current version of semantic results format and the compound queries... - FR 80.152.199.128 15:24, 24 September 2009 (UTC)Reply
I seem to have the same issue, even though I use Semantic Compound Queries. Cf http://community.hackit.cx/index.php?title=Tasks_follow-up&month=10&year=2010 - unless I made a mistake, it's supposed to show the two dates in http://community.hackit.cx/wiki/Alpha_1.2 but only shows the later (feel free to try to alter those pages if you want to). Any idea what could be wrong? --XavierAntoviaque 10:11, 29 September 2010 (UTC)Reply
You're using version 1.4.3 of SRF - try upgrading to the latest version; there have been a lot of bug fixes since then. Yaron Koren 13:22, 29 September 2010 (UTC)Reply

At least in my wiki the calendar produces a bug. My wiki has an URL like

https://wiki.mypage.com/index.php

Now when I open the calendar, it might link to an entry like

https://wiki.mypage.com/index.php/Appointment_2010

So far everything is fine. But once I change the month (or just go forward an backwards, having the same month on the screen as before) the calendar suddenly links to

https://wiki.mypage.com/Appointment_2010

This is invalid, as the index.php is missing in the URL. The reason is that relative paths are used, and while the calendar has the URL

https://wiki.mypage.com/index.php/Calendar when I open it, once I change the month it becomes

https://wiki.mypage.com/index.php?title=Calender&month=11&year=2009

So this is where it has problems with the relative paths, because now the index.php is not part of the local URL anymore. Do you agree that this should be fixed? And can you probably provide some quick code that needs to be changed to make it work again? --80.152.199.128 16:24, 29 October 2009 (UTC)Thanks,Reply

Is it possible that you have $wgArticlePath set incorrectly in your LocalSettings.php file? It should be "/index.php/$1". Yaron Koren 19:38, 29 October 2009 (UTC)Reply
Thanks. So far I did not have an $wgArticlePath in my LocalSettings.php at all, it was never specified automatically. However, also when I put it in, the problem stays the same. I now have this:
$wgScriptPath       = "";
$wgScriptExtension  = ".php";

$wgArticlePath = "/index.php/$1";

Any more ideas? --80.152.199.128 20:05, 29 October 2009 (UTC)Reply

No idea; that should work. Do regular wiki-links work on a page, when you have the page's URL set to the form "/index.php?title=Page_name"? Yaron Koren 23:06, 29 October 2009 (UTC)Reply
Yes, manually changing the URL from "/index.php/Testpage" to "index.php?title=Testpage" leaves the links working. Problem only exists on calendar when I jump to a different calendar page.--78.34.102.66 11:04, 2 November 2009 (UTC)Reply
What versions of MediaWiki, SMW and SRF are you using? Yaron Koren 15:32, 2 November 2009 (UTC)Reply
MediaWiki 1.15, SMW 1.4.1 and SRF 1.4.5, pretty up to date I think. --78.34.102.66 15:45, 2 November 2009 (UTC)Reply
Okay, found out something more: There is no problem with the calendar when selecting different months with the drop-down box on the right side, then the URL keeps the right format "/index.php/Kalender?title=Kalender&month=7&year=2009". Just when going to next or previous month with the two arrows right and left of the "Today" link, the URL switches to "/index.php?title=Kalender&month=11&year=2009". Here is a screenshot of what I mean: http://www.abload.de/img/calendarr9rp.png. Wondering that no one else has experienced this issue before, there seems to be a problem with those two buttons. --87.79.175.64 18:03, 2 November 2009 (UTC)Reply
Wait, those arrows point to URLs that contain "index.php"? The problem before was that they didn't include "index.php", right? Yaron Koren 18:49, 2 November 2009 (UTC)Reply
With the arrows you reach an URL where the index.php is followed by a question mark, as stated above. And once the calendar URL is like this, all links within the calendar are missing the index.php. If I edit the URL manually, putting the "/" after the index.php and reloading the page, also the links in the calendar have the index.php included again.--87.79.176.218 07:51, 3 November 2009 (UTC)Reply
My guess is that this is somehow a problem with your wiki's URL rewriting, but I don't know more than that. Yaron Koren 18:10, 4 November 2009 (UTC)Reply

I find the text a bit unclear, at least it isn't clear to me how I should be able to get this to work. I am able to get a calendar, but don't get any events on there.

Could someone add a step-by-step guide? Questions I have are: - Do I need to add anything more than the property date, within or outside a template? I now did (left out the {}):

update |date=February 22, 2010

  • Do I need to define date as date? So edit date to state "has type::date"?
  • Do I need to define a page explicitly as event, or does that happen automatically due to it having a date?
  • Or, should I just define a different kind of category and use that one?
  • Do I need to define #calendarstartdate and #calendarenddate?

Sorry if I have missed something in the semantic mediawiki guide, please give me specific pointers to what, if anything, I clearly missed or misunderstood.

Thanks a lot in advance,

Frank

Hi - yes, the date property (whether it's called "Date" or anything else) has to be defined with "has type::date". No, you don't need to do anything else to define a page as an event. And you don't need to define those two functions - you don't even need to use them for now. I would try running the query without "format=calendar" and see if you can get any results - it could be that your problem is unrelated to the calendar. Yaron Koren 18:54, 1 March 2010 (UTC)Reply
Fixed it, is was indeed calendar independent: interpreted the 'has date' as something haveing the property 'date', but ofcourse it is just another name for a date property or whatever you call it. So, given my definition of an update, my query had to read 'date' everywhere where 'has date' was used.--82.75.111.229 15:47, 7 March 2010 (UTC)Reply

How to add an event[edit]

I tried following instructions above, but did not quite understand. Please confirm the following: On a page where I want to display a calendar, I use,

{{#ask:
  [[Category:Events]]
  [[Has date::>{{#calendarstartdate:}}]]
  [[Has date::<{{#calendarenddate:}}]]
  |? Has date
  |format=calendar
}}

then, for a page I want to be able to list in a calendar, what syntax do I use? AJC - 05/14/2010

You could put something like [[Has date::January 1, 2010]] [[Category:Events]]. "Has date" has to be defined as a "Date" property, also. Yaron Koren 17:21, 14 May 2010 (UTC)Reply
How do you define "Has date" as a "Date" property?
Thanks for the tip. I think there may be something else going on with my calendar, since I am not able to view any other month other than May. My event page now reads

"Has type::date and Has date::May 1, 2010" still nothing though.

FIXED - This is what I did. I created a Property page for the name I wanted to use to specify the date, in this case, Deployment_Date
http://mywikiserver/wiki/index.php/Property:Deployment_Date

Then on the page I want my calendar displayed on: (see where I used deployment date instead of has date)

{{#ask:
<!--
  [[date::>{{#calendarstartdate:}}]]
  [[date::<{{#calendarenddate:}}]]
-->
   [[deployment date::+]]
  |?deployment date
  |format=calendar
}}

Then, on the page I want listed as an event:

[[deployment date::May 5, 2010]]

Works perefectly! - A Calhoun - 10:34, 19 May, 2010

Is the calendar supposed to honor local time for the user?[edit]

I'm using the current version of SRF. When using the calendar format I notice that it is using UTC to determine which day is the current day, instead of using the local offset for the current user. As an example, for me with a local time offset of "-8:00", any time after 1600 hours local the calendar shows tomorrow as the current day instead of today.

I would have thought the calendar could pick up the users time offset and incorporate that into the date calculations?

Thanks!

Al Hooton

Future Development[edit]

Are there any plans that will allow the Calendar format to query more than simply the page title? I run a racing website that covers a number of different racing series, so instead of the user simply seeing all the races on a given date, it'd be nice to be able to add a ?Series argument so that the user instead of seeing 2010 Joe Shear Classic 136, 2010 Crane Cams 250 can instead see 2010 Joe Shear Classic 136 (ASA-MWT), 2010 Crane Cames 250 (USAR). --98.101.84.49 18:19, 15 April 2010 (UTC)Reply

You can already do that, can't you? Yaron Koren 15:50, 3 May 2010 (UTC)Reply

Display events as bullet points or alternating colours within the calendar[edit]

The existing options for colour are fine but would it be possible to display events within one day as bullet points and/or as alternating lines so every event entry displays with alternating background colour since one day can have more than one entry and it gone be hard to read with out an identifier. --MWJames 15:13, 3 May 2010 (UTC)Reply

This sounds like a question better suited to the mailing list, since there are a lot of factors that could go into the design. Yaron Koren 15:52, 3 May 2010 (UTC)Reply
Thanks, that's fine with me, just sent out the message. --MWJames 15:04, 4 May 2010 (UTC)Reply

Resizing the Calendar[edit]

Is there any way to resize the calendar?

Well, resizing the browser should resize the calendar; but other than that, no. Unless you're talking about just, say, displaying the calendar in a smaller size for everyone. If so, that should be doable by changing the CSS... Yaron Koren 19:27, 11 May 2010 (UTC)Reply

Week view[edit]

Is it possible to only show a few days (for instance a Week) instead of the whole month??

No, unfortunately. Yaron Koren 15:40, 11 October 2010 (UTC)Reply
This would be a nice feature, though. --[[kgh]] 15:29, 10 May 2011 (UTC)Reply

Calendar not displaying correctly[edit]

I have successfully been able to run a query getting the results I expected. The problem now is that the calendar is not rendering correctly. I see the calendar but in basic text, no borders, no colour, small etc. I can't scroll to the next month etc. I am guessing I am missing some css/js. I am using 1.16. Couldn't see documentation regarding the need to add any css/js code. Please help. Glenn --156.22.9.252 22:37, 28 February 2011 (UTC)Reply

What version of Semantic Result Formats are you using? Yaron Koren 22:41, 28 February 2011 (UTC)Reply
Version 1.5.2.1 Glenn --156.22.9.252 23:25, 28 February 2011 (UTC)Reply
Hm... there might be a problem with your settings, or your file permissions. If you look at the "HTML source" for the page, and click on the link for "SRFC_main.css", does it lead to a normal-looking CSS page? Yaron Koren 16:02, 1 March 2011 (UTC)Reply
It is now suddenly working...wierd. May have been a cache issue ?? Thanks for your help anyway. Glenn --156.22.9.252 23:51, 1 March 2011 (UTC)Reply

Code for an event with multiple days[edit]

Hi all,

Most of my events will be over 2 days. I have been able to get a single day event to work but need assistance with multiple day events to ensure the event shows up on multiple days on the calendar.

Current code is as follows:

{{#ask:[[Category:Events]]
[[Has date::>{{#calendarstartdate:}}]]
[[Has date::<{{#calendarenddate:}}]]
|? Has date
|format=calendar
}}

Help would be appreciated. Thanks. Glenn --156.22.9.252 00:17, 2 March 2011 (UTC)Reply

Your best bet is probably to use #set_recurring_event for that. Yaron Koren 00:53, 2 March 2011 (UTC)Reply
This is not a recurring event, simply one that goes for 2 or more days which I would like reflected on the calendar. I see the top discussion refers to same but with no code advice. For each event I will have a property of "start date" and "end date". Glenn --156.22.9.252 02:23, 2 March 2011 (UTC)Reply
My recommendation still stands. It would be cool if there were a nicer way to do it, but I don't think there is. Yaron Koren 03:09, 2 March 2011 (UTC)Reply
Thanks, suggested code? Glenn --156.22.9.252 03:50, 2 March 2011 (UTC)Reply

start=2[edit]

Hi, the example provided at discoursedb.org includes this setting. However I cannot find a documentation for it. I would be great to have it. Thank you and cheers --[[kgh]] 15:30, 10 May 2011 (UTC)Reply

That's not an actual parameter - some other user added it to the query about six months ago, for no apparent reason. I just reverted the change. Yaron Koren 22:42, 10 May 2011 (UTC)Reply
It looked like a strange effort to set Monday as the first day of the week. It is good to know that everything is ok now. Thank you and cheers --[[kgh]] 06:21, 11 May 2011 (UTC)Reply

<p><br /></p>[edit]

Heiya, this extension automatically includes this extra section just above the navigation table. I think it should be removed since it results in quite a big wast of space. In case wiki users would like to have it, it will be easier to insert the space into the page directly. Are there any other thoughts on this? Cheers --[[kgh]] 10:26, 14 May 2011 (UTC)Reply

Sorting by time of day[edit]

The calendar would have been benefited from having an event sort mechanism within each day referring to some time-of-day property.--Even Thorbergsen 21:51, 16 May 2011 (UTC)Reply

You might be able to do that just using "sort=" - I haven't tried it, but my guess is that it would work. Yaron Koren 16:47, 29 June 2011 (UTC)Reply
It works, thanks a lot. I can add it to the description. --Even Thorbergsen 13:58, 21 July 2011 (UTC)Reply
I notice that my attempt to explain the sorting mechanism with the use of a separate time-of-day property alongside a Has date property (the variant I have checked), has been modified to referring to a Has date with time-of-day resolution. Shouldn't both possibilities be described?--Even Thorbergsen 22:35, 21 July 2011 (UTC)Reply
Yeah, sorry - I think the much more common setup is to have both date and time stored with the same property. But putting in something about the other possibility would be good. Yaron Koren 22:47, 21 July 2011 (UTC)Reply

Showing other month than current[edit]

Is it possible to show by default a different month than the current month? --Dgennaro 15:29, 29 June 2011 (UTC)Reply

Not at the moment, no... though it's not a bad idea for a feature. Yaron Koren 16:46, 29 June 2011 (UTC)Reply

displaying multiple recurring events[edit]

hi, I am currently working on a calendar. I want to display the time of the event. Using templates this is possible.

Template1
<includeonly><span style="display:none">{{#ask:[[{{{1}}}]]
|?startOfEvent
|template=Template2
}}</span><div style="line-height:10px;font-size:9px;border-left:3px solid red"
>[[{{{1}}}|{{#var:EventBegin}} [{{{3}}}] {{{4}}}]]<br 
/>{{#if:{{{5}}}|<span style="font-size:95%"
>{{{5}}}</span>}}</div></includeonly>
Template2
<includeonly>{{#vardefine:EventBegin|{{#time:H:i|{{#explode:{{{1}}}|,|0}}}}}}</includeonly>
Calendar page
{{#ask:
[[startOfEvent::>{{#calendarstartdate:}}]]
[[startOfEvent::<{{#calendarenddate:}}]]
|?startOfEvent
|?eventType
|?eventName
|?location
|?info
|limit=200
|format=calendar
|sort=startOfEvent,eventType
|order=ascending,ascending
|template=Template1
}}
Event page
{{#set:
|startOfEvent = 2011/09/19 19:00:00
|eventType = Meeting
|eventName = City foo
|location = Foo Bar, somewhere
|info = Same procedure as every week, James
}}
{{#set_recurring_event:
property=startOfEvent
|start=2011/01/03
|end=2013/09/05
|unit=week
|period=1
|include=2011/09/19
|exclude=2011/08/15; 2011/08/22; 2011/08/29
}}

I'm having the problem, that I cannot identify what the currently processed date is. Is there a variable telling me which date is currently being processed? This would help me a lot, because then I could identfy the time of each event. So far, as you can see in template2, I take the time of the first value. If there is no such feature, then this would be my wish. Thanks, Alex 83.135.252.13 18:32, 14 September 2011 (UTC)Reply

Controlling Pagename Link Text after passing to semantic-template[edit]

The {{{PAGENAME}}}s returned in our SR are uninformative, and wed like to use other an image or parserfunction result as the text to link to the page from within a template. Is there a way to pass the plaintext of SR's pagename to a template, or an alternative way of specifying link target?

example:  
[[{{{1}}}|{{{expression}}}]]
* 1 - PAGENAME
* expression -   #if statement of some complexity

Answer: Use "|link=none" argument in semantic query.