[Vtigercrm-commits] [vtiger-commits] r9855 - in /vtigercrm/branches/5.0.3/modules/Calendar: CalendarCommon.php calendar_share.php script.js updateCalendarSharing.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Nov 17 08:43:48 EST 2006
Author: richie
Date: Fri Nov 17 06:43:42 2006
New Revision: 9855
Log:
share calendar option made more user friendly
Modified:
vtigercrm/branches/5.0.3/modules/Calendar/CalendarCommon.php
vtigercrm/branches/5.0.3/modules/Calendar/calendar_share.php
vtigercrm/branches/5.0.3/modules/Calendar/script.js
vtigercrm/branches/5.0.3/modules/Calendar/updateCalendarSharing.php
Modified: vtigercrm/branches/5.0.3/modules/Calendar/CalendarCommon.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/CalendarCommon.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/CalendarCommon.php Fri Nov 17 06:43:42 2006
@@ -16,16 +16,20 @@
*/
function getSharedUserId($id)
{
- global $adb;
- $sharedid = Array();
- $query = "SELECT * from vtiger_sharedcalendar where userid=".$id;
+ global $adb;
+ $sharedid = Array();
+ $query = "SELECT vtiger_users.user_name,vtiger_sharedcalendar.* from vtiger_sharedcalendar left join vtiger_users on vtiger_sharedcalendar.sharedid=vtiger_users.id where userid=".$id;
$result = $adb->query($query);
$rows = $adb->num_rows($result);
for($j=0;$j<$rows;$j++)
{
- $sharedid[] = $adb->query_result($result,$j,'sharedid');
+
+ $id = $adb->query_result($result,$j,'sharedid');
+ $sharedname = $adb->query_result($result,$j,'user_name');
+ $sharedid[$id]=$sharedname;
+
}
- return $sharedid;
+ return $sharedid;
}
/**
Modified: vtigercrm/branches/5.0.3/modules/Calendar/calendar_share.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/calendar_share.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/calendar_share.php Fri Nov 17 06:43:42 2006
@@ -39,6 +39,8 @@
<input type="hidden" name="subtab" value="<?php echo $_REQUEST['subtab'] ?>">
<input type="hidden" name="parenttab" value="<?php echo $_REQUEST['parenttab'] ?>">
<input type="hidden" name="current_userid" value="<? echo $current_user->id ?>" >
+<input type="hidden" name="shar_userid" id="shar_userid" >
+
<table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
<tr>
<td class=small >
@@ -91,24 +93,65 @@
<td align="left">
<b><?echo $mod_strings['LBL_CALSHARE']?></b><br>
<?echo $mod_strings['LBL_CALSHAREMESSAGE']?><br><br>
- <div id="cal_shar" style="border:1px solid #666666;width:90%;height:200px;overflow:auto;position:relative;">
- <table width="95%" border="0" cellpadding="5" cellspacing="0" align="center">
- <?php
- $cnt = 1;
- echo '<tr>';
- foreach($userDetails as $id=>$name)
- {
- if(in_array($id,$shareduser_ids))
- $checkbox = "checked";
- else
- $checkbox = "";
- echo '<td width="50%" align="left"><input type="checkbox" name="user[]" value='.$id.' '.$checkbox.'> '.$name.'</td>';
- if($cnt%2 == 0)
- echo '</tr>';
- $cnt++;
- }
- ?>
- </table>
+ <!-- Calendar sharing UI-->
+ <DIV id="cal_shar" style="display:block;width:100%;height:200px">
+ <table border=0 cellspacing=0 cellpadding=2 width=100% bgcolor="#FFFFFF">
+ <tr>
+ <td valign=top>
+ <table border=0 cellspacing=0 cellpadding=2 width=100%>
+ <tr>
+ <td colspan=3>
+ <ul style="padding-left:20px">
+ <li><?php echo $mod_strings['LBL_INVITE_INST1']?>
+ <li><?php echo $mod_strings['LBL_INVITE_INST2']?>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><b><?php echo $mod_strings['LBL_AVL_USERS']?></b></td>
+ <td> </td>
+ <td><b><?php echo $mod_strings['LBL_SEL_USERS']?></b></td>
+ </tr>
+ <tr>
+ <td width=40% align=center valign=top>
+ <select name="available_users" id="available_users" class=small size=5
+ multiple style="height:70px;width:100%">
+ <?php
+ foreach($userDetails as $id=>$name)
+ {
+ if($id != '')
+ echo "<option value=".$id.">".$name."</option>";
+ }
+ ?>
+ </select>
+
+ </td>
+ <td width=20% align=center valign=top>
+ <input type=button value="<?php echo $mod_strings['LBL_ADD_BUTTON'] ?> >>" class="crm button small save" style="width:100%" onClick="addsharedColumn('available_users','selected_users')"><br>
+ <input type=button value="<< <?php echo $mod_strings['LBL_RMV_BUTTON'] ?> " class="crm button small cancel" style="width:100%" onClick="delsharedColumn('selected_users')">
+ </td>
+ <td>
+ <select name="selected_users" id="selected_users" class=small size=5 multiple style="height:70px;width:100%">
+ <?php
+ foreach($shareduser_ids as $shar_id=>$share_user)
+ {
+ if($shar_id != '')
+ echo "<option value=".$shar_id.">".$share_user."</option>";
+ }
+ ?>
+ </select>
+
+
+ </select>
+ <td>
+ </tr>
+ </table>
+
+
+ </td>
+ </tr>
+ </table>
+
</div>
</td>
</tr>
@@ -119,7 +162,7 @@
<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerPopupTransport">
<tr>
<td align="center">
- <input type="submit" name="save" value=" <? echo $app_strings['LBL_SAVE_BUTTON_LABEL'] ?> " class="crmbutton small save" />
+ <input type="submit" name="save" value=" <? echo $app_strings['LBL_SAVE_BUTTON_LABEL'] ?> " class="crmbutton small save" onClick = "userEventSharing('shar_userid','selected_users');"/>
<input type="button" name="cancel" value=" <? echo $app_strings['LBL_CANCEL_BUTTON_LABEL'] ?> " class="crmbutton small cancel" onclick="fninvsh('calSettings');" />
</td>
</tr>
Modified: vtigercrm/branches/5.0.3/modules/Calendar/script.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/script.js (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/script.js Fri Nov 17 06:43:42 2006
@@ -190,7 +190,7 @@
}
function maincheck_form()
{
- formSelectColumnString('inviteesid');
+ formSelectColumnString('inviteesid','selectedusers');
starthour = document.EditView.starthr.value;
startmin = document.EditView.startmin.value;
startformat = document.EditView.startfmt.value;
@@ -294,7 +294,7 @@
}
function check_form()
{
- formSelectColumnString('inviteesid');
+ formSelectColumnString('inviteesid','selectedusers');
if(trim(document.EditView.subject.value) == "")
{
alert("Missing Event Name");
@@ -497,12 +497,20 @@
}
+function userEventSharing(selectedusrid,selcolid)
+{
+ formSelectColumnString(selectedusrid,selcolid);
+}
+
+
function addColumn()
{
+ setObjects();
var selectlength=selectedColumnsObj.length
var availlength=availListObj.length
+
var s=0
for (i=0;i<selectlength;i++)
{
@@ -512,13 +520,16 @@
{
if (availListObj.options[s].selected==true)
{
+
for (j=0;j<selectlength;j++)
{
if (selectedColumnsObj.options[j].value==availListObj.options[s].value)
{
+
var rowFound=true
var existingObj=selectedColumnsObj.options[j]
- breaK;
+
+ break;
}
}
if (rowFound!=true)
@@ -528,22 +539,24 @@
if (browser_ie) newColObj.innerText=availListObj.options[s].innerText
else if (browser_nn4 || browser_nn6) newColObj.text=availListObj.options[s].text
selectedColumnsObj.appendChild(newColObj)
- availListObj.removeChild(availListObj.options[s])
+ availListObj.removeChild(availListObj.options[s])
newColObj.selected=true
rowFound=false
}
else
{
existingObj.selected=true
+
}
}
else
s++
}
}
-
function delColumn()
{
+
+ setObjects();
var selectlength=selectedColumnsObj.length
var availlength=availListObj.length
var s=0
@@ -561,7 +574,7 @@
{
var rowFound=true
var existingObj=availListObj.options[j]
- breaK;
+ break;
}
}
@@ -570,24 +583,85 @@
var newColObj=document.createElement("OPTION")
newColObj.value=selectedColumnsObj.options[s].value
if (browser_ie) newColObj.innerText=selectedColumnsObj.options[s].innerText
- else if (browser_nn4 || browser_nn6) newColObj.text=selectedColumnsObj.options[s].text
+ else if (browser_nn4 || browser_nn6)
+ newColObj.text=selectedColumnsObj.options[s].text
availListObj.appendChild(newColObj)
selectedColumnsObj.removeChild(selectedColumnsObj.options[s])
newColObj.selected=true
rowFound=false
}
- else
+ else
{
existingObj.selected=true
}
}
- else
+ else
s++
- }
-}
-
-function formSelectColumnString(usr)
-{
+
+ }
+
+
+}
+function addsharedColumn(avail_users,sel_users)
+{
+ availListObj=getObj(avail_users)
+ selectedColumnsObj=getObj(sel_users)
+ var selectlength=selectedColumnsObj.length
+ var availlength=availListObj.length
+
+ for (i=0;i<selectedColumnsObj.length;i++)
+ {
+ selectedColumnsObj.options[i].selected=false
+ }
+ for (i=0;i<availListObj.length;i++)
+ {
+ if (availListObj.options[i].selected==true)
+ {
+ for (j=0;j<selectedColumnsObj.length;j++)
+ {
+ if (selectedColumnsObj.options[j].value==availListObj.options[i].value)
+ {
+ var rowFound=true
+ var existingObj=selectedColumnsObj.options[j]
+ break
+ }
+ }
+ if (rowFound!=true)
+ {
+ var newColObj=document.createElement("OPTION")
+ newColObj.value=availListObj.options[i].value
+ if (browser_ie) newColObj.innerText=availListObj.options[i].innerText
+ else if (browser_nn4 || browser_nn6) newColObj.text=availListObj.options[i].text
+ selectedColumnsObj.appendChild(newColObj)
+ availListObj.options[i].selected=false
+ newColObj.selected=true
+ rowFound=false
+ }
+ else
+ {
+ existingObj.selected=true
+ }
+ }
+ }
+}
+
+function delsharedColumn(sel_users)
+{
+ selectedColumnsObj=getObj(sel_users)
+ var selectlength=selectedColumnsObj.options.length
+ for(i = 0; i <= selectlength; i++)
+ {
+ if(selectedColumnsObj.options.selectedIndex >= 0)
+ selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
+ }
+
+}
+
+
+function formSelectColumnString(usr,col)
+{
+
+ var selectedColumnsObj=getObj(col)
usr_id = document.getElementById(usr);
var selectedColStr = "";
for (i=0;i<selectedColumnsObj.options.length;i++)
Modified: vtigercrm/branches/5.0.3/modules/Calendar/updateCalendarSharing.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/updateCalendarSharing.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/updateCalendarSharing.php Fri Nov 17 06:43:42 2006
@@ -17,7 +17,8 @@
$hour_format = 'am/pm';
$delquery = "delete from vtiger_sharedcalendar where userid=".$_REQUEST["current_userid"];
$adb->query($delquery);
-$sharedid = $_REQUEST['user'];
+$selectedid = $_REQUEST['shar_userid'];
+$sharedid = explode (";",$selectedid);
if(isset($sharedid) && $sharedid != null)
{
foreach($sharedid as $sid)
More information about the vtigercrm-commits
mailing list