コード例 #1
0
    /**
     * Renders the Issue History Tab
     *
     * @param mixed $_issuesContainer array of issues associated with current ticket
     *
     * @author Abhinav Kumar
     * @return boolean 'true' on success and 'false' otherwise
     * @throws SWIFT_Exception if class is not loaded
     */
    public function RenderHistoryTab($_issuesContainer)
    {
        $_SWIFT = SWIFT::GetInstance();
        $_JIRABridge = SWIFT_JIRABridge::GetInstance();
        if (!$this->GetIsClassLoaded()) {
            throw new SWIFT_Exception(__CLASS__ . ' ' . SWIFT_CLASSNOTLOADED);
        } else {
            if (!is_array($_issuesContainer)) {
                throw new SWIFT_Exception(SWIFT_INVALIDDATA);
            }
        }
        $this->UserInterface->Start(get_class($this), '', SWIFT_UserInterface::MODE_INSERT, false);
        $_IssueHistoryTabObject = new SWIFT_UserInterfaceTab($this->UserInterface, 'history', '', 1, 'history', false, false, 4, '');
        $_columnContainer = array();
        // Issue ID
        $_columnContainer[0]['value'] = $this->Language->Get('jira_issueid');
        $_columnContainer[0]['align'] = 'left';
        $_columnContainer[0]['width'] = '10';
        // Summary
        $_columnContainer[1]['value'] = $this->Language->Get('jira_summary');
        $_columnContainer[1]['align'] = 'left';
        $_columnContainer[1]['width'] = '100';
        // Updated
        $_columnContainer[3]['value'] = $this->Language->Get('jira_updated');
        $_columnContainer[3]['align'] = 'left';
        $_columnContainer[3]['width'] = '10';
        // Priority
        $_columnContainer[4]['value'] = $this->Language->Get('jira_priority');
        $_columnContainer[4]['align'] = 'left';
        $_columnContainer[4]['width'] = '10';
        // Status
        $_columnContainer[5]['value'] = $this->Language->Get('jira_status');
        $_columnContainer[5]['align'] = 'left';
        $_columnContainer[5]['width'] = '10';
        // Assigned To
        $_columnContainer[6]['value'] = $this->Language->Get('jira_assignedto');
        $_columnContainer[6]['align'] = 'left';
        $_columnContainer[6]['width'] = '10';
        // Action
        $_columnContainer[7]['value'] = $this->Language->Get('jira_action');
        $_columnContainer[7]['align'] = 'left';
        $_columnContainer[7]['width'] = '10';
        $_IssueHistoryTabObject->Row($_columnContainer, 'gridtabletitlerow');
        if (empty($_issuesContainer)) {
            $_columnContainer = array();
            $_columnContainer[0]['value'] = $this->Language->Get('jira_noissuefound');
            $_columnContainer[0]['align'] = 'left';
            $_columnContainer[0]['width'] = '100%';
            $_IssueHistoryTabObject->Row($_columnContainer);
            $_renderHTML = $_IssueHistoryTabObject->GetDisplayHTML(true);
            $_renderHTML .= '<script language="Javascript" type="text/javascript">';
            $_renderHTML .= 'ClearFunctionQueue();';
            $_renderHTML .= '</script>';
            echo $_renderHTML;
            return true;
        }
        foreach ($_issuesContainer as $_Issue) {
            $_columnContainer = array();
            $_issueURL = $_SWIFT->Settings->Get('bj_jiraurl') . 'browse/' . $_Issue->GetKey();
            // Key
            $_columnContainer[0]['value'] = '<a href="' . $_issueURL . '" target="_blank">' . htmlspecialchars($_Issue->GetKey()) . '</a>';
            $_columnContainer[0]['align'] = 'left';
            $_columnContainer[0]['width'] = '10';
            // Summary
            $_columnContainer[1]['value'] = '<a href="' . $_issueURL . '" target="_blank">' . IIF(strlen($_Issue->GetSummary()) > 100, htmlspecialchars(substr($_Issue->GetSummary(), 0, 100)) . '...', htmlspecialchars($_Issue->GetSummary())) . '</a>';
            $_columnContainer[1]['align'] = 'left';
            $_columnContainer[1]['width'] = '100';
            // Updated
            $_columnContainer[3]['value'] = htmlspecialchars(SWIFT_Date::EasyDate($_Issue->GetUpdated()) . IIF(SWIFT_Date::EasyDate($_Issue->GetUpdated()) == $this->Language->Get('edjustnow'), '', ' ago'));
            $_columnContainer[3]['align'] = 'left';
            $_columnContainer[3]['width'] = '10';
            // Priority
            $_columnContainer[4]['value'] = htmlspecialchars($_Issue->GetPriority());
            $_columnContainer[4]['align'] = 'left';
            $_columnContainer[4]['width'] = '10';
            // Status
            $_columnContainer[5]['value'] = htmlspecialchars($_Issue->GetStatus());
            $_columnContainer[5]['align'] = 'left';
            $_columnContainer[5]['width'] = '10';
            // Comments
            $_columnContainer[6]['value'] = htmlspecialchars($_Issue->GetAssignee());
            $_columnContainer[6]['align'] = 'left';
            $_columnContainer[6]['width'] = '10';
            // Unlink
            $_columnContainer[7]['value'] = '<a title="' . $this->Language->Get('postJIRAComment') . '" href="#" onclick="postJIRAComment(\'' . $_Issue->GetKey() . '\')">
										<img src="' . SWIFT::Get('swiftpath') . SWIFT_APPSDIRECTORY . '/jira/resources/icon-comment.gif' . '"/>
									  </a>' . ' | ' . '<a title="' . $this->Language->Get('jira_unlinkissue') . '" href="#" onclick="unlinkJIRAIssue(\'' . $_Issue->GetKey() . '\')">
										<img src="' . SWIFT::Get('swiftpath') . SWIFT_APPSDIRECTORY . '/jira/resources/edit_delete.png' . '"/>
									   </a>';
            $_columnContainer[7]['align'] = 'left';
            $_columnContainer[7]['width'] = '10';
            $_IssueHistoryTabObject->Row($_columnContainer, '', $_Issue->GetKey());
            //Fetch the issue comments now
            if ($_JIRABridge) {
                $_commentsContainer = $_JIRABridge->FetchAllCommentsBy('issuekey', $_Issue->GetKey());
                if (isset($_columnContainer) && _is_array($_commentsContainer)) {
                    $_renderedNotes = array();
                    foreach ($_commentsContainer as $_JIRAComment) {
                        $_renderedNotes[] = '<div class="notebackground">
											<div class="notecontainer">
												<div class="note">' . nl2br($_JIRAComment->GetRawBody(), true) . '</div>
											</div>
											<cite class="tip">
											<strong>
												<img border="0" align="absmiddle" src="' . SWIFT::Get('themepath') . 'images/icon_user2.png"/> ' . $_JIRAComment->GetAuthor() . ' ' . htmlspecialchars(SWIFT_Date::EasyDate($_JIRAComment->GetUpdated())) . ' ago
												</strong><div style="float: right; padding-right: 4px;"></div>
											</cite>
										</div>';
                    }
                    $_renderedNotes = implode('', $_renderedNotes);
                    $_commentContainer[0]['value'] = '<div class="allnotes">' . $_renderedNotes . '</div>';
                    $_commentContainer[0]['width'] = '100';
                    $_commentContainer[0]['align'] = 'left';
                    $_commentContainer[0]['colspan'] = '7';
                    $_commentContainer[0]['style'] = 'background: none repeat scroll 0pt 0pt #F6F1E7; padding: 0px;';
                    $_IssueHistoryTabObject->Row($_commentContainer, '', $_Issue->GetKey());
                }
            }
        }
        $_renderHTML = $_IssueHistoryTabObject->GetDisplayHTML(true);
        echo $_renderHTML;
        return true;
    }
コード例 #2
0
    /**
     * Renders Link Issue Form
     *
     * @param int $_ticketID The current ticket id
     *
     * @return boolean 'TRUE' on success and 'FALSE' otherwise
     * @throws SWIFT_Exception if class is not loaded or $_ticketID is not provided
     */
    public function RenderLinkIssueForm($_ticketID)
    {
        $_SWIFT = SWIFT::GetInstance();
        if (!$this->GetIsClassLoaded()) {
            throw new SWIFT_Exception(SWIFT_CLASSNOTLOADED);
        }
        if (empty($_ticketID)) {
            throw new SWIFT_Exception('Ticket ID' . $this->Language->Get('jira_noempty'));
        }
        $_ticketID = (int) $_ticketID;
        $this->Load->Library('Ticket:Ticket', false, false, APP_TICKETS);
        $_SWIFT_TicketObject = SWIFT_Ticket::GetObjectOnID($_ticketID);
        $_ticketPostContainer = $_SWIFT_TicketObject->GetTicketPosts();
        $_ticketPosts = array();
        foreach ($_ticketPostContainer as $_TicketPost) {
            $_creater = $_TicketPost->GetProperty('fullname');
            if ($_TicketPost->GetProperty('creator') == SWIFT_Ticket::CREATOR_STAFF) {
                $_staffDataStore = $_SWIFT->Staff->GetDataStore();
                $_creater = $_staffDataStore['grouptitle'];
            } else {
                if ($_TicketPost->GetProperty('creator') == SWIFT_Ticket::CREATOR_USER) {
                    $_creater .= ' (' . $this->Language->Get('jira_user') . ')';
                }
            }
            $_postedOn = SWIFT_Date::Get(SWIFT_Date::TYPE_DATETIME, $_TicketPost->GetProperty('dateline'));
            $_ticketPosts[] = $_creater . ' - ' . $_postedOn . PHP_EOL . strip_tags(trim($_TicketPost->GetDisplayContents())) . PHP_EOL;
        }
        $_ticketPosts = implode(PHP_EOL, $_ticketPosts);
        $_ticketPosts = '[' . $_SWIFT_TicketObject->GetProperty('ticketmaskid') . ']: ' . $_SWIFT_TicketObject->GetProperty('subject') . PHP_EOL . '==================================================' . PHP_EOL . PHP_EOL . $_ticketPosts;
        $this->UserInterface->Start(get_class($this), '/JIRA/Bug/ProcessLinkIssueForm', SWIFT_UserInterface::MODE_INSERT, true);
        $_buttonText = '<input type="button" name="submitbutton" id="%formid%_submit" class="rebuttonblue" onclick="processIssueLinking(\'%formid%\');PreventDoubleClicking(this);" value="' . $this->Language->Get('jira_save') . '" />
					<input type="button" name="submitbutton" id="%formid%_cancel" class="rebuttonred" onclick="javascript: $(\'.ui-icon-closethick\').click();" value="' . $this->Language->Get('jira_cancel') . '"/>';
        $this->UserInterface->OverrideButtonText($_buttonText);
        $_GeneralTabObject = $this->UserInterface->AddTab($this->Language->Get('tabgeneral'), SWIFT::Get('swiftpath') . '__modules/jira/resources/postbugtojira_b.gif', 'general', true, false);
        $this->Load->Library('JIRA:JIRABridge', false, false, 'jira');
        $_JIRABridge = SWIFT_JIRABridge::GetInstance();
        if (!$_JIRABridge) {
            echo $this->Language->Get('jira_error');
        }
        //Add form fields
        $_GeneralTabObject->Hidden('ticketId', $_ticketID);
        $_GeneralTabObject->Hidden('ticketkey', $_SWIFT_TicketObject->GetTicketDisplayID());
        $_GeneralTabObject->Text('jira_issue_id', $this->Language->Get('jira_issue_id'), $this->Language->Get('jira_issue_id_desc'), '', 'text', 60);
        $_GeneralTabObject->Title('<label for="description">' . $this->Language->Get('jira_description') . '</label><br/><span class="tabledescription">' . $this->Language->Get('jira_sensitive') . '</span>');
        $_GeneralTabObject->TextArea('description', '', $this->Language->Get('jira_description_desc'), $_ticketPosts, 3, 14);
        //Add Hidden fields - proves handy for Loading the view after update
        $this->UserInterface->Hidden('jira_ticketid', $_SWIFT_TicketObject->GetTicketID());
        $this->UserInterface->Hidden('jira_listtype', 'inbox');
        $this->UserInterface->Hidden('jira_departmentid', $_SWIFT_TicketObject->GetProperty('departmentid'));
        $this->UserInterface->Hidden('jira_ticketstatusid', $_SWIFT_TicketObject->GetProperty('ticketstatusid'));
        $this->UserInterface->Hidden('jira_tickettypeid', $_SWIFT_TicketObject->GetProperty('tickettypeid'));
        $this->UserInterface->End();
        return true;
    }
コード例 #3
0
 /**
  * Render the Action forms
  *
  * @author Atul Atri
  *
  * @param array  $_projectsOpts    basecamp project list
  * @param array  $_todoProjectList list of todo lists on basecamp in selected project
  * @param array  $_personList      list of persons
  * @param array  $_ticketID        ticket tid
  * @param String $_errorTitle      Error title if some error needs to be rended
  * @param String $_errorMsg        Error Message if some error needs to be rended
  *
  * @return bool "true" on Success, "false" otherwise
  */
 public function RenderTodoExportForm($_projectsOpts, $_todoProjectList, $_personList, $_ticketID, $_errorTitle = '', $_errorMsg = '')
 {
     $this->UserInterface->Header($this->Language->Get('basecamp') . ' > ' . $this->Language->Get('basecamp_todoexportform'));
     $this->UserInterface->Start(get_class($this), '/basecamp/TodoManager/TodoExportFormSubmit', SWIFT_UserInterface::MODE_EDIT, false, false, false, false, 'todoExportFormResHolder', "SWIFT.Basecamp.AdminObject.RestoreTodoExportForm");
     $this->UserInterface->Toolbar->AddButton($this->Language->Get('export'));
     $_ActionTab = $this->UserInterface->AddTab($this->Language->Get('basecamp_tab_export'), 'icon_form.gif', 'action', true);
     if ($_errorMsg) {
         if (!$_errorTitle) {
             $_errorTitle = $this->Language->Get('error');
         }
         $_ActionTab->Error($_errorTitle, $_errorMsg, 'bc_todo_list_error');
     }
     $_ActionTab->Select('todoproject', $this->Language->Get('basecamp_todoproject'), $this->Language->Get('d_basecamp_todoproject'), $_projectsOpts);
     $_ActionTab->Select('todolist', $this->Language->Get('basecamp_todlist'), $this->Language->Get('d_basecamp_todlist'), $_todoProjectList);
     $_ActionTab->Select('assignee', $this->Language->Get('basecamp_assignee'), $this->Language->Get('d_basecamp_assignee'), $_personList);
     $_ActionTab->date('duedate', $this->Language->Get('basecamp_duedate'), $this->Language->Get('d_basecamp_duedate'));
     $_SWIFT_TicketObject = SWIFT_Ticket::GetObjectOnID($_ticketID);
     $_ticketSub = trim($_SWIFT_TicketObject->subject);
     $_todoItemStr = '[' . $_SWIFT_TicketObject->ticketmaskid . '] ' . $_ticketSub;
     $_ActionTab->Text('todoitem', $this->Language->Get('basecamp_todoitem_name'), '', $_todoItemStr, 'text', 60);
     if ($_SWIFT_TicketObject->GetProperty('hasattachments')) {
         $_attachments = $_SWIFT_TicketObject->GetAttachmentContainer();
         $_checkBoxContainer = array();
         foreach ($_attachments as $_tmpArr) {
             foreach ($_tmpArr as $_nextAttachment) {
                 $_attachementId = $_nextAttachment['attachmentid'];
                 $_attachementSize = round($_nextAttachment['filesize'] / 1024, 2);
                 $_tmp['value'] = $_attachementId;
                 $_tmp['title'] = $_nextAttachment['filename'] . " ({$_attachementSize} KB)";
                 $_checkBoxContainer[$_attachementId] = $_tmp;
             }
         }
         $_ActionTab->CheckBoxList('todo_files', $this->Language->Get('basecamp_todo_files'), $this->Language->Get('d_basecamp_todo_files'), $_checkBoxContainer);
     }
     $_ticketPostContainer = $_SWIFT_TicketObject->GetTicketPosts();
     $_ticketPosts = array();
     foreach ($_ticketPostContainer as $_TicketPost) {
         $_creater = ucfirst($_TicketPost->GetProperty('fullname'));
         $_postedOn = SWIFT_Date::Get(SWIFT_Date::TYPE_DATETIME, $_TicketPost->GetProperty('dateline'));
         $_subStr = '';
         if ($_TicketPost->GetProperty('creator') == SWIFT_Ticket::CREATOR_STAFF) {
             $_staffDataStore = $this->Staff->GetDataStore();
             $_subStr .= '[' . $_staffDataStore['grouptitle'] . "] {$_creater} " . $this->Language->Get('bc_wrote_on') . " {$_postedOn}";
         } else {
             if ($_TicketPost->GetProperty('creator') == SWIFT_Ticket::CREATOR_USER) {
                 $_subStr .= '[' . $this->Language->Get('bc_user') . "] {$_creater} " . $this->Language->Get('bc_wrote_on') . " {$_postedOn}";
             }
         }
         $_postContent = trim($_TicketPost->GetDisplayContents());
         $_subStrLen = strlen($_subStr);
         $_ticketPosts[] = $_subStr . PHP_EOL . str_repeat('-', $_subStrLen) . PHP_EOL . strip_tags($_postContent);
     }
     $_firstComment = implode(PHP_EOL . PHP_EOL . PHP_EOL, $_ticketPosts);
     $_ActionTab->TextArea('todocomment', $this->Language->Get('basecamp_todocomment'), $this->Language->Get('d_basecamp_todocomment'), $_firstComment, 30, 20);
     $this->UserInterface->Hidden('todo_ticketid', $_ticketID);
     $this->UserInterface->End();
     $this->UserInterface->Footer();
 }