Beispiel #1
0
<?php

include_once "include_db.php";
include_once "include_functions.php";
checkUserSessionandCookie();
$USERNAME = $_SESSION["uname"];
$TASKID = get_GET_var('taskid');
$manageWorks = new manageWorks();
$manageUsers = new manageUsers();
$manageProjects = new manageProjects();
$allPeers = $manageUsers->listOfAllPeerUsers($USERNAME);
$taskDetails = $manageWorks->get_workDetails($TASKID);
$taskDetails['work_briefDesc'] = $taskDetails['work_briefDesc'] ? $taskDetails['work_briefDesc'] : 'No Description';
$usersActiveProjects = $manageUsers->get_usersActiveProjects($USERNAME);
// $allProjects
//  `workID`,
//  `work_userAssigned`,
//  `work_addedBy` ,
//  `work_dateAdded` timestamp ,
//  `work_deadLine` date ,
//  `work_startDate` timestamp,
//  `work_completeDate` timestamp,
//  `work_briefDesc` text,
//  `work_Notes` text,
//  `work_status` '1',
//  `work_priority`  'N',
//  `work_projectName`,
//  `work_isPrivate` 'N',
$workStatus = $taskDetails["work_status"];
switch ($workStatus) {
    case $DE_GLOBALS_WORK_NEW:
Beispiel #2
0
    public function getUnreadComments($username, $howmany = 25)
    {
        // get the lastReadCommentIndex
        // get any comments greater than lastReadCommentIndex  where commentTask is either 'assigned to'  or 'assigned by' $username
        // mark the first one to use for markAllCommentsRead()
        $lastReadCommentIndex = executesql_returnArray("select user_lastReadCommentIndex from users where username='******'");
        if (!$lastReadCommentIndex) {
            $lastReadCommentIndex = 0;
        }
        $result = mysql_query("select COMMENTS.commentID as commentID, COMMENTS.workID as workID, COMMENTS.comment_date as comment_date, COMMENTS.comment_by as comment_by, COMMENTS.comment as comment from COMMENTS, WORKS where COMMENTS.commentID > " . $lastReadCommentIndex . " and COMMENTS.workID=WORKS.workID and (WORKS.work_userAssigned='{$username}' or WORKS.work_addedBy='{$username}' ) ORDER BY COMMENTS.commentID DESC");
        $readresult = mysql_query("select COMMENTS.commentID as commentID, COMMENTS.workID as workID, COMMENTS.comment_date as comment_date, COMMENTS.comment_by as comment_by, COMMENTS.comment as comment from COMMENTS, WORKS where COMMENTS.commentID <= " . $lastReadCommentIndex . " and COMMENTS.workID=WORKS.workID and (WORKS.work_userAssigned='{$username}' or WORKS.work_addedBy='{$username}' ) ORDER BY COMMENTS.commentID DESC LIMIT {$howmany}");
        $nwcount = @mysql_num_rows($result);
        $rccount = @mysql_num_rows($readresult);
        if ($nwcount == 0 && $rccount == 0) {
            return;
        }
        $lastCommentPerson = '';
        $manageWorks = new manageWorks();
        ?>
		<script>
			var update_LRCI = function(username, lrci){
				DE_USER_action( 'update_LRCI' , {
					username : username,
					lrci : lrci,
					callback:function(a){
						if(a){ window.location.href = 'comments.php'; }else{ My_JsLibrary.showErrMsg() ; }
					}
				});
			};
		</script>
		<table style='margin-top:20px;'>
		<?php 
        $rowcount = 0;
        while ($row = mysql_fetch_assoc($result)) {
            // $row['commentID'], $row['workID'], $row['comment_date'], $row['comment_by'], $row['comment']
            // get description of this workID
            if ($rowcount == 0 && $nwcount > 0) {
                ?>
				<tr><td></td>
					<td align='right'> <a class='blueTextButton' href='#' onclick="update_LRCI('<?php 
                echo $username;
                ?>
','<?php 
                echo $row['commentID'];
                ?>
');">mark as read</a> </td>
				</tr>
				<?php 
            }
            $rowcount++;
            $thisworkdetails = $manageWorks->get_workDetails($row['workID']);
            $this_bdesc = stripslashes($thisworkdetails['work_briefDesc']);
            ?>
			<tr><td valign='top' align='right'>
					<span style='font-weight:bold;'> <?php 
            if ($lastCommentPerson != $row['comment_by']) {
                echo $row['comment_by'];
            }
            ?>
 </span>
				</td>
				<td><div class='ncs1'>
						<div class='ncd0' onclick="ManageTasksJsFunction.detailsWork('<?php 
            echo $row['workID'];
            ?>
');">
							<?php 
            echo "Task " . $row['workID'] . ": " . getNwordsFromString($this_bdesc, 7);
            ?>
 ... 
						</div>
						<div class='ncd1'><?php 
            echo format_makeLinks(stripslashes(mynl2br($row['comment'])));
            ?>
 </div>
						<div class='nct1'><?php 
            echo caldateTS_to_humanWithTS($row['comment_date']);
            ?>
 </div>
					</div>
				</td>
			</tr>
			<?php 
            $lastCommentPerson = $row['comment_by'];
        }
        while ($row = mysql_fetch_assoc($readresult)) {
            // $row['commentID'], $row['workID'], $row['comment_date'], $row['comment_by'], $row['comment']
            // get description of this workID
            $thisworkdetails = $manageWorks->get_workDetails($row['workID']);
            $this_bdesc = $thisworkdetails['work_briefDesc'];
            $this_classname = 'rcs1';
            ?>
			<tr><td valign='top' align='right'>
					<span style='font-weight:bold; color: #A4A4A4;'> <?php 
            if ($lastCommentPerson != $row['comment_by']) {
                echo $row['comment_by'];
            }
            ?>
 </span>
				</td>
				<td><div class='rcs1'>
						<div class='ncd0' onclick="ManageTasksJsFunction.detailsWork('<?php 
            echo $row['workID'];
            ?>
');">
							<?php 
            echo "Task " . $row['workID'] . ": " . getNwordsFromString($this_bdesc, 7);
            ?>
 ... 
						</div>
						<div class='ncd1'><?php 
            echo mynl2br($row['comment']);
            ?>
 </div>
						<div class='nct1'><?php 
            echo caldateTS_to_humanWithTS($row['comment_date']);
            ?>
 </div>
					</div>
				</td>
			</tr>
			<?php 
            $lastCommentPerson = $row['comment_by'];
        }
        echo "</table>";
    }
Beispiel #3
0
     $manageWorks->addComment($workid, APPNAME, $COMMENTLOGMESSAGE);
     send_Action_Response('Success', "Details emailed !");
     exit;
     break;
 case 'AddComment':
     $comment = htmlentities($_POST['newComment']);
     $workid = get_POST_var('workid');
     $notifyAssigned = get_POST_var('notifyAssigned');
     if (!checkPermissions_canUserViewTask($USERNAME, $workid)) {
         send_Action_Response('Fail', 'insufficient privilege !');
         return;
     }
     $manageWorks = new manageWorks();
     $manageWorks->addComment($workid, $USERNAME, $comment);
     if ($notifyAssigned == 'Y') {
         $ThisWorkDetails = $manageWorks->get_workDetails($workid);
         $userassigned = $ThisWorkDetails['work_userAssigned'];
         $userOwner = $ThisWorkDetails['work_addedBy'];
         $work_briefDesc = $ThisWorkDetails['work_briefDesc'];
         $OtherPerson = $USERNAME == $userassigned ? $userOwner : $userassigned;
         $tmp_notify_subject = "[#DE] new comment by {$USERNAME} on  '{$work_briefDesc}' ";
         $tmp_notify_body = " <BR> New Comment :<BR> <B> {$comment} </B>\n\t\t\t\t\t\t\t\t<BR> -------------------------------------------\n\t\t\t\t\t\t\t\t<BR> Quick link to task : http://{$_SESSION['subdomain']}.discreteevents.com/taskdetails.php?taskid={$workid} ";
         NotifyEventEmail($OtherPerson, $USERNAME, $tmp_notify_subject, $tmp_notify_body);
     }
     send_Action_Response('Success', "Comment Added !");
     exit;
     break;
 case 'AddNote':
     $newNote = get_POST_var('NewNoteText');
     $manageNotes = new manageNotes();
     $manageNotes->insertNote($newNote);