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
Calendar Script CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)Edit Event directly from Event Details
Pages: [1]   Go Down
Print
Author Topic: Edit Event directly from Event Details  (Read 1189 times)
0 Members and 1 Guest are viewing this topic.
rwhirn
New Member
*

Karma: 0
Offline Offline

Posts: 0

Programmer


WWW
« on: January 24, 2002, 07:47:00 PM »

Has anyone done a hack where you can edit an event directly from the Event details screen. It seems a horrible waste to click "edit event" just to get a list of all the events when you've already selected the event you want to edit.
Logged
rwhirn
New Member
*

Karma: 0
Offline Offline

Posts: 0

Programmer


WWW
« Reply #1 on: January 31, 2002, 05:23:00 PM »

Just to answer my own question for anyone else who might want to do this.

Locate the area in your default.html that says:

      <% } elsif ($VIEW eq "Event") { %>
         <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
         <%
         foreach (@$fields) {
            next unless ($db->{'properties'}->{$_}->{'display_details'});
         %>
            <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
         <% } %>

Since this is not a form you cannot add a button, but you can add a link. Add the following lines immediately after the last line above:

         <TR><TD ALIGN="CENTER" COLSPAN="2">
         <P><B><a href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR%>&username=<%=$User->{username}%>&command=edit_event_form&template=add_edit_event.html&EVENT_id=<%= EVENT FIELD(id) %>" CLASS="commandtext"><FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">Click Here to Edit This Event</FONT></A></B></P>
         </TD></TR>
         <TR><TD> </TD></TR>

You'll note I added a blank row after the link to separate it a bit from the footer text.

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

Logged
stephenlac
New Member
*

Karma: 0
Offline Offline

Posts: 0

Graphics


« Reply #2 on: February 02, 2002, 01:10:00 AM »

Very handy modification..... Thanks!

The modification had a few typos (extra spaces) that prevented it from working on my IIS server, but I've fixed those.

I've also expanded upon it and added a couple of lines to restrict the link to users with edit_event and edit_own_event permissions. Here's the code, to be inserted as per the above instructions:

<% if ($User->hasPermission($CALENDAR_KEY,"EDIT_EVENTS") | | $User->hasPermission($CALENDAR_KEY,"EDIT_OWN_EVENTS")) { %>
<TR>
<TD></TD>
<TD><BR>
<P><B><a href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR%>&username=<%=$User->{username}%>&command=edit_event_form&template=add_edit_event.html&EVENT_id=<%= EVENT FIELD(id) %>"  CLASS="navigationtext"><FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">Edit This Event</FONT></A></B></P>
<BR>
</TD></TR>
<% } %>

[This message has been edited by stephenlac (edited February 02, 2002).]

Logged
andrewhearn
New Member
*

Karma: 0
Offline Offline

Posts: 0

IT Support for an ISP


WWW
« Reply #3 on: February 04, 2002, 01:08:00 PM »

Could this be changed to a link that says 'Delete entry' instead and for the entry to be removed?

How?

Thanks!

Logged

stephenlac
New Member
*

Karma: 0
Offline Offline

Posts: 0

Graphics


« Reply #4 on: February 17, 2002, 09:17:00 PM »

Yes it can, quite easily. But use the following with caution! Normally when deleting an event you get a javascript alert that says something to the effect of... "Are you sure? This cannot be undone!"   The following code does not give you a chance to back out.

It would be fairly simple to add the javascript function from the edit_delete_events.html admin template, and do it that way. I don't have time right now to do the mods.

Here's the code to have "Edit this event | Delete this event" at the bottom of the event detail page (sans warning!):

<% if ($User->hasPermission($CALENDAR_KEY,"EDIT_EVENTS") | | $User->hasPermission($CALENDAR_KEY,"EDIT_OWN_EVENTS")) { %>
<TR>
<TD></TD>
<TD><BR>
<P>
<B><a href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR%>&username=<%=$User->{username}%>&command=edit_event_form&template=add_edit_event.html&EVENT_id=<%= EVENT FIELD(id) %>" CLASS="navigationtext"><FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">Edit This Event</FONT></A> |
<a href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR%>&username=<%=$User->{username}%>&command=delete_event&template=edit_delete_events.html&EVENT_id=<%= EVENT FIELD(id) %>" CLASS="navigationtext"><FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">Delete This Event</FONT></A></B>
</P>
<BR>
</TD></TR>
<% } %>

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

Logged
Foghorn
Guest
« Reply #5 on: January 23, 2004, 02:37:00 PM »

Is there a way to modify this so that the link will only appear in events that that particular user has added?  I want them to be able to modify their own events but not someone elses.

Thanks Much

Logged
wderzawiec
New Member
*

Karma: 0
Offline Offline

Posts: 15

Web site coordinator


WWW
« Reply #6 on: May 09, 2006, 06:43:00 AM »

Just found this and it saved me a lot of time, it's exactly what I was looking for.  Thanks.

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

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: May 09, 2006, 06:11:00 PM »

** Just found this... it's exactly what I was looking for. **

Glad to hear it. There are quite a few useful hacks (including this one) listed in the 'Links' section of the Unofficial CalendarScript - Mods and Plugins site.

** The modification had a few typos (extra spaces) that prevented it from working on my IIS server, but I've fixed those.  **

     This forum software adds a space between double | | characters. Make sure any extra space between such characters is removed from code copied and pasted from these forums.

JFYI

Dan O.

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

[This message has been edited by DanO (edited May 10, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #8 on: July 29, 2006, 04:06:00 PM »

** Is there a way to modify the above code to only let people who create the event (with edit or delete own event permissions) to edit or delete? **

If you only want the link to appear on events which the user them self has added, try changing the conditional line to:

code:
<% if ($User->{name} eq $EVENT->{'details'}->{author_name} && $User->hasPermission($CALENDAR_KEY,"EDIT_OWN_EVENTS")) { %>

        This code is un-tested so use at your own risk!

Dan O.

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

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: January 04, 2007, 02:22:00 PM »

The $CALENDAR variable in the above supplied link code should be $CALENDAR_KEY for CalendarScript version 3.2+ (and possibly for earlier version 3 installations as well). It would really only affect the code when being used on other than the default calendar.

Also, if you add the following code to the 'delete' link, users will get a JavaScript confirmation box before deleting the event (which is irreversible!).

onClick="return confirm('Are you sure you want to DELETE this event?\nTHIS ACTION CANNOT BE UNDONE!')"

JFYI

Dan O.

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

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