Commit 65a9daf2 authored by mangapower's avatar mangapower

[FIX] Fixed bug with calendar events and minor problems with calendars. GUI...

[FIX] Fixed bug with calendar events and minor problems with calendars. GUI need to be re-designed (jQuery is good option)
parent 947d9e98
......@@ -42,7 +42,11 @@ class CalendarLib extends TikiLib {
$categories = $categlib->get_jailed( (array) $val );
$cat_count = count( $categories );
$join_tables .= " inner join `tiki_objects` as tob on (tob.`itemId`= tcal.`calendarId` and tob.`type`= ?) inner join `tiki_category_objects` as tc on (tc.`catObjectId`=tob.`objectId` and tc.`categId` IN(" . implode(', ', array_fill(0, $cat_count, '?')) . ")) ";
$join_tables .= " inner join `tiki_objects` as tob on (tob.`itemId`= tcal.`calendarId` and tob.`type`= ?) inner join `tiki_category_objects` as tc on (tc.`catObjectId`=tob.`objectId` and tc.`categId` IN(" . implode(', ', array_fill(0, $cat_count, '?')) . "))";
if ($mid = "")
$getUncategorized = " where (tob.`itemId`=tcal.`calendarId` and )";
else
$getUncategorized = "and (tob.`itemId`!=tcal.`calendarId` and tob.`type`='calendar')";
if( $cat_count > 1 ) {
$distinct = ' DISTINCT ';
......
......@@ -48,7 +48,7 @@
{$calendar.name|escape}<br />{tr}or{/tr}&nbsp;
<input type="submit" name="changeCal" value="{tr}Go to{/tr}" />
{/if}
<select name="save[calendarId]" id="calid" onchange="javascript:document.getElementById('editcalitem').submit();">
<select name="save[calendarId]" id="calid">
{foreach item=it key=itid from=$listcals}
<option value="{$it.calendarId}" style="background-color:#{$it.custombgcolor};color:#{$it.customfgcolor};"
{if $calitem.calendarId}
......
......@@ -6,6 +6,7 @@
// $Id: /cvsroot/tikiwiki/tiki/tiki-admin_calendars.php,v 1.34.2.2 2008-02-12 19:20:11 sylvieg Exp $
$section = 'calendar';
require_once ('tiki-setup.php');
require_once ('lib/categories/categlib.php');
include_once ('lib/calendar/calendarlib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
......@@ -19,7 +20,28 @@ if ($tiki_p_admin_calendar != 'y' and $tiki_p_admin != 'y') {
if (!isset($_REQUEST["calendarId"])) {
$_REQUEST["calendarId"] = 0;
} else {
$smarty->assign('individual', $userlib->object_has_one_permission($_REQUEST["calendarId"], 'calendar'));
// Check if calendar belongs to perspective
$category_jails = $categlib->get_jail();
if(!isset($filter['categId']) && !empty($category_jails))
{
$categories = $categlib->get_object_categories('calendar', $_REQUEST["calendarId"]);
if (empty ($categories))
$smarty->assign('individual', $userlib->object_has_one_permission($_REQUEST["calendarId"], 'calendar'));
else
{
$intersection = array_intersect($category, $category_jails);
if (!empty ($intersection))
$smarty->assign('individual', $userlib->object_has_one_permission($_REQUEST["calendarId"], 'calendar'));
else
{
$smarty->assign('errortype', 404);
$smarty->assign('msg',tra("Object doesn't exists"));
$smarty->display("error.tpl");
die;
}
}
}
}
if (isset($_REQUEST["drop"])) {
$area = "delcalendar";
......
......@@ -45,7 +45,8 @@ if ($rawcals['cant'] == 0 && $tiki_p_admin_calendar == 'y') {
$rawcals['data'] = Perms::filter( array( 'type' => 'calendar' ), 'object', $rawcals['data'], array( 'object' => 'calendarId' ), 'view_calendar' );
foreach ($rawcals["data"] as $cal_id=>$cal_data) {
foreach ($rawcals["data"] as $cal_data) {
$cal_id = $cal_data['calendarId'];
$calperms = Perms::get( array( 'type' => 'calendar', 'object' => $cal_id ) );
if ($cal_data["personal"] == "y") {
if ($user) {
......@@ -60,12 +61,13 @@ foreach ($rawcals["data"] as $cal_id=>$cal_data) {
$cal_data["tiki_p_change_events"] = 'n';
}
} else {
$cal_data["tiki_p_view_calendar"] = $calperms->view_calendar ? 'y' : 'n';
$cal_data["tiki_p_view_events"] = $calperms->view_events ? 'y' : 'n';
$cal_data["tiki_p_add_events"] = $calperms->add_events ? 'y' : 'n';
$cal_data["tiki_p_change_events"] = $calperms->change_events ? 'y' : 'n';
$cal_data["tiki_p_view_calendar"] = $calperms->view_calendar;
$cal_data["tiki_p_view_events"] = $calperms->view_events;
$cal_data["tiki_p_add_events"] = $calperms->add_events;
$cal_data["tiki_p_change_events"] = $calperms->change_events;
}
$caladd["$cal_id"] = $cal_data;
}
$smarty->assign('listcals',$caladd);
......@@ -183,7 +185,6 @@ if (isset($save['start']) && isset($save['end'])) {
if (isset($_POST['act'])) {
if (empty($save['user'])) $save['user'] = $user;
$newcalid = $save['calendarId'];
if ((empty($save['calitemId']) and $caladd["$newcalid"]['tiki_p_add_events'])
or (!empty($save['calitemId']) and $caladd["$newcalid"]['tiki_p_change_events'])) {
if (empty($save['name'])) $save['name'] = tra("event without name");
......@@ -195,7 +196,7 @@ if (isset($_POST['act'])) {
$save['status'] = $calendar['defaulteventstatus'];
}
}
if (array_key_exists('recurrent',$_POST) && ($_POST['recurrent'] == 1) && $_POST['affect']!='event') {
$impossibleDates = false;
if ($_POST['end_Hour'] < $_POST['start_Hour']) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment