]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 302955: Remove the "delete" link for the default milestone - Patch by Gavin Shell...
authorlpsolit%gmail.com <>
Mon, 29 Aug 2005 00:41:52 +0000 (00:41 +0000)
committerlpsolit%gmail.com <>
Mon, 29 Aug 2005 00:41:52 +0000 (00:41 +0000)
editmilestones.cgi
template/en/default/admin/milestones/list.html.tmpl
template/en/default/admin/table.html.tmpl
template/en/default/filterexceptions.pl

index fa1117ede240498553b7c826f7e3a16fd011c804..18c3f62aa06e73d03705fd8a8182fb8d0e779b54 100755 (executable)
@@ -84,6 +84,7 @@ unless ($action) {
 
     $vars->{'product'} = $product->name;
     $vars->{'milestones'} = \@milestones;
+    $vars->{'default_milestone'} = $product->default_milestone;
     $template->process("admin/milestones/list.html.tmpl",
                        $vars)
       || ThrowTemplateError($template->error());
index 160dcd6da77ae75036df064fa7b8fcd654347b22..d36b61a3d9ab73c8b3dfb306746baa1c915c17d5 100644 (file)
        name => "sortkey"
        heading => "Sortkey"
      },
+     {
+       name => "action"
+       heading => "Action"
+       content => "Delete"
+       contentlink => delete_contentlink
+     }
    ]
 %]
 
-[% columns.push({
-     heading => "Action"
-     content => "Delete"
-     contentlink => delete_contentlink
-   }) %]
+[%# We want to override the usual 'Delete' link for the default
+    milestone %]
+[% overrides.action = [ {
+     match_value => "$default_milestone"
+     match_field => 'name'
+     override_content => 1
+     content => "(Default milestone)"
+     override_contentlink => 1
+     contentlink => undef
+   } ]
+%] 
 
 [% PROCESS admin/table.html.tmpl
      columns = columns
      data = milestones
+     overrides = overrides
 %]
 
 <p>
 
 [% PROCESS admin/milestones/footer.html.tmpl
   no_edit_other_milestones_link = 1
- %]
+%]
 
 [% PROCESS global/footer.html.tmpl %]
index ff554429a009ba54b5691ba251fe3340d1e68a60..76ed601d6a7715db1ec20385e02cef1e2a141388 100644 (file)
   #   Each hash contains data for a single row of data. The
   #   keys are column names from columns subhashes name field.
   #
+  # overrides:
+  #   Provides a method for overriding individual table cells. This is
+  #   a hash, whose key is the column name, so the column must be
+  #   named for one of it's cells to be overwritten. The hash value is
+  #   an array. Each item in this array is a hash specifying
+  #   row-matching criteria, and any overridden values. The
+  #   row-matching criteria consist of keys:
+  #     match_field: The name of the row value we want to match
+  #     match_value: The value to match against
+  #   Each column value mentioned in the 'columns' documentation above
+  #   can be overwritten (apart from name and heading). To override a
+  #   table-cell value 'xxx', specify a new 'xxx' value, and specify a
+  #   'override_xxx' value as well. See
+  #   admin/milestones/list.html.tmpl for example
+  #
   #%]
 
 [% PROCESS "global/field-descs.none.tmpl" %]
 [%###################  TABLE CONTENT  ######################%]
 
 [% FOREACH row = data %]
+
   <tr>
     [% FOREACH c = columns %]
-      <td [% IF c.align %] align="[% c.align FILTER html %]" [% END %]>
-      
-        [% IF c.contentlink %]
-          [% link_uri = c.contentlink %]
+
+      [%# Copy to local variables, as we may update these %]
+      [% contentlink = c.contentlink
+         content = c.content
+         content_use_field = c.content_use_field
+         align = c.align
+         allow_html_content = c.allow_html_content
+         yesno_field = c.yesno_field
+       %]
+
+      [%# Are there any specific overrides for this column? %]
+      [% FOREACH override = overrides.${c.name} %]
+
+        [%# Is the override for this row? %]
+        [% IF override.match_value == row.${override.match_field} %]
+
+          [% contentlink = override.contentlink 
+             IF override.override_contentlink %]
+          [% content = override.content
+             IF override.override_content %]
+          [% content_use_field = override.content_use_field
+             IF override.override_content_use_field %]
+          [% align = override.align
+             IF override.override_align %]
+          [% allow_html_content = override.allow_html_content
+             IF override.override_allow_html_content %]
+          [% yesno_field = override.yesno_field
+             IF override.override_yesno_field %]
+
+          [% LAST %]
+
+        [% END %]
+      [% END %]
+
+      <td [% IF align %] align="[% align FILTER html %]" [% END %]>
+
+        [% IF contentlink %]
+          [% link_uri = contentlink %]
           [% WHILE link_uri.search('%%(.+?)%%')%]
             [% FOREACH m = link_uri.match('%%(.+?)%%') %]
               [% IF row.$m %]
           <a href="[% link_uri %]">
         [% END %]
         
-        [% IF c.content_use_field %]
+        [% IF content_use_field %]
            [% colname = row.${c.name} %]
            [% field_descs.${colname} FILTER html %]
-        [% ELSIF c.content %]
-            [% c.content %]
+        [% ELSIF content %]
+            [% content FILTER none %]
         [% ELSE %]
-          [% IF c.yesno_field %]
+          [% IF yesno_field %]
             [% IF row.${c.name} %]
               Yes
             [% ELSE %]
               No
             [% END %]
           [% ELSE %]
-            [% IF c.allow_html_content %]
+            [% IF allow_html_content %]
               [% row.${c.name} FILTER none %]
             [% ELSE %]
               [% row.${c.name} FILTER html %]
           [% END %]
         [% END %]
         
-        [% IF c.contentlink %]
+        [% IF contentlink %]
           </a>
         [% END %]
          
index 89a54bc3def60ac371ea91ec81b8ecb3a57ee07e..8ec9a3f3f1a6c91e182555d4147546a23e5fed75 100644 (file)
 ],
 
 'admin/table.html.tmpl' => [
-  'link_uri',
-  'c.content'
+  'link_uri'
 ],
 
 'admin/classifications/del.html.tmpl' => [