[Vtigercrm-commits] [vtiger-commits] r9485 - in /vtigercrm/trunk/modules/Calendar: Appointment.php CalendarCommon.php EditView.php addEventUI.php calendarLayout.php script.js
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed Sep 13 07:20:28 EDT 2006
Author: richie
Date: Wed Sep 13 05:20:10 2006
New Revision: 9485
Log:
Fixes for Calendar Security Done -- Minnie
Modified:
vtigercrm/trunk/modules/Calendar/Appointment.php
vtigercrm/trunk/modules/Calendar/CalendarCommon.php
vtigercrm/trunk/modules/Calendar/EditView.php
vtigercrm/trunk/modules/Calendar/addEventUI.php
vtigercrm/trunk/modules/Calendar/calendarLayout.php
vtigercrm/trunk/modules/Calendar/script.js
Modified: vtigercrm/trunk/modules/Calendar/Appointment.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/Appointment.php (original)
+++ vtigercrm/trunk/modules/Calendar/Appointment.php Wed Sep 13 05:20:10 2006
@@ -10,6 +10,7 @@
********************************************************************************/
require_once('modules/Calendar/CalendarCommon.php');
require_once('include/utils/CommonUtils.php');
+require_once('include/utils/UserInfoUtil.php');
require_once('include/database/PearDatabase.php');
require_once('modules/Calendar/Activity.php');
class Appointment
@@ -56,24 +57,18 @@
function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
{
global $current_user,$adb;
- $shared_ids = getSharedCalendarId($current_user->id);
- if(empty($shared_ids))
- $shared_ids = $current_user->id;
- $q= "select vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_activity.activitytype in ('Call','Meeting') AND ";
-
- if(!is_admin($current_user))
- {
- $q .= " ( ";
- }
-
- $q.=" ((vtiger_activity.date_start < '". $to_datetime->get_formatted_date() ."' AND vtiger_activity.date_start >= '". $from_datetime->get_formatted_date()."')";
- if(!is_admin($current_user))
- {
- $q .= " ) AND ((vtiger_crmentity.smownerid ='".$current_user->id."' or vtiger_salesmanactivityrel.smid = '".$current_user->id."') or (vtiger_crmentity.smownerid in (".$shared_ids.") or vtiger_salesmanactivityrel.smid in (".$shared_ids.")))";
- }
- $q .= " AND vtiger_crmentity.deleted = 0) AND vtiger_recurringevents.activityid is NULL ";
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+ $shared_ids = getSharedCalendarId($current_user->id);
+ $q= "select vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype in ('Call','Meeting') AND (vtiger_activity.date_start < '". $to_datetime->get_formatted_date() ."' AND vtiger_activity.date_start >= '". $from_datetime->get_formatted_date()."') ";
+ if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3)
+ {
+ $sec_parameter=getListViewSecurityParameter('Calendar');
+ $q .= $sec_parameter;
+ }
+
+ $q .= " AND vtiger_recurringevents.activityid is NULL ";
$q .= " group by vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
- //echo $q;
$r = $adb->query($q);
$n = $adb->getRowCount($r);
$a = 0;
@@ -88,20 +83,16 @@
unset($obj);
}
//Get Recurring events
- $q = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.activitytype, vtiger_crmentity.description, vtiger_activity.time_start,vtiger_activity.time_end, vtiger_activity.duration_hours, vtiger_activity.duration_minutes,vtiger_activity.due_date, vtiger_activity.priority, vtiger_activity.location,vtiger_activity.eventstatus, vtiger_crmentity.*, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_activitygrouprelation.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid";
-
- $q.=" where ( vtiger_activity.activitytype in ('Call','Meeting') AND ";
- if(!is_admin($current_user))
- {
- $q .= " ( ";
- }
- $q .= " (recurringdate < '".$to_datetime->get_formatted_date()."' AND recurringdate >= '".$from_datetime->get_formatted_date(). "') ";
- if(!is_admin($current_user))
- {
- $q .= " ) AND ((vtiger_crmentity.smownerid ='".$current_user->id."' or vtiger_salesmanactivityrel.smid = '".$current_user->id."' ) or (vtiger_crmentity.smownerid in (".$shared_ids.") or vtiger_salesmanactivityrel.smid in (".$shared_ids.")))";
- }
-
- $q .= " AND vtiger_crmentity.deleted = 0 )" ;
+ $q = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.activitytype, vtiger_crmentity.description, vtiger_activity.time_start,vtiger_activity.time_end, vtiger_activity.duration_hours, vtiger_activity.duration_minutes,vtiger_activity.due_date, vtiger_activity.priority, vtiger_activity.location,vtiger_activity.eventstatus, vtiger_crmentity.*, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_activitygrouprelation.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid";
+
+ $q.=" where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype in ('Call','Meeting') AND (recurringdate < '".$to_datetime->get_formatted_date()."' AND recurringdate >= '".$from_datetime->get_formatted_date(). "') ";
+
+ if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3)
+ {
+ $sec_parameter=getListViewSecurityParameter('Calendar');
+ $q .= $sec_parameter;
+ }
+
$q .= " ORDER by recurringid";
$r = $adb->query($q);
$n = $adb->getRowCount($r);
Modified: vtigercrm/trunk/modules/Calendar/CalendarCommon.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/CalendarCommon.php (original)
+++ vtigercrm/trunk/modules/Calendar/CalendarCommon.php Wed Sep 13 05:20:10 2006
@@ -9,14 +9,6 @@
*
********************************************************************************/
//Code Added by Minnie -Starts
-require_once('include/database/PearDatabase.php');
-
-global $mod_strings,$current_user;
-global $theme;
-$theme_path="themes/".$theme."/";
-$image_path=$theme_path."images/";
-require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-require('user_privileges/user_privileges_'.$current_user->id.'.php');
/**
* To get the lists of sharedids
* @param $id -- The user id :: Type integer
@@ -64,19 +56,35 @@
*/
function getOtherUserName($id,$check)
{
- global $adb;
+ global $adb,$current_user;
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+ $user_details=Array();
if($check)
+ {
$query="select * from vtiger_users where deleted=0 and status='Active' and id!=".$id;
+ $result = $adb->query($query);
+ $num_rows=$adb->num_rows($result);
+ for($i=0;$i<$num_rows;$i++)
+ {
+ $userid=$adb->query_result($result,$i,'id');
+ $username=$adb->query_result($result,$i,'user_name');
+ $user_details[$userid]=$username;
+ }
+
+ }
else
- $query="select * from vtiger_users where deleted=0 and status='Active' and is_admin='off' and id!=".$id;
- $result = $adb->query($query);
- $num_rows=$adb->num_rows($result);
- $user_details=Array();
- for($i=0;$i<$num_rows;$i++)
- {
- $userid=$adb->query_result($result,$i,'id');
- $username=$adb->query_result($result,$i,'user_name');
- $user_details[$userid]=$username;
+ {
+ if($is_admin==false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid('Calendar')] == 3 or $defaultOrgSharingPermission[getTabid('Calendar')] == 0))
+ {
+ $user_details = get_user_array(FALSE, "Active", $id, 'private');
+ unset($user_details[$id]);
+ }
+ else
+ {
+ $user_details = get_user_array(FALSE, "Active", $id);
+ unset($user_details[$id]);
+ }
}
return $user_details;
}
@@ -200,7 +208,7 @@
$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrtext.'</option>';
}
$combo .= '</select> ';
- $combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small value="'.$min.'">';
+ $combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small>';
for($i=0;$i<12;$i++)
{
$minvalue = 5;
@@ -209,7 +217,7 @@
{
$value= '0'.$value;
}
- else $value= $value;
+ else $value = $value;
if($min == $value)
$minsel = 'selected';
else
@@ -217,7 +225,7 @@
$combo .= '<option value="'.$value.'" "'.$minsel.'">'.$value.'</option>';
}
$combo .= '</select> ';
- $combo .= '<select name="'.$bimode.'fmt" id="'.$bimode.'fmt" value="'.$fmt.'" class=small>';
+ $combo .= '<select name="'.$bimode.'fmt" id="'.$bimode.'fmt" class=small>';
if($fmt == 'am')
{
$amselected = 'selected';
@@ -234,7 +242,7 @@
}
else
{
- $combo .= '<select name="'.$bimode.'hr" id="'.$bimode.'hr" class=small value="'.$hour.'">';
+ $combo .= '<select name="'.$bimode.'hr" id="'.$bimode.'hr" class=small>';
for($i=0;$i<=23;$i++)
{
if($i <= 9 && strlen(trim($i)) < 2)
@@ -249,7 +257,7 @@
$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrvalue.'</option>';
}
$combo .= '</select>Hr ';
- $combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small value="'.$min.'">';
+ $combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small>';
for($i=0;$i<12;$i++)
{
$minvalue = 5;
@@ -265,7 +273,7 @@
$minsel = '';
$combo .= '<option value="'.$value.'" "'.$minsel.'">'.$value.'</option>';
}
- $combo .= '</select> min<input type="hidden" name="'.$bimode.'fmt" id="'.$bimode.'fmt" value="'.$fmt.'">';
+ $combo .= '</select> min<input type="hidden" name="'.$bimode.'fmt" id="'.$bimode.'fmt">';
}
return $combo;
}
@@ -300,11 +308,13 @@
/*Fuction to get value for Assigned To field
*returns values of Assigned To field in array format
*/
-function getAssignedTo()
+function getAssignedTo($tabid)
{
global $current_user,$noof_group_rows,$adb;
$assigned_user_id = $current_user->id;
- if($is_admin==false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid('Calendar')] == 3 or $defaultOrgSharingPermission[getTabid('Calendar')] == 0))
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ if($is_admin==false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[$tabid] == 3 or $defaultOrgSharingPermission[$tabid] == 0))
{
$result=get_current_user_access_groups('Calendar');
}
@@ -313,8 +323,8 @@
$result = get_group_options();
}
$nameArray = $adb->fetch_array($result);
- global $current_user;
- if($is_admin==false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0))
+
+ if($is_admin==false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[$tabid] == 3 or $defaultOrgSharingPermission[$tabid] == 0))
{
$users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id,'private'), $assigned_user_id);
}
Modified: vtigercrm/trunk/modules/Calendar/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/EditView.php (original)
+++ vtigercrm/trunk/modules/Calendar/EditView.php Wed Sep 13 05:20:10 2006
@@ -130,6 +130,7 @@
$userDetails=getOtherUserName($current_user->id,true);
//echo '<pre>';print_r($userDetails);echo '</pre>';
$to_email = getUserEmailId('id',$current_user->id);
+$smarty->assign("CURRENTUSERID",$current_user->id);
$disp_view = getView($focus->mode);
if($disp_view == 'edit_view')
Modified: vtigercrm/trunk/modules/Calendar/addEventUI.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/addEventUI.php (original)
+++ vtigercrm/trunk/modules/Calendar/addEventUI.php Wed Sep 13 05:20:10 2006
@@ -24,7 +24,8 @@
//echo '<pre>';print_r($userDetails);echo '</pre>';
$to_email = getUserEmailId('id',$current_user->id);
$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
- $assignedto = getAssignedTo();
+ $taskassignedto = getAssignedTo(9);
+ $eventassignedto = getAssignedTo(16);
$mysel= $_GET['view'];
$calendar_arr = Array();
$calendar_arr['IMAGE_PATH'] = $image_path;
@@ -79,6 +80,7 @@
$calendar_arr['calendar']->hour_format = 'am/pm';
else
$calendar_arr['calendar']->hour_format = $current_user->hour_format;
+
/** Function to construct HTML code for Assigned To field
* @param $assignedto -- Assigned To values :: Type array
* @param $toggletype -- String to different event and task :: Type string
@@ -223,35 +225,57 @@
</tr>
<tr>
<td nowrap align="right"><b><?php echo $mod_strings['LBL_EVENTNAME']?></b></td>
- <td align="left"><input name="subject" type="text" class="textbox" value="" style="width:50%"> <input name="visibility" value="Public" type="checkbox"><?php echo $mod_strings['LBL_PUBLIC']; ?></td>
+ <td align="left"><input name="subject" type="text" class="textbox" value="" style="width:50%">
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'visibility') == '0') { ?>
+ <input name="visibility" value="Public" type="checkbox"><?php echo $mod_strings['LBL_PUBLIC']; ?>
+ <?php } ?>
+ </td>
</tr>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'description') == '0') { ?>
<tr>
<td valign="top" align="right"><b><?php echo $mod_strings['Description']?></b></td>
<td align="left"><textarea style = "width:100%; height : 60px;" name="description"></textarea></td>
</tr>
+ <?php } ?>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'location') == '0') { ?>
<tr>
<td nowrap align="right"><b><?php echo $mod_strings['Location']?></b></td>
<td align="left"><input name="location" type="text" class="textbox" value="" style="width:50%"></td>
</tr>
+ <?php } ?>
<tr>
<td colspan=2 width=80% align="center">
<table border=0 cellspacing=0 cellpadding=3 width=80%>
<tr>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0') { ?>
<td ><b><?php echo $mod_strings['Status'] ; ?></b></td>
+ <?php } ?>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'assigned_user_id') == '0') { ?>
<td ><b><?php echo $mod_strings['Assigned To']; ?></b></td>
+ <?php } ?>
</tr>
<tr>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0') { ?>
<td valign=top><?php echo getActFieldCombo('eventstatus','vtiger_eventstatus'); ?></td>
+ <?php } ?>
<td valign=top rowspan=2>
- <?php echo getAssignedToHTML($assignedto,'event'); ?>
- <br><input type="checkbox" name="sendnotification" > <?php echo $mod_strings['LBL_SENDNOTIFICATION'] ?>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'assigned_user_id') == '0') { ?>
+ <?php echo getAssignedToHTML($eventassignedto,'event'); ?>
+ <br><?php }else{
+ ?><input name="assigned_user_id" value="<?php echo $current_user->id ?>" type="hidden">
+ <?php } ?>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'sendnotification') == '0') { ?>
+ <input type="checkbox" name="sendnotification" > <?php echo $mod_strings['LBL_SENDNOTIFICATION'] ?>
+ <?php } ?>
</td>
</tr>
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'taskpriority') == '0') { ?>
<tr>
<td valign=top><b><?php echo $mod_strings['Priority'] ; ?></b>
<br><?php echo getActFieldCombo('taskpriority','vtiger_taskpriority'); ?>
</td>
</tr>
+ <?php } ?>
</table>
</td>
</tr>
@@ -269,7 +293,7 @@
<?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'start');?>
</td></tr>
<tr><td>
- <input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="<?php echo $calendar_arr['calendar']->date_time->get_formatted_date() ?>"></td><td width=50%><img border=0 src="<?echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
+ <input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=50%><img border=0 src="<?echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
<script type="text/javascript">
Calendar.setup ({
inputField : "jscal_field_date_start", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
@@ -285,7 +309,7 @@
<?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'end');?>
</td></tr>
<tr><td>
- <input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="<?php echo $calendar_arr['calendar']->date_time->get_formatted_date() ?>"></td><td width=100%><img border=0 src="<?php echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
+ <input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=100%><img border=0 src="<?php echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
<script type="text/javascript">
Calendar.setup ({
inputField : "jscal_field_due_date", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
@@ -377,6 +401,7 @@
<!-- Reminder UI -->
<DIV id="addEventAlarmUI" style="display:none;width:100%">
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'reminder_time') == '0') { ?>
<table bgcolor="#FFFFFF">
<tr><td><?php echo $mod_strings['LBL_SENDREMINDER']?></td>
<td>
@@ -435,14 +460,16 @@
<?php echo $mod_strings['LBL_SDRMD'] ?> :
</td>
<td >
- <input type=text name="toemail" class=textbox style="width:90%" value="<?php echo $to_email ?>">
+ <input type=text name="toemail" readonly="readonly" class=textbox style="width:90%" value="<?php echo $to_email ?>">
</td>
</tr>
</table>
+ <?php } ?>
</DIV>
</DIV>
<!-- Repeat UI -->
<div id="addEventRepeatUI" style="display:none;width:100%">
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'recurringtype') == '0') { ?>
<table border=0 cellspacing=0 cellpadding=2 width=100% bgcolor="#FFFFFF">
<tr>
<td nowrap align=right width=20% valign=top>
@@ -537,9 +564,11 @@
</td>
</tr>
</table>
+ <?php } ?>
</div>
<div id="addEventRelatedtoUI" style="display:none;width:100%">
<table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="#FFFFFF">
+ <?php if(getFieldVisibilityPermission('Events',$current_user->id,'parent_id') == '0') { ?>
<tr>
<td><b><?php echo $mod_strings['LBL_RELATEDTO']?></b></td>
<td>
@@ -558,6 +587,7 @@
</div>
</td>
</tr>
+ <?php } ?>
<tr>
<td><b><?php echo $app_strings['Contacts'] ?></b></td>
<td colspan="2">
@@ -649,22 +679,50 @@
<td width="20%" align="right"><b><?php echo $mod_strings['LBL_TODONAME'] ?></b></td>
<td width="80%" align="left"><input name="task_subject" type="text" value="" class="textbox" style="width:70%"></td>
</tr>
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'description') == '0') { ?>
<tr>
<td align="right"><b><?php echo $mod_strings['Description'] ?></b></td>
<td align="left"><textarea style="width: 100%; height: 60px;" name="task_description"></textarea></td>
</tr>
+ <?php } ?>
<tr>
<td colspan="2" align="center" width="80%">
<table border="0" cellpadding="3" cellspacing="0" width="80%">
<tr>
- <td align="left"><b><?php echo $mod_strings['Status']; ?></b></td>
- <td align="left"><b><?php echo $mod_strings['Priority']; ?></b></td>
- <td align="left"><b><?php echo $mod_strings['Assigned To']; ?></b></td>
+ <td align="left">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0') { ?>
+ <b><?php echo $mod_strings['Status']; ?></b>
+ <?php } ?>
+ </td>
+ <td align="left">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskpriority') == '0') { ?>
+ <b><?php echo $mod_strings['Priority']; ?></b>
+ <?php } ?>
+ </td>
+ <td align="left">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'assigned_user_id') == '0') { ?>
+ <b><?php echo $mod_strings['Assigned To']; ?></b>
+ <?php } ?>
+ </td>
</tr>
<tr>
- <td align="left" valign="top"><?php echo getActFieldCombo('taskstatus','vtiger_taskstatus'); ?></td>
- <td align="left" valign="top"><?php echo getActFieldCombo('taskpriority','vtiger_taskpriority'); ?></td>
- <td align="left" valign="top"><?php echo getAssignedToHTML($assignedto,'task'); ?></td>
+ <td align="left" valign="top">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0') { ?>
+ <?php echo getActFieldCombo('taskstatus','vtiger_taskstatus'); ?>
+ <?php } ?>
+ </td>
+ <td align="left" valign="top">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskpriority') == '0') { ?>
+ <?php echo getActFieldCombo('taskpriority','vtiger_taskpriority'); ?>
+ <?php } ?>
+ </td>
+ <td align="left" valign="top">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'assigned_user_id') == '0') { ?>
+ <?php echo getAssignedToHTML($taskassignedto,'task'); ?>
+ <?php }else{
+ ?><input name="task_assigned_user_id" value="<?php echo $current_user->id ?>" type="hidden">
+ <?php } ?>
+ </td>
</tr>
</table>
</td>
@@ -679,10 +737,10 @@
<tr><td colspan=3 ><b><?php echo $mod_strings['LBL_TODODATETIME'] ?></b></td></tr>
<tr><td colspan=3><?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'start'); ?></td></tr>
<tr><td>
- <input type="text" name="task_date_start" id="task_date_start" class="textbox" style="width:90px" value="<?php echo $calendar_arr['calendar']->date_time->get_formatted_date() ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
+ <input type="text" name="task_date_start" id="task_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_date_start">
<script type="text/javascript">
Calendar.setup ({
- inputField : "task_date_start", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
+ inputField : "task_date_start", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_task_date_start", singleClick : true, step : 1
})
</script>
</td></tr>
@@ -691,10 +749,10 @@
<table border="0" cellpadding="2" cellspacing="0" width="95%" align=center>
<tr><td colspan=3><b><?php echo $mod_strings['Due Date'] ?></b></td></tr>
<tr><td>
- <input type="text" name="task_due_date" id="task_due_date" class="textbox" style="width:90px" value="<?php echo $calendar_arr['calendar']->date_time->get_formatted_date() ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
+ <input type="text" name="task_due_date" id="task_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_due_date">
<script type="text/javascript">
Calendar.setup ({
- inputField : "task_due_date", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
+ inputField : "task_due_date", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_task_due_date", singleClick : true, step : 1
})
</script>
</td></tr>
@@ -710,9 +768,9 @@
<table border=0 cellspacing=0 cellpadding=3 width=100%>
<tr>
<td class="dvtTabCache" style="width:10px" nowrap> </td>
- <td id="cellTabNotification" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabNotification','on');switchClass('cellTabtodoRelatedto','off');gshow('addTaskAlarmUI','todo',document.createTodo.task_date_start.value,'',document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskRelatedtoUI');"><?php echo $mod_strings['LBL_NOTIFICATION']?></a></td>
+ <td id="cellTabNotification" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabNotification','on');switchClass('cellTabtodoRelatedto','off');gshow('addTaskAlarmUI','todo',document.createTodo.task_date_start.value,document.createTodo.task_due_date.value,document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskRelatedtoUI');"><?php echo $mod_strings['LBL_NOTIFICATION']?></a></td>
<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">
- <td id="cellTabtodoRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabtodoRelatedto','on'); switchClass('cellTabNotification','off');gshow('addTaskRelatedtoUI','todo',document.createTodo.task_date_start.value,'',document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskAlarmUI');"><?php echo $mod_strings['LBL_RELATEDTO']?></a></td>
+ <td id="cellTabtodoRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabtodoRelatedto','on'); switchClass('cellTabNotification','off');gshow('addTaskRelatedtoUI','todo',document.createTodo.task_date_start.value,document.createTodo.task_due_date.value,document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskAlarmUI');"><?php echo $mod_strings['LBL_RELATEDTO']?></a></td>
<td class="dvtTabCache" style="width: 100%;"> </td>
</tr>
</table>
@@ -722,14 +780,17 @@
<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
<!-- Reminder UI -->
<DIV id="addTaskAlarmUI" style="display:block;width:100%">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'sendnotification') == '0') { ?>
<table>
<tr><td><?php echo $mod_strings['LBL_SENDNOTIFICATION'] ?></td><td>
<input name="task_sendnotification" type="checkbox">
</td></tr>
</table>
+ <?php } ?>
</DIV>
<div id="addTaskRelatedtoUI" style="display:none;width:100%">
<table width="100%" cellpadding="5" cellspacing="0" border="0">
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0') { ?>
<tr>
<td><b><?php echo $mod_strings['LBL_RELATEDTO']?></b></td>
<td>
@@ -753,6 +814,8 @@
</div>
</td>
</tr>
+ <?php } ?>
+ <?php if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0') { ?>
<tr>
<td><b><?php echo $mod_strings['LBL_CONTACT_NAME'] ?></b></td>
<td colspan="2">
@@ -760,6 +823,7 @@
<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="<?php echo $mod_strings['LBL_SELECT_CONTACT'] ; ?>">
</td>
</tr>
+ <?php } ?>
</table>
</div>
</td></tr>
Modified: vtigercrm/trunk/modules/Calendar/calendarLayout.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/calendarLayout.php (original)
+++ vtigercrm/trunk/modules/Calendar/calendarLayout.php Wed Sep 13 05:20:10 2006
@@ -1308,10 +1308,10 @@
$Entries = Array();
$category = getParentTab();
global $adb,$current_user,$mod_strings,$cal_log;
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$cal_log->debug("Entering getEventList() method...");
$shared_ids = getSharedCalendarId($current_user->id);
- if(empty($shared_ids))
- $shared_ids = $current_user->id;
$query = "SELECT vtiger_groups.groupname, vtiger_users.user_name,
vtiger_activity.* FROM vtiger_activity
INNER JOIN vtiger_crmentity
@@ -1330,26 +1330,30 @@
OR vtiger_recurringevents.recurringdate BETWEEN '".$start_date."' AND '".$end_date."') ";
if($info != '')
{
- $pending_query = $query." AND (vtiger_activity.eventstatus = 'Planned')
- AND vtiger_crmentity.smownerid = ".$current_user->id."
- GROUP BY vtiger_activity.activityid
- ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
+ $com_q = " AND vtiger_crmentity.smownerid = ".$current_user->id."
+ GROUP BY vtiger_activity.activityid";
+ $pending_query = $query." AND (vtiger_activity.eventstatus = 'Planned')".$com_q;
+ $total_q = $query."".$com_q;
+ $total_res = $adb->query($total_q);
+ $total = $adb->num_rows($total_res);
$res = $adb->query($pending_query);
$pending_rows = $adb->num_rows($res);
- }
- if(!is_admin($current_user))
- $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.") ";
+ $cal_log->debug("Exiting getEventList() method...");
+ return Array('totalevent'=>$total,'pendingevent'=>$pending_rows);
+ }
+ if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3)
+ {
+ $sec_parameter=getListViewSecurityParameter('Calendar');
+ $query .= $sec_parameter;
+ }
+ /*if(!is_admin($current_user))
+ $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.") ";*/
$query .= "GROUP BY vtiger_activity.activityid ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
if( $adb->dbType == "pgsql")
$query = fixPostgresQuery( $query, $log, 0);
$result = $adb->query($query);
$rows = $adb->num_rows($result);
- if($info != '')
- {
- $cal_log->debug("Exiting getEventList() method...");
- return Array('totalevent'=>$rows,'pendingevent'=>$pending_rows);
- }
for($i=0;$i<$rows;$i++)
{
$element = Array();
@@ -1429,8 +1433,8 @@
global $adb,$current_user,$mod_strings,$cal_log;
$cal_log->debug("Entering getTodoList() method...");
$shared_ids = getSharedCalendarId($current_user->id);
- if(empty($shared_ids))
- $shared_ids = $current_user->id;
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$query = "SELECT vtiger_groups.groupname, vtiger_users.user_name, vtiger_cntactivityrel.contactid,
vtiger_activity.* FROM vtiger_activity
INNER JOIN vtiger_crmentity
@@ -1448,28 +1452,36 @@
AND (vtiger_activity.date_start BETWEEN '".$start_date."' AND '".$end_date."')";
if($info != '')
{
- $pending_query = $query." AND (vtiger_activity.status != 'Completed')
- AND vtiger_crmentity.smownerid = ".$current_user->id."
- ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
+ $com_q = " AND vtiger_crmentity.smownerid = ".$current_user->id;
+ $pending_query = $query." AND (vtiger_activity.status != 'Completed')".$com_q;
+ $total_q = $query."".$com_q;
if( $adb->dbType == "pgsql")
+ {
$pending_query = fixPostgresQuery( $pending_query, $log, 0);
+ $total_q = fixPostgresQuery( $total_q, $log, 0);
+ }
+ $total_res = $adb->query($total_q);
+ $total = $adb->num_rows($total_res);
$res = $adb->query($pending_query);
$pending_rows = $adb->num_rows($res);
+ $cal_log->debug("Exiting getTodoList() method...");
+ return Array('totaltodo'=>$total,'pendingtodo'=>$pending_rows);
}
- if(!is_admin($current_user))
- $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.")";
+ if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[9] == 3)
+ {
+ $sec_parameter=getListViewSecurityParameter('Calendar');
+ $query .= $sec_parameter;
+ }
+
+ /*if(!is_admin($current_user))
+ $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.")";*/
$query .= " ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
if( $adb->dbType == "pgsql")
$query = fixPostgresQuery( $query, $log, 0);
$result = $adb->query($query);
$rows = $adb->num_rows($result);
- if($info != '')
- {
- $cal_log->debug("Exiting getTodoList() method...");
- return Array('totaltodo'=>$rows,'pendingtodo'=>$pending_rows);
- }
for($i=0;$i<$rows;$i++)
{
$element = Array();
Modified: vtigercrm/trunk/modules/Calendar/script.js
==============================================================================
--- vtigercrm/trunk/modules/Calendar/script.js (original)
+++ vtigercrm/trunk/modules/Calendar/script.js Wed Sep 13 05:20:10 2006
@@ -94,8 +94,6 @@
{
var y=document.getElementById(argg1).style;
- if (y.display=="none")
- {
if(type == 'call' || type == 'meeting')
{
if(type == 'call')
@@ -117,12 +115,15 @@
if(type == 'todo')
{
document.createTodo.task_date_start.value = startdate;
+ document.createTodo.task_due_date.value = enddate;
document.createTodo.starthr.value = starthr;
document.createTodo.startmin.value = startmin;
document.createTodo.startfmt.value = startfmt;
document.createTodo.viewOption.value = viewOption;
document.createTodo.subtab.value = subtab;
}
+ if (y.display=="none")
+ {
y.display="block";
}
}
@@ -302,10 +303,6 @@
}
else
{
- if(document.EditView.recurringcheck.checked == false)
- {
- document.EditView.recurringtype.value = '--None--';
- }
if(document.EditView.record.value != '')
{
document.EditView.mode.value = 'edit';
@@ -418,6 +415,10 @@
return false;
document.EditView.time_start.value = starthour+':'+startmin;
document.EditView.time_end.value = endhour+':'+endmin;
+ if(document.EditView.recurringcheck.checked == false)
+ {
+ document.EditView.recurringtype.value = '--None--';
+ }
return true;
}
}
More information about the vtigercrm-commits
mailing list