<?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>
<?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);
//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>
<?php
-$script = $_SERVER['SCRIPT_NAME'].'/assistant/stats';
$month=date('Y-m');
$month_sql='';
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>
<?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;
<?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>
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: //?