Home arrow Support & FAQs arrow Forum arrow Extensionsarrow Archivearrow JCal Proarrow Feature Requests (board locked)arrow User connected to new event?
Pages: [1]
Print
Author Topic: User connected to new event?  (Read 5355 times)
oscar
Newbie
*

Karma: +0/-0
Posts: 11


View Profile Email
« on: February 06, 2007, 07:25:29 AM »

Is it possible to see who posted a new event, before approving it?
Logged
ludootje
Newbie
*

Karma: +0/-0
Posts: 27


View Profile
« Reply #1 on: February 06, 2007, 05:58:52 PM »

There is no field "submitted_by" or something like that in the jcalpro events table, at least not at this moment. As far as I understand it, that means it is impossible to see who posted a new event. I hope this will be included very soon, because it would make approval much more reliable and sensible.

Furthermore, at this moment, you can only allow a Joomla user group ("registered user", "author", "publisher" etc.) to edit events. This means that every Tom, Dick and Harry can change events entered by anyone, provided he (the editor) belongs to that group, even those events entered by the Super Administrator. I don't think that is very desirable. I would Very Much like to see this facility to allow only the original submitter of an event to edit, at least as an option.

Ludo
Logged
V-man
Administrator
Hero Member
*****

Karma: +101/-3
Posts: 3484


JCal Pro, the Joomla calendar


View Profile
« Reply #2 on: February 06, 2007, 09:17:28 PM »

I think we've added this to the feature set for a future release. I think it will be necessary for 'author' privileges as well as interactions with other components like CB.
Logged

*** Please read this post and the FAQs before posting in the forum. ***
*** Documentation links: JCal Pro | sh404SEF | I'll Be There RSVP ***
*** Support questions via PM or e-mail will be ignored.
ludootje
Newbie
*

Karma: +0/-0
Posts: 27


View Profile
« Reply #3 on: February 11, 2007, 05:07:14 AM »

Hi,

I inserted a very short and undoubtedly incomplete patch to make it possible that the original contributor is the only one who can EDIT his or her event (and, of course, the Administrator and Super Administrator). It goes like this:
- add an extra field to your jos_jcalpro_events table. Call it "joomla_userid", type INT, length 11, non zero. Insert it at the END of the table!! (doesn't actually matter much, but if you do, you minimize the coding needed further on).
- The coding happens in components/com_jcalpro/admin_events.php
- In the beginning, for instance right below "defined(_VALID_MOS)", insert this:
Code:
global $database, $my;
- A few lines further, there's the "case 'edit'". Immediately below the "case", insert this:
Code:
$query = "SELECT * FROM jos_jcalpro_events WHERE extid= $extid";
$database->setQuery($query);
$rows = $database->loadObjectList();
$row = $rows[0];

if ($my->id == $row->joomla_userid || $my->usertype === "Administrator" || $my->usertype === "Super Administrator") {
   
} else {
?> <script language="javascript" type="text/javascript">alert("You are not authorized to edit this event.")
javascript:history.go(-1)</script>
<?php
return;
}
So the original code remains intact. These few lines match the user's id with the id of the original contributor. Or, if he's Admin or Super Admin, he's allowed to enter the edit function.
- Now we still need the code to insert the original contributor. This is, of course, done in the function where a new event is dealt with: print_admin_add_event_form
- In that function, add this at the very beginning:
Code:
global $my;
$userid = $my->id;
- Towards the end of that function, you'll find a long Insert statement, which begins with "query = INSERT INTO ".$CONFIG_EXT['TABLE_EVENTS'] .
There, at the end of the "title, description... published" line, make the line look like this: 
...
Code:
published, joomla_userid
And at the end of the Values line, add the $userid variable, so the line looks like:
Code:
'$recur_until', '1', '$userid'

OK, that's it.

Now, be aware that this code overrides certain settings with regard to "editing rights" which you may have set in the backend. If the logic of this patch doesn't coincide with your settings, umm, very sorry then Smiley. It's meant as a Very rough patch, but for me it does what I wanted. From now on, registered users on my site can still contribute an event, but editing has become the privilege of the original contributor (and the admins), which is what I wanted. There may also be a whole lot of considerations with Community Builder, which I didn't look into (because I don't use the darn thing). But if your only requirement is to have the original contributor to become the sole editor of the event, this code will probably do the trick for you. But noooooo guarantees! It is a patch, nothing more.

Ludo
« Last Edit: February 11, 2007, 09:21:34 AM by ludootje » Logged
V-man
Administrator
Hero Member
*****

Karma: +101/-3
Posts: 3484


JCal Pro, the Joomla calendar


View Profile
« Reply #4 on: February 14, 2007, 11:01:20 PM »

Thanks Ludo.
Logged

*** Please read this post and the FAQs before posting in the forum. ***
*** Documentation links: JCal Pro | sh404SEF | I'll Be There RSVP ***
*** Support questions via PM or e-mail will be ignored.
McMasters
Newbie
*

Karma: +0/-0
Posts: 8



View Profile
« Reply #5 on: March 07, 2007, 11:51:15 AM »

Friggin' AWSOME!!  Grin  Cheesy  Grin  Cheesy

Works with CB. Wink

The directions are a bit difficult to understand for the codeing challenged.....me

ADD THE TABLE AS DESCRIBED IN THE ORIGINAL POST OR YOU WILL GET DATABASE ERROR WHEN SUBMITING

NOTE: This only works with new submissions, since this is a new field in the table. If you want it to be retroactive you will have to edit that field with the correct userid's.
So it works with anything newly submitted. Because now when a user submits an event his/her id # is attaced to the event. Which is very very COOL. Like the Fonz. Roll Eyes

top of file should look like...
Code:
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $database, $my;

if (!defined('ADMIN_EVENTS_PHP')) {
  define('ADMIN_EVENTS_PHP', true);
  include $CONFIG_EXT['LANGUAGES_DIR']."{$CONFIG_EXT['lang']}/index.php";
  }




Make the case 'edit look like....
Code:
case 'edit':
$query = "SELECT * FROM jos_jcalpro_events WHERE extid= $extid";
$database->setQuery($query);
$rows = $database->loadObjectList();
$row = $rows[0];

if ($my->id == $row->joomla_userid || $my->usertype === "Administrator" || $my->usertype === "Super Administrator") {
   
} else {
?> <script language="javascript" type="text/javascript">alert("Only the original poster and system administrators are able to edit this event.")
javascript:history.go(-1)</script>
<?php
return;
}

if(!empty($extid) && require_priv('edit')) {
$event_mode 'view';
pageheader($lang_event_admin_data['edit_event'] . " :: " $lang_event_admin_data['section_title']);
print_edit_event_form($extid);
} else if (has_priv('Administrator')) {
pageheader($lang_event_admin_data['section_title']);
print_event_list();
}
 break;

// Functions area should look like...
Code:
/ Functions

function print_admin_add_event_form($date = '') {
// function to display events under a specific category
global $my;
$userid = $my->id;
global $database, $CONFIG_EXT, $today, $lang_add_event_view, $lang_system;
global $lang_general, $extmode, $errors, $lang_settings_data;

End of that function should look like...
Code:
$query = "
INSERT INTO ".$CONFIG_EXT['TABLE_EVENTS']." (
title, description, contact, url, email, picture, cat, day, month, year, start_date, end_date, approved, recur_type, recur_val, recur_end_type, recur_count, recur_until, published, joomla_userid
) VALUES (
'$title','$description','$contact','$url','$email','$picture','$cat','$day','$month','$year','$start_date','$end_date','$approve','$recur_type','$recur_val','$recur_end_type','$recur_count','$recur_until', '1', '$userid'
)";
extcal_db_query($query);

But that's not all --- this also works for event deletes. Back up top in the case area --

case 'del' : should look like....
Code:
case 'del' :

$query = "SELECT * FROM jos_jcalpro_events WHERE extid= $extid";
$database->setQuery($query);
$rows = $database->loadObjectList();
$row = $rows[0];

if ($my->id == $row->joomla_userid || $my->usertype === "Administrator" || $my->usertype === "Super Administrator") {
   
} else {
?> <script language="javascript" type="text/javascript">alert("Only the original poster and system administrators are authorized to delete this event. ")
javascript:history.go(-1)</script>
<?php
return;
}


if( !empty($extid) && require_priv('delete') ) {
$event_mode 'view';
pageheader($lang_event_admin_data['delete_event'] . " :: " $lang_event_admin_data['section_title']);
delete_event($extid);
} else if (has_priv('Administrator')) {
pageheader($lang_event_admin_data['section_title']);
print_event_list();
}
break;



You can change the javascript alert box to say what ever suits your site or style.

GREAT WORK LUDO

Logged
V-man
Administrator
Hero Member
*****

Karma: +101/-3
Posts: 3484


JCal Pro, the Joomla calendar


View Profile
« Reply #6 on: March 07, 2007, 12:15:40 PM »

Works with CB. Wink

Do you mean you are using it as a private personal calendar in CB, or u mean the private editing rights for publicly available events.
Logged

*** Please read this post and the FAQs before posting in the forum. ***
*** Documentation links: JCal Pro | sh404SEF | I'll Be There RSVP ***
*** Support questions via PM or e-mail will be ignored.
Wolfcreek
Beta Testers
Newbie
*

Karma: +0/-0
Posts: 3


The Wolf's Den


View Profile WWW
« Reply #7 on: March 12, 2007, 09:31:47 AM »

This is a good question.  I'm trying to develop a CB "appointment reminder" and if you've already done the work to install a pass for userID, then I can implement it and have a CB plugin ready to go with a formal release of any user ownership capabilities of this component.

I was looking for someone to do this and allow us to build it into a "virtual office", but this plugin with the userID capabilities would open things up to allow businesses the ability to post their events, have them show in a tab on CB, or allow appointment generation for someone that wants to keep up with the calendar on a more personal note.

I'm anxious to see this in place.

Will wait for a response before proceeding.

Wolf.

**EDIT**-  Seems that McMasters and I are on the same page.  Love it.  This means there are alot of people that see the value in this option for both the use of the calendar and integration into CB.  I'm so very excited by this news!!!
« Last Edit: March 12, 2007, 09:40:49 AM by Wolfcreek » Logged

Wolf Creek Idea Group
It's a pack mentality around here...just don't sniff inappropriately!
lenamtl
Newbie
*

Karma: +0/-0
Posts: 5


View Profile
« Reply #8 on: April 07, 2007, 03:50:44 PM »

Hi,

Let me know if you do a CB plugin for this.

Thanks
Logged
McMasters
Newbie
*

Karma: +0/-0
Posts: 8



View Profile
« Reply #9 on: May 01, 2007, 10:12:57 PM »

I have gotten a couple of IM's regarding what I meant when I wrote:
Works with CB. Wink

I was responding to what was stated by Ludo at the top of this thread.


 ...There may also be a whole lot of considerations with Community Builder, which I didn't look into (because I don't use the darn thing)...

Ludo

However a CB tab with Calendar postings would be very cool.

Cheers Grin



Now if someone could only figure out how to have Joomla bring me my coffee in the morning, then I would be truely happy Cheesy
« Last Edit: May 01, 2007, 10:23:31 PM by McMasters » Logged
lordbyron
Newbie
*

Karma: +0/-0
Posts: 9



View Profile
« Reply #10 on: May 05, 2007, 04:07:22 AM »

I've been looking for just such a CB plugin for ages. Please keep us posted if you make any progress... Thanks!
Logged
euphoric
Newbie
*

Karma: +0/-0
Posts: 5


View Profile
« Reply #11 on: February 28, 2008, 09:21:45 PM »

Any developments on this?

There still seeems to be no solution to these problems and its almost been a year!!!!
Logged
Pages: [1]
Print