•  
      request #10608 Gantt Chart - allow other Fields as Summary (Select)
    Infos
    #10608
    Thomas Hövelmeyer (thomash)
    2017-09-12 09:57
    2017-08-29 11:37
    10848
    Details
    Gantt Chart - allow other Fields as Summary (Select)
    We are currently exploring the option to use Tuleap to manage several different task-types. In that context we have several Use-Cases where we use Gantt-Charts to display time-periods, project-phases.

    Currently only text fields are allowed as "summary" for a gantt chart.
    For recurring Events/Phases it would be nice to use a select box as "summary" for the gantt entries, so that you do not have to type it in every time.
    For the "Informations at the right of the bars" it is the other way round - here only select fields are allowed to be displayed. Maybe here sometimes Text-Fields would be needed.

    Could the gantt chart be expanded so that the mapping of the fields of a tracker is more flexible?
    Dashboard & Widgets
    9.11
    CentOS 6
    • [x] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Closed
    2017-09-12
    Attachments
    Empty
    References

    Follow-ups

    User avatar

    Contribution integrated into Tuleap 9.11.99.139

    Thanks for the patch


    • Status changed from New to Closed
    • Connected artifacts
    • Close date set to 2017-09-12
    User avatar

    Hi Thomas,

    I don't know if you saw the comment I made on gerrit. Let me know if you are willing to do the changes otherwise you can do it on top of your patch.

    User avatar
    last edited by: Thomas Hövelmeyer (thomash) 2017-08-29 12:44

    I did some quick tests and it works:

    i added a new Field Selector under

    /usr/share/tuleap/plugins/graphontrackersv5/include/common/

    named it:

    HTML_Element_Selectbox_TrackerFields_SelectboxesAndTextsV5

    with contents

    require_once('common/html/HTML_Element_Selectbox.class.php');
    
    /**
    * Define an html selectbox field for selectbox fields and text fields provided by the tracker
    */
    class HTML_Element_Selectbox_TrackerFields_SelectboxesAndTextsV5 extends HTML_Element_Selectbox {
    
        public function __construct($tracker, $label, $name, $value, $with_none = false, $onchange = "", $with_user = true, $desc="") {
            parent::__construct($label, $name, $value, $with_none, $onchange, $desc);
    
            require_once(TRACKER_BASE_DIR. '/Tracker/FormElement/Tracker_FormElementFactory.class.php');
            $aff = Tracker_FormElementFactory::instance();
    
            foreach ($aff->getUsedListFields($tracker) as $field) {
                if($field->userCanRead()){
                    if ($field->getName() != 'comment_type_id') {
                        $selected = $this->value == $field->id;
                        $this->addOption(new HTML_Element_Option($field->getLabel(), $field->id, $selected));
                    }
                }
            }
            foreach ( $aff->getUsedStringFields($tracker) as $field) {
                if($field->userCanRead()){
                    $selected = $this->value == $field->id;
                    $this->addOption(new HTML_Element_Option($field->getLabel(), $field->id, $selected));
                }
            }
    
        }
    }
    ?>

    Then i used this in the Fieldselection for

    gantt_summary
    
    gantt_field_righttext

    in

    GraphOnTrackersV5_Chart_Gantt.class.php