Calendar

Hello,
I’m working on a brand new website. The new website is a human rights calendar.
http://www.humanrightscalendar.com/
The way that I’m thinking is creating 12 sections, each for each month from Jan to Dec. The next step is creating 28-31 articles under each section for the days. Then I can modify articles. If any for example HR abuse happened in 2010-09-07, 2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way to make a better public calendar using SPIP.
Thank you
Kamran

Hi,

I think that the best way is to simply use the date of publication of an article : An article for each HR abuse.
Use the folder structure you prefere (for ex. for each year)
Just change the date of publication into the date of the event.

In this way, sorting by date is easy.

The filter {agenda} can help you finding old articles :
(doc cf.http://www.spip.net/fr_article3182.html)

For example this snippet birthday.html :

<B_yesterday>

Year : [(#DATE|annee|moins{#ENV{old}})]
#TITRE

will return the articles published #ENV{old} years ago, at the same date.

Use the plugin Bonux to create a loop other an array, and you can find every « birthday » article :
(doc : http://www.spip-contrib.net/SPIP-Bounce)

[(#REM) The oldest article, and the most recent]
<BOUCLE_start(ARTICLES){par date}{0,1}>
#SET{start,(#DATE|annee)}
</BOUCLE_start>

<BOUCLE_end(ARTICLES){!par date}{0,1}>
#SET{end,(#DATE|annee)}
</BOUCLE_end>

#SET{compteur,(#GET{end}|moins{#GET{start}})}

[(#REM)
LOOP from start to end
We re-use the snippet above
]
<B_job>

    ={0}}>
  • #INCLURE{fond=birthday,old=#GET{compteur}}
  • #SET{compteur,(#GET{compteur}|moins{1})}

That’s the idea (this code hasn’t been tested :wink: ) .

Of course you can also use the plugin calendar with the same loops, but on the table EVENEMENTS (events) this time.
Documentation for this plugin :

Hope it helps,

.Gilles

On Tue, Sep 7, 2010 at 11:16 PM, kamran Mir Hazar <kamran_mirhazar@yahoo.com> wrote:

Hello,
I’m working on a brand new website. The new website is a human rights calendar.
http://www.humanrightscalendar.com/
The way that I’m thinking is creating 12 sections, each for each month from Jan to Dec. The next step is creating 28-31 articles under each section for the days. Then I can modify articles. If any for example HR abuse happened in 2010-09-07, 2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way to make a better public calendar using SPIP.
Thank you
Kamran


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Hello,

I am working on a new calendar which will replace the old gasteroprod calendar on one of my sites. The latter has the problem that it saturates memory by loading into memory the entire spip_articles table. Therefore each site using this calendar will sooner or later find itself with a blank page where it should show the calendar.

So now I have a calendar in PHP and HTML with some CSS formatting. It uses date_redac to sort articles. This makes it possible to pre-produce articles will appear on the calendar on a certain date and have them published on a different date, for instance one week before the event will take place.

I have to rewrite this completely because SPIP does not offer the complete set of date funktions for spip_articles.date_redac. While using spip_articles.date gives you a fantastic set of easy to use filters and functions, working with spip_articles.date_redac makes it necessary to use some PHP.

Once the calendar will be in production I shall transforme it into a plugin an publish it on spip-zone. If you want to have a look right now I shall send you a link.

klaus++

P.S. Some references concerning agenda gasteroprod:

http://gasteroprod.com/blog/le-meme-agenda-que-gastero-prod-avec-spip.html
http://gasteroprod.com/blog/la-fin-de-l-agenda-gastero-prod.html
we are a modified version:
http://iris-media.lili.de/spip.php?page=rubrique&id_rubrique=31

kamran Mir Hazar wrote:

Hello,
I’m working on a brand new website. The new website is a human rights calendar. http://www.humanrightscalendar.com/ The way that I’m thinking is creating 12 sections, each for each month from Jan to Dec. The next step is creating 28-31 articles under each section for the days. Then I can modify articles. If any for example HR abuse happened in 2010-09-07, 2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way to make a better public calendar using SPIP.

Thank you
Kamran

------------------------------------------------------------------------

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Yes, that’s a problem : articles are too « big » for just an event.

The best solution is certainly to use the plugin Agenda2 (calendar), with an approach similar to those suggested by Kamran :
An article per day. And a list of events linked to this article, occurring at the same date (but not the same year).[*]

Like this, the loops will be faster.

However I’ve already met some complex situations where I had to « compile » the loops into a specific filter (it calculated the big queries with the sql API, and used the functions defined in the plugin for the result output)

Good luck, it can be complex sometimes !

.Gilles

[*] The bonus is that you can import/export the events automatically, from csv for ex.
These functions are already in the plugin – but should be adapted maybe.

On Wed, Sep 8, 2010 at 10:04 AM, klaus++ <klaus@spip.de> wrote:

Hello,

I am working on a new calendar which will replace the old gasteroprod calendar on one of my sites. The latter has the problem that it saturates memory by loading into memory the entire spip_articles table. Therefore each site using this calendar will sooner or later find itself with a blank page where it should show the calendar.

So now I have a calendar in PHP and HTML with some CSS formatting. It uses date_redac to sort articles. This makes it possible to pre-produce articles will appear on the calendar on a certain date and have them published on a different date, for instance one week before the event will take place.

I have to rewrite this completely because SPIP does not offer the complete set of date funktions for spip_articles.date_redac. While using spip_articles.date gives you a fantastic set of easy to use filters and functions, working with spip_articles.date_redac makes it necessary to use some PHP.

Once the calendar will be in production I shall transforme it into a plugin an publish it on spip-zone. If you want to have a look right now I shall send you a link.

klaus++

P.S. Some references concerning agenda gasteroprod:

http://gasteroprod.com/blog/le-meme-agenda-que-gastero-prod-avec-spip.html
http://gasteroprod.com/blog/la-fin-de-l-agenda-gastero-prod.html
we are a modified version:
http://iris-media.lili.de/spip.php?page=rubrique&id_rubrique=31

kamran Mir Hazar wrote:

Hello,
I’m working on a brand new website. The new website is a human rights calendar. http://www.humanrightscalendar.com/ The way that I’m thinking is creating 12 sections, each for each month from Jan to Dec. The next step is creating 28-31 articles under each section for the days. Then I can modify articles. If any for example HR abuse happened in 2010-09-07, 2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way to make a better public calendar using SPIP.
Thank you
Kamran



spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Memory saturation occurs because the loop in the old script simply takes _all_ articles into memory. I found it much too complicatetd to modify this code and preferred to build a new calendar from scratch. In my script only articles from one month are stored into memory and passed to the calendar so the maximum number of articles to treat is 31 * articles-per-day. I might encounter problems on a site where thousands of articles have the same date_redac but this happens quite rarely.

I also tried to do something with Emmanuel's agenda filters but their output is too complicated for my project. I would have had to eliminate the entire navigation and formatting replacing it by my own code.

In our case I have to deal with a project which is relatively old. When we started it there was only the agenda gasteroprod and it used date_redac as main date field. The publishing date is completely independent from the articles calendar-date. This turned out to be a clear advantage for an author who writes his daily article and has to do this in advance.

When you are dealing with real events like concerts and classes the agenda plugin is fine. I am using it in another site. In our project we are only publishing articles which have a strong link to the day which is defined as their calendar date. Using the plugin agenda would create an additional layer for the author and force him to fill in more forms than he has to fill in now.

My idea for a new plugin is that it would be great to have a simple SPIP tag (#CALENDRIER_MOIS etc.) which accepts as a parameter the name of any date field in a table and produces a simple html table showing alle entries for one month. It could accept additional parameters to change it's behaviour : a particular year and month, the name of a db field to display, the name of a css file, whether or not it should display navigation elements, etc.

klaus++

Gilles VINCENT wrote:

Yes, that's a problem : articles are too "big" for just an event.

The best solution is certainly to use the plugin Agenda2 (calendar), with an
approach similar to those suggested by Kamran :
An article per day. And a list of events linked to this article, occurring
at the same date (but not the same year).[*]

Like this, the loops will be faster.

However I've already met some complex situations where I had to "compile"
the loops into a specific filter (it calculated the big queries with the sql
API, and used the functions defined in the plugin for the result output)

Good luck, it can be complex sometimes !

.Gilles

[*] The bonus is that you can import/export the events automatically, from
csv for ex.
These functions are already in the plugin -- but should be adapted maybe.
---
On Wed, Sep 8, 2010 at 10:04 AM, klaus++ <klaus@spip.de> wrote:

Hello,

I am working on a new calendar which will replace the old gasteroprod
calendar on one of my sites. The latter has the problem that it saturates
memory by loading into memory the entire spip_articles table. Therefore each
site using this calendar will sooner or later find itself with a blank page
where it should show the calendar.

So now I have a calendar in PHP and HTML with some CSS formatting. It uses
date_redac to sort articles. This makes it possible to pre-produce articles
will appear on the calendar on a certain date and have them published on a
different date, for instance one week before the event will take place.

I have to rewrite this completely because SPIP does not offer the complete
set of date funktions for spip_articles.date_redac. While using
spip_articles.date gives you a fantastic set of easy to use filters and
functions, working with spip_articles.date_redac makes it necessary to use
some PHP.

Once the calendar will be in production I shall transforme it into a plugin
an publish it on spip-zone. If you want to have a look right now I shall
send you a link.

klaus++

P.S. Some references concerning agenda gasteroprod:

http://gasteroprod.com/blog/le-meme-agenda-que-gastero-prod-avec-spip.html
http://gasteroprod.com/blog/la-fin-de-l-agenda-gastero-prod.html
we are a modified version:
http://iris-media.lili.de/spip.php?page=rubrique&id_rubrique=31

kamran Mir Hazar wrote:

Hello,
I’m working on a brand new website. The new website is a human rights
calendar. http://www.humanrightscalendar.com/ The way that I’m thinking
is creating 12 sections, each for each month from Jan to Dec. The next step
is creating 28-31 articles under each section for the days. Then I can
modify articles. If any for example HR abuse happened in 2010-09-07,
2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way
to make a better public calendar using SPIP.
Thank you
Kamran

------------------------------------------------------------------------

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Thanks Gilles and Klaus.
My idea was creating article for each day of the year and then modifying articles when I want to record a HR abuse. I don’t think so there are many cases at the same day. If it was I can list them in one article and then link to full story in separate articles. It is my volunteer project for 2011. In 2012 just I can simply change the year of the articles from 2011 to 2012.
I will test your suggestions. For English sites I do not have problem with SPIP plugins, but for Farsi (Dari) sites mostly yes.
Klaus, Can you please send me the link?
Thanks again
Kamran


From: klaus++ klaus@spip.de
To: kamran Mir Hazar editor@kabulpress.org
Cc: spip-en@rezo.net
Sent: Wed, September 8, 2010 10:04:01 AM
Subject: Re: [Spip-en] Calendar

Hello,

I am working on a new calendar which will replace the old gasteroprod calendar on one of my sites. The latter has the problem that it saturates memory by loading into memory the entire spip_articles table. Therefore each site using this calendar will sooner or later find itself with a blank page where it should show the calendar.

So now I have a calendar in PHP and HTML with some CSS formatting. It uses date_redac to sort articles. This makes it possible to pre-produce articles will appear on the calendar on a certain date and have them published on a different date, for instance one week before the event will take place.

I have to rewrite this completely because SPIP does not offer the complete set of date funktions for spip_articles.date_redac. While using spip_articles.date gives you a fantastic set of easy to use filters and functions, working with spip_articles.date_redac makes it necessary to use some PHP.

Once the calendar will be in production I shall transforme it into a plugin an publish it on spip-zone. If you want to have a look right now I shall send you a link.

klaus++

P.S. Some references concerning agenda gasteroprod:

http://gasteroprod.com/blog/le-meme-agenda-que-gastero-prod-avec-spip.html
http://gasteroprod.com/blog/la-fin-de-l-agenda-gastero-prod.html
we are a modified version:
http://iris-media.lili.de/spip.php?page=rubrique&id_rubrique=31

kamran Mir Hazar wrote:

Hello,
I’m working on a brand new website. The new website is a human rights calendar. http://www.humanrightscalendar.com/ The way that I’m thinking is creating 12 sections, each for each month from Jan to Dec. The next step is creating 28-31 articles under each section for the days. Then I can modify articles. If any for example HR abuse happened in 2010-09-07, 2009-09-07 or 1951-09-07, I can list in the same article.
Do you have any better structure for such calendar? Is there a tool or way to make a better public calendar using SPIP.
Thank you
Kamran



spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en