コード例 #1
0
/**
    * Update page
*/
function display_update_page($draftid = -1)
{
    global $id;
    global $incidentid;
    global $action;
    global $CONFIG;
    global $iconset;
    global $now;
    global $dbDrafts;
    global $sit;
    if ($draftid != -1) {
        $draftsql = "SELECT * FROM `{$dbDrafts}` WHERE id = {$draftid}";
        $draftresult = mysql_query($draftsql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        $draftobj = mysql_fetch_object($draftresult);
        $metadata = explode("|", $draftobj->meta);
    }
    // No update body text detected show update form
    ?>
    <script type="text/javascript">
    <!--
    function deleteOption(object) {
        var Current = object.updatetype.selectedIndex;
        object.updatetype.options[Current] = null;
    }

    function notarget(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        object.priority.value=object.storepriority.value;
        //object.priority.disabled=true;
        object.priority.disabled=false;
        object.updatetype.selectedIndex=0;
        object.updatetype.disabled=false;
    }


    function initialresponse(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.selectedIndex=0;
        object.updatetype.disabled=false;
    }


    function actionplan(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }

        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Action Plan', 'actionplan', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.disabled=true;
    }

    function reprioritise(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        // add new option
        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Reprioritise', 'solution', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.disabled=false;
        document.updateform.priority.disabled=false;
        object.updatetype.disabled=true;
    }

    function probdef(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }

        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Problem Definition', 'probdef', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.disabled=true;
    }

    function replaceOption(object) {
        var Current = object.updatetype.selectedIndex;
        object.updatetype.options[Current].text = object.currentText.value;
        object.updatetype.options[Current].value = object.currentText.value;
    }

    <?php 
    echo "var draftid = {$draftid}";
    ?>

    // Auto save
    function save_content(){
        var xmlhttp=false;

        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp=false;
            }
        }
        if (!xmlhttp && window.createRequest) {
            try {
                xmlhttp = window.createRequest();
            } catch (e) {
                xmlhttp=false;
            }
        }

        var toPass = $('updatelog').value;
        //alert(toPass.value);

        var meta = $('target').value+"|"+$('updatetype').value+"|"+$('cust_vis').checked+"|";
        meta += $('priority').value+"|"+$('newstatus').value+"|"+$('nextaction').value+"|";

        if (toPass != '')
        {
            // xmlhttp.open("GET", "ajaxdata.php?action=auto_save&userid="+<?php 
    echo $_SESSION['userid'];
    ?>
+"&type=update&incidentid="+<?php 
    echo $id;
    ?>
+"&draftid="+draftid+"&meta="+meta+"&content="+escape(toPass), true);
            var url = "ajaxdata.php";
            var params = "action=auto_save&userid="+<?php 
    echo $_SESSION['userid'];
    ?>
+"&type=update&incidentid="+<?php 
    echo $id;
    ?>
+"&draftid="+draftid+"&meta="+meta+"&content="+escape(toPass);
            xmlhttp.open("POST", url, true)
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.setRequestHeader("Content-length", params.length);
            xmlhttp.setRequestHeader("Connection", "close");

            xmlhttp.onreadystatechange=function() {
                //remove this in the future after testing
                if (xmlhttp.readyState==4) {
                    if (xmlhttp.responseText != ''){
                        //alert(xmlhttp.responseText);
                        if (draftid == -1)
                        {
                            draftid = xmlhttp.responseText;
                            $('draftid').value = draftid;
                        }
                        var currentTime = new Date();
                        var hours = currentTime.getHours();
                        var minutes = currentTime.getMinutes();
                        if (minutes < 10)
                        {
                            minutes = "0"+minutes;
                        }
                        var seconds = currentTime.getSeconds();
                        if (seconds < 10)
                        {
                            seconds = "0"+seconds;
                        }
                        $('updatestr').innerHTML = '<?php 
    echo "<a href=\"javascript:save_content();\">" . icon('save', 16, $GLOBALS['strSaveDraft']) . "</a> " . icon('info', 16, $GLOBALS['strDraftLastSaved']) . " ";
    ?>
' + hours + ':' + minutes + ':' + seconds;
                    }
                }
            }
            xmlhttp.send(params);
        }
    }

    setInterval("save_content()", 10000); //every 10 seconds

    //-->
    </script>
    <?php 
    echo show_form_errors('update');
    clear_form_errors('update');
    //echo "<form action='".$_SERVER['PHP_SELF']."?id={$id}&amp;draftid={$draftid}' method='post' name='updateform' id='updateform' enctype='multipart/form-data'>";
    echo "<form action='" . $_SERVER['PHP_SELF'] . "?id={$id}' method='post' name='updateform' id='updateform' enctype='multipart/form-data'>";
    echo "<table class='vertical'>";
    echo "<tr>";
    echo "<th align='right' width='20%;'>{$GLOBALS['strSLATarget']}";
    echo icon('sla', 16) . "</th>";
    echo "<td class='shade2'>";
    $target = incident_get_next_target($id);
    $targetNone = '';
    $targetInitialresponse = '';
    $targetProbdef = '';
    $targetActionplan = '';
    $targetSolution = '';
    $typeResearch = '';
    $typeEmailin = '';
    $typeEmailout = '';
    $typePhonecallin = '';
    $typePhonecallout = '';
    $typeExternalinfo = '';
    $typeReviewmet = '';
    if (!empty($metadata)) {
        switch ($metadata[0]) {
            case 'none':
                $targetNone = " SELECTED ";
                break;
            case 'initialresponse':
                $targetInitialresponse = " SELECTED ";
                break;
            case 'probdef':
                $targetProbdef = " SELECTED ";
                break;
            case 'actionplan':
                $targetActionplan = " SELECTED ";
                break;
            case 'solution':
                $targetSolution = " SELECTED ";
                break;
        }
        switch ($metadata[1]) {
            case 'research':
                $typeResearch = " SELECTED ";
                break;
            case 'emailin':
                $typeEmailin = " SELECTED ";
                break;
            case 'emailout':
                $typeEmailout = " SELECTED ";
                break;
            case 'phonecallin':
                $typePhonecallin = " SELECTED ";
                break;
            case 'phonecallout':
                $typePhonecallout = " SELECTED ";
                break;
            case 'externalinfo':
                $typeExternalinfo = " SELECTED ";
                break;
            case 'reviewmet':
                $typeReviewmet = " SELECTED ";
                break;
        }
    }
    echo "<select name='target' id='target' class='dropdown'>\n";
    echo "<option value='none' {$targetNone} onclick='notarget(this.form)'>{$GLOBALS['strNone']}</option>\n";
    switch ($target->type) {
        case 'initialresponse':
            echo "<option value='initialresponse' {$targetInitialresponse} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/initialresponse.png); background-repeat: no-repeat;' onclick='initialresponse(this.form)' >{$GLOBALS['strInitialResponse']}</option>\n";
            echo "<option value='probdef' {$targetProbdef} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/probdef.png); background-repeat: no-repeat;' onclick='probdef(this.form)'>{$GLOBALS['strProblemDefinition']}</option>\n";
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'probdef':
            echo "<option value='probdef' {$targetProbdef} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/probdef.png); background-repeat: no-repeat;' onclick='probdef(this.form)'>{$GLOBALS['strProblemDefinition']}</option>\n";
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'actionplan':
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'solution':
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
    }
    echo "</select>\n";
    echo "</td></tr>\n";
    echo "<tr><th align='right'>{$GLOBALS['strUpdateType']}</th>";
    echo "<td class='shade1'>";
    echo "<select name='updatetype' id='updatetype' class='dropdown'>";
    /*
    if ($target->type!='actionplan' && $target->type!='solution')
        echo "<option value='probdef'>Problem Definition</option>\n";
    if ($target->type!='solution')
        echo "<option value='actionplan'>Action Plan</option>\n";
    */
    echo "<option value='research' {$typeResearch} selected='selected' style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/research.png); background-repeat: no-repeat;'>{$GLOBALS['strResearchNotes']}</option>\n";
    echo "<option value='emailin' {$typeEmailin} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/emailin.png); background-repeat: no-repeat;'>{$GLOBALS['strEmailFromCustomer']}</option>\n";
    echo "<option value='emailout' {$typeEmailout} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/emailout.png); background-repeat: no-repeat;'>{$GLOBALS['strEmailToCustomer']}</option>\n";
    echo "<option value='phonecallin' {$typePhonecallin} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/callin.png); background-repeat: no-repeat;'>{$GLOBALS['strCallFromCustomer']}</option>\n";
    echo "<option value='phonecallout' {$typePhonecallout} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/callout.png); background-repeat: no-repeat;'>{$GLOBALS['strCallToCustomer']}</option>\n";
    echo "<option value='externalinfo' {$typeExternalinfo} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/externalinfo.png); background-repeat: no-repeat;'>{$GLOBALS['strExternalInfo']}</option>\n";
    echo "<option value='reviewmet' {$typeReviewmet} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/review.png); background-repeat: no-repeat;'>{$GLOBALS['strReview']}</option>\n";
    echo "</select>";
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strUpdate']}<br />";
    echo "<span class='required'>{$GLOBALS['strRequired']}</span></th>";
    echo "<td class='shade1'>";
    $checkbox = '';
    if (!empty($metadata)) {
        if ($metadata[2] == "true") {
            $checkbox = "checked='checked'";
        }
    } else {
        $checkbox = "checked='checked'";
    }
    echo "<label><input type='checkbox' name='cust_vis' id='cust_vis' ";
    echo "{$checkbox} value='yes' /> {$GLOBALS['strMakeVisibleInPortal']}<label><br />";
    echo bbcode_toolbar('updatelog');
    echo "<textarea name='bodytext' id='updatelog' rows='13' cols='50'>";
    if ($draftid != -1) {
        echo $draftobj->content;
    }
    echo "</textarea>";
    echo "<div id='updatestr'><a href='javascript:save_content();'>" . icon('save', 16, $GLOBALS['strSaveDraft']) . "</a></div>";
    echo "</td></tr>";
    if ($target->type == 'initialresponse') {
        $disable_priority = TRUE;
    } else {
        $disable_priority = FALSE;
    }
    echo "<tr><th align='right'>{$GLOBALS['strNewPriority']}</th>";
    echo "<td class='shade1'>";
    //    // FIXME fix maximum priority
    //    $servicelevel=maintenance_servicelevel(incident_maintid($id));
    //    if ($servicelevel == 2 || $servicelevel == 5) $maxpriority = 4;
    //    else $maxpriority = 3;
    $maxpriority = 4;
    $setPriorityTo = incident_priority($id);
    if (!empty($metadata)) {
        $setPriorityTo = $metadata[3];
    }
    echo priority_drop_down("newpriority", $setPriorityTo, $maxpriority, $disable_priority);
    //id='priority
    echo "</td></tr>\n";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strNewStatus']}</th>";
    $setStatusTo = incident_status($id);
    $disabled = FALSE;
    //we do this so if you update another user's incident, it defaults to active
    if ($sit[2] != incident_owner($incidentid)) {
        $setStatusTo = '0';
    } elseif (!empty($metadata)) {
        $setStatusTo = $metadata[4];
    }
    echo "<td class='shade1'>" . incidentstatus_drop_down("newstatus", $setStatusTo) . "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strNextAction']}</th>";
    $nextAction = '';
    if (!empty($metadata)) {
        $nextAction = $metadata[5];
    }
    echo "<td class='shade2'><input type='text' name='nextaction' ";
    echo "id='nextaction' maxlength='50' size='30' value='{$nextAction}' /></td></tr>";
    echo "<tr>";
    echo "<th align='right'>";
    echo "<strong>{$GLOBALS['strTimeToNextAction']}</strong></th>";
    echo "<td class='shade2'>";
    echo show_next_action();
    echo "</td></tr>";
    echo "<tr>";
    // calculate upload filesize
    $att_file_size = readable_file_size($CONFIG['upload_max_filesize']);
    echo "<th align='right'>{$GLOBALS['strAttachFile']}";
    echo " (&lt;{$att_file_size})</th>";
    echo "<td class='shade1'><input type='hidden' name='MAX_FILE_SIZE' value='{$CONFIG['upload_max_filesize']}' />";
    echo "<input type='file' name='attachment' size='40' maxfilesize='{$CONFIG['upload_max_filesize']}' /></td>";
    echo "</tr>";
    echo "</table>";
    echo "<p class='center'>";
    echo "<input type='hidden' name='action' value='update' />";
    if ($draftid == -1) {
        $localdraft = '';
    } else {
        $localdraft = $draftid;
    }
    echo "<input type='hidden' name='draftid' id='draftid' value='{$localdraft}' />";
    echo "<input type='hidden' name='storepriority' value='" . incident_priority($id) . "' />";
    echo "<input type='submit' name='submit' value='{$GLOBALS['strUpdateIncident']}' /></p>";
    echo "</form>";
}
コード例 #2
0
     $insresult = mysql_query($insql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_WARNING);
     }
     if (mysql_num_rows($insresult) > 0) {
         $inupdate = mysql_fetch_object($insresult);
         if ($inupdate->locked == $sit[2] or empty($inupdate->locked)) {
             echo "<a class='barlink' href='unlock_update.php?id={$id}'>{$strUnlock}</a> | ";
             echo "<a class='barlink' href=\"javascript:window.location='move_update.php?id={$id}&amp;updateid={$inupdate->updateid}&amp;contactid={$inupdate->contactid}&amp;win=incomingview'\" >{$strAssign}</a> | ";
             echo "<a class='barlink' href=\"javascript:window.opener.location='incident_add.php?action=findcontact&amp;incomingid={$id}&amp;search_string={$inupdate->emailfrom}&amp;from={$inupdate->from}&amp;contactid={$inupdate->contactid}&amp;win=incomingcreate'; window.close();\">{$strCreate}</a> | ";
             echo "<a class='barlink' href=\"javascript:window.opener.location='delete_update.php?updateid={$inupdate->updateid}&amp;tempid={$inupdate->id}&amp;timestamp={$inupdate->timestamp}'; window.close(); \">{$strDelete}</a>";
         }
     } elseif (incident_status($id) != 2) {
         echo "<a href= \"javascript:wt_winpopup('incident_reassign.php?id={$id}&amp;reason=Initial%20assignment%20to%20engineer&amp;popup=yes','mini');\" title='Assign this incident'>{$strAssign}</a>";
     }
 } elseif (incident_status($id) != 2) {
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_update.php?id={$id}&amp;popup={$popup}' accesskey='U'>{$strUpdate}</a> | ";
     echo "<a class='barlink' href='javascript:close_window({$id});' accesskey='C'>{$strClose}</a> | ";
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_reassign.php?id={$id}&amp;popup={$popup}' accesskey='R'>{$strReassign}</a> | ";
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_edit.php?id={$id}&amp;popup={$popup}' accesskey='T'>{$strEdit}</a> | ";
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_service_levels.php?id={$id}&amp;popup={$popup}' accesskey='S'>{$strService}</a> | ";
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_relationships.php?id={$id}&amp;tab=relationships' accesskey='L'>{$strRelations}</a> | ";
     echo "<a class='barlink' href='javascript:email_window({$id})' accesskey='E'>{$strEmail}</a> | ";
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_attachments.php?id={$id}&amp;popup={$popup}' accesskey='F'>{$strFiles}</a> | ";
     if ($servicelevel->timed == 'yes') {
         echo "<a class='barlink' href='{$CONFIG['application_webpath']}tasks.php?incident={$id}'>{$strActivities}</a> | ";
     }
     echo "<a class='barlink' href='{$CONFIG['application_webpath']}incident_details.php?id={$id}&amp;popup={$popup}' accesskey='D'>{$strDetailsAndLog}</a> | ";
     echo "<a class='barlink' href='javascript:help_window({$permission});'>{$strHelpChar}</a>";
     if (!empty($_REQUEST['popup'])) {
         echo " | <a class=barlink href='javascript:window.close();'>{$strCloseWindow}</a>";
コード例 #3
0
                break;
        }
        if ($updates['nextaction'] != '') {
            echo " Next Action: <strong>" . $updates['nextaction'] . '</strong>';
        }
        echo " - {$update_timestamp_string}</th></tr>";
        echo "<tr><td class='shade2' width='100%'>";
        $updatecounter++;
        echo parse_updatebody($updates['bodytext']);
        echo "</td></tr>";
        echo "</table>";
        include APPLICATION_INCPATH . 'htmlfooter.inc.php';
    }
} else {
    // check that the incident is still open.  i.e. status not = closed
    if (incident_status($incidentid) != STATUS_CLOSED) {
        $moved_attachments = TRUE;
        // update the incident record, change the incident status to active
        $sql = "UPDATE `{$dbIncidents}` SET status='1', lastupdated='{$now}', timeofnextaction='0' WHERE id='{$incidentid}'";
        mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
        }
        $old_path = $CONFIG['attachment_fspath'] . 'updates' . $fsdelim;
        $new_path = $CONFIG['attachment_fspath'] . $incidentid . $fsdelim;
        //move attachments from updates to incident
        $sql = "SELECT linkcolref, filename FROM `{$dbLinks}` AS l, ";
        $sql .= "`{$dbFiles}` as f ";
        $sql .= "WHERE l.origcolref = '{$updateid}' ";
        $sql .= "AND l.linktype = 5 ";
        $sql .= "AND l.linkcolref = f.id";
コード例 #4
0
             } else {
                 //new call
                 $sql = "INSERT INTO `{$dbTempIncoming}` (updateid, incidentid, `from`, emailfrom, subject, reason, contactid) ";
                 $sql .= "VALUES ('{$updateid}', '0', '" . mysql_real_escape_string($from_email) . "',";
                 $sql .= "'" . mysql_real_escape_string($from_name) . "', '" . mysql_real_escape_string($subject);
                 $sql .= "', '{$SYSLANG['strPossibleNewIncident']}', '{$contactid}' )";
                 mysql_query($sql);
                 if (mysql_error()) {
                     trigger_error(mysql_error(), E_USER_WARNING);
                 }
             }
             $holdingemailid = mysql_insert_id();
         }
         //Fix for http://bugs.sitracker.org/view.php?id=572, we shouldn't really have
         //incident ID of 0 here, but apparently we do :/
         if (FALSE !== incident_status($incidentid)) {
             trigger('TRIGGER_INCIDENT_UPDATED_EXTERNAL', array('incidentid' => $incidentid));
         }
     } else {
         if ($incidentid != 0) {
             $bodytext = "[i]Received duplicate email within 15 minutes. Message not stored. Possible mail loop.[/i]";
             $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, bodytext, timestamp, customervisibility, currentowner, currentstatus) ";
             $sql .= "VALUES ('{$incidentid}', 0, 'emailin', '{$bodytext}', '{$now}', '{$customer_visible}', '{$owner}', 1)";
             mysql_query($sql);
             if (mysql_error()) {
                 trigger_error(mysql_error(), E_USER_WARNING);
             }
         }
     }
 }
 //** END UPDATE **//
コード例 #5
0
ファイル: tasks.php プロジェクト: sitracker/sitracker_old
         echo "</td>";
         echo "</tr>";
     }
 }
 echo "</table>\n";
 echo "</form>";
 if ($mode == 'incident') {
     echo "<script type='text/javascript'>\n//<![CDATA[\ncountUp();\n//]]>\n</script>";
     //force a quick udate
 }
 //echo "<pre>";
 //print_r($billing);
 //echo "</pre>";
 if ($mode == 'incident') {
     // Show add activity link if the incident is open
     if (incident_status($id) != 2 and !$engineerhasrunnintask) {
         echo "<p align='center'><a href='task_add.php?incident={$id}'>{$strStartNewActivity}</a></p>";
     }
 } else {
     if ($show != 'incidents') {
         echo "<p align='center'><a href='task_add.php'>{$strAddTask}</a></p>";
     }
 }
 if ($mode == 'incident') {
     echo "<h3>" . icon('billing', 32, $strActivityBilling) . " ";
     echo "{$strActivityBilling}</h3>";
     echo "<p align='center'>{$strActivityBillingInfo}</p>";
     if (!empty($billing)) {
         echo "<p><table align='center'>";
         echo "<tr><td></td><th>{$GLOBALS['strMinutes']}</th></th></tr>";
         echo "<tr><th>{$GLOBALS['strBillingEngineerPeriod']}</th>";
コード例 #6
0
ファイル: search.php プロジェクト: sitracker/sitracker_old
        $x = $xtemp;
    }
    return $x;
}
include APPLICATION_INCPATH . 'htmlheader.inc.php';
?>
<script type='text/javascript'>
//<![CDATA[
var id = <?php 
echo $q;
?>
;
if (!isNaN(id))
{
    <?php 
if (FALSE !== incident_status($q)) {
    $sql = "SELECT id FROM `{$dbIncidents}` WHERE id='{$q}'";
    $result = mysql_query($sql);
    if (mysql_num_rows($result) > 0) {
        ?>
                window.location = 'incident_details.php?id=' + id + '&win=jump&return=<?php 
        if (!empty($_SERVER['HTTP_REFERER'])) {
            echo $_SERVER['HTTP_REFERER'];
        } else {
            echo $_CONFIG['application_webpath'];
        }
        ?>
';
            <?php 
    }
}
コード例 #7
0
ファイル: incident.php プロジェクト: sitracker/sitracker_old
 $quotereplace[5] = "<span class='quoteirrel'>\\1</span>";
 $quotereplace[6] = "<span class='quoteirrel'>\\1</span>";
 $quotereplace[7] = "<span class='quote1'>\\1</span>";
 $quotereplace[8] = "<span class='quote2'>\\1</span>";
 $quotereplace[9] = "<span class='quote3'>\\1</span>";
 $updatebody = preg_replace($quote, $quotereplace, $updatebody);
 $updatebody = bbcode($updatebody);
 //$updatebody = emotion($updatebody);
 //"!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e"
 // [\n\t ]+
 $updatebody = preg_replace("!([\n\t ]+)(http[s]?:/{2}[\\w\\.]{2,}[/\\w\\-\\.\\?\\&\\=\\#\$\\%|;|\\[|\\]~:]*)!e", "'\\1<a href=\"\\2\" title=\"\\2\">'.(strlen('\\2')>=70 ? substr('\\2',0,70).'...':'\\2').'</a>'", $updatebody);
 // Lookup some extra data
 $updateuser = user_realname($update->userid, TRUE);
 $updatetime = readable_date($update->timestamp);
 $currentowner = user_realname($update->currentowner, TRUE);
 $currentstatus = incident_status($update->currentstatus);
 echo "<div class='detailhead' align='center'>";
 //show update type icon
 if (array_key_exists($update->type, $updatetypes)) {
     if (!empty($update->sla) and $update->type == 'slamet') {
         echo icon($slatypes[$update->sla]['icon'], 16, $update->type);
     }
     echo icon($updatetypes[$update->type]['icon'], 16, $update->type);
 } else {
     echo icon($updatetypes['research']['icon'], 16, $strResearch);
     if ($update->sla != '') {
         echo icon($slatypes[$update->sla]['icon'], 16, $update->type);
     }
 }
 echo " {$updatetime}</div>";
 if ($updatebody != '') {
コード例 #8
0
         break;
     case 'date':
         // kh: parse date from calendar picker, format: 200-12-31
         $date = explode("-", $date);
         $timeofnextaction = mktime(8 + $timeoffset, 0, 0, $date[1], $date[2], $date[0]);
         $now = time();
         if ($timeofnextaction < 0) {
             $timeofnextaction = 0;
         }
         break;
     default:
         $timeofnextaction = 0;
         break;
 }
 $oldtimeofnextaction = incident_timeofnextaction($id);
 if ($newincidentstatus != incident_status($id)) {
     $sql = "UPDATE `{$dbIncidents}` SET status='{$newincidentstatus}', lastupdated='{$now}', timeofnextaction='{$timeofnextaction}' WHERE id='{$id}'";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     $updateheader = "New Status: <b>" . incidentstatus_name($newincidentstatus) . "</b>\n\n";
 } else {
     mysql_query("UPDATE `{$dbIncidents}` SET lastupdated='{$now}', timeofnextaction='{$timeofnextaction}' WHERE id='{$id}'");
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
 }
 $timetext = '';
 if ($timeofnextaction != 0) {
     $timetext = "Next Action Time: ";
コード例 #9
0
     break;
 case 'delete':
     // Retrieve details of the relationship
     $sql = "SELECT * FROM `{$dbRelatedIncidents}` WHERE id='{$rid}'";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
     }
     $relation = mysql_fetch_object($result);
     $sql = "DELETE FROM `{$dbRelatedIncidents}` WHERE id='{$rid}'";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     $onwer = incident_owner($id);
     $status = incident_status($id);
     // Insert an entry into the update log for this incident
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
     $sql .= "VALUES ('{$relation->incidentid}', '{$sit[2]}', 'editing', '{$now}', '{$owner}', '{$status}', 'hide', '','Removed relationship with Incident {$relation->relatedid}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     // Insert an entry into the update log for the related incident
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
     $sql .= "VALUES ('{$relation->relatedid}', '{$sit[2]}', 'editing', '{$now}', '{$owner}', '{$status}', 'hide', '','Removed relationship with Incident {$relation->incidentid}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     echo "<br /><p class='info' align='center'>{$strRelationshipRemoved}</p>";
コード例 #10
0
 if ($_FILES['attachment']['error'] != '' and $_FILES['attachment']['error'] != UPLOAD_ERR_OK) {
     echo get_file_upload_error_message($_FILES['attachment']['error'], $_FILES['attachment']['name']);
 } else {
     // OK to proceed
     // Create an entry in the files table
     $sql = "INSERT INTO `{$dbFiles}` (category, filename, size, userid, usertype, filedate) ";
     $sql .= "VALUES ('public', '{$_FILES['attachment']['name']}', '{$_FILES['attachment']['size']}', '{$sit[2]}', 'user', NOW())";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     $fileid = mysql_insert_id();
     //create update
     $updatetext = $SYSLANG['strFileUploaded'] . ": [[att={$fileid}]]{$_FILES['attachment']['name']}[[/att]]";
     $currentowner = incident_owner($incidentid);
     $currentstatus = incident_status($incidentid);
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, `type`, `currentowner`, `currentstatus`, ";
     $sql .= "bodytext, `timestamp`) ";
     $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'research', '{$currentowner}', '{$currentstatus}', ";
     $sql .= "'{$updatetext}', '{$now}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     $updateid = mysql_insert_id();
     $incident_attachment_fspath = $CONFIG['attachment_fspath'] . $fsdelim . $incidentid . $fsdelim;
     // make incident attachment dir if it doesn't exist
     $newfilename = $incident_attachment_fspath . $fsdelim . $fileid . "-" . $_FILES['attachment']['name'];
     $umask = umask(00);
     $mk = TRUE;
     if (!file_exists($incident_attachment_fspath)) {