<?php
-function get_post($name, $dflt='') {
+function get_post($name, $dflt='')
+{
return ((!isset($_POST[$name]) || $_POST[$name] === '') ? $dflt : $_POST[$name]);
}
//
-// Sets local POST value and adds Value to ajax posting if needed
+// Sets local POST value and adds Value to ajax posting if needed
//
/*function set_post($name, $value, $ajax_trigger=true) {
global $Ajax;
// If var is found returns variable name with prefix stripped,
// and null or -1 otherwise.
//
-function find_submit($prefix, $numeric=true) {
+function find_submit($prefix, $numeric=true)
+{
- foreach($_POST as $postkey=>$postval ) {
- if (strpos($postkey, $prefix) === 0) {
- $id = substr($postkey, strlen($prefix));
- return $numeric ? (int)$id : $id;
- }
+ foreach($_POST as $postkey=>$postval )
+ {
+ if (strpos($postkey, $prefix) === 0)
+ {
+ $id = substr($postkey, strlen($prefix));
+ return $numeric ? (int)$id : $id;
+ }
}
return $numeric ? -1 : null;
}
//
// Read numeric value from user formatted input
//
-function input_num($postname=null) {
- if (!isset($_POST[$postname]))
- return null;
+function input_num($postname=null)
+{
+ if (!isset($_POST[$postname]))
+ return null;
return user_numeric($_POST[$postname]);
}
//---------------------------------------------------------------------------------
-function hidden($name, $value)
+function hidden($name, $value, $echo=true)
{
- global $Ajax;
- echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
+ global $Ajax;
+ $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
$Ajax->addUpdate($name, $name, $value);
+ if ($echo)
+ echo $ret."\n";
+ else
+ return $ret;
}
//---------------------------------------------------------------------------------
{
default_focus($name);
$submit_str = "<input type=\"submit\" class=\""
- .($async ? 'ajaxsubmit' : 'inputsubmit')
+ .($async ? 'ajaxsubmit' : 'inputsubmit')
."\" name=\"$name\" id=\"$name\" value=\"$value\" >\n";
if ($echo)
echo $submit_str;
function button($name, $value, $onclick)
{
- default_focus($name);
- echo "<input type=\"button\" class=\"inputsubmit\" name=\"$name\" value=\"$value\" onclick=\"$onclick\" />\n";
+ default_focus($name);
+ echo "<input type=\"button\" class=\"inputsubmit\" name=\"$name\" value=\"$value\" onclick=\"$onclick\" />\n";
}
function button_cell($name, $value, $onclick)
function check($label, $name, $value, $submit_on_change=false)
{
- global $Ajax;
+ global $Ajax;
default_focus($name);
if ($label)
function label_cell($label, $params="", $id=null)
{
global $Ajax;
-
- if(isset($id)) {
+
+ if(isset($id))
+ {
$params .= " id='$id'";
$Ajax->addUpdate($id, $id, $label);
}
{
echo "<tr>";
label_cells($label, $value, $params, $params2);
- if($leftfill!=0)
- echo "<td colspan=$leftfill></td>";
+ if ($leftfill!=0)
+ echo "<td colspan=$leftfill></td>";
echo "</tr>\n";
}
function text_cells($label, $name, $value, $size="", $max="", $params="", $post_label="", $disabled="")
{
- global $Ajax;
+ global $Ajax;
default_focus($name);
if ($label != null)
function text_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null)
{
- global $Ajax;
+ global $Ajax;
default_focus($name);
if (!isset($_POST[$name]) || $_POST[$name] == "")
if (!isset($_POST[$name]) || $_POST[$name]=="")
{
- $_POST[$name] = $init== null ? '' : $init;
+ $_POST[$name] = $init== null ? '' : $init;
}
small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
{
-global $Ajax;
+ global $Ajax;
if (!isset($dec))
- $dec = user_price_dec();
+ $dec = user_price_dec();
if (!isset($_POST[$name]) || $_POST[$name] == "")
{
if ($init)
function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- if(!isset($dec))
- $dec = user_qty_dec();
+ if (!isset($dec))
+ $dec = user_qty_dec();
amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
}
function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- if(!isset($dec))
- $dec = user_qty_dec();
+ if (!isset($dec))
+ $dec = user_qty_dec();
echo "<tr>";
amount_cells($label, $name, $init, $params, $post_label, $dec);
function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- if(!isset($dec))
- $dec = user_qty_dec();
+ if (!isset($dec))
+ $dec = user_qty_dec();
echo "<tr>";
small_amount_cells($label, $name, $init, $params, $post_label, $dec);
function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- if (!isset($dec))
- $dec = user_qty_dec();
+ if (!isset($dec))
+ $dec = user_qty_dec();
amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
}
function textarea_cells($label, $name, $value, $cols, $rows, $params="")
{
- global $Ajax;
-
+ global $Ajax;
+
default_focus($name);
if ($label != null)
echo "<td $params>$label</td>\n";
function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
{
- global $Ajax;
-
+ global $Ajax;
+
default_focus($name);
echo "<tr><td>$label</td>\n";
echo "<td>";