diff --git a/webgui/box.php b/webgui/box.php index 7ba98e4..7c622e4 100644 --- a/webgui/box.php +++ b/webgui/box.php @@ -180,7 +180,7 @@ $sth = $pdo->prepare($sql); $sth->execute([$id]); $box = $sth->fetch(PDO::FETCH_OBJ); -echo '

', $box->label, "

\n"; +echo '

', sprintf(_('Box: %s'), h($box->label)), "

\n"; // Bootstrap grid echo '
'; diff --git a/webgui/cable.php b/webgui/cable.php index 252efdb..ecfe056 100644 --- a/webgui/cable.php +++ b/webgui/cable.php @@ -194,26 +194,13 @@ echo '

', _('Add Cable'), "

\n"; ?>
-
- - -
-
- - -
-
- - -
-
- - -
-\n"; @@ -261,46 +248,18 @@ echo '

', _('Edit cable'), "

\n"; ?> -
- - -
cablename, TRUE, TRUE); form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype, $cable->cabletype); form_create_select('techname', _('Techname'), $g_opt_none + $opt_techname, $cable->techname); -?> -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-length, 1), 0, 9999, 0.01); +form_create_numeric('number', _('Number of conductors'), $cable->conductors, 1, 99, 1); +form_create_numeric('diameter', ('Diameter, mm'), format_float($cable->diameter, 1), 0, 999, 0.1); +form_create_numeric('xsection', _('Cross section, mm²'), format_float($cable->xsection, 1), 0, 999, 0.1); +form_create_numeric('weight', _('Weight, kg/m'), format_float($cable->weight, 2), 0, 9999, 0.01); +form_create_color('color', _('Color'), $cable->color); form_create_select('cablecond', _('Condition'), $opt_cablecond, $cable->cablecond); -?> -
- - -
-remarks); form_edit_buttons($g_scriptname, $id); echo "
\n"; diff --git a/webgui/checklist.php b/webgui/checklist.php index e88cff0..10a3293 100644 --- a/webgui/checklist.php +++ b/webgui/checklist.php @@ -113,11 +113,8 @@ elseif ($action == ACT_ADD): echo '

', _('Add Checklist'), "

\n"; ?>
-
- - -
\n"; @@ -158,11 +155,8 @@ echo '

', _('Edit checklist'), "

\n"; ?> -
- - -
title); form_create_select('clstate', _('State'), $opt_clstate, $checklist->clstate); form_edit_buttons($g_scriptname, $id); diff --git a/webgui/company.php b/webgui/company.php index 10a2dce..8a35f28 100644 --- a/webgui/company.php +++ b/webgui/company.php @@ -253,11 +253,10 @@ elseif ($action == ACT_ADD): echo '

', _('Add Company'), "

\n"; ?> -
- - -
- +
@@ -357,76 +356,22 @@ $company = $sth->fetch(PDO::FETCH_OBJ); ?>
-
- - -
-
- - -
-
- - -
compname); +form_create_text('shortname', _('Short name'), 20, $company->shortname); +form_create_select('comptype', _('Company type'), $opt_comptype, $company->comptype); form_create_select('comptype2', _('Secondary company type'), $g_opt_none + $opt_comptype, $company->comptype2); -?> -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-street); +form_create_text('zip', _('Zip'), 10, $company->zip); +form_create_text('city', _('City'), 30, $company->city); +form_create_text('country', _('Country'), 30, $company->country); +form_create_text('contact', _('Contact'), 30, $company->contact); +form_create_text('phone', _('Phone'), 30, $company->phone); +form_create_text('email', _('Email'), 50, $company->email); +form_create_text('web', _('Web'), 40, $company->web); +form_create_text('customerno', _('Customer no.'), 20, $company->customerno); +form_create_text('contractno', _('Contract no.'), 20, $company->contracno); +form_create_textarea('remarks', _('Remarks'), 3, 150, $company->remarks); $opt_flags = db_load_enum('company', 'flags', true, true, false); form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags)); ?> diff --git a/webgui/documents.php b/webgui/documents.php index 5489e5b..2c909fb 100644 --- a/webgui/documents.php +++ b/webgui/documents.php @@ -321,7 +321,7 @@ $page = gpc_get_int($_REQUEST, 'p', 1); $rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp); $lastpage = ceil($numrows/$rows_pp); -$sql = "SELECT d.docid, d.doctype, d.filename, d.title, COUNT(r.drid) AS refcount " +$sql = "SELECT d.docid, d.doctype, d.mimetype, d.filename, d.title, COUNT(r.drid) AS refcount " . "FROM document AS d LEFT OUTER JOIN docref AS r USING (docid)"; if ($where) $sql .= ' WHERE ' . $where; $sql .= " GROUP BY d.docid, d.doctype, d.filename, d.title"; @@ -379,7 +379,17 @@ foreach ($res as $row) { echo "", $i; echo '', "\n"; echo "\n"; - echo "", $opt_doctype[$row['doctype']], "\n"; + echo ""; + if ($row['mimetype'] == 'application/pdf') { + echo ''; + } else if ($row['mimetype'] == 'image/svg+xml') { + echo ''; + } else if ($row['mimetype'] == 'image/jpeg' or $row['mimetype'] == 'image/png') { + echo ''; + } else { + echo ''; + } + echo ' ', $opt_doctype[$row['doctype']], "\n"; echo "", $row['filename'], "\n"; echo "", $row['title'], "\n"; echo "", $row['refcount'], "\n"; @@ -403,14 +413,10 @@ elseif ($action == ACT_ADD): echo '

', _('Add Document'), "

\n"; ?> -
- - -
-
- - -
+remarks); +?>
@@ -519,6 +525,7 @@ echo '', _('Filename'),"", h($document->filename), echo '', _('File size'),"", format_filesize($document->docsize), "\n"; echo '', _('Upload date'),"", $document->doctime, "\n"; echo '', _('Title'),"", h($document->title), "\n"; +echo '', _('Access'),"", get_enum($document->roleaccess), "\n"; echo '', _('Remarks'),"", h($document->remarks, br:true), "\n"; echo "\n"; @@ -722,13 +729,15 @@ elseif ($action == ACT_EDIT): echo '

', _('Edit Document'), "

\n"; -$sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, remarks " +$sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, roleaccess, remarks " . "FROM document " . "WHERE docid=?"; $sth = $pdo->prepare($sql); $sth->execute([$id]); $document = $sth->fetch(PDO::FETCH_OBJ); +// TODO check roleaccess! + if ($document->doctype == 'picture') { echo ''; } @@ -736,15 +745,10 @@ if ($document->doctype == 'picture') { ?> -
- - -
-
- - -
filename); +form_create_text('title', _('Title'), 40, $document->title); + if ($document->mimetype == 'application/pdf') { echo '
', "\n"; $opt_doctype = array( @@ -757,13 +761,13 @@ if ($document->mimetype == 'application/pdf') { } else { echo '', "\n"; } + +form_create_textarea('remarks', _('Remarks'), 3, 150, $document->remarks); ?> -
- - +
+ +
- - id, 200); ?>

-
- - -
cat); form_create_select('manufacturer', _('Manufacturer'), $opt_manufacturer, $flt->manuf); +form_create_text('model', _('Model'), 40); +form_create_textarea('remarks', _('Remarks'), 3, 150); ?> -
- - -
-
- - -
diff --git a/webgui/fuse.php b/webgui/fuse.php index 3d10a22..cf50fe5 100644 --- a/webgui/fuse.php +++ b/webgui/fuse.php @@ -270,35 +270,16 @@ echo '

', _('Edit fuse'), "

\n"; ?> -
- - -
fnumber, 1, 9999, 1, TRUE, TRUE); form_create_select('ftype', _('Type'), $g_opt_none + $opt_ftype, $fuse->ftype); -?> -
- - -
-
- - -
-
- - -
-description); +form_create_numeric('current', _('Current, A'), format_float($fuse->current), 1, 999, 1); +form_create_color('color', _('Color'), $fuse->color); form_create_select('location', _('Location'), $g_opt_none + $opt_location, $fuse->location); form_create_select('cableid', _('Cable'), $g_opt_none + $opt_cable, $fuse->cableid); form_create_select('eid', _('Equipment'), $g_opt_none + $opt_equipment, $fuse->eid); -?> -
- - -
-remarks); form_edit_buttons($g_scriptname, $id); echo "\n"; diff --git a/webgui/inventory.php b/webgui/inventory.php index bc42442..5be8aca 100644 --- a/webgui/inventory.php +++ b/webgui/inventory.php @@ -15,6 +15,7 @@ $pagetitle=_('Inventory'); $id = gpc_get_int($_REQUEST, 'id', 0); +$opt_conttype = db_load_enum('inventory', 'conttype', true, true); $opt_storage = db_get_opt_storage($user->vid); $opt_box = db_get_opt_box($user->vid); $opt_invcond = db_load_enum('inventory', 'invcond', true, true); @@ -288,6 +289,10 @@ elseif ($action == ACT_ADD): echo '

', _('Add Inventory'), "

\n"; ?>
+ @@ -303,7 +308,9 @@ echo '

', _('Add Inventory'), "

\n";
-id, 201, ['stor','cond','txt']); form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $flt->stor); @@ -430,6 +437,8 @@ $opt_conttype = db_load_enum('inventory', 'conttype', true, true); form_create_select('conttype', _('Container type'), $opt_conttype, $inventory->conttype); form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $inventory->sid); form_create_select('boxid', _('Box'), $g_opt_none + $opt_box, $inventory->boxid); + +// form_create_numeric ?>
diff --git a/webgui/lib/form.inc b/webgui/lib/form.inc index 9b8fbf5..ea70fa9 100644 --- a/webgui/lib/form.inc +++ b/webgui/lib/form.inc @@ -6,6 +6,10 @@ * SPDX-License-Identifier: WTFPL ****************************************************************************** +TODO implement datalist + tel and/or email? + autocomplete? + */ // ========== FORM FUNCTIONS ================================================== @@ -49,20 +53,39 @@ function form_tag_assignment($script, $id, $tags) { // ========== FORM FIELDS ===================================================== -function form_create_numeric($fieldname, $label, $min=NULL, $max=NULL, $step=NULL, $value=NULL) { - // TODO WIP - // step = any float - // step = 0.01 float - // step = 1 integer +function form_create_numeric($fieldname, $label, $value=NULL, $min=NULL, $max=NULL, $step=NULL, $required=FALSE, $autofocus=FALSE) { + // step = 'any'-> any float + // step = 0.01 -> float with limited decimal places + // step = 1 -> integer echo '
', "\n"; - echo '', $label, "\n"; + echo '\n"; echo "
\n"; } -function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL) { +function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL, $required=FALSE, $autofocus=FALSE) { // create generic text entry with assigned label - // TODO required, errortext + // TODO errortext + // perhaps support inputmode="numeric", pattern="[0-9]{1,3}" echo '
', "\n"; echo '\n"; echo '\n"; echo "
\n"; } @@ -92,11 +121,28 @@ function form_create_textarea($fieldname, $label, $rows=3, $maxlen=NULL, $value= echo "
\n"; } +function form_create_date($fieldname, $label, $value=NULL, $mindate=NULL, $maxdate=NULL) { + echo '
', "\n"; + echo '\n"; + echo '\n"; + echo "
\n"; +} + function form_create_color($fieldname, $label, $value=NULL) { // value has to be 6char hex echo '
', "\n"; echo '\n"; - echo '', _('Add Maintenance'), "\n"; ?> -
- - -
-
+form_create_select('eid', _('Equipment'), $opt_equipment, $id); + +/*
+*/ +?>
@@ -446,11 +446,8 @@ echo '

', _('Edit Maintenance'), "

\n"; ?> -
- - -
activities); form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid); form_create_select('series', _('Series'), $g_opt_none + $g_opt_new + $opt_series, $maint->series); ?> diff --git a/webgui/measurement.php b/webgui/measurement.php index 115c306..486b914 100644 --- a/webgui/measurement.php +++ b/webgui/measurement.php @@ -272,30 +272,13 @@ echo '

', _('Add measurement'), "

\n"; ?> -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-', _('Edit measurement'), "\n"; ?> -
- - -
-
- - -
mname, TRUE, TRUE); +form_create_text('note', _('Note'), 80, $measurement->note); form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval); -?> -
- - -
-
- - -
-
- - -
-val1); +form_create_numeric('val2', _('Value 2'), $measurement->val2); +form_create_numeric('val2', _('Value 2'), $measurement->val3); form_create_select('unit', _('Unit'), $opt_unit, $measurement->unit); form_create_select('accuracy', _('Accuracy'), $opt_accuracy, $measurement->accuracy); form_create_select('mcat', _('Category'), $g_opt_none + $opt_category, $measurement->mcat); diff --git a/webgui/projects.php b/webgui/projects.php index 567f39f..5eb0b8e 100644 --- a/webgui/projects.php +++ b/webgui/projects.php @@ -390,11 +390,8 @@ $project = $sth->fetch(PDO::FETCH_OBJ); ?> -
- - -
projname, TRUE, TRUE); form_create_select('responsible', _('Responsible'), $opt_user, $project->responsible); ?>
diff --git a/webgui/settings.php b/webgui/settings.php index 626e41a..de7e499 100644 --- a/webgui/settings.php +++ b/webgui/settings.php @@ -112,10 +112,6 @@ if ($res = $sth->fetch(PDO::FETCH_NUM)) { $sth->execute([$user->id, $rowspp]); } -$currsym = $pdo->query("SELECT valstr FROM settings WHERE userid=0 AND sno=4")->fetchColumn(); -$maximgx = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn(); -$maximgy = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn(); - ?>

@@ -133,16 +129,22 @@ for ($i = 1; $i <= 6; $i++) { } form_create_select('datefmt', _('Date format'), $opt_datefmt, $datefmt); -?> -
+form_create_numeric('rowspp', _('Number of rows per page'), $rowspp, 5, 100, 1); + +/*
> -
- */ + // limit global settings for captain only -if ($user->role == 'captain'): -?> -

+if ($user->role == 'captain') { + echo '

', _('global for all users'), "

\n"; + + $currsym = $pdo->query("SELECT valstr FROM settings WHERE userid=0 AND sno=4")->fetchColumn(); + $maximgx = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn(); + $maximgy = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn(); + +/*
> @@ -155,8 +157,11 @@ if ($user->role == 'captain'): >
-
diff --git a/webgui/storage.php b/webgui/storage.php index 70e2d18..14eafc7 100644 --- a/webgui/storage.php +++ b/webgui/storage.php @@ -206,16 +206,13 @@ echo '

', _('Add Storage'), "

\n"; ?> - - -
*/ form_create_text('sname', _('Name'), 40); form_create_select('stype', _('Type'), $opt_stype); ?> - - +
+ + +
prepare($sql); $sth->execute([$id]); $storage = $sth->fetch(PDO::FETCH_OBJ); -echo '

', _('Storage'), ': ', $storage->sname, "

\n"; +echo '

', sprintf(_('Storage: %s'), h($storage->sname)), "

\n"; echo '', "\n"; echo '\n"; @@ -238,7 +235,7 @@ echo '\n"; echo '\n"; echo '\n"; -echo '\n"; +echo '\n"; echo '\n"; echo "
', _('Typ'),"", $opt_stype[$storage->stype], "
', _('Capacity'),"", $storage->capacity, ' ', $storage->c echo '
', _('Location (x, y, z)'),"(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")
', _('Width (wx, wy, wz)'),"(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")
', _('Angle'),"", $storage->angle, "°
', _('Color'),"", $storage->color, "
', _('Color'),"", format_color($storage->color), "
', _('Remarks'),"", h($storage->remarks), "
\n"; @@ -311,7 +308,8 @@ elseif ($action == ACT_EDIT): echo '

', _('Edit Storage'), "

\n"; -$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, angle, capacity, capaunit, remarks " +$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, angle, capacity, " + . "color, capaunit, remarks " . "FROM storage " . "WHERE sid=?"; $sth = $pdo->prepare($sql); @@ -326,19 +324,20 @@ $storage = $sth->fetch(PDO::FETCH_OBJ);
name, 40); form_create_select('stype', _('Type'), $opt_stype, $storage->stype); ?>
- +
- +
- +
@@ -346,40 +345,41 @@ form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
- +
- +
- +
-
- - -
-
- - -
angle, 0, 359, 1); +form_create_numeric('capacity', _('Capacity'), $storage->capacity, 0, 32767); form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit); -/*
- - -
-
- - -
*/ form_create_color('color', _('Color'), $storage->color); form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks); ?> +