File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 153153 </tr>
154154 <? endforeach ?>
155155 <tr>
156- <th>Tempo</th>
156+ <th align="right" >Tempo</th>
157157 <td><a href="tempo.php">probably <?= $ user ->has_tempo ? '' : 'not ' ?> </a></td>
158158 </tr>
159159 <tr valign="top">
170170 <? endforeach ?>
171171 </td>
172172 </tr>
173+ <tr valign="top">
174+ <th align="right">Show custom fields</th>
175+ <td>
176+ <? foreach ($ user ->custom_field_ids as $ name => $ id ):
177+ $ checked = in_array ($ id , $ user ->selected_show_custom_fields ) ? 'checked ' : '' ;
178+ ?>
179+ <label>
180+ <input type="checkbox" name="config[show_custom_fields][]" value="<?= $ id ?> " <?= $ checked ?> />
181+ <span class="board-id">(<?= $ id ?> )</span>
182+ <?= html ($ name ) ?>
183+ </label>
184+ <? endforeach ?>
185+ </td>
186+ </tr>
173187 </table>
174188 <p><button>Save</button></p>
175189</form>
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class User extends db_generic_record {
3232 'required ' => false ,
3333 ),
3434 'agile_view_ids ' => FALSE ,
35+ 'show_custom_fields ' => FALSE ,
3536 );
3637
3738 function __construct () {
@@ -191,6 +192,7 @@ function get_custom_field_ids() {
191192 $ fields [mb_strtolower ($ field ->name )] = $ field ->id ;
192193 }
193194
195+ ksort ($ fields );
194196 $ this ->cache__custom_field_ids = serialize ($ fields );
195197 $ this ->save (array ('cache__custom_field_ids ' => $ this ->cache__custom_field_ids ));
196198 }
@@ -204,6 +206,12 @@ function get_selected_agile_boards() {
204206 return $ ids ;
205207 }
206208
209+ function get_selected_show_custom_fields () {
210+ $ ids = $ this ->config ('show_custom_fields ' , '' );
211+ $ ids = array_filter (explode (', ' , $ ids ));
212+ return $ ids ;
213+ }
214+
207215 function get_agile_boards () {
208216 if ( !$ this ->cache__agile_boards ) {
209217 $ boards = jira_get ('/rest/agile/1.0/board ' );
Original file line number Diff line number Diff line change 179179echo '<div class="issue-description markup"> ' . ( do_remarkup ($ issue ->renderedFields ->description ) ?: '<em>No description</em> ' ) . '</div> ' ;
180180
181181$ customs = array ();
182- foreach ( $ user ->custom_field_ids as $ cfName => $ cfKey ) {
182+ foreach ( $ user ->selected_show_custom_fields as $ cfKey ) {
183+ $ cfName = array_search ($ cfKey , $ user ->custom_field_ids );
183184 if ( $ value = @$ issue ->renderedFields ->$ cfKey ) {
184185 $ customs [$ cfName ] = print_r ($ value , 1 );
185186 }
188189 }
189190}
190191
191- if ( $ customs ) {
192+ if ( count ( $ customs) ) {
192193 echo '<h2 class="visiblity-toggle-header open"><a id="custom-fields-toggler" href="#"> ' . count ($ customs ) . ' custom fields</a></h2> ' ;
193194 echo '<div class="custom-fields"> ' ;
194195 foreach ($ customs as $ cfName => $ text ) {
202203 ?>
203204 <script>
204205 (function(a) {
205- a.parentNode.classList.remove('open');
206+ // a.parentNode.classList.remove('open');
206207 a.addEventListener('click', function(e) {
207208 e.preventDefault();
208209 var h2 = this.parentNode;
You can’t perform that action at this time.
0 commit comments