]> git.andy128k.dev Git - ipf.git/commitdiff
allow post method links in object tools
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 18 Jul 2015 17:30:29 +0000 (20:30 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 18 Jul 2015 17:30:29 +0000 (20:30 +0300)
ipf/admin/component.php
ipf/admin/templates/admin/change.html

index b69bd46ba2685579e868c617f50f4e468f97e4ff..6986d0addfc43a4c820cbe17a69b3d709e2535de 100644 (file)
@@ -247,7 +247,19 @@ abstract class IPF_Admin_Component
             $this->_setupEditForm($form);
         }
 
-        $objecttools = $this->objectTools($object);
+        $objecttools = array();
+        foreach ($this->objectTools($object) as $title => $action) {
+            if (!is_array($action)) {
+                $action = array(
+                    'url' => $action,
+                );
+            }
+            $action['title'] = $title;
+            if (!array_key_exists('method', $action))
+                $action['method'] = 'GET';
+            $objecttools[] = $action;
+        }
+
         $extraMedia = $this->extraMedia($form);
 
         return $this->fullContext(array(
index df215032de4ebe45df7b64043c66148fb1179161..a8482dd77ba89e5566196352918a7950a649034b 100644 (file)
     <div id="content-main">
         <ul class="object-tools">
           {block objecttools}
-            {foreach $objecttools as $ot_title => $ot_url}
-              <li><a href="{$ot_url}">{$ot_title}</a></li>
+            {foreach $objecttools as $ot_index => $ot_action}
+              <li>
+              {if $ot_action['method'] == 'POST'}
+                <form id="id_ot_{$ot_index}" method="post" action="{$ot_action['url']}"><a href="javascript:void()" onclick="document.getElementById('id_ot_{$ot_index}').submit();">{$ot_action['title']}</a></form>
+              {else}
+                <a href="{$ot_action['url']}">{$ot_action['title']}</a>
+              {/if}
+              </li>
             {/foreach}
           {/block}
         </ul>