[Vtigercrm-commits] [vtiger-commits] r6540 - in /vtigercrm/trunk/modules/Calendar: calendar_share.php script.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat May 27 11:33:10 EDT 2006


Author: saraj
Date: Sat May 27 09:33:05 2006
New Revision: 6540

Log:
changes made for calendar sharing

Modified:
    vtigercrm/trunk/modules/Calendar/calendar_share.php
    vtigercrm/trunk/modules/Calendar/script.js

Modified: vtigercrm/trunk/modules/Calendar/calendar_share.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/calendar_share.php (original)
+++ vtigercrm/trunk/modules/Calendar/calendar_share.php Sat May 27 09:33:05 2006
@@ -8,153 +8,106 @@
  * All Rights Reserved.
 *
  ********************************************************************************/
-global $current_user,$mod_strings;
+global $current_user,$mod_strings,$app_strings;
+global $theme;
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once ($theme_path."layout_utils.php");
 require_once('include/database/PearDatabase.php');
 require_once('modules/Calendar/CalendarCommon.php');
- echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'], true);
- echo "\n<BR>\n";
  $t=Date("Ymd");
  $userDetails=getOtherUserName($current_user->id);
- $html = getHeaderTab($t,'shared');
- echo $html;
+ $shareduser_ids = getSharedUserId($current_user->id);
 ?>
-<table width="90%" align="center" border="0" cellspacing="0" cellpadding="5">
-<tr>
-	<td class="genHeaderSmall" colspan=3 align="left"><?php echo$mod_strings['LBL_CALENDAR_SHARED']?></td>
-</tr>
-<form name="SharedList" method="post" action="index.php">
-<input name="idlist" type="hidden">
-<tr>
-         <td colspan=3 style="padding-right:20px" nowrap><input class="small" type="submit" value="Disable Sharing" onclick="return DisableSharing()"/>
-	</td>
-</tr>
-<tr>
-<td class="detailedViewHeader" width="3%"><input type="checkbox"  name="selectall" onClick=toggleSelect(this.checked,"selected_id")></td>
-<?php
-$header = getSharedUserListViewHeader();
-foreach($header as $index=>$headerlabel)
-{
-        echo '<th class="detailedViewHeader">'.$headerlabel.'</th>';
-}
-echo '</tr><tr>';
-$shareduser_entries = array();
-$cnt=1;
-$shareduser_ids = getSharedUserId($current_user->id);
-$output = '';
-if($shareduser_ids != '')
-{
-	foreach($shareduser_ids as $key=>$value)
-	{
-		$shareduser_entries[$value] = getSharedUserListViewEntries($value);
-	}
-	foreach($shareduser_entries as $array_key=>$array_value)
-	{
-		if ($cnt%2==0)
-		{
-	        	$output .='<tr class="dvtCellLabel">';
-			$output .='<td><input type="checkbox" NAME="selected_id" value="'.$array_key.'" onClick=toggleSelectAll(this.name,"selectall")></td>';
-		}
-		else
-		{
-			$output .='<tr class="dvtCellInfo">';
-			$output .='<td><input type="checkbox" NAME="selected_id" value="'.$array_key.'" onClick=toggleSelectAll(this.name,"selectall")></td>';
-		}
-		$output .='<td>';
-		$output .=$array_value[0].'</td>';
-		$output .='<td>';
-		$output .=$array_value[1].'</td>';
-		$output .='</tr>';
-		$cnt++;
-	}
-	echo $output;
-}
-else
-{
-	echo '	<tr style="height: 25px;" bgcolor="white">
-		<td><i>None</i></td>
+<table border=0 cellspacing=0 cellpadding=5 width=100%>
+	<tr>
+		<td class="genHeaderSmall" align="left"><? echo $mod_strings['LBL_CALSETTINGS']?></td>
+		<td align=right>
+			<a href="javascript:fninvsh('calSettings');"><img src="<?echo $image_path?>close.gif" border="0"  align="absmiddle" /></a>
+		</td>
+	</tr>
+	<tr><td colspan="2"><hr /></td></tr>
+</table>
+<form name="SharingForm" method="post" action="index.php">
+<input type="hidden" name="module" value="Calendar">
+<input type="hidden" name="action" value="updateCalendarSharing">
+<input type="hidden" name="current_userid" value="<? echo $current_user->id ?>" >
+<table border=0 cellspacing=0 cellpadding=5 width=100%>
+	<tr>
+		<td align="right" width="10%" valign="top"><img src="<?echo $image_path?>cal_clock.jpg" align="absmiddle"></td>
+		<td align="left" width="90%">
+			<b><?echo $mod_strings['LBL_TIMESETTINGS']?></b><br>
+			<input type="checkbox" name="sttime_check" <? if($current_user->start_hour != ''){?> checked <? } ?> onClick="enableCalstarttime();">&nbsp;<?echo $mod_strings['LBL_CALSTART']?> 
+			<select name="start_hour" <? if($current_user->start_hour == ''){?>disabled <? } ?> >
+				<?
+					for($i=6;$i<=16;$i++)
+					{
+						if($i >= 12)
+						{
+							if($i == 12)
+								$hour = $i;
+							else 
+								$hour = $i - 12;
+							$hour = $hour.":00 pm";
+						}
+						else
+               					{
+							$hour = $i.":00 am";
+       						}
+						if($i <= 9 && strlen(trim($i)) < 2)
+						{
+							$value = '0'.$i.':00';
+                       				}
+						else
+							$value = $i.':00';
+							if($value === $current_user->start_hour)
+                                                       	        $selected = 'selected';
+                                                         else
+                                                                $selected = '';
+				?>
+				<option <?echo $selected?> value="<? echo $value?>"><? echo $hour?></option>
+				<?
+					}
+				?>
+			</select><br>
+			<input type="checkbox" name="hour_format" value="24">&nbsp;<?echo $mod_strings['LBL_USE24']?>
+		</td>
+	</tr>
+	<tr><td colspan="2" style="border-bottom:1px dotted #CCCCCC;"></td></tr>
+	<tr>
+		<td align="right" valign="top"><img src="<?echo $image_path?>cal_sharing.jpg" width="45" height="38" align="absmiddle"></td>
+		<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.'>&nbsp;'.$name.'</td>';
+						if($cnt%2 == 0)
+							echo '</tr>';
+                                                $cnt++;
+					}
+                    		?>
+			</table>
+		</div>
+		</td>
+	</tr>
+	<tr><td colspan="2" style="border-bottom:1px dashed #CCCCCC;">&nbsp;</td></tr>
+	<tr>
+		<td colspan="2" align="center">
+			<input type="submit" name="save" value=" &nbsp;<? echo $app_strings['LBL_SAVE_BUTTON_LABEL'] ?>&nbsp;" class="classBtn" />&nbsp;&nbsp;
+			<input type="button" name="cancel" value=" <? echo $app_strings['LBL_CANCEL_BUTTON_LABEL'] ?> " class="classBtn" onclick="fninvsh('calSettings');" />
+		</td>
+	</tr>
+	<tr><td colspan="2" style="border-top:1px dashed #CCCCCC;">&nbsp;</td></tr>
+</table>
+</form>
 
-		</tr>';
-}
-?>
-</tr></form><table width="90%" align="center" border="0" cellspacing="0" cellpadding="5">
-<tr style="height: 25px;"><td colspan=3>&nbsp;</td></tr>
-<tr>
-        <td class="genHeaderSmall" colspan=3 align="left"><?php echo$mod_strings['LBL_CALENDAR_SHARING']?></td>
-</tr>
-<!--User list-->
-<form name="SharingForm" method="post" action="index.php">
-  <input type="hidden" name="module" value="Calendar">
-  <input type="hidden" name="action" value="updateCalendarSharing">
-  <input type="hidden" name="current_userid" value="<? echo $current_user->id ?>" >
-<table  style="border:1px solid #dddddd;" border=0 align="center" cellspacing=0 cellpadding=2 width=90%>
-	<tr>
-	<td valign=top>
-	<table border=0 cellspacing=0 cellpadding=2 width=100%>
-		<tr>
-		  <td colspan=3>
-		  <ul style="padding-left:20px">
-		    <li>To share your calendar, select the users from the "Available Users" list and click the "Add"  button.
-		    <li>To remove, select the users in the "Selected Users" list and the click "Remove" button.
-		  </ul>
-		  </td>
-		</tr>
-		<tr>
-		  <td><b>Available  Users</b></td>
-		  <td>&nbsp;</td>
-		  <td><b>Selected Users</b></td>
-		</tr>
-		<tr>
-		  <td width=40% align=center valign=top>
-		    <select name="available" id="available" class=small size=5 multiple style="height:70px;width:100%">
-		    <?php
-		    for($i=1;$i<=count($userDetails)+1;$i++){
-			if($userDetails[$i] != '')
-				echo "<option value=".$i.">".$userDetails[$i]."</option>";
-		    }
-		    ?>
-		    </select>
-		  </td>
-		  <input type=hidden name="sharedid" value="">
-		  <td width=20% align=center valign=top>
-                    <input type=button value="Add >>" class=small style="width:100%" onClick="addColumn()"><br>
-                    <input type=button value="<< Remove " class=small style="width:100%" onClick="delColumn()">
-    		  </td>
-		  <td width=40% align=center valign=top>
-		    <select name="selectedusers" id="selectedusers" class=small size=5 multiple style="height:70px;width:100%">
-		    </select>
-		  </td>
-		</tr>
-	</table>
-	</td></tr>
-</table>
-
-<tr>
-	<td align=center colspan=3>
-           <input title='Save [Alt+S]' accessKey='S' type="submit" class=small style="width:90px" onClick="return validate()" value="Save">
-           <input type="button" class=small style="width:90px" value="Cancel">
-        </td>
-</tr>
-</form>
-<tr style="height: 25px;"><td colspan=3>&nbsp;</td></tr>
-</table>
-</td></tr></table>
-</td></tr></table>
-</td></tr></table>
-
-<script language="JavaScript" type="text/JavaScript">
-
-function validate()
-{
-        formSelectColumnString();
-
-        if(document.SharingForm.sharedid.value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0)
-        {
-
-                alert('Select atleast one user');
-                return false;
-        }
-        return true;
-}
-
-setObjects();
-</script>

Modified: vtigercrm/trunk/modules/Calendar/script.js
==============================================================================
--- vtigercrm/trunk/modules/Calendar/script.js (original)
+++ vtigercrm/trunk/modules/Calendar/script.js Sat May 27 09:33:05 2006
@@ -80,7 +80,7 @@
 
 
 
-function gshow(argg1,startdate,enddate,starthr,startmin,startfmt,endhr,endmin,endfmt)
+function gshow(argg1,type,startdate,enddate,starthr,startmin,startfmt,endhr,endmin,endfmt)
 {
 	var y=document.getElementById(argg1).style;
 	
@@ -94,6 +94,10 @@
 		document.getElementById("endhr").value = endhr;
                 document.getElementById("endmin").value = endmin;
                 document.getElementById("endfmt").value = endfmt;
+		if(type == 'call')
+			document.appSave.activitytype[0].checked = true;
+		if(type == 'meeting')
+			document.appSave.activitytype[1].checked = true;
 		y.display="block";
 	}
 }
@@ -137,6 +141,15 @@
 		}
 		
 }
+
+function enableCalstarttime()
+{
+	if(document.SharingForm.sttime_check.checked == true)
+		document.SharingForm.start_hour.disabled = false;
+	else	
+		document.SharingForm.start_hour.disabled = true;
+}
+
 
 function check_form()
 {
@@ -228,6 +241,8 @@
 
 }
 
+
+
 function addColumn()
 {
         var selectlength=selectedColumnsObj.length
@@ -345,6 +360,27 @@
 	ajaxObj.process("index.php?",urlstring);
 }
 
+function fnAddEvent(obj,CurrObj,start_date,end_date,start_hr,start_min,start_fmt,end_hr,end_min,end_fmt){
+	var tagName = document.getElementById(CurrObj);
+	var left_Side = findPosX(obj);
+	var top_Side = findPosY(obj);
+	tagName.style.left= left_Side  + 'px';
+	tagName.style.top= top_Side + 22+ 'px';
+	tagName.style.display = 'block';
+	document.getElementById("addcall").href="javascript:gshow('addEvent','call','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"')";
+	document.getElementById("addmeeting").href="javascript:gshow('addEvent','meeting','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"')";
+	document.getElementById("addtodo").href="javascript:gshow('addEvent','todo','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"')";
+	
+}
+	
+function fnRemoveEvent(){
+	var tagName = document.getElementById('addEventDropDown').style.display= 'none';
+}
+
+function fnShowEvent(){
+		var tagName = document.getElementById('addEventDropDown').style.display= 'block';
+}
+
 function ajaxMiniCalSaveResponse(response)
 {
         document.getElementById("miniCal").innerHTML=response.responseText;
@@ -358,4 +394,37 @@
 	
 }
 
-
+function getCalSettings()
+{
+	 var ajaxObj = new Ajax(ajaxCalSettingsSaveResponse);
+	 var urlstring ="module=Calendar&action=CalendarAjax&type=settings&parenttab=My Home Page&ajax=true";
+	 ajaxObj.process("index.php?",urlstring);
+}
+
+function ajaxCalSettingsSaveResponse(response)
+{
+        document.getElementById("calSettings").innerHTML=response.responseText;
+}
+
+function getcalAction(obj,Lay,id,view,hour,day,month,year){
+    var tagName = document.getElementById(Lay);
+    var leftSide = findPosX(obj);
+    var topSide = findPosY(obj);
+    var maxW = tagName.style.width;
+    var widthM = maxW.substring(0,maxW.length-2);
+    var getVal = eval(leftSide) + eval(widthM);
+    if(getVal  > window.innerWidth ){
+        leftSide = eval(leftSide) - eval(widthM);
+        tagName.style.left = leftSide + 'px';
+    }
+    else
+        tagName.style.left= leftSide + 'px';
+    tagName.style.top= topSide + 'px';
+    tagName.style.display = 'block';
+    tagName.style.visibility = "visible";
+    document.getElementById("complete").href="index.php?return_module=Calendar&return_action=index&action=Save&module=Activities&record="+id+"&change_status=true&eventstatus=Held&view="+view+"&hour="+hour+"&day="+day+"&month="+month+"&year="+year+"&parenttab=My Home Page";
+    document.getElementById("pending").href="index.php?return_module=Calendar&return_action=index&action=Save&module=Activities&record="+id+"&change_status=true&eventstatus=Not Held&view="+view+"&hour="+hour+"&day="+day+"&month="+month+"&year="+year+"&parenttab=My Home Page";
+    document.getElementById("postpone").href="index.php?action=EditView&module=Activities&record="+id+"&activity_mode=Events";
+    document.getElementById("actdelete").href="index.php?return_module=Calendar&return_action=index&action=Delete&module=Activities&record="+id+"&view="+view+"&hour="+hour+"&day="+day+"&month="+month+"&year="+year+"&parenttab=My Home Page";
+}
+





More information about the vtigercrm-commits mailing list