protected function fetchArtifactPrefix()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $current_user = UserManager::instance()->getCurrentUser();
     $always_collapsed = '';
     $fieldset_is_collapsed = $this->isCollapsed();
     $fieldset_is_expanded = !$fieldset_is_collapsed;
     if ($fieldset_is_collapsed) {
         $always_collapsed = 'active';
     }
     $html = '';
     $html .= '<fieldset class="tracker_artifact_fieldset">';
     $html .= '<legend title="' . $hp->purify($this->getDescription(), CODENDI_PURIFIER_CONVERT_HTML) . '" 
                       class="' . Toggler::getClassName('fieldset_' . $this->getId(), $fieldset_is_expanded, true) . '"
                       id="fieldset_' . $this->getId() . '"
                       data-id="' . $this->getId() . '">';
     $html .= '<table><tr><td class="tracker_artifact_fieldset_title">';
     $html .= $hp->purify($this->getLabel(), CODENDI_PURIFIER_CONVERT_HTML);
     $html .= '</td>';
     $html .= '<td class="tracker_artifact_fieldset_alwayscollapsed ' . $always_collapsed . '">';
     if ($current_user->isLoggedIn()) {
         $html .= '<i class="icon-pushpin"></i>';
     }
     $html .= '</td></tr></table>';
     $html .= '</legend>';
     $html .= '<div class="tracker_artifact_fieldset_content">';
     return $html;
 }
 protected function fetchArtifactPrefix()
 {
     $html = '';
     $hp = Codendi_HTMLPurifier::instance();
     $html .= '<fieldset class="tracker_artifact_fieldset">';
     $html .= '<legend title="' . $hp->purify($this->getDescription(), CODENDI_PURIFIER_CONVERT_HTML) . '" 
                       class="' . Toggler::getClassName('fieldset_' . $this->getId(), true, true) . '" 
                       id="fieldset_' . $this->getId() . '">';
     $html .= $hp->purify($this->getLabel(), CODENDI_PURIFIER_CONVERT_HTML);
     $html .= '</legend>';
     return $html;
 }
Esempio n. 3
0
 /**
  * Returns HTML code to display the artifact follow-up comments
  *
  * @param User $current_user the current user
  *
  * @return string The HTML code for artifact follow-up comments
  */
 protected function fetchFollowUps($current_user, $submitted_comment = '')
 {
     $html = '';
     $html_submit_button = '<p style="text-align:center;">';
     $html_submit_button .= '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />';
     $html_submit_button .= ' ';
     $html_submit_button .= '<input type="submit" name="submit_and_stay" value="' . $GLOBALS['Language']->getText('global', 'btn_submit_and_stay') . '" />';
     $html_submit_button .= '</p>';
     $html .= $html_submit_button;
     $html .= '<fieldset id="tracker_artifact_followup_comments"><legend
                       class="' . Toggler::getClassName('tracker_artifact_followups', true, true) . '"
                       id="tracker_artifact_followups">' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '</legend>';
     $html .= '<ul class="tracker_artifact_followups">';
     $previous_changeset = null;
     $i = 0;
     foreach ($this->getChangesets() as $changeset) {
         if ($previous_changeset) {
             $html .= '<li id="followup_' . $changeset->id . '" class="' . html_get_alt_row_color($i++) . ' tracker_artifact_followup">';
             $html .= $changeset->fetchFollowUp($previous_changeset);
             $html .= '</li>';
         }
         $previous_changeset = $changeset;
     }
     $html .= '<li>';
     $html .= '<div class="' . html_get_alt_row_color($i++) . '">';
     $hp = Codendi_HTMLPurifier::instance();
     if (count($responses = $this->getTracker()->getCannedResponseFactory()->getCannedResponses($this->getTracker()))) {
         $html .= '<p><b>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'use_canned') . '</b>&nbsp;';
         $html .= '<select id="tracker_artifact_canned_response_sb">';
         $html .= '<option selected="selected" value="">--</option>';
         foreach ($responses as $r) {
             $html .= '<option value="' . $hp->purify($r->body, CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify($r->title, CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
         }
         $html .= '</select>';
         $html .= '<noscript> javascript must be enabled to use this feature! </noscript>';
         $html .= '</p>';
     }
     $html .= '<b>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'add_comment') . '</b><br />';
     $html .= '<textarea id="tracker_followup_comment_new" wrap="soft" rows="12" cols="80" style="width:99%;" name="artifact_followup_comment" id="artifact_followup_comment">' . $hp->purify($submitted_comment, CODENDI_PURIFIER_CONVERT_HTML) . '</textarea>';
     $html .= '</div>';
     if ($current_user->isAnonymous()) {
         $html .= $this->fetchAnonymousEmailForm();
     }
     $html .= '</li>';
     $html .= '</ul>';
     $html .= '</fieldset>';
     $html .= $html_submit_button;
     $html .= '</td></tr></table>';
     //see fetchFields
     return $html;
 }
 /**
  * Build the HTML for all the link with the same way (from or to the project)
  * 
  * It build either the list of all "forward" links or the list of all
  * "back links"
  * 
  * @param  String $way Either 'links' or 'back_links'
  * @param  String $res One row of link
  * @return String
  */
 function getLinks($way, DataAccessResult $dar)
 {
     $html = '';
     $previousLinkName = '';
     $ulClosed = true;
     foreach ($dar as $row) {
         if ($row['link_name'] != $previousLinkName) {
             if (!$ulClosed) {
                 // Do not close the list when the list is not started
                 $html .= "    </ul>\n";
                 $html .= "  </li>\n";
                 $ulClosed = true;
             }
             $spanId = 'plugin_project_links_name_' . $way . '_' . $row['link_type_id'];
             $cssClass = Toggler::getClassName($spanId);
             // Link name title
             $html .= "  <li><span id=\"" . $spanId . "\" class=\"" . $cssClass . "\">" . $row['link_name'] . "</span>\n";
             $html .= "    <ul>\n";
             $ulClosed = false;
         }
         $html .= "      <li>";
         $html .= $this->getOneLink($row);
         $html .= "  </li>\n";
         $previousLinkName = $row['link_name'];
     }
     if (!$ulClosed) {
         $html .= "    </ul>\n";
         $html .= "  </li>\n";
     }
     return $html;
 }