My Subscriptions

No active or expired subscriptions. View Available Subscriptions

Advanced Search

Home arrow Forum arrow JCal Pro 1.5.xarrow 1.5.x General Discussionarrow SOLVED: publishing new events
Pages: [1]
Print
Author Topic: SOLVED: publishing new events  (Read 4332 times)
libbyy
Newbie
*

Karma: +0/-0
Posts: 31


View Profile Email
« on: February 28, 2007, 05:31:15 AM »

Hi
When I add new events (either from the front end or back end) I receive an email saying they require authorsation. If I go into the backend these events are marked 'published' but are in fact not published. If I edit those events and save then they are published. Is there anyway I can ensure that these unpublished events are actually marked unpublished so I can see at a glance what needs to be checked?
« Last Edit: March 03, 2007, 05:40:13 PM by V-man » Logged
dlb
Newbie
*

Karma: +0/-0
Posts: 11


View Profile
« Reply #1 on: March 02, 2007, 04:25:38 PM »

I'm having the same problem.  Editing and saving without any changes will "really" publish the event.  Using version 1.5.1.2.
Logged
V-man
Administrator
Hero Member
*****

Karma: +5/-1
Posts: 1803


Ignorance is curable, stupid is forever.


View Profile
« Reply #2 on: March 02, 2007, 04:56:27 PM »

This bug has been confirmed for front-end event submissions by users without approval privileges as specified in the settings. In addition, toggling the publish status of the event doesn't solve the problem the event MUST be opened and saved to show up on the calendar. We'll get this one sorted.

In the backend however, JCal doesn't check for the approval permissions (since you should be a manager or admin to be in the backend at all). Can you confirm that creating events from the backend gives this error?
« Last Edit: March 02, 2007, 04:58:33 PM by V-man » Logged

*** Please read this post before posting in the forum. ***

Support questions via PM will be ignored. Please use the forum for all support-related enquiries.
dlb
Newbie
*

Karma: +0/-0
Posts: 11


View Profile
« Reply #3 on: March 02, 2007, 05:12:21 PM »

From the back end, logged in as super admin, a newly added event publishes correctly.
Logged
van
Sr. Member
****

Karma: +0/-0
Posts: 442


View Profile
« Reply #4 on: March 02, 2007, 09:14:05 PM »

The original authors created that neat little Email system for approving events by non-admins, but unfortunately that's all they did. I can't find anywhere in the Admin forms where you can view or change the "Approved" flag, except by editing and saving the record.

However, it is easy to implement:

Add this block at Line 371 of "administrator/components/com_jcalpro/includes/events.html.php". It should go right under the similar block for "Published":

Code:
<tr>
<td valign="top" align="right">
Approved:
</td>
<td>
<?php echo $lists['approved']; ?>
</td>
</tr>

Then, add the following at line 232 of "administrator/components/com_jcalpro/includes/events.php", right under the similar line for "published":

Code:
$lists['approved'] = mosHTML::yesnoradioList ( 'approved', '', $row->approved );

This will add an "Approved" flag right under the "Published" flag that will let you view and change the approval status.

However, I think the ideal solution is to change the Event List, so it shows both the Published and Approved flags, which would both be clickable.
Logged
van
Sr. Member
****

Karma: +0/-0
Posts: 442


View Profile
« Reply #5 on: March 02, 2007, 09:40:06 PM »

And here are the edits to add "Approved" as a clickable column in the Event List:

In "events.html.php", add this block at line 106 (right under the similar block for "published":

Code:
$app_img = $row->approved ? 'tick.png' : 'publish_x.png';
$app_task = $row->approved ? 'notapprove' : 'approve';
$app_alt = $row->approved ? 'Approved' : 'Not Approved';

In "events.html.php", add this block at line line 149 (right under the similar block for the published icon):

Code:
<td>
<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $app_task;?>')">
<img src="images/<?php echo $app_img;?>" width="12" height="12" border="0" alt="<?php echo $alt?>" />
</a>
</td>

Then, in "events.php", add the following at line 75, right under the similar "case" statements for "unpublish" and "publish":

Code:
case 'notapprove':
changeEvent ( $cid, 2, $option, $section );
break;

case 'approve':
changeEvent ( $cid, 3, $option, $section );
break;

Then, in "events.php", completely replace function "changeEvent" at line 527 with the following. There were lots of little edits, so replacing the entire function seems safest:

Code:
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param integer 2 if notapproving, 3 if approving
* @param string The current option
*/
function changeEvent ( $cid=null, $state=0, $option, $section )
{
global $database, $my;

    $actions = array( 0=>"unpublish", 1=>"publish", 2=>"notapprove", 3=>"approve" );
   
if ( count( $cid ) < 1 )
{
echo "<script> alert('Select a record to ".$actions[$state]."'); window.history.go(-1);</script>\n";
exit;
}

$cids = implode ( ',', $cid );

if( $state == 0 || $state == 1 ) {
    $database->setQuery ( "UPDATE #__jcalpro_events SET published='$state'"
    . "\nWHERE extid IN ($cids) AND (checked_out=0 OR (checked_out='$my->id'))"
    );
}
if( $state == 2 || $state == 3 ) {
    $state -= 2;
    $database->setQuery ( "UPDATE #__jcalpro_events SET approved='$state'"
    . "\nWHERE extid IN ($cids) AND (checked_out=0 OR (checked_out='$my->id'))"
    );
}

if ( !$database->query ( ) )
{
echo "<script> alert('".$database->getErrorMsg ( )."'); window.history.go(-1); </script>\n";
exit();
}

if ( count( $cid ) == 1 )
{
$row = new mosJCalProEvents ( $database );
$row->checkin ( intval ( $cid[0] ) );
}

mosRedirect ( "index2.php?option=$option&section=$section" );
}

Now, you have clickable "Published" and "Approved" columns in the event list.
Logged
dlb
Newbie
*

Karma: +0/-0
Posts: 11


View Profile
« Reply #6 on: March 02, 2007, 11:18:51 PM »

That worked!  Thank you!

My line numbers differed slightly from yours, but your descriptions got me through it.  The event added on the front side defaults to published, but not approved.

Now to look the gift horse in the mouth:
  • shouldn't the event default to "false" for both published and approved?
  • you'll need to add a column heading to finish the fix, but that's for another day

Thanks again, van!

Dale
Logged
van
Sr. Member
****

Karma: +0/-0
Posts: 442


View Profile
« Reply #7 on: March 03, 2007, 12:10:45 AM »

I was wondering the same thing. It does seem confusing to show a new user-submitted event as Published, before it is Approved. I will go take a look at this.

Uh, oh ... what column heading did I miss?
Logged
V-man
Administrator
Hero Member
*****

Karma: +5/-1
Posts: 1803


Ignorance is curable, stupid is forever.


View Profile
« Reply #8 on: March 03, 2007, 12:31:21 AM »

I think having it automatically published but not approved saves a few clicks for the admin, and there is no technical downside, is there?

I think he means the table header for the approval column in the events manager.
Logged

*** Please read this post before posting in the forum. ***

Support questions via PM will be ignored. Please use the forum for all support-related enquiries.
van
Sr. Member
****

Karma: +0/-0
Posts: 442


View Profile
« Reply #9 on: March 03, 2007, 01:00:18 AM »

Oh ... forgot to post that part:

"events.html.php", Line 88, insert the following, after the similar block for "Published":

Code:
<th class="title">
Approved
</th>
Logged
dlb
Newbie
*

Karma: +0/-0
Posts: 11


View Profile
« Reply #10 on: March 03, 2007, 02:20:02 PM »

Thanks, now the events table is lovely!

I don't know if this is related, but I was adding an event on the back end to see if the new "approved" flag showed up there.  It did, so I canceled the event add.  I got the following error:

Code:
Fatal error: Call to undefined function: cancelevent() in /home/content/d/b/r/dbrackin/html/joomla/administrator/components/com_jcalpro/includes/events.php on line 83

Y'all are not going to want to see me coming if I keep this up.   Smiley
Logged
van
Sr. Member
****

Karma: +0/-0
Posts: 442


View Profile
« Reply #11 on: March 03, 2007, 03:25:53 PM »

No problem ... keep it coming! You are our eyes into a wide range of sites and implementations, helping us find stuff we won't see otherwise.

This is simple ... yet confusing. Can you look at this file:

"administrator/components/com_jcalpro/includes/events.php"

And see if you have a "cancelEvent" function at the very end of it? It should look like this:

Code:
function cancelEvent ( $option, $section )
{
global $database;

$row = new mosJCalProEvents ( $database );
$row->bind ( $_POST );
$row->checkin ( ) ;

mosRedirect ( "index2.php?option=$option&section=$section" );
}

If you do, then this could just be a problem with the order of things in this file for your particular implementation. When you get to line 83 (per the error message), it can't find the "cancelEvent" function, since it is not defined until the very end of the file.

Moving the function up to the top of this file could solve the problem, though if this is the case, it is curious how anything is working for you. Very strange ... perhaps there is something else I am not thinking of.
Logged
dlb
Newbie
*

Karma: +0/-0
Posts: 11


View Profile
« Reply #12 on: March 03, 2007, 04:37:55 PM »

It was a hardware issue - loose nut on the keyboard.   Grin

When I pasted in the changeEvent function, I accidentally overwrote the cancelEvent function (but I did overwrite it cleanly!).  Purely my fault, it works fine now.

I understand that we're your eyes, that's why I posted the "me too" post to begin with.  But it feels  ungrateful.

Thanks again, van.

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

Karma: +5/-1
Posts: 1803


Ignorance is curable, stupid is forever.


View Profile
« Reply #13 on: March 03, 2007, 05:40:40 PM »

The issue has been addressed in the forthcoming Release Candidate v1.5.2.
« Last Edit: March 04, 2007, 12:13:04 AM by V-man » Logged

*** Please read this post before posting in the forum. ***

Support questions via PM will be ignored. Please use the forum for all support-related enquiries.
Pages: [1]
Print
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com

Original Joomla Template design by RocketTheme ( Conversion by Bloc)