Vylepseno (zjednoduseno) rozhrani pro assistanty
authorThomas Mudrunka <tomas@mudrunka.cz>
Mon, 22 Aug 2011 19:29:31 +0000 (21:29 +0200)
committerThomas Mudrunka <tomas@mudrunka.cz>
Mon, 22 Aug 2011 19:29:31 +0000 (21:29 +0200)
assistants/dispose.inc.php
assistants/go.inc.php
assistants/sell.inc.php
assistants/stats.inc.php
assistants/store-single.inc.php
assistants/store.inc.php
index.php

index 56622bfe40837b13da1de014d61499de388d7e88..691b258665fc6af99b5081c25bfcaf1bb3e956c9 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/dispose';
-switch($step) {
+switch($SUBPATH[0]) {
        default: case 1:
 ?>
-<form action="<?=$script?>/2" method="GET">
+<form action="<?=$URL?>/2" method="GET">
        item_serial: <input type="text" name="serial" autofocus />
        <input type="submit" value="DISPOSE" />
 </form>
index c74bbaedfbd719e03ace82feef8ee62f6256b75f..d488e5edc982cbbe3aae6dca5fffae8790df8b5f 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-//$script = $_SERVER['SCRIPT_NAME'].'/assistant/go';
-
 $id=$_GET['q'];
 $barcode_prefix_regexp = '/^'.preg_replace('/\//', '\/', BARCODE_PREFIX).'/';
 if(preg_match($barcode_prefix_regexp, $id)) $id=preg_replace($barcode_prefix_regexp, '', $id);
index 0cd1d7d4bdf69f6b828e4e582400be5ebba009d2..af7ef8b5e47d28568d8ea34059b2bb115dd4c86c 100644 (file)
@@ -3,11 +3,10 @@
 //TODO: Highlight fields that should be filled (and maybe even check them when submited)
 //TODO: Add support for selling/disposing multiple items at once...
 //TODO: Reuse /item/$item_id/edit
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/sell';
-switch($step) {
+switch($SUBPATH[0]) {
        default: case 1:
 ?>
-<form action="<?=$script?>/2" method="GET">
+<form action="<?=$URL?>/2" method="GET">
        item_serial: <input type="text" name="serial" autofocus />
        <input type="submit" value="SELL" />
 </form>
index bd84300c4e9961fefc5c5a4a925ff8340a948b62..f295c76ea6db095ecd73b94fc1eab85f17dd3770 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/stats';
 $month=date('Y-m');
 $month_sql='';
 if(isset($_GET['month'])) {
@@ -8,7 +7,7 @@ if(isset($_GET['month'])) {
 }
 ?>
 
-<form action="<?=$script?>/" method="GET">
+<form action="<?=$URL?>/" method="GET">
        YYYY-MM: <input type="text" name="month" autofocus value="<?=$month?>" />
        <input type="submit" value="SELECT BY MONTH" />
 </form>
index 04bf68443c4ec5fec79c096576355bd8f1dbb618..dc550b8247b3b099344459f5872b2de4131b4648 100644 (file)
@@ -1,7 +1,6 @@
 <?php
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/store-single';
-$this->process_http_request_post('new', false, false, 'assistant/store-single/2');
-switch($step) {
+$this->process_http_request_post('new', false, false, "$URL_INTERNAL/2");
+switch($SUBPATH[0]) {
        default: case 1:
                echo $this->render_form_add('model');
                break;
index 8980c3bb4fd77a0665b26744fc65b7fd6d0060c6..3e05919a679ff9e440d9ae288d0fbb63aff82dbb 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/store';
-switch($step) {
+switch($SUBPATH[0]) {
        default: case 1:
 ?>
-<form action="<?=$script?>/2" method="GET">
+<form action="<?=$URL?>/2" method="GET">
        model_barcode: <input type="text" name="barcode" autofocus />
        <input type="submit" value="STORE" />
 </form>
index 6036ac0535b603a39b69f0b2eb5f789f536f50b7..931f06cbb582b2235467c0c3447a4dd913fe1a27 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -725,7 +725,10 @@ class Sklad_UI {
                                die('Tell me why you cry');
                                break;
                        case 'assistant': //assistant
-                               $assistant_vars['step'] = isset($PATH_CHUNKS[3]) && is_numeric($PATH_CHUNKS[3]) ? trim($PATH_CHUNKS[3]) : false;
+                               $PATH_CHUNKS[3] = isset($PATH_CHUNKS[3]) ? trim($PATH_CHUNKS[3]) : false;
+                               $assistant_vars['SUBPATH'] = array_slice($PATH_CHUNKS, 3);
+                               $assistant_vars['URL_INTERNAL'] = 'assistant/'.$PATH_CHUNKS[2];
+                               $assistant_vars['URL'] = $_SERVER['SCRIPT_NAME'].'/'.$assistant_vars['URL_INTERNAL'];
                                echo $this->safe_include(DIR_ASSISTANTS,$PATH_CHUNKS[2],$assistant_vars);
                                break;
                        default:        //?
This page took 0.232838 seconds and 4 git commands to generate.