GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Midgard Components Framework 3rd generation
Homepage: http://www.midgard-project.org
Clone URL: git://github.com/bergie/midcom.git
Render the delete view with frozen DM form
bergie (author)
Thu Apr 10 08:38:16 -0700 2008
commit  0721123de1b8ff72349566292f882963d2366b87
tree    419e91976c347817676281e2800646672df8fa61
parent  f5bc17e3da6e0c36fbf60674ba76d4f1080d393a
...
92
93
94
 
 
 
 
95
96
97
...
92
93
94
95
96
97
98
99
100
101
0
@@ -92,6 +92,10 @@ abstract class midcom_core_controllers_baseclasses_manage
0
         $this->load_datamanager($data, $this->configuration->get('schemadb'));
0
         $data['object'] =& $this->object;
0
         
0
+ // Make a frozen form for display purposes
0
+ $data['datamanager_form'] =& $this->datamanager->get_form('simple');
0
+ $data['datamanager_form']->freeze();
0
+
0
         $_MIDCOM->authorization->require_do('midgard:delete', $this->object);
0
         if(isset($_POST['delete']))
0
         {
...
4
5
6
7
8
9
10
11
 
 
12
13
14
15
16
17
18
19
20
21
22
 
23
24
25
...
4
5
6
 
 
 
 
 
7
8
9
 
 
 
 
 
 
 
 
 
 
10
11
12
13
0
@@ -4,22 +4,10 @@
0
  *
0
  */
0
 ?>
0
-<form method="post">
0
- <label>
0
- <span>URL name</span>
0
- <input disabled='disabled' type="text" name="name" value="" tal:attributes="value midcom_core/object/name" />
0
- </label>
0
+<div tal:content="structure midcom_core/datamanager_form/as_html">
0
+</div>
0
 
0
- <label>
0
- <span>Title</span>
0
- <input disabled='disabled' type="text" name="title" value="" tal:attributes="value midcom_core/object/title" />
0
- </label>
0
-
0
- <label>
0
- <span>Content</span>
0
- <textarea disabled='disabled' name="content" rows="20" cols="40" wrap="off"><span tal:replace="midcom_core/object/content" /></textarea>
0
- </label>
0
-
0
+<form method="post">
0
     <div class="form_toolbar">
0
         <input type="submit" name="delete" value="Delete" accesskey="d" />
0
     </div>
...
34
35
36
 
 
37
38
39
...
178
179
180
 
 
 
 
181
182
183
...
231
232
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
235
236
...
34
35
36
37
38
39
40
41
...
180
181
182
183
184
185
186
187
188
189
...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
0
@@ -34,6 +34,8 @@ class midcom_helper_datamanager_form
0
     protected $datamanager = null;
0
     
0
     protected $storage = null;
0
+
0
+ protected $frozen = false;
0
 
0
     public $widgets = null;
0
     
0
@@ -178,6 +180,10 @@ class midcom_helper_datamanager_form
0
     
0
     public function render_toolbar_html()
0
     {
0
+ if ($this->frozen)
0
+ {
0
+ return '';
0
+ }
0
         $output = "<div class=\"form_toolbar\">\n";
0
         
0
         foreach ($this->schema->operations as $operation => $config)
0
@@ -231,6 +237,24 @@ class midcom_helper_datamanager_form
0
     {
0
         throw new midcom_helper_datamanager_exception_datamanager('Method ' . __FUNCTION__ . ' must be overridden.');
0
     }
0
+
0
+ public function freeze()
0
+ {
0
+ $this->frozen = true;
0
+ foreach ($this->schema->field_order as $field_name)
0
+ {
0
+ $this->widgets->$field_name->freeze();
0
+ }
0
+ }
0
+
0
+ public function unfreeze()
0
+ {
0
+ $this->frozen = false;
0
+ foreach ($this->schema->field_order as $field_name)
0
+ {
0
+ $this->widgets->$field_name->unfreeze();
0
+ }
0
+ }
0
 
0
     public function get_submit_values()
0
     {

Comments

    No one has commented yet.