Making WordPress.org

Changeset 2031


Ignore:
Timestamp:
11/02/2015 06:59:20 AM (8 years ago)
Author:
nacin
Message:

Trac Notifications: Not all Tracs have components, focuses, milestones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php

    r2027 r2031  
    8686
    8787    function get_trac_focuses() {
    88         return array( 'accessibility', 'administration', 'docs', 'javascript', 'multisite', 'performance', 'rtl', 'template', 'ui' );
     88        if ( 'core' === $this->trac ) {
     89            return array( 'accessibility', 'administration', 'docs', 'javascript', 'multisite', 'performance', 'rtl', 'template', 'ui' );
     90        }
     91        return array();
    8992    }
    9093
     
    420423        }
    421424        #components > ul {
    422             float: left;
    423             width: 24%;
    424425            margin: 0 0 0 1% !important;
    425426            margin: 0;
    426427            padding: 0;
     428        }
     429        .make-core #components > ul {
     430            width: 24%;
     431            float: left;
    427432        }
    428433        #components > ul > li {
     
    460465        echo '<h3>New Tickets</h3>';
    461466        $checked = checked( $notifications['newticket'], true, false );
    462         echo '<ul><li style="list-style:none"><label><input type="checkbox" ' . $checked . 'name="notifications[newticket]" /> Receive all new ticket notifications.</label><br /><em>To receive comments to a ticket, you will need to star it, unless it matches one of your other preferences below.</em></li></ul>';
    463         echo '<div id="focuses">';
    464         echo '<h3>Focuses</h3>';
    465         echo '<ul>';
    466         foreach ( $focuses as $focus ) {
    467             $checked = checked( ! empty( $notifications['focus'][ $focus ] ), true, false );
    468             echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[focus][' . esc_attr( $focus ) . ']" /> ' . $focus . '</label></li>';
    469         }
    470         echo '</ul>';
    471         echo '</div>';
    472         echo '<div id="components">';
    473         echo '<h3>Components</h3>';
    474         echo '<p class="select-all"><a href="#" data-action="select-all">select all</a> &bull; <a href="#" data-action="clear-all">clear all</a></p>';
    475         echo "<ul>\n";
    476         $components_tree = $this->make_components_tree( $components );
    477         $breakpoints = array( 'Export', 'Media', 'Script Loader' );
    478         foreach ( $components_tree as $component => $subcomponents ) {
    479             if ( in_array( $component, $breakpoints ) ) {
    480                 echo '</ul><ul>';
    481             }
    482             $checked = checked( ! empty( $notifications['component'][ $component ] ), true, false );
    483             echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[component][' . esc_attr( $component ) . ']" /> ' . $component . "</label>\n";
    484             if ( is_array( $subcomponents ) ) {
    485                 echo "<ul>\n";
    486                 foreach ( $subcomponents as $subcomponent ) {
    487                     $checked = checked( ! empty( $notifications['component'][ $subcomponent ] ), true, false );
    488                     echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[component][' . esc_attr( $subcomponent ) . ']" /> ' . $subcomponent . "</label></li>\n";
    489                 }
    490                 echo "</ul>\n";
    491             }
    492             echo "</li>\n";
    493         }
    494         echo '</ul>';
    495         echo '</div>';
    496         echo '<div id="milestones">';
    497         echo '<h3>Milestones</h3>';
    498         echo '<ul>';
    499         foreach ( $milestones as $milestone ) {
    500             $checked = checked( ! empty( $notifications['milestone'][ $milestone->name ] ), true, false );
    501             $class = '';
    502             if ( ! empty( $milestone->completed ) ) {
    503                 $class = 'completed-milestone';
    504                 if ( $checked ) {
    505                     $class .= ' checked';
    506                 }
    507                 $class = ' class="' . $class . '"';
    508             }
    509             echo  '<li' . $class . '><label><input type="checkbox" ' . $checked . 'name="notifications[milestone][' . esc_attr( $milestone->name ) . ']" /> ' . $milestone->name . '</label></li>';
    510         }
    511         echo '<li id="show-completed"><a href="#">Show recently completed&hellip;</a></li>';
    512         echo '</ul>';
    513         echo '</div>';
     467        echo '<ul style="margin-left: 1% !important"><li style="list-style:none"><label><input type="checkbox" ' . $checked . 'name="notifications[newticket]" /> Receive a notification when new tickets are created.</label></li></ul>';
     468
     469        if ( $focuses ) {
     470            echo '<div id="focuses">';
     471            echo '<h3>Focuses</h3>';
     472            echo '<ul>';
     473            foreach ( $focuses as $focus ) {
     474                $checked = checked( ! empty( $notifications['focus'][ $focus ] ), true, false );
     475                echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[focus][' . esc_attr( $focus ) . ']" /> ' . $focus . '</label></li>';
     476            }
     477            echo '</ul>';
     478            echo '</div>';
     479        }
     480
     481        if ( $components ) {
     482            echo '<div id="components">';
     483            echo '<h3>Components</h3>';
     484            echo '<p class="select-all"><a href="#" data-action="select-all">select all</a> &bull; <a href="#" data-action="clear-all">clear all</a></p>';
     485            echo "<ul>\n";
     486            $components_tree = $this->make_components_tree( $components );
     487            $breakpoints = array( 'Export', 'Media', 'Script Loader' );
     488            foreach ( $components_tree as $component => $subcomponents ) {
     489                if ( in_array( $component, $breakpoints ) ) {
     490                    echo '</ul><ul>';
     491                }
     492                $checked = checked( ! empty( $notifications['component'][ $component ] ), true, false );
     493                echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[component][' . esc_attr( $component ) . ']" /> ' . $component . "</label>\n";
     494                if ( is_array( $subcomponents ) ) {
     495                    echo "<ul>\n";
     496                    foreach ( $subcomponents as $subcomponent ) {
     497                        $checked = checked( ! empty( $notifications['component'][ $subcomponent ] ), true, false );
     498                        echo '<li><label><input type="checkbox" ' . $checked . 'name="notifications[component][' . esc_attr( $subcomponent ) . ']" /> ' . $subcomponent . "</label></li>\n";
     499                    }
     500                    echo "</ul>\n";
     501                }
     502                echo "</li>\n";
     503            }
     504            echo '</ul>';
     505            echo '</div>';
     506        }
     507
     508        if ( $milestones ) {
     509            echo '<div id="milestones">';
     510            echo '<h3>Milestones</h3>';
     511            echo '<ul>';
     512            foreach ( $milestones as $milestone ) {
     513                $checked = checked( ! empty( $notifications['milestone'][ $milestone->name ] ), true, false );
     514                $class = '';
     515                if ( ! empty( $milestone->completed ) ) {
     516                    $class = 'completed-milestone';
     517                    if ( $checked ) {
     518                        $class .= ' checked';
     519                    }
     520                    $class = ' class="' . $class . '"';
     521                }
     522                echo  '<li' . $class . '><label><input type="checkbox" ' . $checked . 'name="notifications[milestone][' . esc_attr( $milestone->name ) . ']" /> ' . $milestone->name . '</label></li>';
     523            }
     524            echo '<li id="show-completed"><a href="#">Show recently completed&hellip;</a></li>';
     525            echo '</ul>';
     526            echo '</div>';
     527        }
     528
    514529        echo '<p class="save-changes"><input type="submit" value="Save Changes" /></p>';
    515530        echo '</form>';
Note: See TracChangeset for help on using the changeset viewer.