Menu

#2722 Global categories are treated as private when an event is added from a category view

Feature_request
open
nobody
None
5
2015-02-24
2014-10-23
Alex G
No

If the calendar is set to show one category and a new event is added, the "categories" field in the "Add entry" form is defaulted to this category. But this category is treated as private even if the category is global (it became global only after this field is modified).

The quick fix is possible by adding a few lines to edit_entry.php (starting from line 403):

~~~~~~~~~~~~~~~

// Get category if passed in URL as cat_id.
$cat_id = getValue ( 'cat_id', '-?[0-9,-]*', true );
if ( ! empty ( $cat_id ) ) {
$res = dbi_execute ( 'SELECT cat_name FROM webcal_categories
WHERE cat_id = ? AND ( cat_owner = ? OR cat_owner IS NULL )',
array ( $cat_id, $real_user ) );
if ( $res ) {
$row = dbi_fetch_row ( $res );
$catNames = $row[0];

// MOD
// make sure global categories are treated as such
if ( empty ( $categories[$cat_id]['cat_owner'] ) ) {
$cat_id = - abs ($cat_id);
$catNames .='*';
}
// END MOD

  $catList = $cat_id;
}

}

~~~~~~~~~~

This is probably not the best solution though.

System Settings

PROGRAM_NAME: WebCalendar v1.2.7 (22 Feb 2013)

SERVER_SOFTWARE: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 PHP/5.3.6

Web Browser: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0

PHP Version: 5.3.6

Discussion


Log in to post a comment.