Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1]   Go Down
Print
Author Topic: Modification request  (Read 477 times)
0 Members and 1 Guest are viewing this topic.
hawaiimikan
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: September 04, 2003, 03:19:00 AM »

Hello everyone:
I would like to have the template modified in order to have two sections for each box of the calendar.  I would like to have all events in the same category be placed on the top portion of the box and all events in another category be placed in the bottom half of the box.  Is this possible?

I guess two categories must be set up first and then when adding events, the user must choose which category he/she would like to place the event.

Could you help me on this?  Thanks.

 

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: September 04, 2003, 07:50:00 PM »

** I would like to have all events in the same category be placed on the top portion of the box and all events in another category be placed in the bottom half of the box. Is this possible?  **

Very likely.

** I guess two categories must be set up first **

I would think so.

** Could you help me on this?  **

I can tell you you'll need to sort the events before printing them, you'll need to make a conditional to print them depending on category and that the area of the default.html template file which will likely need to be edited (for 'Grid View' anyway) starts just after about at the lines:

<%FOREACH GRID COLUMN%>
...
<%FOREACH EVENT%>

What might be easier though is just sort the events and print one category's events first, followed directly with the other.

JMO

Dan O.

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

Logged
hawaiimikan
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: September 08, 2003, 04:43:00 AM »

Thank you for your reply.
I'm new to Calendarscript and just learning how to modify it.
I was able to set up categories and also assigned color to each category.
I search the forum for sorting and printing the events but unable to locate any threads.
Would you assist me on sorting and printing events?
Thank you.

Hawaiimikan

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: September 10, 2003, 08:12:00 PM »

Sorry, I missed your reply previously.

** Would you assist me on sorting  **

You'll have to say on which calendar display (Month View, Day View, etc.) you want the events to be seen sorted on.

** and printing events **

You mean on a printer? There is a print template at the Unofficial CalendarScript - Mods and Plugins site which should work for printing out pages of the calendar. All you should have to do is create a link to it.

BTW. When *I* said printing in my previous message I meant before displaying them in the calendar. JFYI

Dan O.


[This message has been edited by DanO (edited September 10, 2003).]

Logged
hawaiimikan
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: September 11, 2003, 03:17:00 AM »

Hello Dan O.
Thank you for your reply.
I was able to sort events on month view (grid) by following the instructions from this thread. http://www.calendarscript.com/support/forum/Forum3/HTML/000190.html
The above thread sort events based on alphabetical order. To sort my categories properly, I added numbers before each category name.  I'm sure I could do the same for sorting events on list month view.  I got the events printed properly on the calendar.  
**What might be easier though is just sort the events and print one category's events first, followed directly with the other.**
The calendar is now printing on the calendar as you suggested.  What I would like to do now is to separate each box into two sections (two cells separated by a line).  I'd like to put events from one or more categories on the top cell and events from one category on the bottom cell.
Thank you very much.
hawaiimikan

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

[This message has been edited by hawaiimikan (edited September 11, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: September 11, 2003, 07:26:00 PM »

** To sort my categories properly, I added numbers before each category name **

It might help to picture it if you posted the code you're actually using (not to mention help other whom might happen upon this message).

** What I would like to do now is to separate each box into two sections (separated by a line). **

You would have to put a conditional just before where the lines are printed out and insert an <HR> HTML tag when the category changed from one to another.

Dan O.

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

Logged
hawaiimikan
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #6 on: September 16, 2003, 05:28:00 AM »

Hello Dan O,
On the calendar.pl I replaced the following lines:

@{$Grid->{'grid'}->[$y]->[$x]->{'events'}} = sort { ($a->{'schedule'}->{'start'} <=> $b->{'schedule'}->{'start'}) | | ($a->{'details'}->{'id'} <=> $b->{'details'}->{'id'}) } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};

to:

@{$Grid->{'grid'}->[$y]->[$x]->{'events'}} = sort { $a->{'details'}->{'category'} cmp $b->{'details'}->{'category'} } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};
               $EventList->{$Grid->{'grid'}->[$y]->[$x]->{'datestring'}} = sort { $a->{'details'}->{'category'} cmp $b->{'details'}->{'category'} } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};

These codes sort the events in alphabetical order based on the category.


I added a category field and listed the following categories in the select box.
O1_Test
02_Lecture
03_Lab
04_Homework
05_Holiday
06_Other

I wanted to print the categories in the above order.
In order to print the events in this order,  I added numbers in front of each of the category name. Otherwise, Holiday will be printed first, followed with Homework, Lab, Lecture, Other, and Test.


I'm using the dayspan template and on the default.html
I added the following codes for color coding.
<%
if ($EVENT->{details}->{category} eq "01_Test") {$color="#ff0000";}
elsif ($EVENT->{details}->{category} eq "02_Lecture") {$color="#000000";}
elsif ($EVENT->{details}->{category} eq "03_Lab") {$color="#0000FF";}
elsif ($EVENT->{details}->{category} eq "04_Homework") {$color="#009900";}
elsif ($EVENT->{details}->{category} eq "05_Holiday") {$color="#FF66FF";}
elsif ($EVENT->{details}->{category} eq "06_Other") {$color="#990000";}
else {$color="#000000";}
%>
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><FONT COLOR="<%=$color%>"><%= EVENT FIELD(title) %></FONT></A><BR>

As for the line, I'd like to have a straight line that goes across each week, regardless of whether the section above or below the line is empty.  And the line should be located below the dayspan line or section.  I would like the homework events to be printed in the bottom half section of the box and other events on the top section of the box.

**You would have to put a conditional just before where the lines are printed out and insert an <HR> HTML tag when the category changed from one to another.**
Could you help me on the codes?

Thank you.
hawaiimikan


     


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

[This message has been edited by hawaiimikan (edited September 16, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #7 on: September 16, 2003, 12:43:00 PM »

** I would like the homework events to be printed in the bottom half section of the box **

You mean you want a dividing line to be printed above the events listed starting with the 04_Homework category.

** I added a category field and listed the following categories in the select box.
O1_Test > I assume this is 01_Test and not O1_Test
02_Lecture
03_Lab
04_Homework
05_Holiday
06_Other **

** Could you help me on the codes? **

It would have been easier if you'd made the category values just numbers like 1, 2, 3, 4, etc.

The code that then could be used to print the separater could be something like this

<%
if ($EVENT->{details}->{category} > 3) {
if (!$printedbreak)
{
print "<HR>";
$printedbreak = 1;
}
}

You would have to find where the code goes yourself as I'm not familiar with the template you're using.

Of course, if you change the category field values to numbers, you'd also have to change your sort routine to deal with numbers in stead of strings like you have now and also the conditionals for coloring the titles.

Dan O.

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

Logged
hawaiimikan
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #8 on: September 16, 2003, 01:51:00 PM »

**You mean you want a dividing line to be printed above the events listed starting with the 04_Homework category.**

Yes.  I would like a dividing line to be printed above the events belonging to all categories except "Homework."  Events in the Homework categories should be printed below the dividing line.

**O1_Test > I assume this is 01_Test and not O1_Test **
Yes, you are right.

**It would have been easier if you'd made the category values just numbers like 1, 2, 3, 4, etc.**
Yes, I agree with you.  It is easier to sort with number than with text. But if numbers were used for categories, would I be able to represent these numbers as "Text" in the select box?

Thanks again.
hawaiimikan

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #9 on: September 16, 2003, 05:54:00 PM »

** I would like a dividing line to be printed above the events belonging to all categories except "Homework." Events in the Homework categories should be printed below the dividing line. **

I think you mean "all events to be printed above the dividing line except Homework which would go below it".

In that case you should number the Homework category as the highest number and adjust the conditional code appropriately to print the <HR> before it.

Since you only want the one category to be preceded by the line, you should be able to keep the category field values as they are and just use a conditional comparing the category to the Homework category's value.

** But if numbers were used for categories, would I be able to represent these numbers as "Text" in the select box? **

The values in a select field are not seen at all. Their text titles can be anything you like and need not even include the value you're using for them.

Dan O.

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

Logged
Pages: [1]   Go Up
Print
Jump to: