27 Commits
Author SHA1 Message Date
thooge 09387280fc Native gui usable for data editing. Lots of fixes and improvenemts 2026-11-11 18:58:02 +01:00
thooge a6abdaa614 Include updater for web gui 2026-11-08 07:39:52 +01:00
thooge 198063fc8d Work on editable lists in native gui 2026-11-04 20:38:19 +01:00
thooge 669c15109a Implement record locking for native gui 2026-11-04 17:21:39 +01:00
thooge 1a6674c819 Native gui make almost every data editable 2026-11-04 12:45:16 +01:00
thooge b8ac8d0185 Fix missing config value load and date event in box 2026-10-30 13:24:42 +01:00
thooge 8ac72e717e Added data change event system to native gui 2026-10-30 13:08:20 +01:00
thooge f6ab45c465 Fix ymsgui.py: missing parenthesis 2026-10-30 11:50:37 +01:00
thooge 5fe9a52f15 Webgui code improvements and fixes 2026-10-30 11:40:59 +01:00
thooge dacf32b401 Fixes for sane module and scanner feature 2026-10-30 09:43:45 +01:00
thooge 7aa5d2af3b More work on native gui. Make data editable. 2026-10-29 18:59:21 +01:00
thooge 5641e1706f Webgui fixed cables and fuses, parts of code reorganized 2026-10-25 09:03:24 +01:00
thooge 9d09b1e120 Webgui improve filter functions 2026-10-24 10:47:44 +02:00
thooge b3825cb1b3 Webgui improve series handling and plan date precision 2026-10-22 22:03:04 +02:00
thooge c2df7e8013 Webgui improve maintenance list and filter 2026-10-21 20:06:15 +02:00
thooge 06a9834688 Native gui first steps: storage, box and companies are editable 2026-10-21 17:16:55 +02:00
thooge 1eea4058bf Webgui translation update and improvement 2026-10-18 19:47:25 +02:00
thooge aee50ecb4f Prepare combo list reload with revisions and fix box/storage in webgui 2026-10-18 10:35:35 +02:00
thooge ee947b772f Work on localization and some small fixes 2026-10-17 08:34:54 +02:00
thooge 3a43f749f5 More webgui code improvements and some new vessel data 2026-10-11 18:42:25 +02:00
thooge 72571ede53 Webgui code improvements for dropdown handling 2026-10-01 18:10:57 +02:00
thooge 131af7d9e7 Work on native gui. Display records and add missing tasks and measurements. 2026-09-30 16:18:44 +02:00
thooge c3109b9d2a Fixed console password utility ymspass.py 2026-09-26 09:08:10 +02:00
thooge 99df0287be Added custom properties and backup settings 2026-09-25 17:36:11 +02:00
thooge 53ea5af9e7 Improve file access rights in webgui 2026-09-24 09:17:41 +02:00
thooge 5dcda3fe81 Fix debian packaging for native gui 2026-09-23 07:44:05 +02:00
thooge f6b37c9f26 Fixed generic data and added english version 2026-09-22 17:51:00 +02:00
114 changed files with 17997 additions and 4806 deletions

No files matched your search

-1
View File
@@ -3,7 +3,6 @@ __pycache__/
*.txt *.txt
*.bak *.bak
*.pot *.pot
*.mo
compare_* compare_*
# Debian package build artifacts # Debian package build artifacts
+13
View File
@@ -1,6 +1,19 @@
CHANGELOG CHANGELOG
========= =========
0.3.0 - 2026-11-11
------------------
* native gui: can create and edit all kind of records
* native gui: implemented record locking
* updater script for web gui
* many bugs fixed in webgui
* prepare list revision feature (reload support)
* database localization tool
* new property table for generic key/value store
* webgui: set file access rights
* fix debian packaging
0.2.2 - 2026-09-21 0.2.2 - 2026-09-21
------------------ ------------------
+13 -5
View File
@@ -14,6 +14,9 @@ Yacht Management Software (YMS) Installation
1.2 Native GUI 1.2 Native GUI
- Python GTK3 - Python GTK3
- python3-gi - python3-gi
- python3-fitz
- python3-pyudev
- python3-dateutil
- gir1.2-gtk-3.0 - gir1.2-gtk-3.0
- gir1.2-rsvg-2.0 - gir1.2-rsvg-2.0
@@ -50,11 +53,16 @@ According to your desired language import minimal required dataset into your
new database. For german use new database. For german use
mariadb yms < minimal.sql mariadb yms < minimal.sql
or alternatively for english language
or alternatively for english language
mariadb yms < minimal_en.sql mariadb yms < minimal_en.sql
It is strongly recommended to import the following data.
These are selection lists that are typically always required.
mariadb yms < generic.sql
or alternatively for english language
mariadb yms < generic_en.sql
Optional import some sample data Optional import some sample data
mariadb yms < mariadb_sample.sql mariadb yms < mariadb_sample.sql
@@ -77,9 +85,9 @@ group (here as example 'yms'). The user which runs the local gui (here
usermod -aG yms guiuser usermod -aG yms guiuser
chgrp yms /var/local/lib/yms chgrp yms /var/local/lib/yms
chgrp yms /var/local/lib/yms/thumb chgrp yms /var/local/lib/yms/thumb
chmod -R 770 /var/local/yms chmod -R 770 /var/local/lib/yms
4. Setup local GUI 5. Setup local GUI
Create a local database user with same name as your computer user and allow Create a local database user with same name as your computer user and allow
database access with current unix credentials. E.g if your current unix user database access with current unix credentials. E.g if your current unix user
+3 -1
View File
@@ -28,7 +28,8 @@ prepare: ymsgui.py yms/*.py yms/ui/*.ui
xgettext -L Python -o locale/program.pot ymsgui.py yms/*.py xgettext -L Python -o locale/program.pot ymsgui.py yms/*.py
xgettext -L Python -o locale/views.pot ymsgui.py yms/view/*.py xgettext -L Python -o locale/views.pot ymsgui.py yms/view/*.py
xgettext -L Glade -o locale/ui.pot yms/ui/*.ui xgettext -L Glade -o locale/ui.pot yms/ui/*.ui
msgcat -o locale/combined.pot locale/program.pot locale/views.pot locale/ui.pot db/localize.py db/mariadb.sql > locale/db.pot
msgcat -o locale/combined.pot locale/program.pot locale/views.pot locale/ui.pot locale/db.pot
msgmerge -U locale/de.po locale/combined.pot msgmerge -U locale/de.po locale/combined.pot
translation: locale/de/LC_MESSAGES/ymsgui.mo translation: locale/de/LC_MESSAGES/ymsgui.mo
@@ -42,6 +43,7 @@ clean:
find . -type d -name "__pycache__" -prune -exec rm -rf {} + find . -type d -name "__pycache__" -prune -exec rm -rf {} +
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
rm -f locale/program.pot rm -f locale/program.pot
rm -f locale/views.pot
rm -f locale/ui.pot rm -f locale/ui.pot
rm -f locale/combined.pot rm -f locale/combined.pot
rm -f locale/de/LC_MESSAGES/ymsgui.mo rm -f locale/de/LC_MESSAGES/ymsgui.mo
+2 -1
View File
@@ -2,7 +2,8 @@ YMS - Open Source Yacht Management System
Preview Version Preview Version
Free, self-hosted software for managing your boat's equipment, Free, self-hosted software for managing your boat's equipment,
inventory, documents, maintenance and tasks. inventory, documents, maintenance, projects, tasks and some
other things.
Your boat. Your data. Your software. Your boat. Your data. Your software.
+28
View File
@@ -0,0 +1,28 @@
Web GUI
-------
There is a script for updating the files for the web gui:
python update_web.py -d <path_to_webgui> -b <path_to_backup_dir>
Just execute with target path to your YMS installation and optional
a path to a backup directory e.g. /var/backups.
If you are unsure use the switch --dryrun to check beforehand.
Native GUI
----------
Follow the instructions in INSTALL
Database
--------
Compare the running database schema with the schema delivered
in db/mariadb.sql.
For easy comparison you can create a new empty database.
Then dump schema from running and new database and compare
the results.
+52 -13
View File
@@ -9,25 +9,40 @@ INSERT INTO user (userid, login, pass, displayname, role) VALUES
(2, 'helmsman', '$2y$10$LFl2jvrt2kB.c2KXBLaCI.RF2XAGNmFsoRc.V2tzLKrfCPiBCbI0e', 'Helmsman', 'helmsman'), (2, 'helmsman', '$2y$10$LFl2jvrt2kB.c2KXBLaCI.RF2XAGNmFsoRc.V2tzLKrfCPiBCbI0e', 'Helmsman', 'helmsman'),
(3, 'sailor', '$2y$10$H5ZKd9r3KLAzI7W5u3ocgOCcXF4aDgjMAFYCzVC9Q9/Q9BqAV0MKS', 'Sailor', 'sailor'); (3, 'sailor', '$2y$10$H5ZKd9r3KLAzI7W5u3ocgOCcXF4aDgjMAFYCzVC9Q9/Q9BqAV0MKS', 'Sailor', 'sailor');
INSERT INTO vessel (vid, vesselname, model, loa, lwl, beam, draught, displacement, ballast) VALUES INSERT INTO vessel (vid, htype, vesselname, model, loa, lwl, beam, draught, displacement, ballast, shapefile) VALUES
(1, 'Generic vessel', 'Generic model', 10.0, 9.5, 3.0, 1.8, 4000, 1200); (1, 'mono', 'Generic vessel', 'Generic model', 10.0, 9.5, 3.0, 1.8, 4000, 1200, 'generic.svg');
INSERT INTO settings (userid, sno, valint) VALUES
(2, 1, 1), -- Vessel 1 for helmsman
(3, 1, 1); -- Vessel 1 for sailor
UPDATE settings SET valint=1 WHERE userid=1 AND sno=1; -- Vessel 1 for captain
INSERT INTO storage (sid, vid, sname, stype, x, y, z, remarks) VALUES INSERT INTO storage (sid, vid, sname, stype, x, y, z, remarks) VALUES
(0, 1, 'An Bord', 0, 0, 0, 0, 'Alles wo der Ort nicht spezifiziert werden kann'); (0, 1, 'An Bord', 0, 0, 0, 0, 'Alles wo der Ort nicht spezifiziert werden kann');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(1, 1, 'Mono'), (1, 1, 'Sloop'),
(1, 2, 'Katamaran'), (1, 2, 'Kutter'),
(1, 3, 'Trimaran'); (1, 3, 'Ketsch'),
(1, 4, 'Yawl'),
(1, 5, 'Schoner'),
(1, 6, 'Katamaran'),
(1, 7, 'Trimaran'),
(1, 8, 'Motorsegler'),
(1, 9, 'Motoryacht'),
(1, 10, 'Pilothouse'),
(1, 11, 'Trawler'),
(1, 12, 'Sonstiges');
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(2, 4, 'Dienstleister', NULL), -- Service (2, 4, 'Dienstleister', NULL),
(2, 5, 'Segelmacher', NULL), -- Sailmaker (2, 5, 'Segelmacher', NULL),
(2, 6, 'Yachthafen', NULL); -- Marina (2, 6, 'Yachthafen', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(3, 2, 'Bilge', NULL), (3, 3, 'Bilge', NULL),
(3, 3, 'Schwalbennest', NULL); (3, 4, 'Schwalbennest', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(4, 1, 'Rumpf'), (4, 1, 'Rumpf'),
@@ -38,7 +53,10 @@ INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(4, 6, 'Elektrik'), (4, 6, 'Elektrik'),
(4, 7, 'Elektronik'), (4, 7, 'Elektronik'),
(4, 8, 'Navigation'), (4, 8, 'Navigation'),
(4, 9, 'Pantry'); (4, 9, 'Pantry'),
(4, 10, 'Solar'),
(4, 11, 'Sicherheit'),
(4, 12, 'Laufendes Gut');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(5, 1, 'Allgemein'), (5, 1, 'Allgemein'),
@@ -68,7 +86,7 @@ INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(7, 4, 'MEGA/AMG-Sicherung', 'MEGA'), (7, 4, 'MEGA/AMG-Sicherung', 'MEGA'),
(7, 5, 'MRBF-Sicherung', 'MRBF'), (7, 5, 'MRBF-Sicherung', 'MRBF'),
(7, 6, 'ANL-Sicherung', 'ANL'), (7, 6, 'ANL-Sicherung', 'ANL'),
(7, 7, 'Class-T-Sicherung', 'Class T'), (7, 7, 'Class-T-Sicherung', 'Cl-T'),
(7, 8, 'Feinsicherung 5×20 mm', 'Fein'), (7, 8, 'Feinsicherung 5×20 mm', 'Fein'),
(7, 9, 'Glassicherung inline', 'Glas'), (7, 9, 'Glassicherung inline', 'Glas'),
(7, 10, 'Automat / Leitungsschutzschalter', 'Auto'), (7, 10, 'Automat / Leitungsschutzschalter', 'Auto'),
@@ -76,7 +94,6 @@ INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(7, 12, 'Streifensicherung', 'Str'); (7, 12, 'Streifensicherung', 'Str');
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(8, 1, 'Millimeter', 'mm'),
(8, 2, 'Zentimeter', 'cm'), (8, 2, 'Zentimeter', 'cm'),
(8, 3, 'Meter', 'm'), (8, 3, 'Meter', 'm'),
(8, 4, 'Gramm', 'g'), (8, 4, 'Gramm', 'g'),
@@ -127,6 +144,28 @@ INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(12, 15, 'Aircell 7'), (12, 15, 'Aircell 7'),
(12, 16, 'Ecoflex 10'); (12, 16, 'Ecoflex 10');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(13, 1, 'Leinen'),
(13, 2, 'Pantry'),
(13, 3, 'Werkzeug'),
(13, 4, 'Deck'),
(13, 5, 'Sicherkeit'),
(13, 6, 'Elektrik'),
(13, 7, 'Betriebsstoffe'),
(13, 8, 'Wartung'),
(13, 9, 'Sonstiges');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(15, 1, 'Vermessungsdaten'),
(15, 2, 'Rigg und Segel'),
(15, 3, 'Rumpf und Deck'),
(15, 4, 'Beschläge und Befestigungen'),
(15, 5, 'Abmessungen'),
(15, 6, 'Tanks und Volumen'),
(15, 7, 'Motor und Antrieb'),
(15, 8, 'Elektrik'),
(15, 9, 'Sonstiges');
/* supplier */ /* supplier */
INSERT INTO company (comptype, compname, street, zip, city, country, phone, email, web) VALUES INSERT INTO company (comptype, compname, street, zip, city, country, phone, email, web) VALUES
(1, 'Compass24', NULL, NULL, 'Ascheberg', 'Deutschland', NULL, NULL, 'compass24.de'), (1, 'Compass24', NULL, NULL, 'Ascheberg', 'Deutschland', NULL, NULL, 'compass24.de'),
+201
View File
@@ -0,0 +1,201 @@
/* Generic data suitable for all kind of boats
* SPDX-License-Identifier: WTFPL
Add this data additionally after applying minmal.sql
*/
INSERT INTO user (userid, login, pass, displayname, role) VALUES
(2, 'helmsman', '$2y$10$LFl2jvrt2kB.c2KXBLaCI.RF2XAGNmFsoRc.V2tzLKrfCPiBCbI0e', 'Helmsman', 'helmsman'),
(3, 'sailor', '$2y$10$H5ZKd9r3KLAzI7W5u3ocgOCcXF4aDgjMAFYCzVC9Q9/Q9BqAV0MKS', 'Sailor', 'sailor');
INSERT INTO vessel (vid, vesselname, model, loa, lwl, beam, draught, displacement, ballast) VALUES
(1, 'Generic vessel', 'Generic model', 10.0, 9.5, 3.0, 1.8, 4000, 1200);
INSERT INTO settings (userid, sno, valint) VALUES
(2, 1, 1), -- Vessel 1 for helmsman
(3, 1, 1); -- Vessel 1 for sailor
INSERT INTO storage (sid, vid, sname, stype, x, y, z, remarks) VALUES
(0, 1, 'An Bord', 0, 0, 0, 0, 'Alles wo der Ort nicht spezifiziert werden kann');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(1, 1, 'Sloop'),
(1, 2, 'Cutter'),
(1, 3, 'Ketsch'),
(1, 4, 'Yawl'),
(1, 5, 'Schooner'),
(1, 6, 'Catamaran'),
(1, 7, 'Trimaran'),
(1, 8, 'Motorseailor'),
(1, 9, 'Motoryacht'),
(1, 10, 'Pilothouse'),
(1, 11, 'Trawler'),
(1, 12, 'Other');
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(2, 4, 'Service', NULL),
(2, 5, 'Sailmaker', NULL),
(2, 6, 'Marina', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(3, 3, 'Bilge', NULL),
(3, 4, 'Quarter Berth', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(4, 1, 'Hull'),
(4, 2, 'Deck'),
(4, 3, 'Rigging'),
(4, 4, 'Sails'),
(4, 5, 'Engine'),
(4, 6, 'Electrical'),
(4, 7, 'Electronics'),
(4, 8, 'Navigation'),
(4, 9, 'Galley'),
(4, 10, 'Solar'),
(4, 11, 'Safety'),
(4, 12, 'Running Rigging');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(5, 1, 'General'),
(5, 2, 'Drinks'),
(5, 3, 'Sweets'),
(5, 4, 'Tinned Food'),
(5, 5, 'Fresh Food'),
(5, 6, 'Dry Goods'),
(5, 7, 'Freeze-Dried Food'),
(5, 8, 'Savoury Snacks');
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(6, 1, 'kg', 'kg'),
(6, 2, 'Litre', 'L'),
(6, 3, 'Piece', 'pc'),
(6, 4, 'Pack', 'pk'),
(6, 5, 'Tin', 'tin'),
(6, 6, 'Bottle', 'btl'),
(6, 7, 'Bag', 'bag'),
(6, 8, 'Bar', 'bar'),
(6, 9, 'Jar', 'jar');
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(7, 1, 'ATO/ATC blade fuse', 'ATO'),
(7, 2, 'MAXI blade fuse', 'Max'),
(7, 3, 'MIDI/AMI fuse', 'MIDI'),
(7, 4, 'MEGA/AMG fuse', 'MEGA'),
(7, 5, 'MRBF fuse', 'MRBF'),
(7, 6, 'ANL fuse', 'ANL'),
(7, 7, 'Class-T fuse', 'Cl-T'),
(7, 8, '5×20 mm cartridge fuse', 'Cart'),
(7, 9, 'Glass inline fuse', 'Glas'),
(7, 10, 'Circuit breaker', 'Auto'),
(7, 11, 'Torpedo fuse', 'Torp'),
(7, 12, 'Strip fuse', 'Str');
INSERT INTO dropdown (ddid, ddval, ddshort, ddtext) VALUES
(8, 2, 'cm', 'Centimetre'),
(8, 3, 'g', 'Gram'),
(8, 4, 'kg', 'Kilogram'),
(8, 5, 'm', 'Metre'),
(8, 6, 'kW', 'Kilowatt'),
(8, 7, 'A', 'Ampere'),
(8, 8, 'L', 'Litre');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(9, 1, 'Small Plastic Box'),
(9, 2, 'Large Plastic Box'),
(9, 3, 'Parts Organiser'),
(9, 4, 'Toolbox');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(11, 1, 'Single-core cable'),
(11, 2, 'Control cable'),
(11, 3, 'Data cable'),
(11, 4, 'Network cable'),
(11, 5, 'Coaxial cable'),
(11, 6, 'Aerial cable'),
(11, 7, 'Speaker cable'),
(11, 8, 'Microphone cable'),
(11, 9, 'Battery cable'),
(11, 10, 'Solar cable'),
(11, 11, 'Rubber cable'),
(11, 12, 'Ribbon cable'),
(11, 13, 'Telephone cable'),
(11, 14, 'NMEA cable'),
(11, 15, 'CAN bus cable'),
(11, 16, 'USB cable');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(12, 1, 'H05V-K'),
(12, 2, 'H07V-K'),
(12, 3, 'H05VV-F'),
(12, 4, 'H07RN-F'),
(12, 5, 'LiYY'),
(12, 6, 'LiYCY'),
(12, 7, 'LiYCY-TP'),
(12, 8, 'Cat 5e'),
(12, 9, 'Cat 6'),
(12, 10, 'RG-58'),
(12, 11, 'RG-213'),
(12, 12, 'RG-316'),
(12, 13, 'H-155'),
(12, 14, 'Aircell 5'),
(12, 15, 'Aircell 7'),
(12, 16, 'Ecoflex 10');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(13, 1, 'Ropes'),
(13, 2, 'Pantry'),
(13, 3, 'Tools'),
(13, 4, 'Deck'),
(13, 5, 'Safety'),
(13, 6, 'Electrical'),
(13, 7, 'Operating Supplies'),
(13, 8, 'Maintenance'),
(13, 9, 'Miscellaneous');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(15, 1, 'Measurement Data'),
(15, 2, 'Rigging and Sails'),
(15, 3, 'Hull and Deck'),
(15, 4, 'Fittings and Fastenings'),
(15, 5, 'Dimensions'),
(15, 6, 'Tanks and Volumes'),
(15, 7, 'Engine and Propulsion'),
(15, 8, 'Electrical Systems'),
(15, 9, 'Miscellaneous');
/* supplier */
INSERT INTO company (comptype, compname, street, zip, city, country, phone, email, web) VALUES
(1, 'Compass24', NULL, NULL, 'Ascheberg', 'Deutschland', NULL, NULL, 'compass24.de'),
(1, 'Gründl', NULL, NULL, NULL, 'Deutschland', NULL, NULL, 'gruendl.de'),
(1, 'KlabauterShop', NULL, NULL, NULL, 'Deutschland', NULL, 'info@klabautershop.de', 'klabautershop.de'),
(1, 'SVB', NULL, NULL, 'Bremen', 'Deutschland', NULL, NULL, 'svb.de'),
(1, 'Toplicht', 'Notkestraße 97', '22607', 'Hamburg', 'Deutschland', '040 8890100', 'toplicht@toplicht.de', 'toplicht.de');
/* manufacturer */
INSERT INTO company (comptype, compname, street, zip, city, country, contact, phone, email, web) VALUES
(2, 'Airmar', NULL, NULL, NULL, 'USA', 'Sales', NULL, 'sales@airmar.com', 'airmar.com'),
(2, 'B&G', 'Marienthaler Str. 17', '24340', 'Eckernförde', 'Deutschland', 'Sales', '+49 4351 883290', 'sales.de@navico.com', 'bandg.com'),
(2, 'Blue Sea Systems', 'N85 W12545 Westbrook Crossing', '53051', 'Menomonee Falls', 'USA', 'Customer Service', '+1 800 307 6702', NULL, 'bluesea.com'),
(2, 'Dometic', 'Hemvärnsgatan 15', '171 54', 'Solna', 'Schweden', 'Customer Service', '+49 511 474046-400', 'contact.eu@dometic.com', 'dometic.com'),
(2, 'Garmin', 'Parkring 35', '85748', 'Garching', 'Deutschland', 'Zentrale', '+49 89 541999-700', 'impressum@garmin.de', 'garmin.com'),
(2, 'Harken', NULL, NULL, 'Pewaukee', 'USA', 'Customer Service', NULL, NULL, 'harken.com'),
(2, 'Hella Marine', NULL, NULL, 'Auckland', 'Neuseeland', 'Marine', NULL, NULL, 'hellamarine.com'),
(2, 'Icom', NULL, NULL, NULL, 'Japan', 'Marine', NULL, NULL, 'icomjapan.com'),
(2, 'Isotherm', NULL, NULL, NULL, 'Italien', 'Marine', NULL, NULL, 'indelwebastomarine.com'),
(2, 'Jabsco', '301 Water Street SE, Suite 200', '20003', 'Washington', 'USA', 'Xylem', '+1 978 281 0440', NULL, 'xylem.com'),
(2, 'Johnson Pump', NULL, NULL, NULL, 'Schweden', 'Marine', NULL, NULL, 'johnson-pump.com'),
(2, 'Lewmar', 'Southmoor Lane', 'PO9 1JJ', 'Havant', 'Vereinigtes Königreich', 'Customer Service', '+44 23 9247 1841', 'info@lewmar.com', 'lewmar.com'),
(2, 'Lofrans', 'Via Leonardo Da Vinci 6', '20040', 'Cambiago (MI)', 'Italien', 'Customer Service', '+39 02 36640684', NULL, 'lofrans.it'),
(2, 'Mastervolt', 'Snijdersbergweg 93', '1105 AN', 'Amsterdam', 'Niederlande', 'Customer Service', '+31 20 3422100', 'info.emea@OneASG.com', 'mastervolt.com'),
(2, 'Plastimo', NULL, NULL, 'Lorient', 'Frankreich', 'Marine', NULL, NULL, 'plastimo.com'),
(2, 'Quick', 'Via Piangipane 120/A', '48124', 'Piangipane (RA)', 'Italien', 'Headquarters', '+39 0544 415061', 'quick@quickitaly.com', 'quickitaly.com'),
(2, 'Raymarine', 'Atlantic-Haus, Zirkusweg 1', '20359', 'Hamburg', 'Deutschland', 'Support', '+49 40 2378080', NULL, 'raymarine.com'),
(2, 'Ronstan', NULL, NULL, 'Melbourne', 'Australien', 'Marine', NULL, NULL, 'ronstan.com'),
(2, 'Selden', 'Redegatan 11', '421 21', 'Västra Frölunda', 'Schweden', 'Headquarters', '+46 31 696900', 'info@seldenmast.com', 'seldenmast.com'),
(2, 'Simrad', NULL, NULL, NULL, 'Norwegen', 'Marine', NULL, NULL, 'simrad-yachting.com'),
(2, 'Spinlock', 'Birmingham Road', 'PO31 7BH', 'Cowes', 'Vereinigtes Königreich', 'Customer Service', '+44 1983 295555', NULL, 'spinlock.co.uk'),
(2, 'Torqeedo', NULL, NULL, NULL, 'Deutschland', 'Marine', NULL, NULL, 'torqeedo.com'),
(2, 'Vetus', 'Havenstraat 11', '3115 HC', 'Schiedam', 'Niederlande', 'Headquarters', '+31 884 884700', 'info@vetus.com', 'vetus.com'),
(2, 'Victron Energy', 'De Paal 35', '1351 JG', 'Almere', 'Niederlande', 'Headquarters', NULL, NULL, 'victronenergy.com'),
(2, 'Whale', NULL, NULL, NULL, 'Vereinigtes Königreich', 'Marine', NULL, NULL, 'whalepumps.com');
Executable
+90
View File
@@ -0,0 +1,90 @@
#!/usr/bin/python3
# SPDX-License-Identifier: WTFPL
"""
Database localization helper tool
Parse enums and sets from sql schema script for translatable strings
"""
import os
import sys
import argparse
import re
__author__ = "Thomas Hooge"
__copyright__ = "Copyright 2026"
__version__ = "0.1"
__email__ = "thomas@hoogi.de"
__status__ = "Development"
COLUMN_RE = re.compile(
r"^\s*(?P<column>\w+)\s+(?P<type>enum|set)\s*"
r"\(\s*(?P<values>'[a-z]+'(?:\s*,\s*'[a-z]+')*)\s*\)",
re.IGNORECASE
)
TABLE_RE = re.compile(
r"CREATE TABLE (?P<table>\w+)",
re.IGNORECASE
)
def load_msgids(sql):
current_table = None
for lineno, line in enumerate(sql.splitlines(), 1):
table_match = TABLE_RE.search(line)
if table_match:
current_table = table_match.group("table")
column_match = COLUMN_RE.search(line)
if current_table and column_match:
column = column_match.group("column")
values = re.findall(
r"'([a-z]+)'",
column_match.group("values"),
)
context = f"{current_table}.{column}"
for value in values:
yield context, value, lineno
def write_pot(msgids, output, filename):
output.write(
'msgid ""\n'
'msgstr ""\n'
'"Content-Type: text/plain; charset=UTF-8\\n"\n'
'"Content-Transfer-Encoding: 8bit\\n"\n'
'"MIME-Version: 1.0\\n"\n'
'\n'
)
for context, msgid, lineno in sorted(set(msgids)):
output.write(f"#: {filename}:{lineno}\n")
output.write(f'msgctxt "{context}"\n')
output.write(f'msgid "{msgid}"\n')
output.write('msgstr ""\n\n')
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=(
"Database localization helper tool\n"
"Parse enums and sets from SQL schema script "
"for translatable strings"
),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument(
"sql_file",
help="SQL schema file to parse",
)
parser.add_argument(
"--version",
action="version",
version=f"%(prog)s {__version__}",
)
args = parser.parse_args()
try:
with open(args.sql_file, "r", encoding="utf-8") as f:
sql = f.read()
except OSError as e:
parser.error(str(e))
write_pot(load_msgids(sql), sys.stdout, args.sql_file)
+31 -8
View File
@@ -64,7 +64,7 @@ CREATE TABLE dropdown (
ddtext varchar(50) NOT NULL, ddtext varchar(50) NOT NULL,
ddshort varchar(4) DEFAULT NULL, ddshort varchar(4) DEFAULT NULL,
color char(6) DEFAULT NULL, color char(6) DEFAULT NULL,
flags enum('locked','fixed') DEFAULT NULL, flags set('locked','fixed') DEFAULT NULL,
PRIMARY KEY (ddid, ddval) PRIMARY KEY (ddid, ddval)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
@@ -93,11 +93,17 @@ CREATE TABLE company (
CREATE TABLE vessel ( CREATE TABLE vessel (
vid smallint(6) NOT NULL AUTO_INCREMENT, vid smallint(6) NOT NULL AUTO_INCREMENT,
vtype enum('mono','cat','tri') NOT NULL DEFAULT 'mono', vtype tinyint(3) DEFAULT NULL,
htype enum('mono','cat','tri') NOT NULL DEFAULT 'mono',
vesselname varchar(40) NOT NULL, vesselname varchar(40) NOT NULL,
model varchar(20) DEFAULT NULL, model varchar(20) DEFAULT NULL,
shipyard smallint(6) DEFAULT NULL, shipyard smallint(6) DEFAULT NULL,
year_built year DEFAULT NULL, year_built year DEFAULT NULL,
hull_number varchar(20) DEFAULT NULL,
-- TODO perhaps as properties?
-- reg_number varchar(20) DEFAULT NULL,
-- mmsi varchar(10) DEFAULT NULL,
-- callsign varchar(6) DEFAULT NULL,
loa float(4,2) UNSIGNED DEFAULT NULL, loa float(4,2) UNSIGNED DEFAULT NULL,
lwl float(4,2) UNSIGNED DEFAULT NULL, lwl float(4,2) UNSIGNED DEFAULT NULL,
beam float(4,2) UNSIGNED DEFAULT NULL, beam float(4,2) UNSIGNED DEFAULT NULL,
@@ -208,6 +214,7 @@ CREATE TABLE equipment (
x smallint(6) UNSIGNED NOT NULL DEFAULT 0, x smallint(6) UNSIGNED NOT NULL DEFAULT 0,
y smallint(6) NOT NULL DEFAULT 0, y smallint(6) NOT NULL DEFAULT 0,
z smallint(6) NOT NULL DEFAULT 0, z smallint(6) NOT NULL DEFAULT 0,
econd enum('unknown','excellent','good','fair','bad','repairable','defect') NOT NULL default 'unknown',
remarks varchar(150) DEFAULT NULL, remarks varchar(150) DEFAULT NULL,
flags set('ordered','removed','deleted') DEFAULT NULL, flags set('ordered','removed','deleted') DEFAULT NULL,
PRIMARY KEY(eid), PRIMARY KEY(eid),
@@ -289,7 +296,7 @@ CREATE TABLE cable (
ON DELETE RESTRICT ON DELETE RESTRICT
) ENGINE=InnoDB; ) ENGINE=InnoDB;
CREATE table fuse ( CREATE TABLE fuse (
fuseid smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, fuseid smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT,
vid smallint(6) NOT NULL DEFAULT 1, vid smallint(6) NOT NULL DEFAULT 1,
fnumber smallint(6) NOT NULL, fnumber smallint(6) NOT NULL,
@@ -299,6 +306,7 @@ CREATE table fuse (
eid smallint(6) UNSIGNED DEFAULT NULL, eid smallint(6) UNSIGNED DEFAULT NULL,
location tinyint(3) DEFAULT 0, -- from dropdown id 10 location tinyint(3) DEFAULT 0, -- from dropdown id 10
description varchar(60) DEFAULT NULL, description varchar(60) DEFAULT NULL,
color char(6) DEFAULT NULL,
remarks varchar(150) DEFAULT NULL, remarks varchar(150) DEFAULT NULL,
PRIMARY KEY (fuseid), PRIMARY KEY (fuseid),
UNIQUE INDEX ix_fusenumber (vid, fnumber), UNIQUE INDEX ix_fusenumber (vid, fnumber),
@@ -326,6 +334,7 @@ CREATE TABLE measurement (
unit tinyint(3) NOT NULL DEFAULT 1, unit tinyint(3) NOT NULL DEFAULT 1,
accuracy enum('unknown','precise','normal','rough','estimated') NOT NULL DEFAULT 'unknown', accuracy enum('unknown','precise','normal','rough','estimated') NOT NULL DEFAULT 'unknown',
mdate date DEFAULT NULL, mdate date DEFAULT NULL,
mcat tinyint(3) DEFAULT NULL,
note varchar(80) DEFAULT NULL, note varchar(80) DEFAULT NULL,
PRIMARY KEY (mid), PRIMARY KEY (mid),
FOREIGN KEY fk_measurement_vessel (vid) FOREIGN KEY fk_measurement_vessel (vid)
@@ -341,7 +350,7 @@ CREATE TABLE provisions (
provname varchar(40) NOT NULL, provname varchar(40) NOT NULL,
provcat tinyint(3) DEFAULT NULL, provcat tinyint(3) DEFAULT NULL,
sid smallint(6) UNSIGNED DEFAULT NULL, sid smallint(6) UNSIGNED DEFAULT NULL,
boxid smallint(6) UNSIGNED NOT NULL DEFAULT 1, boxid smallint(6) UNSIGNED DEFAULT NULL,
number smallint(6) UNSIGNED NOT NULL DEFAULT 1, number smallint(6) UNSIGNED NOT NULL DEFAULT 1,
target smallint(6) UNSIGNED DEFAULT NULL, -- for shopping list target smallint(6) UNSIGNED DEFAULT NULL, -- for shopping list
weight float(5,2) UNSIGNED DEFAULT NULL, weight float(5,2) UNSIGNED DEFAULT NULL,
@@ -405,14 +414,15 @@ CREATE TABLE maintenance (
maintid int(10) NOT NULL AUTO_INCREMENT, maintid int(10) NOT NULL AUTO_INCREMENT,
vid smallint(6) NOT NULL DEFAULT 1, vid smallint(6) NOT NULL DEFAULT 1,
eid smallint(6) UNSIGNED DEFAULT NULL, eid smallint(6) UNSIGNED DEFAULT NULL,
series smallint(6) DEFAULT NULL, series smallint(6) UNSIGNED DEFAULT NULL,
activities varchar(40) NOT NULL, activities varchar(40) NOT NULL,
plan_date DATE DEFAULT NULL, plan_date DATE DEFAULT NULL,
plan_precision enum('day','week','month','quarter') NOT NULL DEFAULT 'day',
completion_date DATE DEFAULT NULL, completion_date DATE DEFAULT NULL,
interval_hours smallint(6) DEFAULT NULL, interval_hours smallint(6) DEFAULT NULL,
last_hours int(10) DEFAULT NULL, last_hours int(10) DEFAULT NULL,
remarks varchar(150) DEFAULT NULL, remarks varchar(150) DEFAULT NULL,
maintstate enum('new','plan','ongoing','done') NOT NULL DEFAULT 'new', maintstate enum('new','plan','ongoing','skipped','missed','done') NOT NULL DEFAULT 'new',
PRIMARY KEY (maintid), PRIMARY KEY (maintid),
FOREIGN KEY fk_maintenance_vessel (vid) FOREIGN KEY fk_maintenance_vessel (vid)
REFERENCES vessel(vid) REFERENCES vessel(vid)
@@ -484,6 +494,18 @@ CREATE TABLE note (
ON DELETE RESTRICT ON DELETE RESTRICT
) ENGINE=InnoDB; ) ENGINE=InnoDB;
/* generic key value store for main objects */
CREATE TABLE property (
propid int(10) NOT NULL AUTO_INCREMENT,
objid int(10) UNSIGNED NOT NULL,
objtype enum('vessel','equip','inv','proj','maint'),
keyname varchar(32) NOT NULL,
valstr varchar(200) DEFAULT NULL,
valint int(10) DEFAULT NULL,
PRIMARY KEY (propid),
INDEX ix_prop_obj (objid, objtype)
);
CREATE TABLE checklist ( CREATE TABLE checklist (
clid smallint(6) NOT NULL AUTO_INCREMENT, clid smallint(6) NOT NULL AUTO_INCREMENT,
title varchar(30) NOT NULL, title varchar(30) NOT NULL,
@@ -556,10 +578,11 @@ CREATE TABLE recordlock (
UNIQUE KEY ix_lock_token (token) UNIQUE KEY ix_lock_token (token)
) ENGINE=MEMORY; ) ENGINE=MEMORY;
/* Use with: UPDATE revision SET changed=CURRENT_TIMESTAMP WHERE revid=? */ /* Use with: UPDATE revision SET changed=CURRENT_TIMESTAMP WHERE revtype=? AND revid=? */
CREATE TABLE revision ( CREATE TABLE revision (
revtype enum('dropdown','table') NOT NULL,
revid smallint(6) UNSIGNED NOT NULL, revid smallint(6) UNSIGNED NOT NULL,
changed timestamp NOT NULL, changed timestamp NOT NULL,
PRIMARY KEY (revid), PRIMARY KEY (revtype, revid),
INDEX ix_revision_ts (changed) -- for select by timestamp INDEX ix_revision_ts (changed) -- for select by timestamp
) ENGINE=MEMORY; ) ENGINE=MEMORY;
+23 -15
View File
@@ -30,6 +30,9 @@ INSERT INTO settings (userid, sno, valstr) VALUES
(-1, 4, 'currency symbol e.g. €, $, £, ¥'), (-1, 4, 'currency symbol e.g. €, $, £, ¥'),
(-1, 5, 'signalk connection'), (-1, 5, 'signalk connection'),
(-1, 6, 'nmea2000 connection'), (-1, 6, 'nmea2000 connection'),
(-1, 7, 'usb backup device serial'),
(-1, 8, 'usb backup partition uuid'),
(-1, 9, 'last backup'),
(-1, 10, 'rows in table'), (-1, 10, 'rows in table'),
(-1, 20, 'maximum image width'), (-1, 20, 'maximum image width'),
(-1, 21, 'maximum image height'), (-1, 21, 'maximum image height'),
@@ -61,21 +64,23 @@ INSERT INTO settings (userid, sno, valstr) VALUES
(-1, 212, 'fuse filter json'); (-1, 212, 'fuse filter json');
/* List of lists is always required */ /* List of lists is always required */
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(0, 0, 'Liste der Listen'), (0, 0, 'Liste der Listen', 'locked'),
(0, 1, 'Rumpftypen'), (0, 1, 'Bootstypen', NULL),
(0, 2, 'Firmentypen'), (0, 2, 'Firmentypen', NULL),
(0, 3, 'Stauraumtypen'), (0, 3, 'Stauraumtypen', NULL),
(0, 4, 'Ausrüstungskategorien'), (0, 4, 'Ausrüstungskategorien', NULL),
(0, 5, 'Proviantkategorien'), (0, 5, 'Proviantkategorien', NULL),
(0, 6, 'Provianteinheiten'), (0, 6, 'Provianteinheiten', NULL),
(0, 7, 'Sicherungstypen'), (0, 7, 'Sicherungstypen', NULL),
(0, 8, 'Einheiten'), (0, 8, 'Einheiten', NULL),
(0, 9, 'Kistentypen'), (0, 9, 'Kistentypen', NULL),
(0, 10, 'Sicherungsblöcke'), -- fuse locations (0, 10, 'Sicherungsblöcke', NULL), -- fuse locations
(0, 11, 'Kabeltypen'), (0, 11, 'Kabeltypen', NULL),
(0, 12, 'Technische Kabel-Bezeichnung'), (0, 12, 'Technische Kabel-Bezeichnung', NULL),
(0, 13, 'Inventarkategorien'); (0, 13, 'Inventarkategorien', NULL),
(0, 14, 'BBN vessel.data Felder', 'locked'),
(0, 15, 'Messungskategorien', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(2, 1, 'Lieferant', 'fixed'), (2, 1, 'Lieferant', 'fixed'),
@@ -88,5 +93,8 @@ INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(3, 1, 'Tank', 'fixed'), (3, 1, 'Tank', 'fixed'),
(3, 2, 'Extern', 'fixed'); -- not on board (3, 2, 'Extern', 'fixed'); -- not on board
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort, flags) VALUES
(8, 1, 'Millimeter', 'mm', 'fixed');
INSERT INTO company (compid, compname, comptype) VALUES INSERT INTO company (compid, compname, comptype) VALUES
(-3, 'Eigenbau', 3); (-3, 'Eigenbau', 3);
+23 -15
View File
@@ -29,6 +29,9 @@ INSERT INTO settings (userid, sno, valstr) VALUES
(-1, 4, 'currency symbol e.g. €, $, £, ¥'), (-1, 4, 'currency symbol e.g. €, $, £, ¥'),
(-1, 5, 'signalk connection'), (-1, 5, 'signalk connection'),
(-1, 6, 'nmea2000 connection'), (-1, 6, 'nmea2000 connection'),
(-1, 7, 'usb backup device serial'),
(-1, 8, 'usb backup partition uuid'),
(-1, 9, 'last backup'),
(-1, 10, 'rows in table'), (-1, 10, 'rows in table'),
(-1, 20, 'maximum image width'), (-1, 20, 'maximum image width'),
(-1, 21, 'maximum image height'), (-1, 21, 'maximum image height'),
@@ -60,21 +63,23 @@ INSERT INTO settings (userid, sno, valstr) VALUES
(-1, 212, 'fuse filter json'); (-1, 212, 'fuse filter json');
/* List of lists is always required */ /* List of lists is always required */
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(0, 0, 'list of lists'), (0, 0, 'list of lists', NULL),
(0, 1, 'hull type'), (0, 1, 'vessel type', NULL),
(0, 2, 'company type'), (0, 2, 'company type', NULL),
(0, 3, 'storage type'), (0, 3, 'storage type', NULL),
(0, 4, 'equipment category'), (0, 4, 'equipment category', NULL),
(0, 5, 'provision category'), (0, 5, 'provision category', NULL),
(0, 6, 'provision unit'), (0, 6, 'provision unit', NULL),
(0, 7, 'fuse type'), (0, 7, 'fuse type', NULL),
(0, 8, 'unit'), (0, 8, 'unit', NULL),
(0, 9, 'box types'), (0, 9, 'box types', NULL),
(0, 10, 'fuse blocks'), (0, 10, 'fuse blocks', NULL),
(0, 11, 'cable types'), (0, 11, 'cable types', NULL),
(0, 12, 'cable desc. technical'), (0, 12, 'cable desc. technical', NULL),
(0, 13, 'inventory category'); (0, 13, 'inventory category', NULL),
(0, 14, 'BBN vessel.data fields', 'locked'),
(0, 15, 'measurement category', NULL);
INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(2, 1, 'Supplier', 'fixed'), (2, 1, 'Supplier', 'fixed'),
@@ -87,5 +92,8 @@ INSERT INTO dropdown (ddid, ddval, ddtext, flags) VALUES
(3, 1, 'Tank', 'fixed'), (3, 1, 'Tank', 'fixed'),
(3, 2, 'External', 'fixed'); (3, 2, 'External', 'fixed');
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort, flags) VALUES
(8, 1, 'mm', 'Millimetre', 'fixed');
INSERT INTO company (compid, compname, comptype) VALUES INSERT INTO company (compid, compname, comptype) VALUES
(-3, 'Custom built', 3); (-3, 'Custom built', 3);
+88 -136
View File
@@ -1,147 +1,99 @@
/* Generic data suitable for all kind of boats /* Generic data suitable for all kind of boats
* SPDX-License-Identifier: WTFPL * SPDX-License-Identifier: WTFPL
Hinzufügen um das System kennenzulernen
Hängt von generic.sql ab
*/ */
-- minimal vessel INSERT INTO storage (sid, sname, color) VALUES
INSERT INTO vessel (vid, vesselname) VALUES (1, 'Generic vessel'); (1, 'An Bord', 'F9F06B'),
(2, 'Vorpiek', 'F9F06B'),
(3, 'Achterpiek', 'F9F06B'),
(4, 'Salon BB', 'F9F06B'),
(5, 'Salon STB', 'F9F06B'),
(6, 'Pantry', 'F9F06B'),
(7, 'Ankerkasten', 'F9F06B'),
(8, 'An Deck', 'F9F06B'),
(9, 'Backskiste BB', 'F9F06B'),
(10, 'Backskiste STB', 'F9F06B'),
(11, 'Bilge', 'F9F06B'),
(12, 'Gaskasten', 'F9F06B'),
(13, 'Salonkoje BB', 'F9F06B'),
(14, 'Salonkoje STB ', 'F9F06B');
INSERT INTO user (userid, login, pass, displayname, role) VALUES INSERT INTO box (boxid, label) VALUES
(2, 'helmsman', '$2y$10$4keuVm.WD/JeRmAqp2h4MeSxxKITsKv2q07XZrxPUuT/V80CTPbje', 'Helmsman', 'helmsman'), (1, 'Werkzeugkiste'),
(3, 'sailor', '$2y$10$4keuVm.WD/JeRmAqp2h4MeSxxKITsKv2q07XZrxPUuT/V80CTPbje', 'Sailor', 'sailor'); (2, 'Kiste, klein'),
(3, 'Kiste, groß');
INSERT INTO settings (userid, sno, valint) VALUES INSERT INTO equipment (eid, ename) VALUES
(2, 1, 1), -- Vessel 1 for helmsman (1, 'Großsegel'),
(3, 1, 1); -- Vessel 1 for sailor (2, 'Fock'),
(3, 'Genua'),
(4, 'Spinnaker'),
(5, 'Vorstang'),
(6, 'Achterstan'),
(7, 'Oberwant BB'),
(8, 'Unterwant BB'),
(9, 'Oberwant STB'),
(10, 'Unterwant STB'),
(11, 'Motor'),
(12, 'Außenborder'),
(13, 'Schlauchboot'),
(14, 'AIS Transcsiver'),
(15, 'Funkgerät'),
(16, 'Kartenplotter'),
(17, 'Batterie');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO inventory (invid, invname, icat, conttype, sid, boxid, eid, number,
(1, 1, 'Einrumpf'), -- Mono weight, price, purchdate, invcond, remarks, flags) VALUES
(1, 2, 'Katamaran'), (1, 'Bootshaken', NULL, 'storage', 1, NULL, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(1, 3, 'Trimaran'); (2, 'Fender', NULL, 'storage', 1, NULL, NULL, 4, NULL, NULL, NULL, 'unknown', NULL, NULL),
(3, 'Winschkurbel', NULL, 'storage', 1, NULL, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(4, 'Landanschlußkabel', NULL, 'storage', 1, NULL, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(5, 'Kochtopf', NULL, 'storage', 24, NULL, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(6, 'Pfanne', NULL, 'storage', 24, NULL, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(7, 'Kombizange', NULL, 'box', NULL, 6, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(8, 'Hammer', NULL, 'box', NULL, 6, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL),
(9, 'Rohrzange', NULL, 'box', NULL, 6, NULL, 1, NULL, NULL, NULL, 'good', NULL, NULL),
(10, 'Schraubenzieher, groß', NULL, 'box', NULL, 6, NULL, 1, NULL, NULL, NULL, 'unknown', NULL, NULL);
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO provisions (provname) VALUES
(2, 4, 'Dienstleister'), -- Service ('Kaffee'),
(2, 5, 'Segelmacher'), -- Sailmaker ('Zucker'),
(2, 6, 'Yachthafen'); -- Marina ('Salz'),
('Pfeffer'),
('Milch'),
('Müsliriegel'),
('Erbsensuppe'),
('Gulaschsuppe'),
('Kekse');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO checklist (clid, title) VALUES
(3, 3, 'Bilge'), (1, 'Einwintern'),
(3, 4, 'Schwalbennest'); (2, 'Auswintern'),
(3, 'Mast legen');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO checkitem (checkid, checkname) VALUES
(4, 1, 'Rumpf'), (1, 'Bilge trocknen'),
(4, 2, 'Deck'), (2, 'Frostschutz in Motor einfüllen'),
(4, 3, 'Rigg'), (3, 'Windpilot abbauen'),
(4, 4, 'Segel'), (4, 'Plane über Boot'),
(4, 5, 'Motor'), (5, 'Plane Vorschiff unterstützen'),
(4, 6, 'Elektrik'), (5, 'Salinge unterstützen'),
(4, 7, 'Elektronik'), (6, 'Polster ausräumen'),
(4, 8, 'Navigation'), (7, 'Gardinen abnehmen'),
(4, 9, 'Pantry'), (8, 'Kleiderschrank leeräumen'),
(4, 10, 'Solar'), (9, 'Lebensmittel von Bord');
(4, 11, 'Sicherheit'),
(4, 12, 'lfd. Gut');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES INSERT INTO checkref (clid, checkid) VALUES
(5, 1, 'Allgemein'), (1, 1),
(5, 2, 'Getränke'), (1, 2),
(5, 3, 'Naschkram'), (1, 3),
(5, 4, 'Konserven'), (1, 4),
(5, 5, 'Frischware'), (1, 5),
(5, 6, 'Trockenware'), (1, 6),
(5, 7, 'Gefriergetrocknet'), (1, 7),
(5, 8, 'Snacks (salzig)'); (1, 8),
(1, 9);
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(6, 1, 'kg', 'kg'),
(6, 2, 'Liter', 'L'),
(6, 3, 'Stück', 'St'),
(6, 4, 'Packung', 'Pkg'),
(6, 5, 'Dose', 'Ds'),
(6, 6, 'Flasche', 'Fl'),
(6, 7, 'Tüte', 'Tue'),
(6, 8, 'Tafel', 'Ta'),
(6, 9, 'Glas', 'Gl');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(7, 1, 'ATO'),
(7, 2, 'Streifensicherung'),
(7, 3, 'Feinsicherung (GS)'),
(7, 4, 'Torpedosicherung'),
(7, 5, 'T-Sicherung');
INSERT INTO dropdown (ddid, ddval, ddshort, ddtext) VALUES
(8, 1, 'mm', 'Millimeter'),
(8, 2, 'cm', 'Zentimeter'),
(8, 3, 'g', 'Gramm'),
(8, 4, 'kg', 'Kilogramm'),
(8, 5, 'm', 'Meter'),
(8, 6, 'kW', 'Kilowatt'),
(8, 7, 'A', 'Ampere'),
(8, 8, 'l', 'Liter');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(9, 1, 'Plastikbox, klein'),
(9, 2, 'Plastikbox, groß'),
(9, 3, 'Sortimentskasten'),
(9, 4, 'Werkzeugkiste');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(10, 1, 'Kabel-Inline'),
(10, 2, 'BlueSea innen'),
(10, 3, 'Bluesea außen'),
(10, 4, 'Panel 1 (STV 103)'),
(10, 5, 'Panel 2 (STV 108)'),
(10, 6, 'Reihenklemme 1'),
(10, 7, 'Reihenklemme 2');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(11, 1, 'Einzelader'),
(11, 2, 'Steuerleitung'),
(11, 3, 'Datenkabel'),
(11, 4, 'Netzwerkkabel'),
(11, 5, 'Koaxialkabel'),
(11, 6, 'Antennenkabel'),
(11, 7, 'Lautsprecherkabel'),
(11, 8, 'Mikrofonkabel'),
(11, 9, 'Batteriekabel'),
(11, 10, 'Solarkabel'),
(11, 11, 'Gummileitung'),
(11, 12, 'Flachbandkabel'),
(11, 13, 'Telefonkabel'),
(11, 14, 'NMEA-Kabel'),
(11, 15, 'CAN-Bus-Kabel'),
(11, 16, 'USB-Kabel');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(12, 1, 'H05V-K'),
(12, 2, 'H07V-K'),
(12, 3, 'H05VV-F'),
(12, 4, 'H07RN-F'),
(12, 5, 'LiYY'),
(12, 6, 'LiYCY'),
(12, 7, 'LiYCY-TP'),
(12, 8, 'Cat 5e'),
(12, 9, 'Cat 6'),
(12, 10, 'RG-58'),
(12, 11, 'RG-213'),
(12, 12, 'RG-316'),
(12, 13, 'H-155'),
(12, 14, 'Aircell 5'),
(12, 15, 'Aircell 7'),
(12, 16, 'Ecoflex 10');
INSERT INTO storage (sid, vid, sname, stype, x, y, z, remarks) VALUES
(0, 1, 'An Bord', 0, 0, 0, 0, 'Alles wo der Ort nicht spezifiziert werden kann');
/* Eine Liste mit häufig verwendeten Herstellern
comptype=2
*/
INSERT INTO company (comptype, compname) VALUES
(2, 'Garmin'),
(2, 'Watcheye'),
(2, 'Digital Yacht'),
(2, 'B&G'),
(2, 'Raymarine'),
(2, 'Harken'),
(2, 'Selden');
+5 -114
View File
@@ -1,116 +1,7 @@
/* Generic data suitable for all kind of boats /* Some sample data
* SPDX-License-Identifier: WTFPL * SPDX-License-Identifier: WTFPL
Add this to get to know the system
Depends on generic_en.sql
*/ */
-- minimal vessel
INSERT INTO vessel (vid, vesselname) VALUES (1, 'Generic vessel');
INSERT INTO user (userid, login, pass, displayname, role) VALUES
(2, 'helmsman', '$2y$10$4keuVm.WD/JeRmAqp2h4MeSxxKITsKv2q07XZrxPUuT/V80CTPbje', 'Helmsman', 'helmsman'),
(3, 'sailor', '$2y$10$4keuVm.WD/JeRmAqp2h4MeSxxKITsKv2q07XZrxPUuT/V80CTPbje', 'Sailor', 'sailor');
INSERT INTO settings (userid, sno, valint) VALUES
(2, 1, 1), -- Vessel 1 for helmsman
(3, 1, 1); -- Vessel 1 for sailor
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(1, 1, 'Monohull'),
(1, 2, 'Catamaran'),
(1, 3, 'Trimaran');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(2, 4, 'Service'),
(2, 5, 'Sailmaker'),
(2, 6, 'Marina');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(3, 3, 'Bilge'),
(3, 4, 'Quarter Berth');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(4, 1, 'Hull'),
(4, 2, 'Deck'),
(4, 3, 'Rigging'),
(4, 4, 'Sails'),
(4, 5, 'Engine'),
(4, 6, 'Electrical'),
(4, 7, 'Electronics'),
(4, 8, 'Navigation'),
(4, 9, 'Galley'),
(4, 10, 'Solar'),
(4, 11, 'Safety'),
(4, 12, 'Running Rigging');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(5, 1, 'General'),
(5, 2, 'Drinks'),
(5, 3, 'Sweets'),
(5, 4, 'Tinned Food'),
(5, 5, 'Fresh Food'),
(5, 6, 'Dry Goods'),
(5, 7, 'Freeze-Dried Food'),
(5, 8, 'Savoury Snacks');
INSERT INTO dropdown (ddid, ddval, ddtext, ddshort) VALUES
(6, 1, 'kg', 'kg'),
(6, 2, 'Litre', 'L'),
(6, 3, 'Piece', 'pc'),
(6, 4, 'Pack', 'pk'),
(6, 5, 'Tin', 'tin'),
(6, 6, 'Bottle', 'btl'),
(6, 7, 'Bag', 'bag'),
(6, 8, 'Bar', 'bar'),
(6, 9, 'Jar', 'jar');
INSERT INTO dropdown (ddid, ddval, ddshort, ddtext) VALUES
(8, 1, 'mm', 'Millimetre'),
(8, 2, 'cm', 'Centimetre'),
(8, 3, 'g', 'Gram'),
(8, 4, 'kg', 'Kilogram'),
(8, 5, 'm', 'Metre'),
(8, 6, 'kW', 'Kilowatt'),
(8, 7, 'A', 'Ampere'),
(8, 8, 'L', 'Litre');
-- TODO add inch, feet, ...
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(9, 1, 'Small Plastic Box'),
(9, 2, 'Large Plastic Box'),
(9, 3, 'Parts Organiser'),
(9, 4, 'Toolbox');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(11, 1, 'Single-Core Cable'),
(11, 2, 'Control Cable'),
(11, 3, 'Data Cable'),
(11, 4, 'Network Cable'),
(11, 5, 'Coaxial Cable'),
(11, 6, 'Aerial Cable'),
(11, 7, 'Speaker Cable'),
(11, 8, 'Microphone Cable'),
(11, 9, 'Battery Cable'),
(11, 10, 'Solar Cable'),
(11, 11, 'Rubber Cable'),
(11, 12, 'Ribbon Cable'),
(11, 13, 'Telephone Cable'),
(11, 14, 'NMEA Cable'),
(11, 15, 'CAN Bus Cable'),
(11, 16, 'USB Cable');
INSERT INTO dropdown (ddid, ddval, ddtext) VALUES
(12, 1, 'H05V-K'),
(12, 2, 'H07V-K'),
(12, 3, 'H05VV-F'),
(12, 4, 'H07RN-F'),
(12, 5, 'LiYY'),
(12, 6, 'LiYCY'),
(12, 7, 'LiYCY-TP'),
(12, 8, 'Cat 5e'),
(12, 9, 'Cat 6'),
(12, 10, 'RG-58'),
(12, 11, 'RG-213'),
(12, 12, 'RG-316'),
(12, 13, 'H-155'),
(12, 14, 'Aircell 5'),
(12, 15, 'Aircell 7'),
(12, 16, 'Ecoflex 10');
+14
View File
@@ -1,3 +1,17 @@
yms (0.3.0-1) unstable; urgency=medium
* native gui: can create and edit all kind of records
* native gui: implemented record locking
* updater script for web gui
* many bugs fixed in webgui
* prepare list revision feature (reload support)
* database localization tool
* new property table for generic key/value store
* webgui: set file access rights
* fix debian packaging
-- Thomas Hooge <thomas@hoogi.de> Wed, 11 Nov 2026 19:00:00 +0200
yms (0.2.2-1) unstable; urgency=medium yms (0.2.2-1) unstable; urgency=medium
* native gui: prepared list views for main objects * native gui: prepared list views for main objects
+5
View File
@@ -17,12 +17,17 @@ Depends:
gir1.2-gtk-3.0, gir1.2-gtk-3.0,
gir1.2-rsvg-2.0, gir1.2-rsvg-2.0,
python3-mysqldb, python3-mysqldb,
python3-dateutil,
python3-fitz,
python3-bcrypt, python3-bcrypt,
python3-pyudev,
php (>= 8.0), php (>= 8.0),
php-mysql, php-mysql,
php-xml, php-xml,
gettext, gettext,
mupdf-tools mupdf-tools
Suggests:
python3-sane
Description: Yacht Management Software Description: Yacht Management Software
Yacht Management Software (YMS) is an application for managing yachts and Yacht Management Software (YMS) is an application for managing yachts and
sailboats. It provides a native GTK desktop interface and a web interface. sailboats. It provides a native GTK desktop interface and a web interface.
+3
View File
@@ -4,6 +4,8 @@ db/*.sql usr/share/yms/db/
# Native GUI # Native GUI
ymsgui.py usr/lib/yms/ ymsgui.py usr/lib/yms/
yms/*.py usr/lib/yms/yms/ yms/*.py usr/lib/yms/yms/
yms/model/*.py usr/lib/yms/yms/model/
yms/view/*.py usr/lib/yms/yms/view/
# GTK UI # GTK UI
yms/ui/* usr/share/yms/ui/ yms/ui/* usr/share/yms/ui/
@@ -22,6 +24,7 @@ webgui/config.inc-sample usr/share/yms/
# Shared static data # Shared static data
shapes/* usr/share/yms/shapes/ shapes/* usr/share/yms/shapes/
icons/* usr/share/yms/icons/
# Desktop entry # Desktop entry
yms.desktop usr/share/applications/ yms.desktop usr/share/applications/
+2
View File
@@ -0,0 +1,2 @@
/etc/yms/config.inc /usr/share/yms/webgui/config.inc
/usr/share/yms/icons /usr/lib/yms/icons
-1
View File
@@ -97,7 +97,6 @@ if [ "$RET" = "true" ]; then
> /etc/yms/config.inc > /etc/yms/config.inc
chmod 0640 /etc/yms/config.inc chmod 0640 /etc/yms/config.inc
chown root:www-data /etc/yms/config.inc chown root:www-data /etc/yms/config.inc
ln -s /etc/yms/config.inc /usr/share/yms/webgui/config.inc
fi fi
fi fi
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+1
View File
@@ -9,3 +9,4 @@ rm /var/www/html/index.html
rm /var/www/html/README rm /var/www/html/README
rm /var/www/html/TODO rm /var/www/html/TODO
rm /var/www/html/locale/de_DE.po rm /var/www/html/locale/de_DE.po
rm /var/www/html/Makefile
+1929 -384
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
Executable
+188
View File
@@ -0,0 +1,188 @@
#!/usr/bin/python
"""
Updater for web gui
"""
import os
import sys
import getopt
import re
import shutil
import glob
import tarfile
from datetime import datetime
source_dir = "./webgui"
target_dir = "/var/www/html/yms"
backup_dir = "/var/backups"
backup = False
accept = False
dryrun = False
__author__ = "Thomas Hooge"
__copyright__ = "Copyleft 2024-2026, all rights reversed"
__version__ = "0.1"
__email__ = "thomas@hoogi.de"
__status__ = "Test"
# Update files on top level
update_files = ["*.php", "*.css", "globals.inc", "manifest.json", "sailboat.svg"]
# Totally replace target dirs with new ones
update_dirs_full = ["bootstrap", "css", "js", "lib", "shapes", "img"]
# Locale: translation files
locales = ["de_DE"]
def ask_yn(prompt):
answer = input(f"{prompt} (y/n): ").strip().lower()
return answer in ("y", "yes")
def read_version(globalfile):
if os.path.isfile(globalfile):
with open(globalfile, "r", encoding="utf-8") as fh:
content = fh.read(4096)
pattern = r"\$g_version\s*=\s*'(v\d+\.\d+\.\d+)';"
match = re.search(pattern, content)
if match:
return tuple(map(int, match.group(1).lstrip("v").split(".")))
return None
def create_backup(source_dir, backup_dir, dryrun=False):
if not os.path.isdir(backup_dir):
print(f"Backup directory '{backup_dir}' does not exist.")
return None
if not os.access(backup_dir, os.W_OK):
print(f"Backup directory '{backup_dir}' is not writeable.")
return None
dir_name = os.path.basename(os.path.normpath(source_dir))
date_stamp = datetime.now().strftime("%Y%m%d")
backup_file = os.path.join(backup_dir, f"{dir_name}_{date_stamp}.tar.gz")
def exclude_config(member):
if member.name == f"{dir_name}/config.inc":
return None
return member
if not dryrun:
with tarfile.open(backup_file, "w:gz") as tar:
tar.add(source_dir, arcname=dir_name, filter=exclude_config)
else:
print(f"creating backup of '{source_dir}' in '{backup_file}'")
return backup_file
def copy_dir_replace(dirname, source_dir, target_dir, dryrun=False):
# Complete replaces old directory with new one
source_path = os.path.join(source_dir, dirname)
target_path = os.path.join(target_dir, dirname)
print(f"full replace dir '{source_path}' -> '{target_path}'")
if os.path.exists(target_path):
if not dryrun:
shutil.rmtree(target_path)
else:
print(f"remove directory tree '{target_path}'")
else:
if dryrun:
print(f"directory '{target_path}' does not exist yet")
if not dryrun:
shutil.copytree(source_path, target_dir)
else:
print(f"copy directory tree '{source_path}' -> '{target_dir}'")
def copy_wildcard(source_dir, target_dir, pattern, dryrun=False):
print(f"copy pattern '{pattern}' from '{source_dir}' -> '{target_dir}'")
if not dryrun:
os.makedirs(target_dir, exist_ok=True)
if dryrun:
print(f"processing pattern '{pattern}'")
for source_file in glob.glob(os.path.join(source_dir, pattern)):
if os.path.isfile(source_file):
target_file = os.path.join(target_dir, os.path.basename(source_file))
if not dryrun:
shutil.copy2(source_file, target_file)
else:
print(f"copy file '{source_file}' -> '{target_file}'")
def usage():
print("{} v{}".format(os.path.basename(__file__), __version__))
print(__copyright__)
print()
print("Command line options")
print(f" -d --dir Target directory (default={target_dir})")
print(" -b --backup Backup directory (no backup if missing)")
print(" -h --help Show this help")
print(" -y --accept Skip security questions")
print(" --dryrun Test mode")
print()
if __name__ == "__main__":
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "d:b:yh",
["dir=", "backup=", "accept", "help", "dryrun"])
except getopt.GetoptError as err:
print(str(err))
sys.exit(2)
for opt, arg in opts:
if opt in ("-d", "--dir"):
target_dir = arg
elif opt in ("-b", "--backup"):
backup = True
backup_dir = arg
elif opt in ("-y", "--accept"):
accept = True
elif opt in ("-h", "--help"):
usage()
sys.exit(0)
elif opt in ("--dryrun"):
dryrun = True
# Check if target dir exists
if not os.path.isdir(target_dir):
print(f"Target directory '{target_dir}' does not exist. Aborting.")
sys.exit(1)
# Check if target dir contains a valid yms installation
# globals.inc must exist and contain version info in $g_version
globalfile = os.path.join(target_dir, 'globals.inc')
version = read_version(globalfile)
if not version:
print("Target contains no valid yms installation. Aborting.")
sys.exit(1)
# Check if version in source dir is greater than installed version
version_new = read_version(os.path.join(source_dir, 'globals.inc'))
if False: #version >= version_new:
versionstring = "v" + ".".join(map(str,version))
versionstring_new = "v" + ".".join(map(str,version_new))
print(f"Version {versionstring_new} is not newer than installed version {versionstring}. Aborting.")
sys.exit(1)
# Check if target is writeable
if False: #not os.access(target_dir, os.W_OK):
print(f"Target directory '{target_dir}' is not writeable, Aborting.")
sys.exit(1)
# Query for updating found installation
versionstring = "v" + ".".join(map(str,version))
if not accept and not ask_yn(f"Update yms {versionstring} installation in {target_dir}"):
print("Update cancelled by user")
sys.exit(0)
# Create backup
if backup and not create_backup(target_dir, backup_dir, dryrun):
print("Aborting.")
sys.exit(1)
# First complete directories
for dir in update_dirs_full:
source = os.path.join(source_dir, dir)
copy_dir_replace(dir, source_dir, target_dir, dryrun)
# Second update files in main directory
for pattern in update_files:
copy_wildcard(source_dir, target_dir, pattern, dryrun)
# At last the locales
for language in locales:
source_path = os.path.join(source_dir, "locale", language, "LC_MESSAGES")
target_path = os.path.join(target_dir, "locale", language, "LC_MESSAGES")
copy_wildcard(source_path, target_path, "*.mo", dryrun)
print("Done.")
+14
View File
@@ -0,0 +1,14 @@
# .PHONY php translation
FILES = *.php globals.inc lib/*.inc
all: php
php: yms.pot
yms.pot: $(FILES)
xgettext -L PHP -o yms.pot -p locale $(FILES) --from-code=UTF-8 --keyword="pgettext:1c,2"
msgmerge -U locale/de_DE.po locale/yms.pot
translation: locale/de_DE.po
msgfmt locale/de_DE.po -o locale/de_DE/LC_MESSAGES/yms.mo
+14 -7
View File
@@ -16,6 +16,7 @@ There can be a difference because not all items have a weight entered
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Boxes'); $pagetitle = _('Boxes');
@@ -31,7 +32,7 @@ foreach ($sth->fetchAll() as $row) {
$opt_storage[$row['sid']] = $row['sname']; $opt_storage[$row['sid']] = $row['sname'];
} }
$opt_boxtype = db_get_options(9); $opt_boxtype = db_get_options(DD_BOX_TYPE);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -50,6 +51,7 @@ switch ($submit = form_get_action()) {
$p[':content'] = gpc_get_string($_POST, 'content'); $p[':content'] = gpc_get_string($_POST, 'content');
$p[':remarks'] = gpc_get_string($_POST, 'remarks'); $p[':remarks'] = gpc_get_string($_POST, 'remarks');
$id = db_exec_insert('box', $p); $id = db_exec_insert('box', $p);
db_set_revision('table', TBL_BOXES);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -88,10 +90,12 @@ if ($action == ACT_DEFAULT):
echo "<h1>$pagetitle</h1>\n"; echo "<h1>$pagetitle</h1>\n";
$sql = "SELECT boxid, boxtype, sid, label, color, content, weight, remarks " $sql = "SELECT b.boxid, b.boxtype, b.sid, b.label, b.color, b.content, b.weight, b.remarks "
. "FROM box " . "FROM box AS b JOIN storage AS s USING (sid) "
. "ORDER BY label"; . "WHERE s.vid=? "
$sth = $pdo->query($sql); . "ORDER BY b.label";
$sth = $pdo->prepare($sql);
$sth->execute([$user->vid]);
$res = $sth->fetchAll(); $res = $sth->fetchAll();
echo '<table class="table table-striped">', "\n"; echo '<table class="table table-striped">', "\n";
echo "<thead>\n"; echo "<thead>\n";
@@ -115,13 +119,16 @@ foreach ($res as $row) {
echo '<td>', ($opt_boxtype[$row['boxtype']] ?? ''), "</td>\n"; echo '<td>', ($opt_boxtype[$row['boxtype']] ?? ''), "</td>\n";
echo '<td>', format_color(strtoupper($row['color'])), "</td>\n"; echo '<td>', format_color(strtoupper($row['color'])), "</td>\n";
echo '<td>', $row['content'], "</td>\n"; echo '<td>', $row['content'], "</td>\n";
echo '<td class="text-end">', format_float($row['weight'], 2), "</td>\n"; echo '<td class="text-end">', format_float($row['weight'], 2, 'kg'), "</td>\n";
// Edit current record button // Edit current record button
echo "<td>"; echo "<td>";
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['boxid'], '"><i class="bi-pencil"></i></a>', "\n"; echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['boxid'], '"><i class="bi-pencil"></i></a>', "\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary
//$numrows = count($res);
//table_rec_summary(1, $numrows, $numrows, 6);
echo "</table>\n"; echo "</table>\n";
form_add_button('box.php'); form_add_button('box.php');
@@ -173,7 +180,7 @@ $sth = $pdo->prepare($sql);
$sth->execute([$id]); $sth->execute([$id]);
$box = $sth->fetch(PDO::FETCH_OBJ); $box = $sth->fetch(PDO::FETCH_OBJ);
echo '<h2>', $box->label, "</h2>\n"; echo '<h2>', sprintf(_('Box: %s'), h($box->label)), "</h2>\n";
// Bootstrap grid // Bootstrap grid
echo '<div class="container">'; echo '<div class="container">';
+51 -66
View File
@@ -9,13 +9,14 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Cables'); $pagetitle = _('Cables');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_cabletype = db_get_options(11); $opt_cabletype = db_get_options(DD_CABLE_TYPE);
$opt_techname = db_get_options(12); $opt_techname = db_get_options(DD_CABLE_TECHNAME);
$opt_cablecond = db_load_enum('cable', 'cablecond', true, true); $opt_cablecond = db_load_enum('cable', 'cablecond', true, true);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -31,6 +32,7 @@ switch ($submit = form_get_action()) {
case 'filter': case 'filter':
$flt = array(); $flt = array();
$flt['type'] = gpc_get_int($_POST, 'flt_type');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt');
db_save_filter($flt, 211); db_save_filter($flt, 211);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
@@ -47,6 +49,7 @@ switch ($submit = form_get_action()) {
$p[':conductors'] = gpc_get_int($_POST, 'conductors'); $p[':conductors'] = gpc_get_int($_POST, 'conductors');
$p[':xsection'] = gpc_get_float($_POST, 'xsection'); $p[':xsection'] = gpc_get_float($_POST, 'xsection');
$id = db_exec_insert('cable', $p); $id = db_exec_insert('cable', $p);
db_set_revision('table', TBL_CABLES);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -94,7 +97,24 @@ if ($action == ACT_DEFAULT):
// ========== VARIANT: default behavior ======================================= // ========== VARIANT: default behavior =======================================
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 211); $flt = db_get_filter($user->id, 211, ['txt', 'type']);
$w = array('vid=:vid');
$p = array(':vid' => $user->vid);
if (strlen($flt->txt) > 1) {
$w[] = 'cablename LIKE :txt OR remarks LIKE :txt';
$p[':txt'] = '%'.$flt->txt.'%';
}
if ($flt->type == -1) {
$w[] = 'cabletype IS NULL';
} elseif ($flt->type > 0) {
$w[] = 'cabletype=:cabletype';
$p[':type'] = $flt->type;
}
$where = join(' AND ', $w);
$order = ' ORDER BY cablename';
echo "<h1>$pagetitle</h1>\n"; echo "<h1>$pagetitle</h1>\n";
@@ -104,10 +124,10 @@ echo "<h1>$pagetitle</h1>\n";
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2"> <?php
<label for="flt_txt">Text</label> filter_create_select('flt_type', _('Type'), $g_opt_all + $g_opt_none + $opt_cabletype, $flt->type);
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?? ''?>"> filter_create_text('flt_txt', _('Text'), $flt->text, 30, 45);
</div> ?>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -117,17 +137,22 @@ echo "<h1>$pagetitle</h1>\n";
</form> </form>
<?php <?php
$sql = "SELECT cableid, cablename, conductors, length, xsection, color, cablecond " $sql = "SELECT cableid, cablename, cabletype, conductors, length, xsection, color, cablecond "
. "FROM cable " . "FROM cable ";
. "ORDER BY cablename"; $sql .= ' WHERE ' . $where;
$sth = $pdo->query($sql); $sql .= $order;
$sth = $pdo->prepare($sql);
$sth->execute($p);
$res = $sth->fetchAll(); $res = $sth->fetchAll();
echo '<table class="table table-striped">', "\n"; echo '<table class="table table-striped">', "\n";
echo "<thead>\n"; echo "<thead>\n";
echo "<tr>\n"; echo "<tr>\n";
echo '<th>#</th>'; echo '<th>#</th>';
echo '<th>', _('Cable'), "</th>"; echo '<th>', _('Cable'), "</th>";
echo '<th>', _('Name'), "</th>"; echo '<th>', _('Name'), "</th>";
echo '<th>', _('Type'), "</th>";
echo '<th>', _('Conductors'), "</th>"; echo '<th>', _('Conductors'), "</th>";
echo '<th>', _('Length'), "</th>"; echo '<th>', _('Length'), "</th>";
echo '<th>', _('Cross section'), "</th>"; echo '<th>', _('Cross section'), "</th>";
@@ -145,6 +170,7 @@ foreach ($res as $row) {
echo "</td>\n"; echo "</td>\n";
echo "<td>", $row['cableid'], "</td>\n"; echo "<td>", $row['cableid'], "</td>\n";
echo "<td>", $row['cablename'], "</td>\n"; echo "<td>", $row['cablename'], "</td>\n";
echo "<td>", $row['cabletype'], "</td>\n";
echo "<td>", $row['conductors'], "</td>\n"; echo "<td>", $row['conductors'], "</td>\n";
echo "<td>", $row['length'], "m</td>\n"; echo "<td>", $row['length'], "m</td>\n";
echo "<td>", $row['xsection'], "mm²</td>\n"; echo "<td>", $row['xsection'], "mm²</td>\n";
@@ -156,7 +182,7 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
table_rec_summary(1, $i, $i, 9); // table_rec_summary(1, $i-1, $i-1, 10);
echo "</table>\n"; echo "</table>\n";
form_add_button($g_scriptname); form_add_button($g_scriptname);
@@ -168,26 +194,13 @@ echo '<h2>', _('Add Cable'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="tagname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="cablename" name="cablename" required autofocus>
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Length, m')?></label>
<input type="text" class="form-control" id="length" name="length">
</div>
<?php <?php
form_create_text('cablename', _('Name'), 80, NULL, TRUE, TRUE);
form_create_numeric('length', _('Length, m'), step: 0.01);
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype); form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype);
?> form_create_numeric('number', _('Number of conductors'), NULL, 1, 99, 1);
<div class="mb-3"> form_create_numeric('xsection', _('Cross section, mm²'), NULL, 0, 999, 0.1);
<label for="note" class="form-label"><?=_('Number of conductors')?></label>
<input type="number" class="form-control" id="conductors" name="conductors">
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Cross section, mm²')?></label>
<input type="text" class="form-control" id="xsection" name="xsection">
</div>
<?php
form_new_buttons($g_scriptname); form_new_buttons($g_scriptname);
echo "</form>\n"; echo "</form>\n";
@@ -235,46 +248,18 @@ echo '<h2>', _('Edit cable'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="mname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="cablename" name="cablename" value="<?=h($cable->cablename)?>">
</div>
<?php <?php
form_create_text('cablename', _('Name'), 80, $cable->cablename, TRUE, TRUE);
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype, $cable->cabletype); form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype, $cable->cabletype);
form_create_select('techname', _('Techname'), $g_opt_none + $opt_techname, $cable->techname); form_create_select('techname', _('Techname'), $g_opt_none + $opt_techname, $cable->techname);
?> form_create_numeric('length', _('Length, m'), format_float($cable->length, 1), 0, 9999, 0.01);
<div class="mb-3"> form_create_numeric('number', _('Number of conductors'), $cable->conductors, 1, 99, 1);
<label for="note" class="form-label"><?=_('Length, m')?></label> form_create_numeric('diameter', ('Diameter, mm'), format_float($cable->diameter, 1), 0, 999, 0.1);
<input type="text" class="form-control" id="length" name="length" value="<?=format_float($cable->length, 1);?>"> form_create_numeric('xsection', _('Cross section, mm²'), format_float($cable->xsection, 1), 0, 999, 0.1);
</div> form_create_numeric('weight', _('Weight, kg/m'), format_float($cable->weight, 2), 0, 9999, 0.01);
<div class="mb-3"> form_create_color('color', _('Color'), $cable->color);
<label for="note" class="form-label"><?=_('Number of conductors')?></label>
<input type="number" class="form-control" id="conductors" name="conductors" value="<?=$cable->conductors;?>">
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Diameter, mm')?></label>
<input type="text" class="form-control" id="diameter" name="diameter" value="<?=format_float($cable->diameter, 1);?>">
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Cross section, mm²')?></label>
<input type="text" class="form-control" id="xsection" name="xsection" value="<?=format_float($cable->xsection, 1);?>">
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Weight, kg/m')?></label>
<input type="text" class="form-control" id="weight" name="weight" value="<?=$cable->weight;?>">
</div>
<div class="mb-3">
<label for="color" class="form-label"><?=_('Color')?></label>
<input type="color" name="color" id="color" class="form-control" value="#<?=$cable->color;?>">
</div>
<?php
form_create_select('cablecond', _('Condition'), $opt_cablecond, $cable->cablecond); form_create_select('cablecond', _('Condition'), $opt_cablecond, $cable->cablecond);
?> form_create_textarea('remarks', _('Remarks'), 3, 150, $cable->remarks);
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($cable->remarks)?></textarea>
</div>
<?php
form_edit_buttons($g_scriptname, $id); form_edit_buttons($g_scriptname, $id);
echo "</form>\n"; echo "</form>\n";
+12 -10
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Checklists'); $pagetitle = _('Checklists');
@@ -87,10 +88,17 @@ $res = $sth->fetchAll();
<?php <?php
foreach ($res as $row) { foreach ($res as $row) {
echo "<tr>\n"; echo "<tr>\n";
echo '<td>', $row['clid'], "</td>\n"; echo '<td>', $row['clid'];
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['clid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
// TODO view icon
echo "</td>\n";
echo '<td>', $row['title'], "</td>\n"; echo '<td>', $row['title'], "</td>\n";
echo '<td>', $row['clstate'], "</td>\n"; echo '<td>', $row['clstate'], "</td>\n";
form_action_buttons($g_scriptname, $row['clid']); // Edit current record button
echo '<td>';
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['clid'], '"><i class="bi-pencil"></i></a>', "\n";
echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
@@ -105,11 +113,8 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Checklist'), "</h2>\n"; echo '<h2>', _('Add Checklist'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="title" class="form-label"><?=_('Title')?></label>
<input type="text" class="form-control" id="title" name="title">
</div>
<?php <?php
form_create_text('title', _('Title'), 30);
form_new_buttons($g_scriptname); form_new_buttons($g_scriptname);
echo "</form>\n"; echo "</form>\n";
@@ -150,11 +155,8 @@ echo '<h2>', _('Edit checklist'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="provname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="title" name="title" value="<?=$checklist->title ?>">
</div>
<?php <?php
form_create_text('title', _('Title'), 30, $checklist->title);
form_create_select('clstate', _('State'), $opt_clstate, $checklist->clstate); form_create_select('clstate', _('State'), $opt_clstate, $checklist->clstate);
form_edit_buttons($g_scriptname, $id); form_edit_buttons($g_scriptname, $id);
+46 -96
View File
@@ -9,11 +9,12 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle=_('Company'); $pagetitle=_('Company');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_comptype = db_get_options(2); $opt_comptype = db_get_options(DD_COMPANY_TYPE);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -30,12 +31,17 @@ switch ($submit = form_get_action()) {
$flt = array(); $flt = array();
$flt['type'] = gpc_get_int($_POST, 'flt_type'); $flt['type'] = gpc_get_int($_POST, 'flt_type');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt');
$allowed = db_load_enum('company', 'flags');
$flt['flags'] = gpc_get_set($_POST, 'flt_flags', $allowed);
db_save_filter($flt, 208); db_save_filter($flt, 208);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
case 'freset': case 'freset':
db_clear_filter(208); //db_clear_filter(208);
// set status checkboxes to useful defaults
$flt = array('flags' => ['historic']);
db_save_filter($flt, 208);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
@@ -43,6 +49,7 @@ switch ($submit = form_get_action()) {
$p[':compname'] = gpc_get_string($_POST, 'compname'); $p[':compname'] = gpc_get_string($_POST, 'compname');
$p[':comptype'] = gpc_get_int($_POST, 'comptype'); $p[':comptype'] = gpc_get_int($_POST, 'comptype');
$id = db_exec_insert('company', $p); $id = db_exec_insert('company', $p);
db_set_revision('table', TBL_COMPANIES);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -102,7 +109,7 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle); page_caption_search($pagetitle);
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 208, ['type','txt']); $flt = db_get_filter($user->id, 208, ['type','txt','flags']);
$w = array(); $w = array();
$p = array(); $p = array();
@@ -114,6 +121,19 @@ if (strlen($flt->txt) > 1) {
$w[] = '(compname LIKE :txt OR remarks LIKE :txt)'; $w[] = '(compname LIKE :txt OR remarks LIKE :txt)';
$p[':txt'] = '%'.$flt->txt.'%'; $p[':txt'] = '%'.$flt->txt.'%';
} }
// condition for multiple flags is OR
$parts = ["flags=''", 'flags IS NULL'];
foreach ($flt->flags as $f) {
$parts[] = "FIND_IN_SET('$f', flags)";
}
if (!empty($parts)) {
if (count($parts) > 1) {
$w[] = '(' . join(' OR ', $parts) . ')';
} else {
$w[] = $parts[0];
}
}
$where = join(' AND ', $w); $where = join(' AND ', $w);
$order = ' ORDER BY comptype, compname'; $order = ' ORDER BY comptype, compname';
@@ -158,32 +178,17 @@ try {
$res = $sth->fetchAll(); $res = $sth->fetchAll();
// Filter // Filter
$opt_special = array(
-2 => _('&horbar; all &horbar;'),
);
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_type">Type</label>
<select id="flt_type" class="form-select" name="flt_type">
<?php <?php
foreach ($opt_special + $opt_comptype as $k => $v) { filter_create_select('flt_type', _('Type'), $g_opt_all + $opt_comptype, $flt->type);
echo '<option value="', $k,'"'; filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
if ($k == $flt->type) { $opt_flags = db_load_enum('company', 'flags', true, true, false);
echo ' selected'; filter_create_checks('flt_flags', _('Also show '), $opt_flags, $flt->flags ?? []);
}
echo '>', $v, '</option>';
}
?> ?>
</select>
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt;?>">
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -248,11 +253,10 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Company'), "</h2>\n"; echo '<h2>', _('Add Company'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3"> <?php
<label for="compname" class="form-label"><?=_('Name')?></label> form_create_text('compname', _('Name'), 60);
<input type="text" class="form-control" id="compname" name="compname"> form_create_select('comptype', _('Company type'), $opt_comptype);
</div> ?>
<?php form_create_select('comptype', _('Company type'), $opt_comptype); ?>
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button> <button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a> <a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
</form> </form>
@@ -352,76 +356,22 @@ $company = $sth->fetch(PDO::FETCH_OBJ);
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="compname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="compname" name="compname" value="<?=h($company->compname)?>">
</div>
<div class="mb-3">
<label for="shortname" class="form-label"><?=_('Short name')?></label>
<input type="text" class="form-control" id="shortname" name="shortname" value="<?=h($company->shortname)?>">
</div>
<div class="mb-3">
<label for="comptype" class="form-label"><?=_('Company type')?></label>
<select name="comptype" class="form-control">
<?php
foreach ($opt_comptype as $k => $v) {
echo '<option value="', $k ,'"';
if ($company->comptype == $k) {
echo ' selected';
}
echo '>', $v, "</option>\n";
}
?>
</select>
</div>
<?php <?php
form_create_text('compname', _('Name'), 60, $company->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); form_create_select('comptype2', _('Secondary company type'), $g_opt_none + $opt_comptype, $company->comptype2);
?> form_create_text('street', _('Street'), 40, $company->street);
<div class="mb-3"> form_create_text('zip', _('Zip'), 10, $company->zip);
<label for="street" class="form-label"><?=_('Street')?></label> form_create_text('city', _('City'), 30, $company->city);
<input type="text" class="form-control" id="street" name="street" value="<?=h($company->street)?>"> form_create_text('country', _('Country'), 30, $company->country);
</div> form_create_text('contact', _('Contact'), 30, $company->contact);
<div class="mb-3"> form_create_text('phone', _('Phone'), 30, $company->phone);
<label for="zip" class="form-label"><?=_('Zip')?></label> form_create_text('email', _('Email'), 50, $company->email);
<input type="text" class="form-control" id="zip" name="zip" value="<?=h($company->zip)?>"> form_create_text('web', _('Web'), 40, $company->web);
</div> form_create_text('customerno', _('Customer no.'), 20, $company->customerno);
<div class="mb-3"> form_create_text('contractno', _('Contract no.'), 20, $company->contracno);
<label for="city" class="form-label"><?=_('City')?></label> form_create_textarea('remarks', _('Remarks'), 3, 150, $company->remarks);
<input type="text" class="form-control" id="city" name="city" value="<?=h($company->city)?>">
</div>
<div class="mb-3">
<label for="country" class="form-label"><?=_('Country')?></label>
<input type="text" class="form-control" id="country" name="country" value="<?=h($company->country)?>">
</div>
<div class="mb-3">
<label for="contact" class="form-label"><?=_('Contact')?></label>
<input type="text" class="form-control" id="contact" name="contact" value="<?=h($company->contact)?>">
</div>
<div class="mb-3">
<label for="phone" class="form-label"><?=_('Phone')?></label>
<input type="text" class="form-control" id="phone" name="phone" value="<?=h($company->phone)?>">
</div>
<div class="mb-3">
<label for="email" class="form-label"><?=_('Email')?></label>
<input type="text" class="form-control" id="email" name="email" value="<?=h($company->email)?>">
</div>
<div class="mb-3">
<label for="web" class="form-label"><?=_('Web')?></label>
<input type="text" class="form-control" id="web" name="web" value="<?=h($company->web)?>">
</div>
<div class="mb-3">
<label for="customerno" class="form-label"><?=_('Customer no.')?></label>
<input type="text" class="form-control" id="customerno" name="customerno" value="<?=h($company->customerno)?>">
</div>
<div class="mb-3">
<label for="contractno" class="form-label"><?=_('Contract no.')?></label>
<input type="text" class="form-control" id="contractno" name="contractno" value="<?=h($company->contractno)?>">
</div>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($company->remarks)?></textarea>
</div>
<?php
$opt_flags = db_load_enum('company', 'flags', true, true, false); $opt_flags = db_load_enum('company', 'flags', true, true, false);
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags)); form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags));
?> ?>
+36 -67
View File
@@ -17,6 +17,7 @@ doctype icons
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
require 'lib/fileutils.inc'; require 'lib/fileutils.inc';
$pagetitle = _('Documents'); $pagetitle = _('Documents');
@@ -153,6 +154,7 @@ switch ($submit = form_get_action()) {
$id = db_exec_insert('document', $p); $id = db_exec_insert('document', $p);
$file_techname = sprintf('%s/%s-%06d.%s', $g_doc_basepath, $prefix, $id, $file_ext); $file_techname = sprintf('%s/%s-%06d.%s', $g_doc_basepath, $prefix, $id, $file_ext);
move_uploaded_file($file_tmp, $file_techname); move_uploaded_file($file_tmp, $file_techname);
chmod($file_techname, 0640);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -319,7 +321,7 @@ $page = gpc_get_int($_REQUEST, 'p', 1);
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp); $rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
$lastpage = ceil($numrows/$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)"; . "FROM document AS d LEFT OUTER JOIN docref AS r USING (docid)";
if ($where) $sql .= ' WHERE ' . $where; if ($where) $sql .= ' WHERE ' . $where;
$sql .= " GROUP BY d.docid, d.doctype, d.filename, d.title"; $sql .= " GROUP BY d.docid, d.doctype, d.filename, d.title";
@@ -333,58 +335,21 @@ $sth->execute($p);
$res = $sth->fetchAll(); $res = $sth->fetchAll();
// Filter // Filter
$opt_special = array(
'all' => _('&horbar; all &horbar;'),
);
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_doctype">Type</label>
<select class="form-select" id="flt_doctype" name="flt_doctype">
<?php <?php
foreach ($opt_special + $opt_doctype as $k => $v) { filter_create_select('flt_doctype', _('Type'), $g_opt_all + $opt_doctype, $flt->doctype);
echo '<option value="', $k,'"'; filter_create_select('flt_reftype', _('Reference'), $g_opt_none + $opt_reftype, $flt->reftype);
if ($k == $flt->doctype) { filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
echo ' selected';
}
echo '>', $v, '</option>';
}
?> ?>
</select>
</div> </div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_reftype"><?=_('Reference')?></label>
<select class="form-select" id="flt_reftype" name="flt_reftype">
<?php
$opt_special['none'] = _('&horbar; none &horbar;');
foreach ($opt_special + $opt_reftype as $k => $v) {
echo '<option value="', $k,'"';
if ($k == $flt->reftype) {
echo ' selected';
}
echo '>', $v, '</option>';
}
?>
</select>
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>">
</div>
</div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button> <button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
</div> </div>
</div> </div>
</form> </form>
@@ -414,7 +379,17 @@ foreach ($res as $row) {
echo "<td>", $i; echo "<td>", $i;
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye ms-2"></i></a>', "\n"; echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye ms-2"></i></a>', "\n";
echo "</td>\n"; echo "</td>\n";
echo "<td>", $opt_doctype[$row['doctype']], "</td>\n"; echo "<td>";
if ($row['mimetype'] == 'application/pdf') {
echo '<i class="bi bi-file-earmark-pdf"></i>';
} else if ($row['mimetype'] == 'image/svg+xml') {
echo '<i class="bi bi-file-earmark-easel"></i>';
} else if ($row['mimetype'] == 'image/jpeg' or $row['mimetype'] == 'image/png') {
echo '<i class="bi bi-file-earmark-image"></i>';
} else {
echo '<i class="bi bi-file-earmark"></i>';
}
echo ' ', $opt_doctype[$row['doctype']], "</td>\n";
echo "<td>", $row['filename'], "</td>\n"; echo "<td>", $row['filename'], "</td>\n";
echo "<td>", $row['title'], "</td>\n"; echo "<td>", $row['title'], "</td>\n";
echo "<td>", $row['refcount'], "</td>\n"; echo "<td>", $row['refcount'], "</td>\n";
@@ -438,14 +413,10 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Document'), "</h2>\n"; echo '<h2>', _('Add Document'), "</h2>\n";
?> ?>
<form method="post" enctype="multipart/form-data" action="<?=$g_scriptname?>"> <form method="post" enctype="multipart/form-data" action="<?=$g_scriptname?>">
<div class="mb-3"> <?php
<label for="title" class="form-label"><?=_('Title')?></label> form_create_text('title', _('Title'), 40);
<input type="text" class="form-control" id="title" name="title" value="<?=$title ?? ''?>"> form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks);
</div> ?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$remarks ?? ''?></textarea>
</div>
<div class="mb-3"> <div class="mb-3">
<label for="files" class="form-label"><?=_('Document')?></label> <label for="files" class="form-label"><?=_('Document')?></label>
<input class="form-control" type="file" id="files" name="files" onchange="preview()"> <input class="form-control" type="file" id="files" name="files" onchange="preview()">
@@ -554,6 +525,7 @@ echo '<tr><th scope="row">', _('Filename'),"</th><td>", h($document->filename),
echo '<tr><th scope="row">', _('File size'),"</th><td>", format_filesize($document->docsize), "</td></tr>\n"; echo '<tr><th scope="row">', _('File size'),"</th><td>", format_filesize($document->docsize), "</td></tr>\n";
echo '<tr><th scope="row">', _('Upload date'),"</th><td>", $document->doctime, "</td></tr>\n"; echo '<tr><th scope="row">', _('Upload date'),"</th><td>", $document->doctime, "</td></tr>\n";
echo '<tr><th scope="row">', _('Title'),"</th><td>", h($document->title), "</td></tr>\n"; echo '<tr><th scope="row">', _('Title'),"</th><td>", h($document->title), "</td></tr>\n";
echo '<tr><th scope="row">', _('Access'),"</th><td>", get_enum($document->roleaccess), "</td></tr>\n";
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($document->remarks, br:true), "</td></tr>\n"; echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($document->remarks, br:true), "</td></tr>\n";
echo "</table>\n"; echo "</table>\n";
@@ -757,13 +729,15 @@ elseif ($action == ACT_EDIT):
echo '<h2>', _('Edit Document'), "</h2>\n"; echo '<h2>', _('Edit Document'), "</h2>\n";
$sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, remarks " $sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, roleaccess, remarks "
. "FROM document " . "FROM document "
. "WHERE docid=?"; . "WHERE docid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute([$id]); $sth->execute([$id]);
$document = $sth->fetch(PDO::FETCH_OBJ); $document = $sth->fetch(PDO::FETCH_OBJ);
// TODO check roleaccess!
if ($document->doctype == 'picture') { if ($document->doctype == 'picture') {
echo '<img width="', $g_thumb_size, '" src="dl.php?id=', $document->docid, '">'; echo '<img width="', $g_thumb_size, '" src="dl.php?id=', $document->docid, '">';
} }
@@ -771,15 +745,10 @@ if ($document->doctype == 'picture') {
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="title" class="form-label"><?=_('Filename')?></label>
<input type="text" class="form-control" id="filename" name="filename" value="<?=$document->filename ?>">
</div>
<div class="mb-3">
<label for="title" class="form-label"><?=_('Title')?></label>
<input type="text" class="form-control" id="title" name="title" value="<?=$document->title ?>">
</div>
<?php <?php
form_create_text('filename', _('Filename'), 200, $document->filename);
form_create_text('title', _('Title'), 40, $document->title);
if ($document->mimetype == 'application/pdf') { if ($document->mimetype == 'application/pdf') {
echo '<div class="mb-3">', "\n"; echo '<div class="mb-3">', "\n";
$opt_doctype = array( $opt_doctype = array(
@@ -792,13 +761,13 @@ if ($document->mimetype == 'application/pdf') {
} else { } else {
echo '<input type="hidden" name="doctype" value="', $document->doctype, '">', "\n"; echo '<input type="hidden" name="doctype" value="', $document->doctype, '">', "\n";
} }
form_create_textarea('remarks', _('Remarks'), 3, 150, $document->remarks);
?> ?>
<div class="mb-3"> <div class="container-fluid px-0 my-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label> <button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($document->remarks)?></textarea> <a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
</div> </div>
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
</form> </form>
<?php <?php
+9 -4
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Lists'); $pagetitle = _('Lists');
@@ -84,6 +85,8 @@ switch ($submit = form_get_action()) {
break; break;
case 'update': case 'update':
# changing ddval would need to update all dependent data
# so this is not intended here!
$p[':ddtext'] = gpc_get_string($_POST, 'ddtext'); $p[':ddtext'] = gpc_get_string($_POST, 'ddtext');
$p[':ddshort'] = gpc_get_string($_POST, 'ddshort'); $p[':ddshort'] = gpc_get_string($_POST, 'ddshort');
$p[':color'] = gpc_get_color($_POST, 'color'); $p[':color'] = gpc_get_color($_POST, 'color');
@@ -132,7 +135,7 @@ $sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) { foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$num[$row[0]] = $row[1]; $num[$row[0]] = $row[1];
} }
$sql = "SELECT ddval, ddtext FROM dropdown WHERE ddid=0 AND ddval>0"; $sql = "SELECT ddval, ddtext, flags FROM dropdown WHERE ddid=0 AND ddval>0";
$sth = $pdo->query($sql); $sth = $pdo->query($sql);
echo "<h1>$pagetitle</h1>\n"; echo "<h1>$pagetitle</h1>\n";
@@ -158,9 +161,12 @@ foreach ($sth->fetchAll() as $row) {
echo '</td>'; echo '</td>';
echo '<td>', $row['ddtext'], '</td>'; echo '<td>', $row['ddtext'], '</td>';
echo '<td>', $num[$row['ddval']] ?? 0, '</td>'; echo '<td>', $num[$row['ddval']] ?? 0, '</td>';
// form_action_buttons($g_scriptname, $row['ddval']);
echo "<td>"; echo "<td>";
echo '<a class="text-nowrap" title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['ddval'], '"><i class="bi bi-pencil ms-2"></i></a>'; if ($row['flags'] == 'locked') {
echo _('Locked');
} else {
echo '<a class="text-nowrap" title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['ddval'], '"><i class="bi bi-pencil ms-2"></i></a>';
}
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
@@ -262,7 +268,6 @@ foreach ($sth->fetchAll() as $row) {
echo '<i class="bi-trash"></i>'; echo '<i class="bi-trash"></i>';
echo '</td>', "\n"; echo '</td>', "\n";
// TODO extend function to accept additional parameters // TODO extend function to accept additional parameters
// form_action_buttons($g_scriptname, $row['ddid'];
} }
echo "</tr>\n"; echo "</tr>\n";
} }
+33 -30
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
require 'lib/fileutils.inc'; require 'lib/fileutils.inc';
require 'lib/signalk.inc'; require 'lib/signalk.inc';
@@ -18,8 +19,8 @@ $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_supplier = db_get_opt_supp($g_opt_unknown); $opt_supplier = db_get_opt_supp($g_opt_unknown);
$opt_manufacturer = db_get_opt_manuf($g_opt_unknown); $opt_manufacturer = db_get_opt_manuf($g_opt_unknown);
$opt_ecat = db_get_options(4); // Equipment categories $opt_ecat = db_get_options(DD_EQUIPMENT_CATEGORY);
$opt_unit = db_get_options(8); $opt_unit = db_get_options(DD_UNIT);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -45,7 +46,9 @@ switch ($submit = form_get_action()) {
break; break;
case 'freset': case 'freset':
db_clear_filter(200); // set status checkboxes to useful defaults
$flt = array('flags' => ['ordered']);
db_save_filter($flt, 200);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
@@ -57,6 +60,7 @@ switch ($submit = form_get_action()) {
$p[':model'] = gpc_get_string($_POST, 'model'); $p[':model'] = gpc_get_string($_POST, 'model');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
$id = db_exec_insert('equipment', $p); $id = db_exec_insert('equipment', $p);
db_set_revision('table', TBL_EQUIPMENT);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -202,6 +206,7 @@ switch ($submit = form_get_action()) {
$docid = $pdo->lastInsertId(); $docid = $pdo->lastInsertId();
$file_techname = file_get_docname($docid, 'picture', $file_ext); $file_techname = file_get_docname($docid, 'picture', $file_ext);
move_uploaded_file($file_tmp, $g_doc_basepath . '/' . $file_techname); move_uploaded_file($file_tmp, $g_doc_basepath . '/' . $file_techname);
chmod($g_doc_basepath . '/' . $file_techname, 0640);
} else { } else {
// A document record definitely exists here, now just // A document record definitely exists here, now just
// connect it to the selected equipment // connect it to the selected equipment
@@ -321,29 +326,21 @@ $opt_none_male = array(-1 => pgettext('male', '&horbar; none &horbar;'));
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<?php <?php
filter_create_select('flt_category', _('Category'), $g_opt_all + $g_opt_none + $opt_ecat, $flt->cat); filter_create_select('flt_category', _('Category'), $g_opt_all + $g_opt_none + $opt_ecat, $flt->cat);
filter_create_select('flt_manuf', _('Manufacturer'), $g_opt_all + $opt_none_male + $opt_manufacturer, $flt->manuf); filter_create_select('flt_manuf', _('Manufacturer'), $g_opt_all + $opt_none_male + $opt_manufacturer, $flt->manuf);
filter_create_select('flt_supp', _('Supplier'), $g_opt_all + $opt_none_male + $opt_supplier, $flt->supp); filter_create_select('flt_supp', _('Supplier'), $g_opt_all + $opt_none_male + $opt_supplier, $flt->supp);
?> filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt"><?=_('Text')?></label>
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?>">
</div>
<div class="d-flex flex-nowrap gap-2">
<?php
$opt_flags = db_load_enum('equipment', 'flags', true, true, false); $opt_flags = db_load_enum('equipment', 'flags', true, true, false);
filter_create_checks('flt_flags', _('Flags'), $opt_flags, $flt->flags ?? []); filter_create_checks('flt_flags', _('Also show '), $opt_flags, $flt->flags ?? []);
?> ?>
</div> </div>
</div> <div class="card-footer">
<div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button> <button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
</div> </div>
</div> </div>
</form> </form>
@@ -420,22 +417,13 @@ $flt = db_get_filter($user->id, 200);
?> ?>
<h2><?=_('Add Equipment')?></h2> <h2><?=_('Add Equipment')?></h2>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="ename" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="ename" name="ename">
</div>
<?php <?php
form_create_text('ename', _('name'), 80);
form_create_select('category', _('Category'), $g_opt_none + $opt_ecat, $flt->cat); form_create_select('category', _('Category'), $g_opt_none + $opt_ecat, $flt->cat);
form_create_select('manufacturer', _('Manufacturer'), $opt_manufacturer, $flt->manuf); form_create_select('manufacturer', _('Manufacturer'), $opt_manufacturer, $flt->manuf);
form_create_text('model', _('Model'), 40);
form_create_textarea('remarks', _('Remarks'), 3, 150);
?> ?>
<div class="mb-3">
<label for="model" class="form-label"><?=_('Model')?></label>
<input type="text" class="form-control" id="model" name="model">
</div>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3" maxlength="150"></textarea>
</div>
<div class="container-fluid px-0 my-3"> <div class="container-fluid px-0 my-3">
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button> <button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a> <a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
@@ -477,6 +465,21 @@ if (!empty($equipment->x)) {
} }
echo '<tr><th>', _('Remarks'),"</th><td>", h($equipment->remarks, br:true), "</td></tr>\n"; echo '<tr><th>', _('Remarks'),"</th><td>", h($equipment->remarks, br:true), "</td></tr>\n";
echo '<tr><th>', _('Flags'),"</th><td>", $equipment->flags, "</td></tr>\n"; echo '<tr><th>', _('Flags'),"</th><td>", $equipment->flags, "</td></tr>\n";
// Custom properties
$sql = "SELECT keyname, valstr, valint FROM property WHERE objtype='equip' AND objid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
foreach ($sth->fetchAll() as $row) {
echo "<tr><th>{$row['keyname']}</th><td>";
if (isset($row['valstr'])) {
echo $row['valstr'];
} else {
echo $row['valint'];
}
echo "</td></tr>\n";
}
echo "</table>\n"; echo "</table>\n";
echo '</div>'; // Column break echo '</div>'; // Column break
+43 -41
View File
@@ -9,13 +9,14 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Fuses'); $pagetitle = _('Fuses');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_ftype = db_get_options(7); $opt_ftype = db_get_options(DD_FUSE_TYPE);
$opt_location = db_get_options(10); $opt_location = db_get_options(DD_FUSE_BLOCK);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -31,6 +32,7 @@ switch ($submit = form_get_action()) {
case 'filter': case 'filter':
$flt = array(); $flt = array();
$flt['location'] = gpc_get_int($_POST, 'flt_location'); $flt['location'] = gpc_get_int($_POST, 'flt_location');
$flt['type'] = gpc_get_int($_POST, 'flt_type');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt');
db_save_filter($flt, 212); db_save_filter($flt, 212);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
@@ -43,22 +45,25 @@ switch ($submit = form_get_action()) {
case 'insert': case 'insert':
$p[':vid'] = $user->vid; $p[':vid'] = $user->vid;
$p[':fnumber'] = gpc_get_int($_POST, 'fnumber');; $p[':fnumber'] = gpc_get_int($_POST, 'fnumber');
$p[':ftype'] = gpc_get_int($_POST, 'ftype');; $p[':ftype'] = gpc_get_int($_POST, 'ftype', NULL, -1);
$p[':current'] = gpc_get_int($_POST, 'current');; $p[':current'] = gpc_get_int($_POST, 'current');
$p[':location'] = gpc_get_int($_POST, 'location');; $p[':location'] = gpc_get_int($_POST, 'location');
$p[':description'] = gpc_get_string($_POST, 'description'); $p[':description'] = gpc_get_string($_POST, 'description');
$id = db_exec_insert('fuse', $p); $id = db_exec_insert('fuse', $p);
db_set_revision('table', TBL_FUSES);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
case 'update': case 'update':
$p[':fuseid'] = $id; $p[':fuseid'] = $id;
$p[':fnumber'] = gpc_get_string($_POST, 'fuseid'); $p[':fnumber'] = gpc_get_int($_POST, 'fnumber');
$p[':ftype'] = gpc_get_int($_POST, 'ftype', [-1]);
$p[':current'] = gpc_get_float($_POST, 'current'); $p[':current'] = gpc_get_float($_POST, 'current');
$p[':cableid'] = gpc_get_int($_POST, 'cableid'); $p[':color'] = gpc_get_color($_POST, 'color');
$p[':eid'] = gpc_get_int($_POST, 'id'); $p[':cableid'] = gpc_get_int($_POST, 'cableid', NULL, -1);
$p[':location'] = gpc_get_int($_POST, 'location'); $p[':eid'] = gpc_get_int($_POST, 'id', [-1]);
$p[':location'] = gpc_get_int($_POST, 'location', NULL, -1);
$p[':description'] = gpc_get_string($_POST, 'description'); $p[':description'] = gpc_get_string($_POST, 'description');
$p[':remarks'] = gpc_get_string($_POST, 'remarks'); $p[':remarks'] = gpc_get_string($_POST, 'remarks');
db_exec_update('fuse', $p, 'fuseid'); db_exec_update('fuse', $p, 'fuseid');
@@ -94,10 +99,10 @@ if ($action == ACT_DEFAULT):
// ========== VARIANT: default behavior ======================================= // ========== VARIANT: default behavior =======================================
// lookup tables // lookup tables
$opt_ftype_short = db_get_options(7, '', true); $opt_ftype_short = db_get_options(DD_FUSE_TYPE, '', true);
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 212); $flt = db_get_filter($user->id, 212, ['txt', 'location', 'type']);
$w = array('vid=:vid'); $w = array('vid=:vid');
$p = array(':vid' => $user->vid); $p = array(':vid' => $user->vid);
@@ -108,6 +113,12 @@ if ($flt->location == -1) {
$w[] = 'location=:location'; $w[] = 'location=:location';
$p[':location'] = $flt->location; $p[':location'] = $flt->location;
} }
if ($flt->type == -1) {
$w[] = 'ftype IS NULL';
} elseif ($flt->type > 0) {
$w[] = 'ftype=:ftype';
$p[':ftype'] = $flt->type;
}
if (strlen($flt->txt) > 1) { if (strlen($flt->txt) > 1) {
$w[] = 'description LIKE :txt'; $w[] = 'description LIKE :txt';
$p[':txt'] = '%'.$flt->txt.'%'; $p[':txt'] = '%'.$flt->txt.'%';
@@ -125,11 +136,9 @@ echo "<h1>$pagetitle</h1>\n";
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<?php <?php
filter_create_select('flt_location', _('Location'), $g_opt_all + $g_opt_none + $opt_location, $flt->location); filter_create_select('flt_location', _('Location'), $g_opt_all + $g_opt_none + $opt_location, $flt->location);
filter_create_select('flt_type', _('Type'), $g_opt_all + $g_opt_none + $opt_ftype, $flt->type);
filter_create_text('flt_txt', _('Description'), $flt->text, 30, 45);
?> ?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt"><?=_('Description')?></label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?? ''?>">
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -139,7 +148,7 @@ filter_create_select('flt_location', _('Location'), $g_opt_all + $g_opt_none + $
</form> </form>
<?php <?php
$sql = "SELECT fuseid, fnumber, ftype, location, current, description " $sql = "SELECT fuseid, fnumber, ftype, location, current, color, description "
. "FROM fuse"; . "FROM fuse";
$sql .= ' WHERE ' . $where; $sql .= ' WHERE ' . $where;
$sql .= $order; $sql .= $order;
@@ -155,6 +164,7 @@ echo '<th>#</th>';
echo '<th>', pgettext('number', 'Number'), "</th>"; echo '<th>', pgettext('number', 'Number'), "</th>";
echo '<th>', _('Type'), "</th>"; echo '<th>', _('Type'), "</th>";
echo '<th>', _('Current'), "</th>"; echo '<th>', _('Current'), "</th>";
echo '<th>', _('Color'), "</th>";
echo '<th>', _('Location'), "</th>"; echo '<th>', _('Location'), "</th>";
echo '<th>', _('Description'), "</th>"; echo '<th>', _('Description'), "</th>";
echo "<th></th>"; echo "<th></th>";
@@ -169,6 +179,7 @@ foreach ($res as $row) {
echo "<td>F", $row['fnumber'], "</td>\n"; echo "<td>F", $row['fnumber'], "</td>\n";
echo "<td>",$opt_ftype_short[$row['ftype']], "</td>\n"; echo "<td>",$opt_ftype_short[$row['ftype']], "</td>\n";
echo "<td>", $row['current'], "A</td>\n"; echo "<td>", $row['current'], "A</td>\n";
echo '<td>', format_color(strtoupper($row['color'])), "</td>\n";
echo "<td>", $opt_location[$row['location']], "</td>\n"; echo "<td>", $opt_location[$row['location']], "</td>\n";
echo "<td>", $row['description'], "</td>\n"; echo "<td>", $row['description'], "</td>\n";
// Edit current record button // Edit current record button
@@ -178,7 +189,7 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
table_rec_summary($i0, $i, $numrows, 6); //table_rec_summary(1, $i-1, $i-1, 6);
echo "</table>\n"; echo "</table>\n";
form_add_button($g_scriptname); form_add_button($g_scriptname);
@@ -188,7 +199,7 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add fuse'), "</h2>\n"; echo '<h2>', _('Add fuse'), "</h2>\n";
// calc next free fuse number for convenience // FIXME calc next free fuse number for convenience
$sql = "SELECT max(fnumber) FROM fuse WHERE vid=?"; $sql = "SELECT max(fnumber) FROM fuse WHERE vid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute([$user->vid]); $sth->execute([$user->vid]);
@@ -204,7 +215,9 @@ $fnumber = $sth->fetchColumn() + 1;
<label for="note" class="form-label"><?=_('Description')?></label> <label for="note" class="form-label"><?=_('Description')?></label>
<input type="text" class="form-control" id="description" name="description" autofocus> <input type="text" class="form-control" id="description" name="description" autofocus>
</div> </div>
<?php form_create_select('ftype', _('Type'), $opt_ftype); ?> <?php
form_create_select('ftype', _('Type'), $g_opt_none + $opt_ftype);
?>
<div class="mb-3"> <div class="mb-3">
<label for="current" class="form-label"><?=_('Current, Ampere')?></label> <label for="current" class="form-label"><?=_('Current, Ampere')?></label>
<input type="text" class="form-control" id="current" name="current" required> <input type="text" class="form-control" id="current" name="current" required>
@@ -217,7 +230,7 @@ echo "</form>\n";
elseif ($action == ACT_VIEW): elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record ===================================== // ========== VARIANT: view single record =====================================
$sql = "SELECT fnumber, ftype, current, cableid, eid, location, description, remarks " $sql = "SELECT fnumber, ftype, current, cableid, eid, location, description, color, remarks "
. "FROM fuse " . "FROM fuse "
. "WHERE vid=? AND fuseid=?"; . "WHERE vid=? AND fuseid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -231,6 +244,7 @@ echo '<tr><th style="width:20%">', _('Fuse'),"</th><td>F", $fuse->fnumber, "</td
echo '<tr><th>', _('Description'),"</th><td>", $fuse->description, "</td></tr>\n"; echo '<tr><th>', _('Description'),"</th><td>", $fuse->description, "</td></tr>\n";
echo '<tr><th>', _('Type'),"</th><td>", $opt_ftype[$fuse->ftype], "</td></tr>\n"; echo '<tr><th>', _('Type'),"</th><td>", $opt_ftype[$fuse->ftype], "</td></tr>\n";
echo '<tr><th>', _('Current'),"</th><td>", $fuse->current, "A</td></tr>\n"; echo '<tr><th>', _('Current'),"</th><td>", $fuse->current, "A</td></tr>\n";
echo '<tr><th>', _('Color'),"</th><td>", format_color($fuse->color), "</td></tr>\n";
echo '<tr><th>', _('Location'),"</th><td>", $opt_location[$fuse->location], "</td></tr>\n"; echo '<tr><th>', _('Location'),"</th><td>", $opt_location[$fuse->location], "</td></tr>\n";
echo '<tr><th>', _('Cable'),"</th><td>", $fuse->cableid, "</td></tr>\n"; echo '<tr><th>', _('Cable'),"</th><td>", $fuse->cableid, "</td></tr>\n";
echo '<tr><th>', _('Equipment'),"</th><td>", $fuse->eid, "</td></tr>\n"; echo '<tr><th>', _('Equipment'),"</th><td>", $fuse->eid, "</td></tr>\n";
@@ -245,7 +259,7 @@ elseif ($action == ACT_EDIT):
$opt_cable = db_get_opt_cable($user->vid); $opt_cable = db_get_opt_cable($user->vid);
$opt_equipment = db_get_opt_equip($user->vid); $opt_equipment = db_get_opt_equip($user->vid);
$sql = "SELECT fnumber, ftype, current, cableid, eid, location, description, remarks " $sql = "SELECT fnumber, ftype, current, cableid, eid, location, description, color, remarks "
. "FROM fuse " . "FROM fuse "
. "WHERE fuseid=?"; . "WHERE fuseid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -256,28 +270,16 @@ echo '<h2>', _('Edit fuse'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3"> <?php
<label for="fnumber" class="form-label"><?=_('Fuse number')?></label> form_create_numeric('fnumber', _('Fuse number'), $fuse->fnumber, 1, 9999, 1, TRUE, TRUE);
<input type="text" class="form-control" id="fnumber" name="fnumber" value="<?=$fuse->fnumber ?>"> form_create_select('ftype', _('Type'), $g_opt_none + $opt_ftype, $fuse->ftype);
</div> form_create_text('description', _('Description'), 60, $fuse->description);
<div class="mb-3"> form_create_numeric('current', _('Current, A'), format_float($fuse->current), 1, 999, 1);
<label for="note" class="form-label"><?=_('Description')?></label> form_create_color('color', _('Color'), $fuse->color);
<input type="text" class="form-control" id="description" name="description" value="<?=h($fuse->description)?>">
</div>
<div class="mb-3">
<label for="current" class="form-label"><?=_('Current')?></label>
<input type="text" class="form-control" id="current" name="current" value="<?=format_float($fuse->current) ?>">
</div>
<?php
form_create_select('location', _('Location'), $g_opt_none + $opt_location, $fuse->location); 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('cableid', _('Cable'), $g_opt_none + $opt_cable, $fuse->cableid);
form_create_select('eid', _('Equipment'), $g_opt_none + $opt_equipment, $fuse->eid); form_create_select('eid', _('Equipment'), $g_opt_none + $opt_equipment, $fuse->eid);
?> form_create_textarea('remarks', _('Remarks'), 3, 150, $fuse->remarks);
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($fuse->remarks)?></textarea>
</div>
<?php
form_edit_buttons($g_scriptname, $id); form_edit_buttons($g_scriptname, $id);
echo "</form>\n"; echo "</form>\n";
+109 -604
View File
@@ -15,6 +15,7 @@
* 0.2.0 2026-08-18 First public release tho * 0.2.0 2026-08-18 First public release tho
* 0.2.1 2026-08-28 Foreign keys, bugfixes and output sanitation tho * 0.2.1 2026-08-28 Foreign keys, bugfixes and output sanitation tho
* 0.2.2 2026-09-21 Lots of improvements and fixes tho * 0.2.2 2026-09-21 Lots of improvements and fixes tho
* 2026-10-01 Dropdown constants for readability tho
* *
*/ */
@@ -47,15 +48,46 @@ define('ROLE_CAPTAIN', 'captain');
define('ROLE_HELMSMAN', 'helmsman'); define('ROLE_HELMSMAN', 'helmsman');
define('ROLE_SAILOR', 'sailor'); define('ROLE_SAILOR', 'sailor');
define('DD_VESSEL_TYPE', 1);
define('DD_COMPANY_TYPE', 2);
define('DD_STORAGE_TYPE', 3);
define('DD_EQUIPMENT_CATEGORY', 4);
define('DD_PROVISION_CATEGORY', 5);
define('DD_PROVISION_UNIT', 6);
define('DD_FUSE_TYPE', 7);
define('DD_UNIT', 8);
define('DD_BOX_TYPE', 9);
define('DD_FUSE_BLOCK', 10);
define('DD_CABLE_TYPE', 11);
define('DD_CABLE_TECHNAME', 12);
define('DD_INVENTORY_CATEGORY', 13);
define('DD_BBN_VESSELDATA', 14);
define('DD_MEASUREMENT_CATEGORY', 15);
// table indices which are used for combo lists
define('TBL_VESSEL', 1);
define('TBL_USERS', 2);
define('TBL_COMPANIES', 3);
define('TBL_STORAGE', 4);
define('TBL_BOXES', 5);
define('TBL_EQUIPMENT', 6);
// define('TBL_INVENTORY', 7);
define('TBL_PROJECTS', 8);
define('TBL_CABLES', 9);
define('TBL_FUSES', 10);
define('TBL_TAGS', 11);
// ========== PAGE START CODE ================================================= // ========== PAGE START CODE =================================================
// global version string // global version string
$g_version = 'v0.2.2'; $g_version = 'v0.3';
$g_scriptname = basename($_SERVER['SCRIPT_NAME']); $g_scriptname = basename($_SERVER['SCRIPT_NAME']);
require 'config.inc'; require 'config.inc';
umask(0027); // no rights for world!
// Localization // Localization
$lang = get_browser_lang(['de', 'en']); $lang = get_browser_lang(['de', 'en']);
@@ -125,6 +157,9 @@ $g_db_scheme_version = $sth->fetchColumn();
$g_db_scheme_required = 1; $g_db_scheme_required = 1;
// Schema version check // Schema version check
if ($g_db_scheme_version !== $g_db_scheme_required) { if ($g_db_scheme_version !== $g_db_scheme_required) {
// TODO if required schema version is smaller than found version then
// an database scheme update is neccessary
// otherwise our program code is outdated an should be updated
echo "<pre>\n"; echo "<pre>\n";
echo "Database schema is wrong: detected version $g_db_scheme_version, but required version $g_db_scheme_required!\n"; echo "Database schema is wrong: detected version $g_db_scheme_version, but required version $g_db_scheme_required!\n";
echo "</pre>\n"; echo "</pre>\n";
@@ -165,6 +200,7 @@ $g_opt_all = array(-2 => _('&horbar; all &horbar;'));
$g_opt_none = array(-1 => _('&horbar; none &horbar;')); $g_opt_none = array(-1 => _('&horbar; none &horbar;'));
$g_opt_empty = array('' => _('&horbar; none &horbar;')); $g_opt_empty = array('' => _('&horbar; none &horbar;'));
$g_opt_unknown = array(-1 => _('&horbar; unknown &horbar;')); $g_opt_unknown = array(-1 => _('&horbar; unknown &horbar;'));
$g_opt_new = array(-3 => _('&horbar; new &horbar;'));
// Initialize message system // Initialize message system
$g_message = new Message; $g_message = new Message;
@@ -428,182 +464,7 @@ function get_userlist() {
// ========== DATABASE FUNCTIONS ============================================== // ========== DATABASE FUNCTIONS ==============================================
function db_exec_insert($table, $params) { // TODO transfer to lib/db.inc
// $params must have keys corresponding to table fields prefixed with ':'
// e.g. $param[':field']
global $pdo;
global $g_error;
$keys = array_keys($params);
$fields = join(', ', array_map(function($s) { return ltrim($s, ':'); }, $keys));
$pnames = join(', ', $keys);
$sql = "INSERT INTO $table ($fields) VALUES ($pnames)";
// $sth = $pdo->prepare("INSERT INTO $table ($fields) VALUES ($pnames)");
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return false;
}
return $pdo->LastInsertId();
}
function db_exec_update($table, $params, $pk) {
// primary key can be a single field name or multiple fields: $pk is an array
global $pdo;
global $g_error;
// remove primary key fields from list of fields to update
if (is_array($pk)) {
if (count($pk) == 1) {
$pk = $pk[0];
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
} else {
$pkparams = array_map(fn($value) => ':' . $value, $pk);
$fields = array_diff_key($params, array_flip($pkparams));
$where = join(' AND ', array_map(fn($s) => "$s=:$s", $pk));
}
} else {
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
}
$fieldlist = join(', ', array_map(fn($s) => ltrim($s, ':') . '=' . $s, array_keys($fields)));
$sql = "UPDATE $table SET $fieldlist WHERE $where";
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return false;
}
return true;
}
function db_exec_delete($table, $condition, $params) {
// WIP untested!
// condition contains the where part of the sql statement
// params are values for placeholders in condition
// returns the number of deleted records
global $pdo;
global $g_error;
// convert params to array if single value is given
if (!is_array($params)) {
$params = [$params];
}
$sql = "DELETE FROM $table";
if (!empty($condition)) {
$sql .= ' WHERE ' . $condition;
}
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return -1;
}
return $sth->rowCount();
}
function db_clear_filter($sno) {
global $user;
global $pdo;
$sql = "DELETE FROM settings WHERE userid=? AND sno=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$user->id, $sno]);
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->Add($sql);
$g_warning->Add('Setting: ', $sno);
return false;
}
return true;
}
function db_save_filter($flt, $sno) {
global $user;
global $pdo;
global $g_warning;
$sql = "UPDATE settings SET valstr=? WHERE userid=? AND sno=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([json_encode($flt), $user->id, $sno]);
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->Add($sql);
$g_warning->Add(print_r($flt, true));
$g_warning->Add('Setting: ', $sno);
return false;
}
return true;
}
function get_enum($enum) {
// translate and beautify enums
$lookup = array(
'NULL' => _('n/a'),
'active' => _('Active'),
'bad' => _('Bad'),
'box' => _('Box'),
'cable' => _('Cable'),
'cat' => _('Catamaran'),
'completed' => _('Completed'),
'closed' => _('Closed'),
'company' => _('Company'),
'defect' => _('Defect'),
'deleted' => _('Deleted'),
'done' => _('Done'),
'drawing' => _('Drawing'),
'equipment' => _('Equipment'),
'estimated' => _('Estimated'),
'excellent' => _('Excellent'),
'fair' => _('Fair'),
'finished' => _('Finished'),
'fixed' => _('Fixed'),
'fuse' => _('Fuse'),
'generic' => _('Generic'),
'good' => _('Good'),
'high' => _('High'),
'historic' => _('Historic'),
'invoice' => _('Invoice'),
'locked' => _('Locked'),
'low' => _('Low'),
'manual' => _('Manual'),
'medium' => _('Medium'),
'mono' => _('Monohull'),
'new' => _('New'),
'none' => _('None'),
'normal' => _('Normal'),
'ongoing' => _('Ongoing'),
'open' => _('Open'),
'ordered' => _('Ordered'),
'paused' => _('Paused'),
'pending' => _('Pending'),
'picture' => _('Picture'),
'plan' => _('Planned'),
'precise' => _('Precise'),
'project' => _('Project'),
'removed' => _('Removed'),
'repairable' => _('Repairable'),
'rough' => _('Rough'),
'storage' => _('Storage'),
'task' => _('Task'),
'tri' => _('Trimaran'),
'unknown' => _('Unknown'),
'user' => _('User'),
'vessel' => _('Vessel'),
'waiting' => _('waiting')
);
return $lookup[$enum] ?? $enum;
}
function db_load_enum($table, $column, $lookup=false, $as_dict=false, $check_null=false) { function db_load_enum($table, $column, $lookup=false, $as_dict=false, $check_null=false) {
// returns array of enum-values as defined in database // returns array of enum-values as defined in database
@@ -773,245 +634,6 @@ function db_get_tag_target($objtype, $objid) {
return [$target, $desc]; return [$target, $desc];
} }
function db_get_ddtext($ddid, $ddval) {
// returns single value for dropdown
global $pdo;
global $g_error;
$sql = "SELECT ddtext FROM dropdown WHERE ddid=? AND ddval=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$ddid, $ddval]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
return '#err';
}
return $sth->fetchColumn();
}
// Functions to get option lists (key/value)
function db_get_options($ddid, $orderby = '', $short = False, $default = NULL) {
// returns list for dropdown
// if short is set the short value will be returned
global $pdo;
$list = array();
if ($default != NULL) {
$list[0] = $default;
}
if ($short) {
$sql = "SELECT ddval, ddshort";
} else {
$sql = "SELECT ddval, ddtext";
}
$sql .= " FROM dropdown WHERE ddid=?";
if ($orderby == 'ddtext') {
$sql .= ' ORDER BY ddtext';
} elseif ($orderby == 'sort') {
$sql .= ' ORDER BY sort';
} else {
$sql .= ' ORDER BY ddval';
}
$sth = $pdo->prepare($sql);
$sth->execute([$ddid]);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_vessel() {
global $pdo;
$list = array();
$sth = $pdo->query("SELECT vid, vesselname, model FROM vessel ORDER BY vid");
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_storage($vid) {
global $pdo;
global $g_error;
$list = array();
// exclude storage type "tank" from list
$sql = "SELECT sid, sname FROM storage WHERE vid=? AND stype<>1 ORDER BY sname";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_box($vid, $exclude=[]) {
global $pdo;
global $g_error;
$list = array();
$sql = "SELECT boxid, label, content "
. "FROM box INNER JOIN storage USING (sid) "
. "WHERE vid=? "
. "ORDER BY label";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
if (! in_array($rec[0], $exclude)) {
$list[$rec[0]] = h($rec[1]) . ($rec[2] ? ' - '. h($rec[2]) : '');
}
}
return $list;
}
function db_get_opt_equip($vid, $default=NULL, $exclude=[]) {
global $pdo;
global $g_error;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT eid, ename FROM equipment WHERE vid=? ORDER BY ename";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
if (! in_array($rec[0], $exclude)) {
$list[$rec[0]] = h($rec[1]);
}
}
return $list;
}
function db_get_opt_manuf($default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT compid, compname FROM company WHERE comptype=2 ORDER BY compname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_supp($default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT compid, compname FROM company WHERE comptype=1 ORDER BY compname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_user($userid, $default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT userid, displayname FROM user WHERE userid>0 ORDER BY displayname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_proj($vid, $exclude=[], $default=NULL) {
// exclude is a list of project states
global $pdo;
global $g_error;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT projid, projname FROM project WHERE vid=?";
$where = [];
foreach ($exclude as $excl) {
$where[] = "NOT FIND_IN_SET('$excl',projstate)";
}
if (! empty($where)) {
$sql .= ' AND '. implode(' AND ', $where);
}
$sql .= " ORDER BY projname";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_cable($vid, $default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT cableid, cablename FROM cable WHERE vid=? ORDER BY cablename";
$sth = $pdo->prepare($sql);
$sth->execute([$vid]);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_filter($user, $sno, $fields = []) {
// if fields supplied empting missing field are created
global $pdo;
global $g_warning;
$flt = new stdClass();
$sth = $pdo->prepare("SELECT valstr FROM settings WHERE userid=? AND sno=?");
try {
$sth->execute([$user, $sno]);
$json = $sth->fetchColumn();
if ($json === false) {
// no settings record. create empty one for later updates
$sth = $pdo->prepare("INSERT INTO settings (userid, sno, valstr) VALUES (?, ?, '{}')");
$sth->execute([$user, $sno]);
} else {
$flt = json_decode($json);
}
// create missing fields
foreach ($fields as $f) {
if (!property_exists($flt, $f)) {
$flt->$f = null;
}
}
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->PrintOut();
}
return $flt;
}
function db_get_default_storage($vesselid, $fallback=true) { function db_get_default_storage($vesselid, $fallback=true) {
global $pdo; global $pdo;
global $g_error, $g_warning; global $g_error, $g_warning;
@@ -1070,194 +692,6 @@ function float_to_sql($var) {
} }
} }
// ========== FORM FUNCTIONS ==================================================
function form_get_action() {
if (!isset($_POST['submit'])) {
if (isset($_GET['f'])) {
$submit = $_GET['f'];
// strip parameters
/* $pos = strpos($submit, '?');
if ($pos > 2) {
$submit = substr($submit, 0, $pos);
} */
} else {
$submit = NULL;
}
} else {
$submit = $_POST['submit'];
}
if (is_array($submit)) {
$submit = key($submit);
}
return strtolower($submit);
}
function form_create_input($fieldname, $label, $value) {
// TODO WIP
echo '<div class="mb-3">', "\n";
echo "</div>\n";
}
function form_create_text($fieldname, $label, $value) {
// TODO WIP
echo '<div class="mb-3">', "\n";
echo "</div>\n";
}
function form_create_check($fieldname, $label, $checked) {
// create single checkbox with assigned label
echo '<div class="mb-3">', "\n";
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '" id="', $fieldname, '"';
if ($checked) {
echo ' checked';
}
echo ">\n";
echo '<label for="', $fieldname, '">', $label, "</label>\n";
echo "</div>\n";
}
function form_create_select($fieldname, $label, $optlist, $selval=NULL, $multiple=FALSE) {
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '">', $label, "</label>\n";
echo '<select class="form-select" name="', $fieldname,'" id="', $fieldname, $multiple ? ' multiple' : '', '">', "\n";
foreach ($optlist as $k => $v) {
echo '<option value="', $k, '"';
if (isset($selval) and ($k == $selval)) {
echo ' selected';
}
echo '>', $v, "</option>\n";
}
echo "</select>\n";
echo "</div>\n";
}
function form_create_checks($fieldname, $label, $optlist, $selected = []) {
// create multiple combined checkboxes with title
echo '<fieldset class="mb-3">';
echo '<legend class="fs-6 mb-1 border-bottom pb-1">', $label, "</legend>\n";
echo '<div class="d-flex flex-wrap gap-3">';
foreach ($optlist as $k => $v) {
echo '<div class="form-check">';
$checked = in_array($k, $selected, true) ? ' checked' : '';
echo '<label class="form-check-label">';
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '[', $k, ']"', $checked, '>';
echo $v;
echo '</label>';
echo '</div>';
}
echo '</div>';
echo '</fieldset>';
}
// TODO DEPRECATED for touch multiple adjacent buttuns are not well suited.
function form_action_buttons($script, $id) {
echo "<td>";
echo '<a title="', _('View'), '" href="', $script, '?f=view&id=', $id, '"><i class="bi-eye"></i></a>', "\n";
echo '<a title="', _('Edit'), '" href="', $script, '?f=edit&id=', $id, '"><i class="bi-pencil"></i></a>', "\n";
echo "</td>\n";
}
function form_add_button($script, $id=NULL, $idname='id') {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<a href="', $script, '?f=add';
if (isset($id)) {
echo '&'.$idname.'='.$id;
}
echo '" class="btn btn-primary" role="button">', _('Add'), "</a>\n";
echo "</div>\n";
}
function form_view_buttons($script, $id, $backlink=NULL) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<a href="', $script, '?f=edit&id=', $id, '" class="btn btn-primary" role="button">', _('Edit'), "</a>\n";
echo '&nbsp;';
echo '<a href="', $script, '?f=del&id=', $id, '" class="btn btn-secondary" role="button">', _('Delete'), "</a>\n";
echo '&nbsp;';
echo '<a href="', $backlink ?? $script, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_new_buttons($script) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<button type="submit" name="submit[insert]" class="btn btn-primary">', _('Save'), "</button>\n";
echo '<a href="', $script, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_edit_buttons($script, $id) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<button type="submit" name="submit[update]" class="btn btn-primary">', _('Save'), "</button>\n";
echo '<a href="', $script, '?f=view&id=', $id, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_delete_buttons($script, $id, $token) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<form method="post" action="', $script, '">', "\n";
echo '<input type="hidden" name="id" value="', $id .'">', "\n";
echo '<input type="hidden" name="token" value="', $token, '">', "\n";
echo '<button type="submit" name="submit[delete]" class="btn btn-primary">', _('Delete'), "</button>\n";
echo '<a href="', $script, '?f=view&id=', $id, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</form>\n";
echo "</div>\n";
}
function form_tag_assignment($script, $id, $tags) {
echo '<tr>';
echo '<th>', _('Tags'), "</th>\n";
echo '<td>', $tags, '</td>';
echo "</tr>\n<tr>";
echo '<th>', _('Tag assignment'), "</th>\n";
echo '<td><form method="post" action="', $script, '">', "\n";
echo '<div class="form-floating">';
echo '<input type="hidden" name="id" value="', $id .'">', "\n";
echo '<label>', _('(Separate by comma)'), '</label>', "\n";
echo '<input type="text" maxlength="80" class="form-control" name="tagstring" value="', $tags, '">', "\n";
echo '<input type="submit">', "\n";
echo "</div></form></td></td>\n";
echo "</tr>";
}
function filter_create_select($fieldname, $label, $optlist, $selval=NULL, $multiple=FALSE) {
// - Wenn multiple gesetzt ist, muß selval ein array sein
// ansonsten ein einfacher String
/* if ($multiple) {
if (!is_array($selval)) {
}
} */
echo '<div class="d-flex flex-nowrap gap-2">', "\n";
echo '<label for="', $fieldname,'">', $label,'</label>', "\n";
echo '<select class="form-select" id="', $fieldname, '" name="', $fieldname, '"', $multiple ? ' multiple' : '', ">\n";
foreach ($optlist as $k => $v) {
echo '<option value="', $k, '"';
if ($k == $selval) {
echo ' selected';
}
echo '>', $v, '</option>', "\n";
}
echo "</select>\n";
echo "</div>";
}
function filter_create_checks($fieldname, $label, $optlist, $selected = []) {
// TODO WIP
echo '<fieldset class="mb-3">';
echo '<legend class="fs-6 mb-1 border-bottom pb-1">', $label, "</legend>\n";
echo '<div class="d-flex flex-wrap gap-3">';
foreach ($optlist as $k => $v) {
echo '<div class="form-check">';
$checked = in_array($k, $selected, true) ? ' checked' : '';
echo '<label class="form-check-label">';
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '[', $k, ']"', $checked, '>';
echo $v;
echo '</label>';
echo '</div>';
}
echo '</div>';
echo '</fieldset>';
}
// ========== FORMAT FUNCTIONS ================================================ // ========== FORMAT FUNCTIONS ================================================
function format_float($val, $decimals = 2, $suffix = '') { function format_float($val, $decimals = 2, $suffix = '') {
@@ -1308,6 +742,9 @@ function format_datetime($datetime, $seconds=false) {
} }
function format_color($color) { function format_color($color) {
if (empty($color)) {
return '';
}
$colstr = '<span style="'; $colstr = '<span style="';
$style = "padding:2px 4px;border-radius:4px;background-color:#".$color; $style = "padding:2px 4px;border-radius:4px;background-color:#".$color;
if (get_color_brightness($color) < 0.4) { if (get_color_brightness($color) < 0.4) {
@@ -1373,6 +810,9 @@ function format_measurement($n, $unit, $v1, $v2, $v3) {
function h($value, $br=false) { function h($value, $br=false) {
// escape value coming from db for safe html output // escape value coming from db for safe html output
// optional convert line breaks to <br> tags // optional convert line breaks to <br> tags
if (!isset($value)) {
return '';
}
$value = htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); $value = htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
return $br ? nl2br($value) : $value; return $br ? nl2br($value) : $value;
} }
@@ -1426,6 +866,71 @@ function pgettext($context, $msgid) {
} }
} }
function get_enum($enum) {
// translate and beautify enums
$lookup = array(
'NULL' => _('n/a'),
'active' => _('Active'),
'bad' => _('Bad'),
'box' => _('Box'),
'cable' => _('Cable'),
'cat' => _('Catamaran'),
'completed' => _('Completed'),
'closed' => _('Closed'),
'company' => _('Company'),
'day' => _('Day'),
'defect' => _('Defect'),
'deleted' => _('Deleted'),
'done' => _('Done'),
'drawing' => _('Drawing'),
'equipment' => _('Equipment'),
'estimated' => _('Estimated'),
'excellent' => _('Excellent'),
'fair' => _('Fair'),
'finished' => _('Finished'),
'fixed' => _('Fixed'),
'fuse' => _('Fuse'),
'generic' => _('Generic'),
'good' => _('Good'),
'high' => _('High'),
'historic' => _('Historic'),
'invoice' => _('Invoice'),
'locked' => _('Locked'),
'low' => _('Low'),
'manual' => _('Manual'),
'medium' => _('Medium'),
'missed' => _('Missed'),
'mono' => _('Monohull'),
'month' => _('Month'),
'new' => _('New'),
'none' => _('None'),
'normal' => _('Normal'),
'ongoing' => _('Ongoing'),
'open' => _('Open'),
'ordered' => _('Ordered'),
'paused' => _('Paused'),
'pending' => _('Pending'),
'picture' => _('Picture'),
'plan' => _('Planned'),
'precise' => _('Precise'),
'project' => _('Project'),
'quarter' => _('Quarter'),
'removed' => _('Removed'),
'repairable' => _('Repairable'),
'rough' => _('Rough'),
'skipped' => _('Skipped'),
'storage' => _('Storage'),
'task' => _('Task'),
'tri' => _('Trimaran'),
'unknown' => _('Unknown'),
'user' => _('User'),
'vessel' => _('Vessel'),
'waiting' => _('Waiting'),
'week' => _('Week'),
);
return $lookup[$enum] ?? $enum;
}
function get_color_brightness($color, $default=0.5) { function get_color_brightness($color, $default=0.5) {
// returns a value between 0 and 1 // returns a value between 0 and 1
// color is a 6 char hex string // color is a 6 char hex string
+26 -16
View File
@@ -9,10 +9,14 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
require 'lib/svg.inc'; require 'lib/svg.inc';
$pagetitle = _('Start'); $pagetitle = _('Start');
$opt_htype = db_load_enum('vessel', 'htype', true, true);
$opt_vtype = db_get_options(DD_VESSEL_TYPE);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
switch ($submit = form_get_action()) { switch ($submit = form_get_action()) {
@@ -46,6 +50,7 @@ switch ($submit = form_get_action()) {
$p[':model'] = gpc_get_string($_POST, 'model'); $p[':model'] = gpc_get_string($_POST, 'model');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
$id = db_exec_insert('vessel', $p); $id = db_exec_insert('vessel', $p);
db_set_revision('table', TBL_VESSEL);
// autoselect newly created vessel // autoselect newly created vessel
$sql = "UPDATE settings SET valint=? WHERE userid=? AND sno=1"; $sql = "UPDATE settings SET valint=? WHERE userid=? AND sno=1";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -64,9 +69,10 @@ switch ($submit = form_get_action()) {
break; break;
} }
$p[':vid'] = gpc_get_int($_POST, 'id'); $p[':vid'] = gpc_get_int($_POST, 'id');
// $p[':vtype'] = gpc_get_string($_POST, 'vtype'); $p[':htype'] = gpc_get_enum($_POST, 'htype', $opt_htype, 'mono');
$p[':vesselname'] = gpc_get_string($_POST, 'vesselname'); $p[':vtype'] = gpc_get_int($_POST, 'vtype', NULL, -1);
$p[':model'] = gpc_get_string($_POST, 'model'); $p[':vesselname'] = gpc_get_string($_POST, 'vesselname', 40);
$p[':model'] = gpc_get_string($_POST, 'model', 20);
$p[':loa'] = gpc_get_float($_POST, 'loa'); $p[':loa'] = gpc_get_float($_POST, 'loa');
$p[':lwl'] = gpc_get_float($_POST, 'lwl'); $p[':lwl'] = gpc_get_float($_POST, 'lwl');
$p[':beam'] = gpc_get_float($_POST, 'beam'); $p[':beam'] = gpc_get_float($_POST, 'beam');
@@ -76,15 +82,10 @@ switch ($submit = form_get_action()) {
$p[':ballast'] = gpc_get_int($_POST, 'ballast'); $p[':ballast'] = gpc_get_int($_POST, 'ballast');
$p[':beltpos_aft'] = gpc_get_float($_POST, 'beltpos_aft'); $p[':beltpos_aft'] = gpc_get_float($_POST, 'beltpos_aft');
$p[':beltpos_bow'] = gpc_get_float($_POST, 'beltpos_bow'); $p[':beltpos_bow'] = gpc_get_float($_POST, 'beltpos_bow');
$p[':shapefile'] = gpc_get_string($_POST, 'shapefile'); $p[':shapefile'] = gpc_get_string($_POST, 'shapefile', 40, NULL, '-1');
if ($p[':shapefile'] == '-1') { $p[':shipyard'] = gpc_get_int($_POST, 'shipyard', NULL, -1);
$p[':shapefile'] = NULL;
}
$p[':shipyard'] = gpc_get_int($_POST, 'shipyard');
if ($p[':shipyard'] == '-1') {
$p[':shipyard'] = NULL;
}
$p[':year_built'] = gpc_get_int($_POST, 'year_built'); $p[':year_built'] = gpc_get_int($_POST, 'year_built');
$p[':hull_number'] = gpc_get_string($_POST, 'hull_number', 20);
$p[':sid_default'] = gpc_get_uint($_POST, 'sid'); $p[':sid_default'] = gpc_get_uint($_POST, 'sid');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('vessel', $p, 'vid'); db_exec_update('vessel', $p, 'vid');
@@ -180,7 +181,7 @@ if ($vessel->shipyard && $vessel->shipyard > 0) {
} }
if (strlen($vessel->remarks) > 0) { if (strlen($vessel->remarks) > 0) {
echo h($vessel->remarks, br:true); echo ' ', h($vessel->remarks, br:true);
} }
echo "</div>\n"; echo "</div>\n";
echo "</div>\n"; // row 2 echo "</div>\n"; // row 2
@@ -351,7 +352,7 @@ if ($user->role == 'captain') {
// Storage: 0 - default, 1 - tank // Storage: 0 - default, 1 - tank
// $stype = [ 0 => _('Default'), 1 => _('Tank')]; // $stype = [ 0 => _('Default'), 1 => _('Tank')];
$stype = db_get_options(3); $stype = db_get_options(DD_STORAGE_TYPE);
$sql = "SELECT stype, COUNT(stype) " $sql = "SELECT stype, COUNT(stype) "
. "FROM storage " . "FROM storage "
. "WHERE vid=? " . "WHERE vid=? "
@@ -531,9 +532,9 @@ foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$opt_shipyard[$row[0]] = $row[1]; $opt_shipyard[$row[0]] = $row[1];
} }
$sql = "SELECT vesselname, vtype, model, loa, lwl, beam, draught, draught_min," $sql = "SELECT vesselname, vtype, htype, model, loa, lwl, beam, draught, draught_min,"
. " displacement, ballast, beltpos_aft, beltpos_bow, shapefile," . " displacement, ballast, beltpos_aft, beltpos_bow, shapefile,"
. " shipyard, year_built, sid_default, remarks " . " shipyard, year_built, hull_number, sid_default, remarks "
. "FROM vessel " . "FROM vessel "
. "WHERE vid=?"; . "WHERE vid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -551,6 +552,9 @@ $vessel = $sth->fetch(PDO::FETCH_OBJ);
<label for="model" class="form-label"><?=_('Model')?></label> <label for="model" class="form-label"><?=_('Model')?></label>
<input type="text" class="form-control" id="model" name="model" value="<?=$vessel->model ?>"> <input type="text" class="form-control" id="model" name="model" value="<?=$vessel->model ?>">
</div> </div>
<?php
form_create_select('vtype', _('Vessel type'), $g_opt_unknown + $opt_vtype, $vessel->vtype);
?>
<div class="mb-3"> <div class="mb-3">
<label for="year_built" class="form-label"><?=_('Year built')?></label> <label for="year_built" class="form-label"><?=_('Year built')?></label>
<input type="number" class="form-control" id="year_built" name="year_built" value="<?=$vessel->year_built ?>"> <input type="number" class="form-control" id="year_built" name="year_built" value="<?=$vessel->year_built ?>">
@@ -596,10 +600,16 @@ $vessel = $sth->fetch(PDO::FETCH_OBJ);
<label for="shapefile" class="form-label"><?=_('Shapefile')?></label> <label for="shapefile" class="form-label"><?=_('Shapefile')?></label>
<input type="text" class="form-control" id="shapefile" name="shapefile" value="<?=$vessel->shapefile ?>"> <input type="text" class="form-control" id="shapefile" name="shapefile" value="<?=$vessel->shapefile ?>">
</div> */ </div> */
form_create_select('htype', _('Hull type'), $opt_htype, $vessel->htype);
form_create_select('shapefile', _('Shape file'), $opt_shapefiles, $vessel->shapefile); form_create_select('shapefile', _('Shape file'), $opt_shapefiles, $vessel->shapefile);
form_create_select('shipyard', _('Shipyard'), $opt_shipyard, $vessel->shipyard); form_create_select('shipyard', _('Shipyard'), $opt_shipyard, $vessel->shipyard);
?>
<div class="mb-3">
<label for="hull_number" class="form-label"><?=_('Hull number')?></label>
<input type="text" class="form-control" id="hull_number" name="hull_number" value="<?=$vessel->hull_number ?>">
</div>
<?php
form_create_select('sid', _('Default Storage'), $g_opt_none + $opt_storage, $vessel->sid_default); form_create_select('sid', _('Default Storage'), $g_opt_none + $opt_storage, $vessel->sid_default);
?> ?>
<div class="mb-3"> <div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label> <label for="remarks" class="form-label"><?=_('Remarks')?></label>
+42 -45
View File
@@ -9,16 +9,18 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle=_('Inventory'); $pagetitle=_('Inventory');
$id = gpc_get_int($_REQUEST, 'id', 0); $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_storage = db_get_opt_storage($user->vid);
$opt_box = db_get_opt_box($user->vid); $opt_box = db_get_opt_box($user->vid);
$opt_invcond = db_load_enum('inventory', 'invcond', true, true); $opt_invcond = db_load_enum('inventory', 'invcond', true, true);
$opt_equipment = db_get_opt_equip($user->vid, [-1 => _('&horbar; none &horbar;')]); $opt_equipment = db_get_opt_equip($user->vid, [-1 => _('&horbar; none &horbar;')]);
$opt_icat = db_get_options(13); $opt_icat = db_get_options(DD_INVENTORY_CATEGORY);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -156,7 +158,7 @@ if (strlen($flt->cond) > 2 ) {
$p[':invcond'] = $flt->cond; $p[':invcond'] = $flt->cond;
} }
if (strlen($flt->txt) > 1) { if (strlen($flt->txt) > 1) {
$w[] = 'invname LIKE :txt'; $w[] = 'invname LIKE :txt OR i.remarks LIKE :txt';
$p[':txt'] = '%'.$flt->txt.'%'; $p[':txt'] = '%'.$flt->txt.'%';
} }
$where = join(' AND ', $w); $where = join(' AND ', $w);
@@ -180,10 +182,12 @@ $page = gpc_get_int($_REQUEST, 'p', 1);
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp); $rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
$lastpage = ceil($numrows/$rows_pp); $lastpage = ceil($numrows/$rows_pp);
$sql = "SELECT i.invid, i.invname, i.number, i.invcond, i.eid, s.sname AS container " $sql = "SELECT i.invid, i.invname, i.number, i.invcond, i.eid, s.sname AS container,"
. " IF(CHAR_LENGTH(i.remarks)>40, CONCAT(LEFT(i.remarks, 40), '&hellip;'), i.remarks) AS remarks "
. "FROM inventory AS i JOIN storage AS s ON (i.conttype='storage' AND i.sid=s.sid)"; . "FROM inventory AS i JOIN storage AS s ON (i.conttype='storage' AND i.sid=s.sid)";
$sql .= ' WHERE ' . $where; $sql .= ' WHERE ' . $where;
$sql .= " UNION SELECT i.invid, i.invname, i.number, i.invcond, i.eid, b.label AS container " $sql .= " UNION SELECT i.invid, i.invname, i.number, i.invcond, i.eid, b.label AS container,"
. " IF(CHAR_LENGTH(i.remarks)>40, CONCAT(LEFT(i.remarks, 40), '&hellip;'), i.remarks) AS remarks "
. "FROM inventory AS i JOIN box AS b ON (i.conttype='box' AND i.boxid=b.boxid) " . "FROM inventory AS i JOIN box AS b ON (i.conttype='box' AND i.boxid=b.boxid) "
. " JOIN storage AS s ON (b.sid=s.sid) "; . " JOIN storage AS s ON (b.sid=s.sid) ";
$sql .= ' WHERE ' . $where; $sql .= ' WHERE ' . $where;
@@ -218,47 +222,16 @@ $opt_special = array(
// - selection for storage // - selection for storage
// - selection for box // - selection for box
// page specific filter end // page specific filter end
filter_create_select('flt_stor', _('Storage'), $g_opt_all + $g_opt_none + $opt_storage, $flt->stor);
filter_create_select('flt_cond', _('Condition'), $g_opt_all + $opt_invcond, $flt->cond);
filter_create_text('flt_text', _('Text'), $flt->txt, 15, 30);
?> ?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_stor"><?=_('Storage')?></label>
<select class="form-select" id="flt_stor" name="flt_stor">
<?php
foreach ($opt_special + $opt_storage as $k => $v) {
echo '<option value="', $k,'"';
if ($k == $flt->stor) {
echo ' selected';
}
echo '>', $v, '</option>';
}
?>
</select>
</div> </div>
<div class="d-flex flex-nowrap gap-2"> <div class="card-footer">
<label for="flt_cond"><?=_('Condition')?></label> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<select class="form-select" id="flt_cond" name="flt_cond"> <button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
<?php </div>
$opt_special = array(
-2 => _('&horbar; all &horbar;'),
);
foreach ($opt_special + $opt_invcond as $k => $v) {
echo '<option value="', h($k), '"';
if ($k == $flt->cond) {
echo ' selected';
}
echo '>', $v, '</option>';
}
?>
</select>
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=h($flt->txt)?>">
</div>
</div>
<div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
</div>
</div> </div>
</form> </form>
@@ -275,6 +248,7 @@ echo "<th>", _('Name'), "</th>\n";
echo "<th>", _('Container'), "</th>\n"; echo "<th>", _('Container'), "</th>\n";
echo "<th>", _('Number'), "</th>\n"; echo "<th>", _('Number'), "</th>\n";
echo "<th>", _('Condition'), "</th>\n"; echo "<th>", _('Condition'), "</th>\n";
echo "<th>", _('Remarks'), "</th>\n";
echo "<th>", _('Tags'), "</th>\n"; echo "<th>", _('Tags'), "</th>\n";
echo "<td></td>\n"; echo "<td></td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -293,6 +267,7 @@ foreach ($res as $row) {
echo "<td>", $row['container'], "</td>\n"; echo "<td>", $row['container'], "</td>\n";
echo "<td>", $row['number'], "</td>\n"; echo "<td>", $row['number'], "</td>\n";
echo "<td>", ($opt_invcond[$row['invcond']] ?? ''), "</td>\n"; echo "<td>", ($opt_invcond[$row['invcond']] ?? ''), "</td>\n";
echo "<td>", $row['remarks'], "</td>\n";
echo "<td>", _('No tags assigned'), "</td>\n"; echo "<td>", _('No tags assigned'), "</td>\n";
// Edit current record button // Edit current record button
echo "<td>"; echo "<td>";
@@ -301,7 +276,7 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
table_rec_summary($i0, $i, $numrows, 7); table_rec_summary($i0, $i, $numrows, 8);
echo "</table>\n"; echo "</table>\n";
echo $pagination; echo $pagination;
@@ -314,6 +289,10 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Inventory'), "</h2>\n"; echo '<h2>', _('Add Inventory'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<?php
form_create_text('invname', _('Name'), 80, NULL, TRUE, TRUE);
form_create_numeric('number', _('Number'), 0, 9999, 1);
/*
<div class="mb-3"> <div class="mb-3">
<label for="invname" class="form-label"><?=_('Name')?></label> <label for="invname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="invname" name="invname" autofocus> <input type="text" class="form-control" id="invname" name="invname" autofocus>
@@ -329,7 +308,9 @@ echo '<h2>', _('Add Inventory'), "</h2>\n";
<option value="box"><?=_('Box')?></option> <option value="box"><?=_('Box')?></option>
</select> </select>
</div> </div>
<?php */
form_create_select('conttype', _('Container type'), $opt_conttype, 'storage');
// load current filter setting for storage default setting // load current filter setting for storage default setting
$flt = db_get_filter($user->id, 201, ['stor','cond','txt']); $flt = db_get_filter($user->id, 201, ['stor','cond','txt']);
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $flt->stor); form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $flt->stor);
@@ -406,6 +387,20 @@ echo "<tr><th>", _('Remarks'), "</th><td>", h($inventory->remarks, br:true), "</
$tags = db_load_taglist('inv', $id); $tags = db_load_taglist('inv', $id);
form_tag_assignment($g_scriptname, $id, $tags); form_tag_assignment($g_scriptname, $id, $tags);
// Custom properties
$sql = "SELECT keyname, valstr, valint FROM property WHERE objtype='inv' AND objid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
foreach ($sth->fetchAll() as $row) {
echo "<tr><th>{$row['keyname']}</th><td>";
if (isset($row['valstr'])) {
echo $row['valstr'];
} else {
echo $row['valint'];
}
echo "</td>\n";
}
echo "</table>\n"; echo "</table>\n";
form_view_buttons($g_scriptname, $id); form_view_buttons($g_scriptname, $id);
@@ -442,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('conttype', _('Container type'), $opt_conttype, $inventory->conttype);
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $inventory->sid); 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_select('boxid', _('Box'), $g_opt_none + $opt_box, $inventory->boxid);
// form_create_numeric
?> ?>
<div class="mb-3"> <div class="mb-3">
<label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label> <label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label>
+379
View File
@@ -8,6 +8,92 @@
*/ */
// ========== GENERIC FUNCTIONS ===============================================
function db_exec_insert($table, $params) {
// $params must have keys corresponding to table fields prefixed with ':'
// e.g. $param[':field']
global $pdo;
global $g_error;
$keys = array_keys($params);
$fields = join(', ', array_map(function($s) { return ltrim($s, ':'); }, $keys));
$pnames = join(', ', $keys);
$sql = "INSERT INTO $table ($fields) VALUES ($pnames)";
// $sth = $pdo->prepare("INSERT INTO $table ($fields) VALUES ($pnames)");
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return false;
}
return $pdo->LastInsertId();
}
function db_exec_update($table, $params, $pk) {
// primary key can be a single field name or multiple fields: $pk is an array
global $pdo;
global $g_error;
// remove primary key fields from list of fields to update
if (is_array($pk)) {
if (count($pk) == 1) {
$pk = $pk[0];
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
} else {
$pkparams = array_map(fn($value) => ':' . $value, $pk);
$fields = array_diff_key($params, array_flip($pkparams));
$where = join(' AND ', array_map(fn($s) => "$s=:$s", $pk));
}
} else {
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
}
$fieldlist = join(', ', array_map(fn($s) => ltrim($s, ':') . '=' . $s, array_keys($fields)));
$sql = "UPDATE $table SET $fieldlist WHERE $where";
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return false;
}
return true;
}
function db_exec_delete($table, $condition, $params) {
// WIP untested!
// condition contains the where part of the sql statement
// params are values for placeholders in condition
// returns the number of deleted records
global $pdo;
global $g_error;
// convert params to array if single value is given
if (!is_array($params)) {
$params = [$params];
}
$sql = "DELETE FROM $table";
if (!empty($condition)) {
$sql .= ' WHERE ' . $condition;
}
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
} catch (PDOexception $e) {
$g_error->Add('SQL-Error: '. $e->getMessage());
$g_error->Add($sql);
$g_error->Add(print_r($params, true));
return -1;
}
return $sth->rowCount();
}
function db_get_setting($sno, $userid, $autocreate=false, $default=NULL) { function db_get_setting($sno, $userid, $autocreate=false, $default=NULL) {
global $pdo; global $pdo;
global $g_error; global $g_error;
@@ -36,6 +122,299 @@ function db_get_setting($sno, $userid, $autocreate=false, $default=NULL) {
return $row; return $row;
} }
function db_get_ddtext($ddid, $ddval) {
// returns single value for dropdown
global $pdo;
global $g_error;
$sql = "SELECT ddtext FROM dropdown WHERE ddid=? AND ddval=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$ddid, $ddval]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
return '#err';
}
return $sth->fetchColumn();
}
function db_set_revision($revtype, $revid) {
global $pdo;
global $g_error;
$sql = "INSERT INTO revision (revtype, revid, changed) "
. "VALUES (?, ?, NOW()) "
. "ON DUPLICATE KEY UPDATE changed = NOW()";
try {
$sth = $pdo->prepare($sql);
$sth->execute([$revtype, $revid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
}
// ========== OPTION FUNCTIONS ================================================
// Functions to get option lists (key/value)
function db_get_options($ddid, $orderby = '', $short = False, $default = NULL) {
// returns list for dropdown
// if short is set the short value will be returned
global $pdo;
$list = array();
if ($default != NULL) {
$list[0] = $default;
}
if ($short) {
$sql = "SELECT ddval, ddshort";
} else {
$sql = "SELECT ddval, ddtext";
}
$sql .= " FROM dropdown WHERE ddid=?";
if ($orderby == 'ddtext') {
$sql .= ' ORDER BY ddtext';
} elseif ($orderby == 'sort') {
$sql .= ' ORDER BY sort';
} else {
$sql .= ' ORDER BY ddval';
}
$sth = $pdo->prepare($sql);
$sth->execute([$ddid]);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_vessel() {
global $pdo;
$list = array();
$sth = $pdo->query("SELECT vid, vesselname, model FROM vessel ORDER BY vid");
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_storage($vid) {
global $pdo;
global $g_error;
$list = array();
// exclude storage type "tank" from list
$sql = "SELECT sid, sname FROM storage WHERE vid=? AND stype<>1 ORDER BY sname";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_box($vid, $exclude=[]) {
global $pdo;
global $g_error;
$list = array();
$sql = "SELECT boxid, label, content "
. "FROM box INNER JOIN storage USING (sid) "
. "WHERE vid=? "
. "ORDER BY label";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
if (! in_array($rec[0], $exclude)) {
$list[$rec[0]] = h($rec[1]) . ($rec[2] ? ' - '. h($rec[2]) : '');
}
}
return $list;
}
function db_get_opt_equip($vid, $default=NULL, $exclude=[]) {
global $pdo;
global $g_error;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT eid, ename FROM equipment WHERE vid=? ORDER BY ename";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
if (! in_array($rec[0], $exclude)) {
$list[$rec[0]] = h($rec[1]);
}
}
return $list;
}
function db_get_opt_manuf($default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT compid, compname FROM company WHERE comptype=2 ORDER BY compname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_supp($default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT compid, compname FROM company WHERE comptype=1 ORDER BY compname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_user($default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT userid, displayname FROM user WHERE userid>0 ORDER BY displayname";
$sth = $pdo->query($sql);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
function db_get_opt_proj($vid, $exclude=[], $default=NULL) {
// exclude is a list of project states
global $pdo;
global $g_error;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT projid, projname FROM project WHERE vid=?";
$where = [];
foreach ($exclude as $excl) {
$where[] = "NOT FIND_IN_SET('$excl',projstate)";
}
if (! empty($where)) {
$sql .= ' AND '. implode(' AND ', $where);
}
$sql .= " ORDER BY projname";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$vid]);
} catch(PDOException $e) {
$g_error->Add($e->getMessage());
}
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$list[$rec[0]] = h($rec[1]);
}
return $list;
}
function db_get_opt_cable($vid, $default=NULL) {
global $pdo;
if (isset($default)) {
$list = $default;
} else {
$list = array();
}
$sql = "SELECT cableid, cablename FROM cable WHERE vid=? ORDER BY cablename";
$sth = $pdo->prepare($sql);
$sth->execute([$vid]);
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $row) {
$list[$row[0]] = h($row[1]);
}
return $list;
}
// ========== FILTER FUNCTIONS ================================================
function db_get_filter($user, $sno, $fields = []) {
// if fields supplied empting missing field are created
global $pdo;
global $g_warning;
$flt = new stdClass();
$sth = $pdo->prepare("SELECT valstr FROM settings WHERE userid=? AND sno=?");
try {
$sth->execute([$user, $sno]);
$json = $sth->fetchColumn();
if ($json === false) {
// no settings record. create empty one for later updates
$sth = $pdo->prepare("INSERT INTO settings (userid, sno, valstr) VALUES (?, ?, '{}')");
$sth->execute([$user, $sno]);
} else {
$flt = json_decode($json);
}
// create missing fields
foreach ($fields as $f) {
if (!property_exists($flt, $f)) {
$flt->$f = null;
}
}
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->PrintOut();
}
return $flt;
}
function db_clear_filter($sno) {
global $user;
global $pdo;
$sql = "DELETE FROM settings WHERE userid=? AND sno=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([$user->id, $sno]);
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->Add($sql);
$g_warning->Add('Setting: ', $sno);
return false;
}
return true;
}
function db_save_filter($flt, $sno) {
global $user;
global $pdo;
global $g_warning;
$sql = "UPDATE settings SET valstr=? WHERE userid=? AND sno=?";
$sth = $pdo->prepare($sql);
try {
$sth->execute([json_encode($flt), $user->id, $sno]);
} catch (PDOexception $e) {
$g_warning->Add('SQL-Error: '. $e->getMessage());
$g_warning->Add($sql);
$g_warning->Add(print_r($flt, true));
$g_warning->Add('Setting: ', $sno);
return false;
}
return true;
}
// ========== LOCKING FUNCTIONS ===============================================
function db_lock_acquire($table, $key, $userid) { function db_lock_acquire($table, $key, $userid) {
global $pdo; global $pdo;
$token = bin2hex(random_bytes(8)); $token = bin2hex(random_bytes(8));
+302
View File
@@ -0,0 +1,302 @@
<?php
/******************************************************************************
* YMS - Yacht Management Software
* Copyright (C) 2024-2026 Thomas Hooge
*
* SPDX-License-Identifier: WTFPL
******************************************************************************
TODO implement datalist
tel and/or email?
autocomplete?
*/
// ========== FORM FUNCTIONS ==================================================
function form_get_action() {
if (!isset($_POST['submit'])) {
if (isset($_GET['f'])) {
$submit = $_GET['f'];
// strip parameters
/* $pos = strpos($submit, '?');
if ($pos > 2) {
$submit = substr($submit, 0, $pos);
} */
} else {
$submit = NULL;
}
} else {
$submit = $_POST['submit'];
}
if (is_array($submit)) {
$submit = key($submit);
}
return strtolower($submit);
}
function form_tag_assignment($script, $id, $tags) {
echo '<tr>';
echo '<th>', _('Tags'), "</th>\n";
echo '<td>', $tags, '</td>';
echo "</tr>\n<tr>";
echo '<th>', _('Tag assignment'), "</th>\n";
echo '<td><form method="post" action="', $script, '">', "\n";
echo '<div class="form-floating">';
echo '<input type="hidden" name="id" value="', $id .'">', "\n";
echo '<label>', _('(Separate by comma)'), '</label>', "\n";
echo '<input type="text" maxlength="80" class="form-control" name="tagstring" value="', $tags, '">', "\n";
echo '<input type="submit">', "\n";
echo "</div></form></td></td>\n";
echo "</tr>";
}
// ========== FORM FIELDS =====================================================
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 '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
echo '<input type="number" class="form-control" id="', $fieldname, '" name = "', $fieldname, '"';
if ($value !== NULL) {
echo ' value="', h($value), '"';
}
if ($min !== NULL) {
echo ' min="', $min, '"';
}
if ($max !== NULL) {
echo ' max="', $max, '"';
}
if ($step !== NULL) {
echo ' step="', $step, '"';
}
if ($required === TRUE) {
echo ' required';
}
if ($autofocus === TRUE) {
echo ' autofocus';
}
echo ">\n";
echo "</div>\n";
}
function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL, $required=FALSE, $autofocus=FALSE) {
// create generic text entry with assigned label
// TODO errortext
// perhaps support inputmode="numeric", pattern="[0-9]{1,3}"
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
echo '<input type="text" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
if ($maxlen !== NULL) {
echo ' maxlength="', $maxlen, '"';
}
if ($value !== NULL) {
echo ' value="', h($value), '"';
}
if ($required === TRUE) {
echo ' required';
}
if ($autofocus === TRUE) {
echo ' autofocus';
}
echo ">\n";
echo "</div>\n";
}
function form_create_textarea($fieldname, $label, $rows=3, $maxlen=NULL, $value=NULL) {
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
echo '<textarea class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
echo ' rows="', $rows, '"';
if ($maxlen !== NULL) {
echo ' maxlength="', $maxlen, '"';
}
echo '>';
if ($value !== NULL) {
echo h($value);
}
echo "</textarea>\n";
echo "</div>\n";
}
function form_create_date($fieldname, $label, $value=NULL, $mindate=NULL, $maxdate=NULL) {
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
echo '<input type="date" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
if ($min !== NULL) {
echo ' min="', $mindate, '"';
}
if ($max !== NULL) {
echo ' max="', $maxdate, '"';
}
if ($value !== NULL) {
echo ' value="', h($value), '"';
}
echo ">\n";
echo "</div>\n";
}
function form_create_color($fieldname, $label, $value=NULL) {
// value has to be 6char hex
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
echo '<input type="color" class="form-control form-control-color" id="', $fieldname, '" name="', $fieldname, '"';
if ($value !== NULL) {
echo ' value="#', $value, '"';
}
echo ">\n";
echo "</div>\n";
}
function form_create_select($fieldname, $label, $optlist, $selval=NULL, $multiple=FALSE) {
echo '<div class="mb-3">', "\n";
echo '<label for="', $fieldname, '">', $label, "</label>\n";
echo '<select class="form-select" name="', $fieldname,'" id="', $fieldname, $multiple ? ' multiple' : '', '">', "\n";
foreach ($optlist as $k => $v) {
echo '<option value="', $k, '"';
if (isset($selval) and ($k == $selval)) {
echo ' selected';
}
echo '>', $v, "</option>\n";
}
echo "</select>\n";
echo "</div>\n";
}
function form_create_option($fieldname, $label) {
// TBD
}
function form_create_check($fieldname, $label, $checked) {
// create single checkbox with assigned label
echo '<div class="mb-3">', "\n";
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '" id="', $fieldname, '"';
if ($checked) {
echo ' checked';
}
echo ">\n";
echo '<label for="', $fieldname, '">', $label, "</label>\n";
echo "</div>\n";
}
function form_create_checks($fieldname, $label, $optlist, $selected = []) {
// create multiple combined checkboxes with title
echo '<fieldset class="mb-3">', "\n";
echo '<legend class="fs-6 mb-1 border-bottom pb-1">', $label, "</legend>\n";
echo '<div class="d-flex flex-wrap gap-3">';
foreach ($optlist as $k => $v) {
echo '<div class="form-check">', "\n";
$checked = in_array($k, $selected, true) ? ' checked' : '';
echo '<label class="form-check-label">';
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '[', $k, ']"', $checked, '>';
echo $v;
echo '</label>';
echo "</div>\n";
}
echo "</div>\n";
echo "</fieldset>\n";
}
// ========== FORM BUTTONS ====================================================
function form_add_button($script, $id=NULL, $idname='id') {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<a href="', $script, '?f=add';
if (isset($id)) {
echo '&'.$idname.'='.$id;
}
echo '" class="btn btn-primary" role="button">', _('Add'), "</a>\n";
echo "</div>\n";
}
function form_view_buttons($script, $id, $backlink=NULL) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<a href="', $script, '?f=edit&id=', $id, '" class="btn btn-primary" role="button">', _('Edit'), "</a>\n";
echo '&nbsp;';
echo '<a href="', $script, '?f=del&id=', $id, '" class="btn btn-secondary" role="button">', _('Delete'), "</a>\n";
echo '&nbsp;';
echo '<a href="', $backlink ?? $script, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_new_buttons($script) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<button type="submit" name="submit[insert]" class="btn btn-primary">', _('Save'), "</button>\n";
echo '<a href="', $script, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_edit_buttons($script, $id) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<button type="submit" name="submit[update]" class="btn btn-primary">', _('Save'), "</button>\n";
echo '<a href="', $script, '?f=view&id=', $id, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</div>\n";
}
function form_delete_buttons($script, $id, $token) {
echo '<div class="container-fluid px-0 my-3">', "\n";
echo '<form method="post" action="', $script, '">', "\n";
echo '<input type="hidden" name="id" value="', $id .'">', "\n";
echo '<input type="hidden" name="token" value="', $token, '">', "\n";
echo '<button type="submit" name="submit[delete]" class="btn btn-primary">', _('Delete'), "</button>\n";
echo '<a href="', $script, '?f=view&id=', $id, '" class="btn btn-secondary">', _('Back'), "</a>\n";
echo "</form>\n";
echo "</div>\n";
}
// ========== FILTER FIELDS ===================================================
function filter_create_text($fieldname, $label, $value, $size=NULL, $maxlength=NULL) {
echo '<div class="d-flex flex-nowrap gap-2 align-items-start">', "\n";
echo '<label for="', $fieldname,'">', $label,'</label>', "\n";
echo '<input class="form-control" type="text" name="', $fieldname, '"';
if (isset($size)) {
echo ' size="', $size,'"';
}
if (isset($maxlength)) {
echo ' maxlength="', $maxlength, '"';
}
echo ' value="', h($value), '">', "\n";
echo "</div>\n";
}
function filter_create_select($fieldname, $label, $optlist, $selval=NULL, $multiple=FALSE) {
// - Wenn multiple gesetzt ist, muß selval ein array sein
// ansonsten ein einfacher String
/* if ($multiple) {
if (!is_array($selval)) {
}
} */
echo '<div class="d-flex flex-nowrap gap-2 align-items-start">', "\n";
echo '<label for="', $fieldname,'">', $label,'</label>', "\n";
echo '<select class="form-select" id="', $fieldname, '" name="', $fieldname, '"', $multiple ? ' multiple' : '', ">\n";
foreach ($optlist as $k => $v) {
echo '<option value="', $k, '"';
if ($k == $selval) {
echo ' selected';
}
echo '>', $v, '</option>', "\n";
}
echo "</select>\n";
echo "</div>\n";
}
function filter_create_checks($fieldname, $label, $optlist, $selected = []) {
// TODO WIP
echo '<fieldset class="mb-3">', "\n";
echo '<legend class="fs-6 mb-1 border-bottom pb-1">', $label, "</legend>\n";
echo '<div class="d-flex flex-wrap gap-3">', "\n";
foreach ($optlist as $k => $v) {
echo '<div class="form-check">', "\n";
$checked = in_array($k, $selected, true) ? ' checked' : '';
echo '<label class="form-check-label">', "\n";
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '[', $k, ']"', $checked, ">\n";
echo $v, "\n";
echo "</label>\n";
echo "</div>\n";
}
echo "</div>\n";
echo "</fieldset>\n";
}
+19 -6
View File
@@ -10,24 +10,37 @@
// ========== GPC FUNCTIONS =================================================== // ========== GPC FUNCTIONS ===================================================
function gpc_get_string(&$GPC, $varname, $maxlen = NULL, $default = NULL) { function gpc_get_string(&$GPC, $varname, $maxlen = NULL, $default = NULL, $nullvals = []) {
// TODO Parameter nullval: single value or array of values which considered as null // Parameter nullvals: single value or array of values which considered as null
// Default value for nullval is "-1"
if (!isset($GPC[$varname]) || (strlen(trim($GPC[$varname])) == 0)) { if (!isset($GPC[$varname]) || (strlen(trim($GPC[$varname])) == 0)) {
return $default; return $default;
} }
$s = trim($GPC[$varname]); $s = trim($GPC[$varname]);
if (isset($maxlen)) { if (isset($maxlen)) {
return substr($s, 0, $maxlen); $s = substr($s, 0, $maxlen);
}
if (!is_array($nullvals)) {
$nullvals = [$nullvals];
}
if (in_array($s, $nullvals, true)) {
return NULL;
} }
return $s; return $s;
} }
function gpc_get_int(&$GPC, $varname, $default = NULL) { function gpc_get_int(&$GPC, $varname, $default = NULL, $nullvals = []) {
// Parameter nullvals: single value or array of values which considered as null
if (!isset($GPC[$varname]) || $GPC[$varname] === '') { if (!isset($GPC[$varname]) || $GPC[$varname] === '') {
return $default; return $default;
} }
return (int)$GPC[$varname]; $value = (int)$GPC[$varname];
if (!is_array($nullvals)) {
$nullvals = [$nullvals];
}
if (in_array($value, $nullvals, true)) {
return NULL;
}
return $value;
} }
function gpc_get_uint(&$GPC, $varname, $default = NULL) { function gpc_get_uint(&$GPC, $varname, $default = NULL) {
+759 -603
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
+120 -31
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Maintenance'); $pagetitle = _('Maintenance');
@@ -16,6 +17,23 @@ $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_equipment = db_get_opt_equip($user->vid); $opt_equipment = db_get_opt_equip($user->vid);
$opt_state = db_load_enum('maintenance', 'maintstate', true, true); $opt_state = db_load_enum('maintenance', 'maintstate', true, true);
$opt_planprec = db_load_enum('maintenance', 'plan_precision', true, true);
// series definition is derived from first maintenance record by plan_date
$opt_series = array();
$sql = "SELECT series, activities "
. "FROM ("
. "SELECT series, activities, "
. "ROW_NUMBER() OVER (PARTITION BY series ORDER BY plan_date ASC) AS n "
. "FROM maintenance "
. "WHERE series>0"
. ") AS ranked "
. "WHERE n=1";
$sth = $pdo->query($sql);
$res = $sth->fetchAll();
foreach ($res as $row) {
$opt_series[$row['series']] = $row['activities'];
}
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -31,13 +49,18 @@ switch ($submit = form_get_action()) {
case 'filter': case 'filter':
$flt = array(); $flt = array();
$flt['equip'] = gpc_get_int($_POST, 'flt_equip'); $flt['equip'] = gpc_get_int($_POST, 'flt_equip');
$flt['series'] = gpc_get_int($_POST, 'flt_series');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt');
$allowed = db_load_enum('maintenance', 'maintstate');
$flt['status'] = gpc_get_set($_POST, 'flt_status', $allowed);
db_save_filter($flt, 204); db_save_filter($flt, 204);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
case 'freset': case 'freset':
db_clear_filter(204); // set status checkboxes to useful defaults
$flt = array('status' => ['new','plan','ongoing']);
db_save_filter($flt, 204);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
@@ -53,11 +76,33 @@ switch ($submit = form_get_action()) {
$p[':maintid'] = $id; $p[':maintid'] = $id;
$p[':eid'] = gpc_get_int($_POST, 'eid'); $p[':eid'] = gpc_get_int($_POST, 'eid');
$p[':activities'] = gpc_get_string($_POST, 'activities', 80); $p[':activities'] = gpc_get_string($_POST, 'activities', 80);
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $series = gpc_get_int($_POST, 'series');
$p[':series'] = gpc_get_int($_POST, 'series'); if ($series == -3) {
// new series number by automatic
// TODO generic db function to create a new int val in column
$sql = "SELECT MIN(n.series) AS next_series "
. "FROM ("
. "SELECT 1 AS series "
. "UNION ALL "
. "SELECT DISTINCT series + 1 "
. "FROM maintenance "
. "WHERE series > 0"
. ") AS n "
. "LEFT JOIN maintenance m ON m.series=n.series "
. "WHERE m.series IS NULL";
$p[':series'] = $pdo->query($sql)->fetchColumn();
} else if ($series <= 0) {
$p[':series'] = NULL;
} else {
$p[':series'] = $series;
}
$p[':plan_date'] = gpc_get_date($_POST, 'plan_date'); $p[':plan_date'] = gpc_get_date($_POST, 'plan_date');
$p[':plan_precision'] = gpc_get_enum($_POST, 'plan_precision', array_keys($opt_planprec));
$p[':interval_hours'] = gpc_get_int($_POST, 'interval_hours');
$p[':last_hours'] = gpc_get_int($_POST, 'last_hours');
$p[':completion_date'] = gpc_get_date($_POST, 'completion_date'); $p[':completion_date'] = gpc_get_date($_POST, 'completion_date');
$p[':maintstate'] = gpc_get_string($_POST, 'maintstate'); $p[':maintstate'] = gpc_get_string($_POST, 'maintstate');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('maintenance', $p, 'maintid'); db_exec_update('maintenance', $p, 'maintid');
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -82,13 +127,14 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle); page_caption_search($pagetitle);
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 204, ['equip','txt']); $flt = db_get_filter($user->id, 204, ['equip','series','txt']);
// Filter // Filter
$opt_special = array( $opt_special = array(
-2 => _('&horbar; all &horbar;'), -2 => _('&horbar; all &horbar;'),
-1 => _('&horbar; none &horbar;') -1 => _('&horbar; none &horbar;')
); );
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
@@ -108,10 +154,16 @@ foreach ($opt_special + $opt_equipment as $k => $v) {
?> ?>
</select> </select>
</div> </div>
<?php
filter_create_select('flt_series', _('Series'), $g_opt_all + $g_opt_none + $opt_series, $flt->series);
?>
<div class="d-flex flex-nowrap gap-2"> <div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label> <label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?? ''?>"> <input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?? ''?>">
</div> </div>
<?php
filter_create_checks('flt_status', _('Status'), $opt_state, $flt->status ?? []);
?>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -135,10 +187,28 @@ if (isset($flt->equip) and ($flt->equip == -1 or $flt->equip == 0)) {
$w[] = 'm.eid=:eid'; $w[] = 'm.eid=:eid';
$p[':eid'] = $flt->equip; $p[':eid'] = $flt->equip;
} }
if (isset($flt->series) and ($flt->series == -1)) {
$w[] = 'm.series IS NULL';
} elseif($flt->series > 0) {
$w[] = 'm.series=:series';
$p[':series'] = $flt->series;
}
if (strlen($flt->txt) > 1) { if (strlen($flt->txt) > 1) {
$w[] = '(m.activities LIKE :txt OR m.remarks LIKE :txt)'; $w[] = '(m.activities LIKE :txt OR m.remarks LIKE :txt)';
$p[':txt'] = '%'.$flt->txt.'%'; $p[':txt'] = '%'.$flt->txt.'%';
} }
// condition for multiple flags is OR
$parts = ['maintstate IS NULL']; // to get empty result
foreach ($flt->status as $s) {
$parts[] = "maintstate='$s'";
}
if (!empty($parts)) {
if (count($parts) > 1) {
$w[] = '(' . join(' OR ', $parts) . ')';
} else {
$w[] = $parts[0];
}
}
$where = join(' AND ', $w); $where = join(' AND ', $w);
$order = ' ORDER BY m.maintid'; $order = ' ORDER BY m.maintid';
@@ -158,11 +228,12 @@ $page = gpc_get_int($_REQUEST, 'p', 1);
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp); $rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
$lastpage = ceil($numrows/$rows_pp); $lastpage = ceil($numrows/$rows_pp);
$sql = "SELECT m.maintid, m.activities, m.remarks, e.ename " $sql = "SELECT m.maintid, m.activities, m.plan_date, m.interval_hours, m.maintstate, e.ename, "
. " IF(CHAR_LENGTH(m.remarks)>40, CONCAT(LEFT(m.remarks, 40), '\u{2026}'), m.remarks) AS remarks "
. "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid)"; . "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid)";
$sql .= ' WHERE ' . $where; $sql .= ' WHERE ' . $where;
$sql .= $order; $sql .= $order;
// if pagination: // if pagination:
$sql .= ' LIMIT ' . ($page - 1) * $rows_pp . ',' . $rows_pp; $sql .= ' LIMIT ' . ($page - 1) * $rows_pp . ',' . $rows_pp;
@@ -180,6 +251,8 @@ echo "<tr>";
echo '<th>#</th>'; echo '<th>#</th>';
echo "<th>", _('Activities'), "</th>"; echo "<th>", _('Activities'), "</th>";
echo "<th>", _('Equipment'), "</th>"; echo "<th>", _('Equipment'), "</th>";
echo "<th>", _('Upcoming'), "</th>"; // Date ou Hours
echo "<th>", _('Status'), "</th>";
echo "<th>", _('Remarks'), "</th>"; echo "<th>", _('Remarks'), "</th>";
echo "</tr>\n"; echo "</tr>\n";
echo "</thead>\n"; echo "</thead>\n";
@@ -192,9 +265,12 @@ foreach ($res as $row) {
echo '<td>', $i; echo '<td>', $i;
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['maintid'], '"><i class="bi-eye ms-2"></i></a>', "\n"; echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['maintid'], '"><i class="bi-eye ms-2"></i></a>', "\n";
echo "</td>\n"; echo "</td>\n";
echo "<td>". $row['activities'] ."</td>\n"; echo "<td>", h($row['activities']) ,"</td>\n";
echo "<td>". $row['ename'] ."</td>\n"; echo "<td>", $row['ename'] ,"</td>\n";
echo "<td>". $row['remarks'] ."</td>\n"; // next plan date or hours
echo "<td>", format_date($row['plan_date']), "</td>\n";
echo "<td>", get_enum($row['maintstate']), "</td>\n";
echo "<td>", h($row['remarks']) ,"</td>\n";
echo "<td>"; echo "<td>";
// Edit current record button // Edit current record button
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['maintid'], '"><i class="bi-pencil"></i></a>', "\n"; echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['maintid'], '"><i class="bi-pencil"></i></a>', "\n";
@@ -216,18 +292,16 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Maintenance'), "</h2>\n"; echo '<h2>', _('Add Maintenance'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="activities" class="form-label"><?=_('Activities')?></label>
<input type="text" class="form-control" id="activities" name="activities">
</div>
<?php <?php
form_create_text('activities', _('Activities'), 40, NULL, TRUE, TRUE);
// TODO // TODO
// Add link to equipment, perhaps later with modal dialog? // Add link to equipment, perhaps later with modal dialog?
?> form_create_select('eid', _('Equipment'), $opt_equipment, $id);
<div class="mb-3">
/* <div class="mb-3">
<label for="eid" class="form-label"><?=_('Equipment')?></label> <label for="eid" class="form-label"><?=_('Equipment')?></label>
<select name="eid" id="eid" class="form-select"> <select name="eid" id="eid" class="form-select">
<?php
foreach ($opt_equipment as $k => $v) { foreach ($opt_equipment as $k => $v) {
echo '<option value="', $k, '"'; echo '<option value="', $k, '"';
if ($k == $id) { if ($k == $id) {
@@ -235,8 +309,10 @@ foreach ($opt_equipment as $k => $v) {
} }
echo '>', $v, "</option>\n"; echo '>', $v, "</option>\n";
} }
?>
</select> </select>
*/
?>
<div class="container-fluid px-0 my-3"> <div class="container-fluid px-0 my-3">
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button> <button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a> <a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
@@ -250,7 +326,8 @@ echo '<h2>', _('View Maintenance'), "</h2>\n";
// load maintenance record // load maintenance record
$sql = "SELECT m.activities, m.eid, m.remarks, m.series, m.maintstate, e.ename, " $sql = "SELECT m.activities, m.eid, m.remarks, m.series, m.maintstate, e.ename, "
. "m.plan_date, m.completion_date, m.interval_hours, m.last_hours " . "m.plan_date, m.plan_precision, m.completion_date, m.interval_hours, "
. "m.last_hours "
. "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid) " . "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid) "
. "WHERE m.maintid=?"; . "WHERE m.maintid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -288,8 +365,24 @@ echo '<tr><th>', _('Series'),"</th><td>", $maint->series, "</td></tr>\n";
echo '<tr><th>', _('Interval'),"</th><td>", $maint->interval_hours, " h</td></tr>\n"; echo '<tr><th>', _('Interval'),"</th><td>", $maint->interval_hours, " h</td></tr>\n";
echo '<tr><th>', _('Last'),"</th><td>", $maint->last_hours, "</td></tr>\n"; echo '<tr><th>', _('Last'),"</th><td>", $maint->last_hours, "</td></tr>\n";
echo '<tr><th>', _('Plan date'),"</th><td>", format_date($maint->plan_date), "</td></tr>\n"; echo '<tr><th>', _('Plan date'),"</th><td>", format_date($maint->plan_date), "</td></tr>\n";
echo '<tr><th>', _('Plan date precision'),"</th><td>", get_enum($maint->plan_precision), "</td></tr>\n";
echo '<tr><th>', _('Completion&nbsp;date'),"</th><td>", format_date($maint->completion_date), "</td></tr>\n"; echo '<tr><th>', _('Completion&nbsp;date'),"</th><td>", format_date($maint->completion_date), "</td></tr>\n";
echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($maint->maintstate), "</td></tr>\n"; echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($maint->maintstate), "</td></tr>\n";
// Custom properties
$sql = "SELECT keyname, valstr, valint FROM property WHERE objtype='maint' AND objid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
foreach ($sth->fetchAll() as $row) {
echo "<tr><th>{$row['keyname']}</th><td>";
if (isset($row['valstr'])) {
echo $row['valstr'];
} else {
echo $row['valint'];
}
echo "</td></tr>\n";
}
echo "</table>\n"; echo "</table>\n";
echo '</div>'; // Column break echo '</div>'; // Column break
@@ -353,19 +446,11 @@ echo '<h2>', _('Edit Maintenance'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3"> <?php
<label for="activities" class="form-label"><?=_('Activities')?></label> form_create_text('activities', _('Activities'), 40, $maint->activities);
<input type="text" class="form-control" id="activities" name="activities" value="<?=h($maint->activities)?>"> form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid);
</div> form_create_select('series', _('Series'), $g_opt_none + $g_opt_new + $opt_series, $maint->series);
<?php form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid); ?> ?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($maint->remarks)?></textarea>
</div>
<div class="mb-3">
<label for="series" class="form-label"><?=_('Series')?></label>
<input type="text" class="form-control" id="series" name="series" maxlength="4" value="<?=$maint->series ?>">
</div>
<div class="mb-3"> <div class="mb-3">
<label for="interval_hours" class="form-label"><?=_('Interval hours')?></label> <label for="interval_hours" class="form-label"><?=_('Interval hours')?></label>
<input type="number" class="form-control" id="interval_hours" name="interval_hours" inputmode="numeric" maxlength="6" value="<?=$maint->interval_hours ?>"> <input type="number" class="form-control" id="interval_hours" name="interval_hours" inputmode="numeric" maxlength="6" value="<?=$maint->interval_hours ?>">
@@ -378,12 +463,16 @@ echo '<h2>', _('Edit Maintenance'), "</h2>\n";
<label for="plan_date"><?=_('Plan date')?></label> <label for="plan_date"><?=_('Plan date')?></label>
<input type="date" class="form-control" id="plan_date" name="plan_date" value="<?=$maint->plan_date ?>"> <input type="date" class="form-control" id="plan_date" name="plan_date" value="<?=$maint->plan_date ?>">
</div> </div>
<?php
form_create_select('plan_precision', _('Date plan precision'), $opt_planprec, $maint->plan_precision);
?>
<div class="mb-3"> <div class="mb-3">
<label for="completion_date"><?=_('Completion date')?></label> <label for="completion_date"><?=_('Completion date')?></label>
<input type="date" class="form-control" id="completion_date" name="completion_date" value="<?=$maint->completion_date ?>"> <input type="date" class="form-control" id="completion_date" name="completion_date" value="<?=$maint->completion_date ?>">
</div> </div>
<?php <?php
form_create_select('maintstate', _('Status'), $opt_state, $maint->maintstate); form_create_select('maintstate', _('Status'), $opt_state, $maint->maintstate);
form_create_textarea('remarks', _('Remarks'), 3, 150, $maint->remarks);
form_edit_buttons($g_scriptname, $id); form_edit_buttons($g_scriptname, $id);
echo "</form>\n"; echo "</form>\n";
+1 -1
View File
@@ -16,7 +16,7 @@ require 'header.php';
<p class="p-3 mb-3 bg-info-subtle border border-info-subtle rounded"> <p class="p-3 mb-3 bg-info-subtle border border-info-subtle rounded">
<i class="bi bi-info-circle-fill me-2"></i> <i class="bi bi-info-circle-fill me-2"></i>
Hinweis: Es handelt sich hier um eine Vorschau (Version <?=$g_version?>)!<br> Hinweis: Es handelt sich hier um eine frühe Version (v<?=$g_version?>)!<br>
Einige Funktionen sind noch nicht oder nicht vollständig implementiert. Einige Funktionen sind noch nicht oder nicht vollständig implementiert.
Rückmeldungen sind immer willkommen!</p> Rückmeldungen sind immer willkommen!</p>
+42 -55
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
// TODO move to somewhere else // TODO move to somewhere else
function format_vals($n, $v1, $v2, $v3) { function format_vals($n, $v1, $v2, $v3) {
@@ -25,7 +26,8 @@ $pagetitle = _('Measurements');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_unit = db_get_options(8); $opt_unit = db_get_options(DD_UNIT);
$opt_category = db_get_options(DD_MEASUREMENT_CATEGORY);
$opt_accuracy = db_load_enum('measurement', 'accuracy', true, true); $opt_accuracy = db_load_enum('measurement', 'accuracy', true, true);
$opt_dimensions = array( $opt_dimensions = array(
1 => _('1D'), 1 => _('1D'),
@@ -52,8 +54,9 @@ switch ($submit = form_get_action()) {
case 'filter': case 'filter':
$flt = array(); $flt = array();
$flt['precision'] = gpc_get_string($_POST, 'flt_precision');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt');
$flt['cat'] = gpc_get_string($_POST, 'flt_cat');
$flt['acc'] = gpc_get_string($_POST, 'flt_acc');
db_save_filter($flt, 207); db_save_filter($flt, 207);
$action = ACT_DEFAULT; $action = ACT_DEFAULT;
break; break;
@@ -102,6 +105,10 @@ switch ($submit = form_get_action()) {
$p[':unit'] = gpc_get_int($_POST, 'unit'); $p[':unit'] = gpc_get_int($_POST, 'unit');
$p[':accuracy'] = gpc_get_string($_POST, 'accuracy'); $p[':accuracy'] = gpc_get_string($_POST, 'accuracy');
$p[':mdate'] = gpc_get_date($_POST, 'mdate'); $p[':mdate'] = gpc_get_date($_POST, 'mdate');
$p[':mcat'] = gpc_get_int($_POST, 'mcat');
if ($p[':mcat'] == -1) {
$p[':mcat'] = NULL;
}
$p[':note'] = gpc_get_string($_POST, 'note'); $p[':note'] = gpc_get_string($_POST, 'note');
$p[':eid'] = gpc_get_int($_POST, 'eid'); $p[':eid'] = gpc_get_int($_POST, 'eid');
if ($p[':eid'] == -1) { if ($p[':eid'] == -1) {
@@ -140,7 +147,7 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle); page_caption_search($pagetitle);
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 207, ['txt']); $flt = db_get_filter($user->id, 207, ['txt', 'cat', 'acc']);
$w = array('(vid=:vid OR vid IS NULL)'); $w = array('(vid=:vid OR vid IS NULL)');
$p = array(':vid' => $user->vid); $p = array(':vid' => $user->vid);
@@ -148,9 +155,20 @@ $p = array(':vid' => $user->vid);
// TODO precision additionally as filter // TODO precision additionally as filter
if (strlen($flt->txt) > 1) { if (strlen($flt->txt) > 1) {
$w[] = 'mname LIKE :txt'; $w[] = 'mname LIKE :txt OR note LIKE :txt';
$p[':txt'] = '%'.$flt->txt.'%'; $p[':txt'] = '%'.$flt->txt.'%';
} }
if ($flt->cat > 0) {
$w[] = 'mcat=:mcat';
$p[':mcat'] = $flt->cat;
} elseif ($flt->mcat == -1) {
$w[] = 'mcat IS NULL';
}
if ($flt->acc > 0) {
$w[] = 'accuracy=:accuracy';
$p[':accuracy'] = $flt->acc;
}
$where = join(' AND ', $w); $where = join(' AND ', $w);
$order = ' ORDER BY mname'; $order = ' ORDER BY mname';
@@ -175,14 +193,15 @@ $opt_special = array(
-1 => _('&horbar; none &horbar;') -1 => _('&horbar; none &horbar;')
); );
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2"> <?php
<label for="flt_txt">Text</label> filter_create_text('flt_txt', _('Text'), $flt->txt, 30, 45);
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>"> filter_create_select('flt_cat', _('Category'), $g_opt_all + $g_opt_none + $opt_category, $flt->cat);
</div> filter_create_select('flt_acc', _('Accuracy'), $g_opt_all + $opt_accuracy, $flt->acc);
?>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -253,30 +272,13 @@ echo '<h2>', _('Add measurement'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="mname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="mname" name="mname" required autofocus>
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Note')?></label>
<input type="text" class="form-control" id="note" name="note">
</div>
<?php <?php
form_create_text('mname', _('Name'), 80, TRUE, TRUE);
form_create_text('note', _('Note'), 80);
form_create_select('nval', _('Dimensions'), $opt_dimensions); form_create_select('nval', _('Dimensions'), $opt_dimensions);
?> form_create_numeric('val1', _('Value 1'));
<div class="mb-3"> form_create_numeric('val2', _('Value 2'));
<label for="val1" class="form-label"><?=_('Value 1')?></label> form_create_numeric('val3', _('Value 3'));
<input type="text" class="form-control" id="val1" name="val1">
</div>
<div class="mb-3">
<label for="val2" class="form-label"><?=_('Value 2')?></label>
<input type="text" class="form-control" id="val1" name="val2">
</div>
<div class="mb-3">
<label for="val3" class="form-label"><?=_('Value 3')?></label>
<input type="text" class="form-control" id="val3" name="val3">
</div>
<?php
form_create_select('unit', _('Unit'), $opt_unit); form_create_select('unit', _('Unit'), $opt_unit);
form_create_select('accuracy', _('Accuracy'), $opt_accuracy); form_create_select('accuracy', _('Accuracy'), $opt_accuracy);
form_create_select('eid', _('Equipment'), $opt_equipment, $id); form_create_select('eid', _('Equipment'), $opt_equipment, $id);
@@ -291,7 +293,7 @@ form_create_select('eid', _('Equipment'), $opt_equipment, $id);
elseif ($action == ACT_VIEW): elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record ===================================== // ========== VARIANT: view single record =====================================
$sql = "SELECT mname, unit, nval, val1, val2, val3, accuracy, mdate, note, eid " $sql = "SELECT mname, unit, nval, val1, val2, val3, accuracy, mdate, mcat, note, eid "
. "FROM measurement " . "FROM measurement "
. "WHERE mid=?"; . "WHERE mid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -310,6 +312,7 @@ echo '<tr><th>', _('Value 3'), '</th><td>', $measurement->val3, "</td></tr>\n";
echo '<tr><th>', _('Accuracy'), '</th><td>', get_enum($measurement->accuracy), "</td></tr>\n"; echo '<tr><th>', _('Accuracy'), '</th><td>', get_enum($measurement->accuracy), "</td></tr>\n";
echo '<tr><th>', _('Date'), '</th><td>', format_date($measurement->mdate), "</td></tr>\n"; echo '<tr><th>', _('Date'), '</th><td>', format_date($measurement->mdate), "</td></tr>\n";
echo '<tr><th>', _('Note'), '</th><td>', h($measurement->note), "</td></tr>\n"; echo '<tr><th>', _('Note'), '</th><td>', h($measurement->note), "</td></tr>\n";
echo '<tr><th>', _('Category'),"</th><td>", $opt_category[$measurement->mcat] ?? 'n/a', "</td></tr>\n";
echo '<tr><th>', _('Equipment'), '</th><td>', $opt_equipment[$measurement->eid], "</td></tr>\n"; echo '<tr><th>', _('Equipment'), '</th><td>', $opt_equipment[$measurement->eid], "</td></tr>\n";
echo "</table>\n"; echo "</table>\n";
@@ -319,7 +322,7 @@ form_view_buttons($g_scriptname, $id);
elseif ($action == ACT_EDIT): elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record ===================================== // ========== VARIANT: edit single record =====================================
$sql = "SELECT mname, nval, val1, val2, val3, unit, accuracy, note, eid " $sql = "SELECT mname, nval, val1, val2, val3, unit, accuracy, note, eid, mcat "
. "FROM measurement " . "FROM measurement "
. "WHERE mid=?"; . "WHERE mid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -330,32 +333,16 @@ echo '<h2>', _('Edit measurement'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="mname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="name" name="mname" value="<?=$measurement->mname ?>">
</div>
<div class="mb-3">
<label for="note" class="form-label"><?=_('Note')?></label>
<input type="text" class="form-control" id="note" name="note" value="<?=$measurement->note ?>">
</div>
<?php <?php
form_create_text('mname', _('Name'), 80, $measurement->mname, TRUE, TRUE);
form_create_text('note', _('Note'), 80, $measurement->note);
form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval); form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval);
?> form_create_numeric('val2', _('Value 2'), $measurement->val1);
<div class="mb-3"> form_create_numeric('val2', _('Value 2'), $measurement->val2);
<label for="val1"><?=_('Value 1')?></label> form_create_numeric('val2', _('Value 2'), $measurement->val3);
<input type="number" min="0" class="form-control" id="val1" name="val1" value="<?=$measurement->val1 ?>">
</div>
<div class="mb-3">
<label for="val2"><?=_('Value 2')?></label>
<input type="number" min="0" class="form-control" id="val2" name="val2" value="<?=$measurement->val2 ?>">
</div>
<div class="mb-3">
<label for="val3"><?=_('Value 3')?></label>
<input type="number" min="0" class="form-control" id="val3" name="val3" value="<?=$measurement->val3 ?>">
</div>
<?php
form_create_select('unit', _('Unit'), $opt_unit, $measurement->unit); form_create_select('unit', _('Unit'), $opt_unit, $measurement->unit);
form_create_select('accuracy', _('Accuracy'), $opt_accuracy, $measurement->accuracy); form_create_select('accuracy', _('Accuracy'), $opt_accuracy, $measurement->accuracy);
form_create_select('mcat', _('Category'), $g_opt_none + $opt_category, $measurement->mcat);
form_create_select('eid', _('Equipment'), $opt_equipment, $measurement->eid); form_create_select('eid', _('Equipment'), $opt_equipment, $measurement->eid);
form_edit_buttons($g_scriptname, $id); form_edit_buttons($g_scriptname, $id);
+18 -3
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Note'); $pagetitle = _('Note');
@@ -85,13 +86,18 @@ if ($action == ACT_DEFAULT):
echo '<h1>', $pagetitle, "</h1>\n"; echo '<h1>', $pagetitle, "</h1>\n";
// TODO This is not so beautiful. Make it prettier
$sql = "SELECT n.noteid, n.notetype, n.refid," $sql = "SELECT n.noteid, n.notetype, n.refid,"
. " IF(CHAR_LENGTH(n.annotation) > 60, CONCAT(LEFT(n.annotation, 60), '&hellip;'), n.annotation) AS annotation " . " IF(CHAR_LENGTH(n.annotation) > 60, CONCAT(LEFT(n.annotation, 60), '&hellip;'), n.annotation) AS annotation "
. "FROM note AS n JOIN task AS t ON (n.notetype='task' AND n.refid=t.taskid AND t.vid=:vid) " . "FROM note AS n LEFT OUTER JOIN task AS t ON (n.notetype='task' AND n.refid=t.taskid AND t.vid=:vid) "
. "UNION " . "UNION "
. "SELECT n.noteid, n.notetype, n.refid," . "SELECT n.noteid, n.notetype, n.refid,"
. " IF(CHAR_LENGTH(n.annotation) > 60, CONCAT(LEFT(n.annotation, 60), '&hellip;'), n.annotation) AS annotation " . " IF(CHAR_LENGTH(n.annotation) > 60, CONCAT(LEFT(n.annotation, 60), '&hellip;'), n.annotation) AS annotation "
. "FROM note AS n JOIN maintenance AS m ON (n.notetype='maint' AND n.refid=m.maintid AND m.vid=:vid) " . "FROM note AS n LEFT OUTER JOIN maintenance AS m ON (n.notetype='maint' AND n.refid=m.maintid AND m.vid=:vid) "
. "UNION "
. "SELECT n.noteid, n.notetype, n.refid,"
. " IF(CHAR_LENGTH(n.annotation) > 60, CONCAT(LEFT(n.annotation, 60), '&hellip;'), n.annotation) AS annotation "
. "FROM note AS n LEFT OUTER JOIN equipment AS e ON (n.notetype='equip' AND n.refid=e.eid AND e.vid=:vid) "
. "ORDER BY noteid"; . "ORDER BY noteid";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute([':vid' => $user->vid]); $sth->execute([':vid' => $user->vid]);
@@ -101,6 +107,7 @@ $res = $sth->fetchAll();
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>#</th>
<th><?=_('ID')?></th> <th><?=_('ID')?></th>
<th><?=_('Reference')?></th> <th><?=_('Reference')?></th>
<th><?=_('Type')?></th> <th><?=_('Type')?></th>
@@ -109,13 +116,21 @@ $res = $sth->fetchAll();
</thead> </thead>
<?php <?php
$i = 0;
foreach ($res as $row) { foreach ($res as $row) {
$i++; // record number
echo "<tr>\n"; echo "<tr>\n";
echo '<td>', $i;
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['noteid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
echo "</td>\n";
echo "<td>", $row['noteid'], "</td>\n"; echo "<td>", $row['noteid'], "</td>\n";
echo "<td>", $row['refid'], "</td>\n"; echo "<td>", $row['refid'], "</td>\n";
echo "<td>", $row['notetype'], "</td>\n"; echo "<td>", $row['notetype'], "</td>\n";
echo "<td>", $row['annotation'], "</td>\n"; echo "<td>", $row['annotation'], "</td>\n";
form_action_buttons($g_scriptname, $row['noteid']); // Edit current record button
echo '<td>';
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['noteid'], '"><i class="bi-pencil"></i></a>', "\n";
echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
+26 -13
View File
@@ -9,17 +9,22 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Projects'); $pagetitle = _('Projects');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
/* OLD
$sql = "SELECT userid, displayname FROM user WHERE userid>0"; $sql = "SELECT userid, displayname FROM user WHERE userid>0";
$sth = $pdo->query($sql); $sth = $pdo->query($sql);
$opt_user = array(); $opt_user = array();
foreach ($sth->fetchAll() as $row) { foreach ($sth->fetchAll() as $row) {
$opt_user[$row['userid']] = $row['displayname']; $opt_user[$row['userid']] = $row['displayname'];
} }
*/
$opt_user = db_get_opt_user();
$opt_state = db_load_enum('project', 'projstate', true, true); $opt_state = db_load_enum('project', 'projstate', true, true);
/* Nur für choices benötigt /* Nur für choices benötigt
@@ -65,6 +70,7 @@ switch ($submit = form_get_action()) {
$p[':responsible'] = gpc_get_int($_POST, 'responsible'); $p[':responsible'] = gpc_get_int($_POST, 'responsible');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
$id = db_exec_insert('project', $p); $id = db_exec_insert('project', $p);
db_set_revision('table', TBL_PROJECTS);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -148,7 +154,8 @@ $lastpage = ceil($numrows/$rows_pp);
// $grandtotal = $pdo->query("SELECT COUNT(*) FROM project WHERE " . $where)->fetchColumn(); // $grandtotal = $pdo->query("SELECT COUNT(*) FROM project WHERE " . $where)->fetchColumn();
$sql = "SELECT projid, projname, startdate, duration, projstate, remarks " $sql = "SELECT projid, projname, startdate, duration, projstate, "
. " IF(CHAR_LENGTH(remarks)>30, CONCAT(LEFT(remarks, 30), '\u{2026}'), remarks) AS remarks "
. "FROM project"; . "FROM project";
$sql .= " WHERE " . $where; $sql .= " WHERE " . $where;
$sql .= $order; $sql .= $order;
@@ -166,17 +173,11 @@ $res = $sth->fetchAll();
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_name"><?=_('Name')?></label>
<input type="text" class="form-control" name="flt_name" size="15" maxlength="30" value="<?=$flt->name ?? '';?>">
</div>
<?php <?php
filter_create_text('flt_name', _('Name'), $flt->name, 15, 30);
filter_create_select('flt_state', _('State'), $g_opt_all + $opt_state, $flt->state ?? -2, FALSE); filter_create_select('flt_state', _('State'), $g_opt_all + $opt_state, $flt->state ?? -2, FALSE);
filter_create_text('flt_remarks', _('Remarks'), $flt->remarks, 15, 30);
?> ?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_remarks"><?=_('Remarks')?></label>
<input type="text" class="form-control" name="flt_remarks" size="15" maxlength="30" value="<?=$flt->remarks ?? '' ?>">
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -316,6 +317,21 @@ echo '<tr><th scope="row">', _('Costs plan'),"</th><td>", format_currency($proje
echo '<tr><th scope="row">', _('Costs final'),"</th><td>", format_currency($project->costs_final), "</td></tr>\n"; echo '<tr><th scope="row">', _('Costs final'),"</th><td>", format_currency($project->costs_final), "</td></tr>\n";
echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($project->projstate), "</td></tr>\n"; echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($project->projstate), "</td></tr>\n";
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($project->remarks, br:true), "</td></tr>\n"; echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($project->remarks, br:true), "</td></tr>\n";
// Custom properties go here
$sql = "SELECT keyname, valstr, valint FROM property WHERE objtype='proj' AND objid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
foreach ($sth->fetchAll() as $row) {
echo "<tr><th>{$row['keyname']}</th><td>";
if (isset($row['valstr'])) {
echo $row['valstr'];
} else {
echo $row['valint'];
}
echo "</td></tr>\n";
}
echo "</table>\n"; echo "</table>\n";
form_view_buttons($g_scriptname, $id); form_view_buttons($g_scriptname, $id);
@@ -374,11 +390,8 @@ $project = $sth->fetch(PDO::FETCH_OBJ);
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<input type="hidden" name="id" value="<?=$id?>"> <input type="hidden" name="id" value="<?=$id?>">
<div class="mb-3">
<label for="projname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="projname" name="projname" value="<?=$project->projname ?>">
</div>
<?php <?php
form_create_text('projname', _('Name'), 40, $project->projname, TRUE, TRUE);
form_create_select('responsible', _('Responsible'), $opt_user, $project->responsible); form_create_select('responsible', _('Responsible'), $opt_user, $project->responsible);
?> ?>
<div class="mb-3"> <div class="mb-3">
+12 -7
View File
@@ -9,14 +9,15 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle=_('Provisions'); $pagetitle=_('Provisions');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_storage = db_get_opt_storage($user->vid); $opt_storage = db_get_opt_storage($user->vid);
$opt_category = db_get_options(5); $opt_category = db_get_options(DD_PROVISION_CATEGORY);
$opt_unit = db_get_options(6); $opt_unit = db_get_options(DD_PROVISION_UNIT);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -102,7 +103,7 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle); page_caption_search($pagetitle);
// load filter from db // load filter from db
$flt = db_get_filter($user->id, 202); $flt = db_get_filter($user->id, 202, ['cat','txt']);
$w = array('(vid=:vid OR sid IS NULL)'); $w = array('(vid=:vid OR sid IS NULL)');
$p = array(':vid' => $user->vid); $p = array(':vid' => $user->vid);
@@ -160,11 +161,8 @@ $res = $sth->fetchAll();
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<?php <?php
filter_create_select('flt_cat', _('Category'), $g_opt_all + $g_opt_none + $opt_category, $flt->cat); filter_create_select('flt_cat', _('Category'), $g_opt_all + $g_opt_none + $opt_category, $flt->cat);
filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
?> ?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt;?>">
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -380,6 +378,13 @@ elseif ($action == ACT_VIEW_LIST):
echo '<h2>', _('Shopping list'), "</h2>\n"; echo '<h2>', _('Shopping list'), "</h2>\n";
// TODO Distinguish between provisions belonging to the boat and provisions
// that are freely available.
// - storage with vid
// - box in storage with vid
// - box without sid is free
// - prov without sid and boxid is free
$sql = "SELECT provid, provname, unit, target - number AS buy " $sql = "SELECT provid, provname, unit, target - number AS buy "
. "FROM provisions " . "FROM provisions "
. "WHERE target IS NOT NULL AND number < target " . "WHERE target IS NOT NULL AND number < target "
+1
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Search'); $pagetitle = _('Search');
+19 -13
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Settings'); $pagetitle = _('Settings');
@@ -111,10 +112,6 @@ if ($res = $sth->fetch(PDO::FETCH_NUM)) {
$sth->execute([$user->id, $rowspp]); $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();
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<h2><?=_('for current user')?></h2> <h2><?=_('for current user')?></h2>
@@ -132,16 +129,22 @@ for ($i = 1; $i <= 6; $i++) {
} }
form_create_select('datefmt', _('Date format'), $opt_datefmt, $datefmt); form_create_select('datefmt', _('Date format'), $opt_datefmt, $datefmt);
?> form_create_numeric('rowspp', _('Number of rows per page'), $rowspp, 5, 100, 1);
<div class="mb-3">
/* <div class="mb-3">
<label for="rowspp" class="form-label"><?=_('Number of rows per page')?></label> <label for="rowspp" class="form-label"><?=_('Number of rows per page')?></label>
<input type="text" class="form-control" id="rowspp" name="rowspp" maxlength="3" value=<?=$rowspp?>> <input type="text" class="form-control" id="rowspp" name="rowspp" maxlength="3" value=<?=$rowspp?>>
</div> </div> */
<?php
// limit global settings for captain only // limit global settings for captain only
if ($user->role == 'captain'): if ($user->role == 'captain') {
?> echo '<h2>', _('global for all users'), "</h2>\n";
<h2><?=_('global for all users')?></h2>
$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();
/*
<div class="mb-3"> <div class="mb-3">
<label for="currsym" class="form-label"><?=_('Currency symbol')?></label> <label for="currsym" class="form-label"><?=_('Currency symbol')?></label>
<input type="text" class="form-control" id="currsym" name="currsym" maxlength="3" value=<?=$currsym?>> <input type="text" class="form-control" id="currsym" name="currsym" maxlength="3" value=<?=$currsym?>>
@@ -154,8 +157,11 @@ if ($user->role == 'captain'):
<label for="maximgy" class="form-label"><?=_('Maximal image height')?></label> <label for="maximgy" class="form-label"><?=_('Maximal image height')?></label>
<input type="text" class="form-control" id="maximgy" name="maximgy" maxlength="4" value=<?=$maximgy?>> <input type="text" class="form-control" id="maximgy" name="maximgy" maxlength="4" value=<?=$maximgy?>>
</div> </div>
<?php */
endif; form_create_text('currsym', _('Currency symbol'), 3, $currsym);
form_create_numeric('maximgx', _('Maximal image width'), $maximgy, 200, 4096, 1);
form_create_numeric('maximgy', _('Maximal image height'), $maximgy, 200, 4096, 1);
}
?> ?>
<div class="container-fluid px-0 my-3"> <div class="container-fluid px-0 my-3">
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button> <button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
+56 -41
View File
@@ -9,12 +9,13 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Storage'); $pagetitle = _('Storage');
$id = gpc_get_int($_REQUEST, 'id', 0); $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_stype = db_get_options(3); $opt_stype = db_get_options(DD_STORAGE_TYPE);
$opt_capaunit = $g_opt_empty + db_load_enum('storage', 'capaunit', true, true); $opt_capaunit = $g_opt_empty + db_load_enum('storage', 'capaunit', true, true);
// ========== ACTIONS START =================================================== // ========== ACTIONS START ===================================================
@@ -33,6 +34,7 @@ switch ($submit = form_get_action()) {
$p[':sname'] = gpc_get_string($_POST, 'sname'); $p[':sname'] = gpc_get_string($_POST, 'sname');
$p[':stype'] = gpc_get_int($_POST, 'stype'); $p[':stype'] = gpc_get_int($_POST, 'stype');
$id = db_exec_insert('storage', $p); $id = db_exec_insert('storage', $p);
db_set_revision('table', TBL_STORAGE);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -50,6 +52,7 @@ switch ($submit = form_get_action()) {
$p[':capacity'] = gpc_get_int($_POST, 'capacity'); $p[':capacity'] = gpc_get_int($_POST, 'capacity');
if ($p[':capacity'] == 0) $p[':capacity'] = NULL; if ($p[':capacity'] == 0) $p[':capacity'] = NULL;
$p[':capaunit'] = gpc_get_string($_POST, 'capaunit'); $p[':capaunit'] = gpc_get_string($_POST, 'capaunit');
$p[':color'] = gpc_get_color($_POST, 'color');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150); $p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('storage', $p, 'sid'); db_exec_update('storage', $p, 'sid');
$action = ACT_VIEW; $action = ACT_VIEW;
@@ -107,7 +110,7 @@ page_caption_search($pagetitle);
// Storage // Storage
// stype from dropdown // stype from dropdown
$sql = "SELECT sid, sname, x, y, z, angle, remarks " $sql = "SELECT sid, sname, color, x, y, z, angle, remarks "
. "FROM storage " . "FROM storage "
. "WHERE vid=? " . "WHERE vid=? "
. "ORDER BY sid"; . "ORDER BY sid";
@@ -119,6 +122,7 @@ echo "<thead>\n";
echo "<tr>"; echo "<tr>";
echo '<th>#</th>'; echo '<th>#</th>';
echo "<th>", _('Name'), "</th>"; echo "<th>", _('Name'), "</th>";
echo "<th>", _('Color'), "</th>";
echo "<th>", _('Position'), "</th>"; echo "<th>", _('Position'), "</th>";
echo "<th>", _('Remarks'), "</th>"; echo "<th>", _('Remarks'), "</th>";
echo "<th>&nbsp;</th>"; echo "<th>&nbsp;</th>";
@@ -132,6 +136,7 @@ foreach ($res as $row) {
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['sid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n"; echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['sid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
echo "</td>\n"; echo "</td>\n";
echo "<td>", $row['sname'], "</td>\n"; echo "<td>", $row['sname'], "</td>\n";
echo '<td>', format_color(strtoupper($row['color'])), "</td>\n";
if ($row['angle'] != 0) { if ($row['angle'] != 0) {
$angle = " (" . $row['angle'] . "°)"; $angle = " (" . $row['angle'] . "°)";
} else { } else {
@@ -146,18 +151,20 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
$numrows = count($res); // $numrows = count($res);
table_rec_summary($i, $numrows, $numrows, 5); // table_rec_summary($i, $numrows, $numrows, 5);
echo "</table>\n"; echo "</table>\n";
form_add_button($g_scriptname); form_add_button($g_scriptname);
// Boxes // Boxes
echo "<h1>", _('Box'), "</h1>\n"; echo "<h1>", _('Box'), "</h1>\n";
$sql = "SELECT boxid, sid, label, color, content, remarks " $sql = "SELECT b.boxid, b.sid, b.label, b.color, b.content, b.remarks "
. "FROM box " . "FROM box AS b JOIN storage AS s USING (sid) "
. "ORDER BY label"; . "WHERE s.vid=? "
$sth = $pdo->query($sql); . "ORDER BY b.label";
$sth = $pdo->prepare($sql);
$sth->execute([$user->vid]);
$res = $sth->fetchAll(); $res = $sth->fetchAll();
echo '<table class="table table-striped">', "\n"; echo '<table class="table table-striped">', "\n";
echo "<thead>\n"; echo "<thead>\n";
@@ -185,8 +192,8 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
$numrows = count($res); // $numrows = count($res);
table_rec_summary($i, $numrows, $numrows, 5); // table_rec_summary($i, $numrows, $numrows, 5);
echo "</table>\n"; echo "</table>\n";
form_add_button('box.php'); form_add_button('box.php');
@@ -197,33 +204,30 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Storage'), "</h2>\n"; echo '<h2>', _('Add Storage'), "</h2>\n";
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="sname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="sname" name="sname">
</div>
<?php <?php
form_create_text('sname', _('Name'), 40);
form_create_select('stype', _('Type'), $opt_stype); form_create_select('stype', _('Type'), $opt_stype);
?> ?>
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button> <div class="container-fluid px-0 my-3">
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a> <button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
</div>
</form> </form>
<?php <?php
elseif ($action == ACT_VIEW): elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record ===================================== // ========== VARIANT: view single record =====================================
$opt_unit = db_get_options(6); $opt_unit = db_get_options(DD_PROVISION_UNIT);
$sql = "SELECT sid, sname, stype, capacity, capaunit, x, y, z, wx, wy, wz, angle, color, remarks " $sql = "SELECT sid, sname, stype, capacity, capaunit, x, y, z, wx, wy, wz, angle, color, remarks "
. "FROM storage " . "FROM storage "
. "WHERE sid=?"; . "WHERE sid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute([$id]); $sth->execute([$id]);
$storage = $sth->fetch(PDO::FETCH_OBJ); $storage = $sth->fetch(PDO::FETCH_OBJ);
echo '<h1>', _('Storage'), ': ', $storage->sname, "</h1>\n"; echo '<h1>', sprintf(_('Storage: %s'), h($storage->sname)), "</h1>\n";
echo '<table class="table">', "\n"; echo '<table class="table">', "\n";
echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $opt_stype[$storage->stype], "</td></tr>\n"; echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $opt_stype[$storage->stype], "</td></tr>\n";
@@ -231,7 +235,7 @@ echo '<tr><th>', _('Capacity'),"</th><td>", $storage->capacity, ' ', $storage->c
echo '<tr><th>', _('Location (x, y, z)'),"</th><td>(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")</td></tr>\n"; echo '<tr><th>', _('Location (x, y, z)'),"</th><td>(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")</td></tr>\n";
echo '<tr><th>', _('Width (wx, wy, wz)'),"</th><td>(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")</td></tr>\n"; echo '<tr><th>', _('Width (wx, wy, wz)'),"</th><td>(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")</td></tr>\n";
echo '<tr><th>', _('Angle'),"</th><td>", $storage->angle, "°</td></tr>\n"; echo '<tr><th>', _('Angle'),"</th><td>", $storage->angle, "°</td></tr>\n";
echo '<tr><th>', _('Color'),"</th><td>", $storage->color, "</td></tr>\n"; echo '<tr><th>', _('Color'),"</th><td>", format_color($storage->color), "</td></tr>\n";
echo '<tr><th>', _('Remarks'),"</th><td>", h($storage->remarks), "</td></tr>\n"; echo '<tr><th>', _('Remarks'),"</th><td>", h($storage->remarks), "</td></tr>\n";
echo "</table>\n"; echo "</table>\n";
@@ -304,7 +308,8 @@ elseif ($action == ACT_EDIT):
echo '<h2>', _('Edit Storage'), "</h2>\n"; echo '<h2>', _('Edit Storage'), "</h2>\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 " . "FROM storage "
. "WHERE sid=?"; . "WHERE sid=?";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -319,19 +324,20 @@ $storage = $sth->fetch(PDO::FETCH_OBJ);
<input type="text" class="form-control" id="sname" name="sname" value="<?=h($storage->sname)?>"> <input type="text" class="form-control" id="sname" name="sname" value="<?=h($storage->sname)?>">
</div> </div>
<?php <?php
form_create_text('sname', _('Name'), $storage->name, 40);
form_create_select('stype', _('Type'), $opt_stype, $storage->stype); form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
?> ?>
<div class="mb-3"> <div class="mb-3">
<label class="form-label"><?=_('Position (x, y, z) in mm')?></label> <label class="form-label"><?=_('Position (x, y, z) in mm')?></label>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<input type="number" class="form-control" id="x" name="x" min="0" value="<?=$storage->x ?>"> <input type="number" class="form-control" id="x" name="x" min="0" max="65535" value="<?=$storage->x ?>">
</div> </div>
<div class="col"> <div class="col">
<input type="number" class="form-control" id="y" name="y" value="<?=$storage->y ?>"> <input type="number" class="form-control" id="y" name="y" min="-32768" max="32767" value="<?=$storage->y ?>">
</div> </div>
<div class="col"> <div class="col">
<input type="number" class="form-control" id="z" name="z" value="<?=$storage->z ?>"> <input type="number" class="form-control" id="z" name="z" min="-32768" max="32767" value="<?=$storage->z ?>">
</div> </div>
</div> </div>
</div> </div>
@@ -339,32 +345,41 @@ form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
<label class="form-label"><?=_('Width (x, y, z) in mm')?></label> <label class="form-label"><?=_('Width (x, y, z) in mm')?></label>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<input type="number" class="form-control" id="wx" name="wx" min="0" value="<?=$storage->wx ?>"> <input type="number" class="form-control" id="wx" name="wx" min="0" max="65535" value="<?=$storage->wx ?>">
</div> </div>
<div class="col"> <div class="col">
<input type="number" class="form-control" id="wy" name="wy" min="0" value="<?=$storage->wy ?>"> <input type="number" class="form-control" id="wy" name="wy" min="0" max="65535" value="<?=$storage->wy ?>">
</div> </div>
<div class="col"> <div class="col">
<input type="number" class="form-control" id="wz" name="wz" min="0" value="<?=$storage->wz ?>"> <input type="number" class="form-control" id="wz" name="wz" min="0" max="65535" value="<?=$storage->wz ?>">
</div> </div>
</div> </div>
</div> </div>
<div class="mb-3"> <?php
<label for="angle" class="form-label"><?=_('Angle, deg.')?></label> form_create_numeric('angle', _('Anglem deg.'), $storage->angle, 0, 359, 1);
<input type="number" class="form-control" id="angle" name="angle" value="<?=$storage->angle ?>"> form_create_numeric('capacity', _('Capacity'), $storage->capacity, 0, 32767);
</div> form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit);
<div class="mb-3"> form_create_color('color', _('Color'), $storage->color);
<label for="capacity" class="form-label"><?=_('Capacity')?></label> form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks);
<input type="number" class="form-control" id="capacity" name="capacity" value="<?=$storage->capacity ?>"> ?>
</div>
<?php form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit); ?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($storage->remarks)?></textarea>
</div>
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button> <button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a> <a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
</form> </form>
<script>
document.getElementById('capaunit').addEventListener('change', function () {
const capacity = document.getElementById('capacity');
if (this.value === 'pcs') {
capacity.step = 1;
decpl = 0;
} else {
capacity.step = 0.01;
decpl = 2;
}
if (capacity.value !== '' && Number.isFinite(Number(capacity.value))) {
capacity.value = Number(capacity.value).toFixed(decpl);
}
});
</script>
<?php <?php
elseif ($action == ACT_DELETE): elseif ($action == ACT_DELETE):
+8 -6
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Tags'); $pagetitle = _('Tags');
@@ -40,6 +41,7 @@ switch ($submit = form_get_action()) {
case 'insert': case 'insert':
$p[':tagname'] = gpc_get_string($_POST, 'tagname');; $p[':tagname'] = gpc_get_string($_POST, 'tagname');;
$id = db_exec_insert('tag', $p); $id = db_exec_insert('tag', $p);
db_set_revision('table', TBL_TAGS);
$action = ACT_VIEW; $action = ACT_VIEW;
break; break;
@@ -89,14 +91,13 @@ echo "<h1>$pagetitle</h1>\n";
// Filter // Filter
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2"> <?php
<label for="flt_txt">Text</label> filter_create_text('flt_txt', _('Text'), $flt->txt, 30, 45);
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?? ''?>"> ?>
</div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button> <button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
@@ -141,7 +142,8 @@ foreach ($res as $row) {
echo "</tr>\n"; echo "</tr>\n";
} }
// Table summary // Table summary
table_rec_summary($i0, $i, $numrows, 6); $numrows = count($res);
table_rec_summary(1, $i, $numrows, 6);
echo "</table>\n"; echo "</table>\n";
form_add_button($g_scriptname); form_add_button($g_scriptname);
+4 -8
View File
@@ -9,6 +9,7 @@
require 'globals.inc'; require 'globals.inc';
require 'lib/db.inc'; require 'lib/db.inc';
require 'lib/gpc.inc'; require 'lib/gpc.inc';
require 'lib/form.inc';
$pagetitle = _('Task'); $pagetitle = _('Task');
@@ -201,7 +202,7 @@ try {
$res = $sth->fetchAll(); $res = $sth->fetchAll();
?> ?>
<form method="post" action="<?=$g_scriptname?>"> <form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card"> <div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div> <div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3"> <div class="card-body d-flex flex-wrap gap-3">
@@ -209,12 +210,7 @@ $res = $sth->fetchAll();
$opt_proj_filter = db_get_opt_proj($user->vid, ['finished']); $opt_proj_filter = db_get_opt_proj($user->vid, ['finished']);
filter_create_select('flt_proj', _('Project'), $g_opt_all + $g_opt_none + $opt_proj_filter, $flt->proj); filter_create_select('flt_proj', _('Project'), $g_opt_all + $g_opt_none + $opt_proj_filter, $flt->proj);
filter_create_select('flt_prio', _('Priority'), $g_opt_all + $g_opt_none + $opt_priority, $flt->prio); filter_create_select('flt_prio', _('Priority'), $g_opt_all + $g_opt_none + $opt_priority, $flt->prio);
?> filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>">
</div>
<?php
$opt_status = db_load_enum('task', 'taskstate', true, true, false); $opt_status = db_load_enum('task', 'taskstate', true, true, false);
filter_create_checks('flt_stat', _('Status'), $opt_status, $flt->stat ?? []); filter_create_checks('flt_stat', _('Status'), $opt_status, $flt->stat ?? []);
?> ?>
@@ -352,7 +348,7 @@ echo '<p>', _('Not yet implemented'), "</p>";
elseif ($action == ACT_EDIT): elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record ===================================== // ========== VARIANT: edit single record =====================================
$opt_user = db_get_opt_user($user->id); // only used here $opt_user = db_get_opt_user(); // only used here
$sql = "SELECT taskname, projid, priority, plandate, duedate, started, finished," $sql = "SELECT taskname, projid, priority, plandate, duedate, started, finished,"
. " taskstate " . " taskstate "
+4 -4
View File
@@ -1,4 +1,4 @@
.TH YMS 1 "August 2026" "YMS 0.2" "User Commands" .TH YMS 1 "November 2026" "YMS 0.3" "User Commands"
.SH NAME .SH NAME
yms - Yacht Management Software yms - Yacht Management Software
.SH SYNOPSIS .SH SYNOPSIS
@@ -50,7 +50,7 @@ the application is running.
Per-user configuration file for the YMS graphical user interface. Per-user configuration file for the YMS graphical user interface.
.TP .TP
.I /var/local/yms/ .I /var/local/lib/yms/
Persistent storage for files managed by YMS. Persistent storage for files managed by YMS.
The directory contains photos, documents and other media associated The directory contains photos, documents and other media associated
@@ -60,7 +60,7 @@ SVG and PDF.
YMS stores application data in two separate locations. YMS stores application data in two separate locations.
The directory The directory
.I /var/local/yms/ .I /var/local/lib/yms/
contains user-managed photos and documents and should be included contains user-managed photos and documents and should be included
in regular backups. in regular backups.
@@ -80,7 +80,7 @@ The source code is available from the YMS Git repository:
.UR https://git.hoogi.de/thooge/YMS .UR https://git.hoogi.de/thooge/YMS
.UE .UE
.SH VERSION .SH VERSION
This manual describes YMS version 0.2. This manual describes YMS version 0.3.
.SH PROJECT .SH PROJECT
The YMS project homepage is available at: The YMS project homepage is available at:
.UR https://yms.hoogi.de/ .UR https://yms.hoogi.de/
+65 -14
View File
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: WTFPL
import MySQLdb import MySQLdb
import secrets import secrets
from gettext import pgettext
class Database: class Database:
@@ -49,36 +52,48 @@ class Database:
def is_connected(self): def is_connected(self):
return self.conn.open return self.conn.open
def is_encrypted(self):
self.cur.execute("SHOW SESSION STATUS LIKE 'Ssl_cipher'")
row = self.cur.fetchone()
return (row and row[1])
def get_timestamp(self): def get_timestamp(self):
self.cur.execute("SELECT CURRENT_TIMESTAMP") self.cur.execute("SELECT CURRENT_TIMESTAMP")
return self.cur.fetchone()[0] return self.cur.fetchone()[0]
def last_error(self): def last_error(self):
if not self.error: if not self.error:
return(0, '') return('UnknownType', 0, '')
code = self.error.args[0]
text = self.error.args[1] etype = type(self.error).__name__
ecode = 0
etext = str(self.error)
if len(self.error.args) >= 2 and isinstance(self.error.args[0], int):
ecode = self.error.args[0]
etext = str(self.error.args[1])
self.error = None self.error = None
return(code, text) return(etype, ecode, etext)
def load_enum(self, table, column): def load_enum(self, table, column):
""" """
TODO this is only an example! perhaps other keys needed Load an enum or set directly from a database table and provide it as a
Load an enum directly from a database table and provide it as a
dictionary for use in, for example, selection lists. dictionary for use in, for example, selection lists.
""" """
sql = ( sql = (
"SELECT TRIM(TRAILING ')' FROM SUBSTRING(column_type,6)) " "SELECT TRIM(TRAILING ')' FROM SUBSTRING(column_type,6)) "
"FROM information_schema.columns " "FROM information_schema.columns "
"WHERE table_schema=DATABASE() AND table_name=%s AND column_name=%s AND data_type='enum'" "WHERE table_schema=DATABASE() AND table_name=%s AND column_name=%s AND data_type IN ('enum','set')"
) )
self.cur.execute(sql, (table, column)) self.cur.execute(sql, (table, column))
row = self.cur.fetchone() row = self.cur.fetchone()
if not row: if not row:
return {} return {}
enumvals = row[0].replace("'", "").split(",")
return { return {
i: _(value.strip("'")) value: pgettext(f"{table}.{column}", value)
for i, value in enumerate(row[0].split(','), 1) for value in enumvals
} }
def lock_acquire(self, table, key, userid): def lock_acquire(self, table, key, userid):
@@ -94,7 +109,7 @@ class Database:
return token return token
except self.conn.IntegrityError as e: except self.conn.IntegrityError as e:
self.conn.rollback() self.conn.rollback()
if e.errno != 1062: if e.args[0] != 1062:
raise raise
# lazy locking: lock exists but is old, so we use it # lazy locking: lock exists but is old, so we use it
sql = ( sql = (
@@ -112,7 +127,7 @@ class Database:
def lock_refresh(self, token): def lock_refresh(self, token):
sql = ( sql = (
"UPDATE recordlock " "UPDATE recordlock "
"SET last_seen=current_timestamp() " "SET last_seen=CURRENT_TIMESTAMP "
"WHERE token=%s" "WHERE token=%s"
) )
self.cur.execute(sql, (token,)) self.cur.execute(sql, (token,))
@@ -125,22 +140,58 @@ class Database:
self.conn.commit() self.conn.commit()
return self.cur.rowcount == 1 return self.cur.rowcount == 1
def load_setting(self, sno, autocreate=True):
sql = "SELECT valstr, valint FROM settings WHERE userid=0 AND sno=%s"
self.cur.execute(sql, (sno,))
row = self.cur.fetchone()
if not row:
if autocreate:
sql = "INSERT INTO settings (userid, sno) VALUES (0, %s)"
self.cur.execute(sql, (sno,))
self.conn.commit()
return (None, None)
return row
def save_setting(self, sno, valstr, valint):
sql = "UPDATE settings SET valstr=%s, valint=%s WHERE userid=0 AND sno=%s"
values = (valstr, valint, sno)
return self.execute_write(sql, values, 1)
def get_free_number(self, table, column):
"""
Get first free number from column, so gaps are filled
"""
sql = (
"SELECT MIN(n.{col}) AS nextval "
"FROM ("
"SELECT 1 AS {col} "
"UNION ALL "
"SELECT DISTINCT {col} + 1 "
"FROM {tbl} "
"WHERE {col} > 0"
") AS n "
"LEFT JOIN {tbl} AS m ON m.{col}=n.{col} "
"WHERE m.{col} IS NULL"
).format(tbl=table, col=column)
self.cur.execute(sql)
return self.cur.fetchone()[0] or 1
def execute_write(self, sql, values=(), expected_rows=None): def execute_write(self, sql, values=(), expected_rows=None):
""" """
Execute an INSERT, UPDATE, or DELETE statement. Execute an INSERT, UPDATE, or DELETE statement.
expected_rows: expected_rows:
None = do not check the number of affected rows None = do not check the number of affected rows
1 = expect exactly one affected row 1 = expect exactly one affected row
0 = expect no affected rows 0 = expect no affected rows / no data changed
""" """
try: try:
self.cur.execute(sql, values) self.cur.execute(sql, values)
except MySQLdb.Error as e: except MySQLdb.Error as e:
self.rollback() self.conn.rollback()
self.error = e self.error = e
return False return False
if (expected_rows is not None and self.cur.rowcount != expected_rows): if (expected_rows is not None and self.cur.rowcount != expected_rows):
self.rollback() self.conn.rollback()
self.error = RuntimeError( self.error = RuntimeError(
"Expected {} affected rows, got {}".format( "Expected {} affected rows, got {}".format(
expected_rows, expected_rows,
+51 -1
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: WTFPL
from gi.repository import Gtk from gi.repository import Gtk
def init_named_controls(window, builder): def init_named_controls(window, builder):
@@ -73,4 +75,52 @@ def get_text_contents(textview):
Convenience function to get all contents from GtkTextView Convenience function to get all contents from GtkTextView
""" """
buf = textview.get_buffer() buf = textview.get_buffer()
return buf.get_text(buf.get_start_iter(), buf.get_end_iter(), True) contents = buf.get_text(buf.get_start_iter(), buf.get_end_iter(), True).strip()
return contents or None
class TouchPopup():
"""
A pop-up window that can be closed again with another click.
The pop-up features a title in bold, as well as a list of labels and values.
"""
#TODO finish converting to GTK3
def __init__(self, parent, title, data, width=None):
self.window = win = gtk.Window(Gtk.WindowType.POPUP)
win.set_position(Gtk.WindowPosition.MOUSE)
win.set_transient_for(parent)
win.set_modal(True)
if width:
win.set_size_request(width, -1)
#win.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#feffd0"))
win.override_background_color(
Gtk.StateFlags.NORMAL,
Gdk.RGBA(1.0, 1.0, 0.816, 1.0) # #feffd0
)
frame = Gtk.Frame()
frame.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
frame.set_border_width(2)
win.add(frame)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
frame.add(vbox)
# Title
label = Gtk.Label("<b>" + title + "</b>")
label.set_use_markup(True)
label.set_alignment(0.0, 0.5)
vbox.pack_start(label)
# Data
sg = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
for d in data:
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
vbox.pack_start(hbox)
label = Gtk.Label(d[0])
label.set_alignment(0.0, 0.5)
hbox.pack_start(label, False, False, 4)
sg.add_widget(label)
label = Gtk.Label(d[1])
label.set_alignment(0.0, 0.5)
hbox.pack_start(label)
win.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
win.connect('button-press-event', self.callback)
win.show_all()
def callback(self, window, event):
window.destroy()
+252 -20
View File
@@ -1,15 +1,22 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
""" from enum import IntEnum
Dropdowns and database enums
dropdowns can change """
Dropdowns, Database enums and Table numbers
dropdowns contents can change
enums are static enums are static
TBD
- language
- dateformat
- dimensions (measurement)
""" """
class Dropdown: class Dropdown(IntEnum):
HULL_TYPE = 1 VESSEL_TYPE = 1
COMPANY_TYPE = 2 COMPANY_TYPE = 2
STORAGE_TYPE = 3 STORAGE_TYPE = 3
EQUIPMENT_CATEGORY = 4 EQUIPMENT_CATEGORY = 4
@@ -21,6 +28,95 @@ class Dropdown:
FUSE_BLOCK = 10 FUSE_BLOCK = 10
CABLE_TYPE = 11 CABLE_TYPE = 11
CABLE_TECHNAME = 12 CABLE_TECHNAME = 12
INVENTORY_CATEGORY = 13
BBN_VESSELDATA = 14
MEASUREMENT_CATEGORY = 15
DDNAME = {
Dropdown.VESSEL_TYPE: "vtype",
Dropdown.COMPANY_TYPE: "comptype",
Dropdown.STORAGE_TYPE: "stype",
Dropdown.EQUIPMENT_CATEGORY: "ecat",
Dropdown.PROVISION_CATEGORY: "provcat",
Dropdown.PROVISION_UNIT: "provunit",
Dropdown.FUSE_TYPE: "ftype",
Dropdown.UNIT: "unit",
Dropdown.BOX_TYPE: "boxtype",
Dropdown.FUSE_BLOCK: "location",
Dropdown.CABLE_TYPE: "cabletype",
Dropdown.CABLE_TECHNAME: "techname",
Dropdown.INVENTORY_CATEGORY: "invcat",
Dropdown.BBN_VESSELDATA: "bbndata",
Dropdown.MEASUREMENT_CATEGORY: "mcat"
}
DropdownDeps = {
Dropdown.VESSEL_TYPE: (
('vessel', 'vtype')
),
Dropdown.COMPANY_TYPE: (
('company', 'comptype'),
('company', 'comptype2')
),
Dropdown.STORAGE_TYPE: (
('storage', 'stype')
),
Dropdown.EQUIPMENT_CATEGORY: (
('equipment', 'ecat')
),
Dropdown.PROVISION_CATEGORY: (
('provisions', 'provcat')
),
Dropdown.PROVISION_UNIT: (
('provisions', 'unit')
),
Dropdown.FUSE_TYPE: (
('fuse', 'ftype')
),
Dropdown.UNIT: (
('measurement', 'unit')
),
Dropdown.BOX_TYPE: (
('box', 'boxtype')
),
Dropdown.FUSE_BLOCK: (
('fuse', 'location')
),
Dropdown.CABLE_TYPE: (
('cable', 'cabletype')
),
Dropdown.CABLE_TECHNAME: (
('cable', 'techname')
),
Dropdown.INVENTORY_CATEGORY: (
('inventory', 'invcat')
),
Dropdown.BBN_VESSELDATA: (
#unused
),
Dropdown.MEASUREMENT_CATEGORY: (
('measurement', 'mcat')
)
}
class Table(IntEnum):
VESSEL = (1, "base")
USERS = (2, "base")
COMPANIES = (3, "companies")
STORAGE = (4, "storage")
BOXES = (5, "boxes")
EQUIPMENT = (6, "equipment")
INVENTORY = (7, "inventory")
PROJECTS = (8, "projects")
CABLES = (9, "cables")
FUSES = (10, "fuses")
TAGS = (11, "tags")
def __new__(cls, value, module):
obj = int.__new__(cls, value)
obj._value_ = value
obj.module = module
return obj
class Lookup: class Lookup:
@@ -28,6 +124,7 @@ class Lookup:
self.db = db self.db = db
self._enums = {} self._enums = {}
self._dropdowns = {} self._dropdowns = {}
self._revision_ts = {} # tracking list revisions
def load(self): def load(self):
self._load_enums() self._load_enums()
@@ -35,36 +132,48 @@ class Lookup:
def _load_enums(self): def _load_enums(self):
""" """
TODO translation via gettext needed enums and sets
translation via gettext from db schema
""" """
db_enums = { db_enums = {
'user.role': ('user', 'role'),
'dropdown.flags': ('dropdown', 'flags'),
'vessel.vtype': ('vessel', 'vtype'),
'storage.capaunit': ('storage', 'capaunit'),
'tagref.objtype': ('tagref', 'objtype'),
'inventory.conttype': ('inventory', 'conttype'),
'inventory.invcond': ('inventory', 'invcond'),
'cable.cablecond': ('cable', 'cablecond'), 'cable.cablecond': ('cable', 'cablecond'),
'measurement.accuracy': ('measurement', 'accuracy'), 'checkitem.checkresult': ('checkitem', 'checkresult'),
'checklist.clstate': ('checklist', 'clstate'),
'company.flags': ('company', 'flags'),
'docref.reftype': ('docref', 'reftype'),
'document.doctype': ('document', 'doctype'), 'document.doctype': ('document', 'doctype'),
'document.roleaccess': ('document', 'roleaccess'), 'document.roleaccess': ('document', 'roleaccess'),
'docref.reftype': ('docref', 'reftype'), 'dropdown.flags': ('dropdown', 'flags'),
'equipment.econd': ('equipment', 'econd'),
'equipment.flags': ('equipment', 'flags'),
'inventory.conttype': ('inventory', 'conttype'),
'inventory.invcond': ('inventory', 'invcond'),
'inventory.flags': ('inventory', 'flags'),
'maintenance.maintstate': ('maintenance', 'maintstate'), 'maintenance.maintstate': ('maintenance', 'maintstate'),
'maintenance.plan_precision': ('maintenance', 'plan_precision'),
'measurement.accuracy': ('measurement', 'accuracy'),
'note.notetype': ('note', 'notetype'),
'project.projstate': ('project', 'projstate'), 'project.projstate': ('project', 'projstate'),
'signalk.datatype': ('signalk', 'datatype'),
'signalk.objtype': ('signalk', 'objtype'),
'storage.capaunit': ('storage', 'capaunit'),
'tagref.objtype': ('tagref', 'objtype'),
'task.priority': ('task', 'priority'), 'task.priority': ('task', 'priority'),
'task.taskstate': ('task', 'taskstate'), 'task.taskstate': ('task', 'taskstate'),
'note.notetype': ('note', 'notetype'), 'user.role': ('user', 'role'),
'checklist.clstate': ('checklist', 'clstate'), 'vessel.htype': ('vessel', 'htype')
'checkitem.checkresult': ('checkitem', 'checkresult'),
'signalk.objtype': ('signalk', 'objtype'),
'signalk.datatype': ('signalk', 'datatype')
} }
for key, (table, column) in db_enums.items(): for key, (table, column) in db_enums.items():
self._enums[key] = self.db.load_enum(table, column) self._enums[key] = self.db.load_enum(table, column)
def _load_dropdowns(self): def _load_dropdowns(self):
self._dropdowns.clear() self._dropdowns.clear()
sql = "SELECT ddval FROM dropdown WHERE ddid=0 AND ddval>0"
# Step 1: init all lists as empty
self.db.cur.execute(sql)
for ddval in self.db.cur.fetchall():
self._dropdowns[ddval[0]] = {}
# Step 2: fill values where defined
sql = ( sql = (
"SELECT ddid, ddval, ddtext " "SELECT ddid, ddval, ddtext "
"FROM dropdown " "FROM dropdown "
@@ -74,15 +183,138 @@ class Lookup:
self.db.cur.execute(sql) self.db.cur.execute(sql)
for ddid, ddval, ddtext in self.db.cur.fetchall(): for ddid, ddval, ddtext in self.db.cur.fetchall():
if ddid not in self._dropdowns: if ddid not in self._dropdowns:
# should really not happen!
print("unknown dropdown list id found!")
self._dropdowns[ddid] = {} self._dropdowns[ddid] = {}
self._dropdowns[ddid][ddval] = ddtext self._dropdowns[ddid][ddval] = ddtext
def reload_dropdown(self, ddid):
self._dropdowns[ddid] = {}
sql = (
"SELECT ddval, ddtext "
"FROM dropdown "
"WHERE ddid=%s "
"ORDER BY sort, ddval"
)
self.db.cur.execute(sql)
for ddval, ddtext in self.db.cur.fetchall():
self._dropdowns[ddid][ddval] = ddtext
def enum(self, name): def enum(self, name):
return self._enums[name] return self._enums[name]
def dropdown(self, ddid): def dropdown(self, ddid):
return self._dropdowns[ddid] return self._dropdowns[ddid]
def iter_dropdowns(self):
yield from self._dropdowns.keys()
def user(self):
self.db.cur.execute("SELECT userid, displayname FROM user ORDER BY displayname")
return dict(self.db.cur.fetchall())
def vessel(self):
vessellist = {}
self.db.dcur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid")
for row in self.db.dcur.fetchall():
vessellist[row['vid']] = (
row['vesselname'] + " - " + row['model'] if row['model']
else row['vesselname']
)
return vessellist
def company(self, comptype):
sql = (
"SELECT compid, compname "
"FROM company "
"WHERE comptype=%(type)s OR comptype2=%(type)s "
"ORDER BY compname"
)
self.db.cur.execute(sql, {"type": comptype})
return dict(self.db.cur.fetchall())
def storage(self, vid):
storagelist = {}
sql = (
"SELECT sid, sname, CONCAT(x, ',', y, ',', z) AS position, remarks "
"FROM storage "
"WHERE vid=%s "
"ORDER BY sname"
)
self.db.cur.execute(sql, (vid,))
for row in self.db.cur.fetchall():
if row[3]:
storagelist[row[0]] = "{} ({}) - {}".format(row[1], row[2], row[3])
else:
storagelist[row[0]] = "{} ({})".format(row[1], row[2])
return storagelist
def box(self, vid):
boxlist = {}
sql = (
"SELECT b.boxid, b.label, b.content "
"FROM box AS b LEFT JOIN storage AS s USING (sid) "
"WHERE s.vid=%s OR s.vid IS NULL "
"ORDER BY b.label"
)
self.db.cur.execute(sql, (vid,))
for row in self.db.cur.fetchall():
if row[2]:
boxlist[row[0]] = "{} - {}".format(row[1], row[2])
else:
boxlist[row[0]] = row[1]
return boxlist
def equipment(self, vid):
sql = (
"SELECT eid, ename "
"FROM equipment "
"WHERE vid=%s "
"ORDER BY ename"
)
self.db.cur.execute(sql, (vid,))
return dict(self.db.cur.fetchall())
def inventory(self, vid):
sql = (
"SELECT invid, invname "
"FROM inventory "
"WHERE vid=%s "
"ORDER BY invname"
)
self.db.cur.execute(sql, (vid,))
return dict(self.db.cur.fetchall())
def cable(self, vid):
sql = (
"SELECT cableid, cablename "
"FROM cable "
"WHERE vid=%s "
"ORDER BY cablename"
)
self.db.cur.execute(sql, (vid,))
return dict(self.db.cur.fetchall())
def fuse(self, vid):
sql = (
"SELECT fuseid, CONCAT('F', fnumber, ' - ', description) "
"FROM fuse "
"WHERE vid=%s "
"ORDER BY fnumber"
)
self.db.cur.execute(sql, (vid,))
return dict(self.db.cur.fetchall())
def project(self, vid):
sql = (
"SELECT projid, projname "
"FROM project "
"WHERE vid=%s "
"ORDER BY projname"
)
self.db.cur.execute(sql, (vid,))
return dict(self.db.cur.fetchall())
def refresh(self): def refresh(self):
# TODO ugly hack please improve # TODO ugly hack please improve
self._load_dropdowns() self._load_dropdowns()
+15 -2
View File
@@ -1,14 +1,27 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Box(DbRecord): class Box(DbRecord):
table = "box" table = "box"
pk_field = "boxid" pk_field = "boxid"
fields = ('boxid', 'sid', 'boxtype', 'parent', 'label', 'color', 'content', pk_is_auto = True
'wx', 'wy', 'wz', 'weight', 'weight_net', 'price', 'remarks') fields = ('boxid', 'sid', 'boxtype', 'parent', 'label', 'color',
'content', 'wx', 'wy', 'wz', 'weight', 'weight_net', 'price',
'remarks')
def __init__(self, db, boxid=None): def __init__(self, db, boxid=None):
super().__init__(db, boxid) super().__init__(db, boxid)
self.title = _("Box({})") self.title = _("Box({})")
def save(self, commit=True):
if not super().save(Table.BOXES):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+15 -3
View File
@@ -1,15 +1,27 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Cable(DbRecord): class Cable(DbRecord):
table = "cable" table = "cable"
pk_field = "cableid" pk_field = "cableid"
fields = ('cableid', 'vid', 'cablename', 'cabletype', 'techname', 'length', pk_is_auto = True
'conductors', 'diameter', 'xsection', 'weight', 'color', 'supplier', fields = ('cableid', 'vid', 'cablename', 'cabletype', 'techname',
'manufacturer', 'cablecond', 'remarks') 'length', 'conductors', 'diameter', 'xsection', 'weight', 'color',
'supplier', 'manufacturer', 'cablecond', 'remarks')
def __init__(self, db, cableid=None): def __init__(self, db, cableid=None):
super().__init__(db, cableid) super().__init__(db, cableid)
self.title = _("Cable({})") self.title = _("Cable({})")
def save(self, commit=True):
if not super().save(Table.CABLES):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+21 -3
View File
@@ -1,15 +1,33 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
# names for fixed dropdown values
SUPPLIER = 1
MANUFACTURER = 2
SHIPYARD = 3
MISC = 9
class Company(DbRecord): class Company(DbRecord):
table = "company" table = "company"
pk_field = "compid" pk_field = "compid"
fields = ('compid', 'compname', 'comptype', 'comptype2', 'shortname', pk_is_auto = True
'street', 'zip', 'city', 'country', 'contact', 'phone', 'email', fields = ('compid', 'compname', 'comptype', 'comptype2',
'web', 'customerno', 'contractno', 'remarks', 'flags' ) 'shortname', 'street', 'zip', 'city', 'country', 'contact', 'phone',
'email', 'web', 'customerno', 'contractno', 'remarks', 'flags')
def __init__(self, db, compid=None): def __init__(self, db, compid=None):
super().__init__(db, compid) super().__init__(db, compid)
self.title = _("Company({})") self.title = _("Company({})")
def save(self, commit=True):
if not super().save(Table.COMPANIES):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+53 -20
View File
@@ -3,28 +3,33 @@
""" """
No commits here: Has to be done elsewhere to support transactions! No commits here: Has to be done elsewhere to support transactions!
Fields has to be a tuple to have fixed order which simplifies debugging
TODO primary keys can be multiple fields, stored as tuple
do not include pk auto fields in inserts and updates!
""" """
from datetime import datetime from datetime import datetime
class DbRecord: class DbRecord:
def __init__(self, db, record_id=None): REQUIRED = ('table', 'pk_field', 'pk_is_auto', 'fields')
if not hasattr(self, "table"):
raise TypeError("DbRecord subclass must define 'table'")
if not hasattr(self, "pk_field"):
raise TypeError("DbRecord subclass must define 'pk_field'")
if not hasattr(self, "fields"):
raise TypeError("DbRecord subclass must define 'fields'")
def __init_subclass__(cls, **kwargs):
for variable in DbRecord.REQUIRED:
if variable not in cls.__dict__:
raise TypeError(f"{cls.__name__} subclass must define '{variable}'")
def __init__(self, db, record_id=None):
self.db = db self.db = db
self.cur = db.cur self.cur = db.cur
self.dcur = db.dcur self.dcur = db.dcur
self.conn = db.conn self.conn = db.conn
self.last_update = None self.last_update = None
self.title = _("DbRecord({})") # for pretty print self._title = _("DbRecord({})") # for pretty print
self.pk_value = None
if record_id is not None: if record_id is not None:
self.pk_value = int(record_id) self.pk_value = int(record_id)
self.load() self.load()
@@ -62,17 +67,33 @@ class DbRecord:
self.clear() self.clear()
return False return False
def save(self): def save(self, rev_id=None):
self.last_update = datetime.now() self.last_update = datetime.now()
if self.pk_value is not None: if self.pk_value is not None:
return self._update() ret = self._update()
else: else:
return self._insert() ret = self._insert()
if ret == True and rev_id is not None:
# set list change marker
sql = (
"INSERT INTO revision (revtype, revid, changed) "
"VALUES ('table', %s, NOW()) "
"ON DUPLICATE KEY UPDATE changed = NOW()"
)
self.cur.execute(sql, (rev_id,))
return ret
def _update(self): def _update(self):
sqlfield = [] sqlfield = []
values = [] values = []
for field in self.fields: if self.pk_is_auto:
if type(self.pk_field) == tuple:
flist = set(self.fields) - set(self.pk_field)
else:
flist = set(self.fields) - {self.pk_field}
else:
flist = self.fields
for field in flist:
newdata = getattr(self, field) newdata = getattr(self, field)
if self.data[field] != newdata: if self.data[field] != newdata:
sqlfield.append("{}=%s".format(field)) sqlfield.append("{}=%s".format(field))
@@ -85,7 +106,7 @@ class DbRecord:
) )
values.append(self.pk_value) values.append(self.pk_value)
try: try:
self.dcur.execute(sql, values) self.cur.execute(sql, values)
except Exception as e: except Exception as e:
print(e) print(e)
print(sql) print(sql)
@@ -97,28 +118,36 @@ class DbRecord:
return True return True
def _insert(self): def _insert(self):
if self.pk_is_auto:
if type(self.pk_field) == tuple:
flist = set(self.fields) - set(self.pk_field)
else:
flist = set(self.fields) - {self.pk_field}
else:
flist = self.fields
sql = ( sql = (
"INSERT INTO {} ({}) " "INSERT INTO {} ({}) "
"VALUES ({})" "VALUES ({})"
).format( ).format(
self.table, self.table,
','.join(self.fields), ','.join(flist),
','.join(["%s"] * len(self.fields)) ','.join(["%s"] * len(flist))
) )
values = [] values = []
for field in self.fields: for field in flist:
newdata = getattr(self, field) newdata = getattr(self, field)
values.append(newdata) values.append(newdata)
self.data[field] = newdata self.data[field] = newdata
try: try:
self.dcur.execute(sql, values) self.cur.execute(sql, values)
except Exception as e: except Exception as e:
print(e) print(e)
print(sql) print(sql)
print(values) print(values)
self.db.error = e self.db.error = e
return False return False
self.pk_value = self.dcur.lastrowid self.pk_value = self.cur.lastrowid
setattr(self, self.pk_field, self.pk_value)
return True return True
def delete(self, record_id=None): def delete(self, record_id=None):
@@ -142,8 +171,12 @@ class DbRecord:
return True return True
def __str__(self): def __str__(self):
out = [self.title.format(self.pk_value)] out = [self._title.format(self.pk_value)]
for field in self.fields: for field in self.fields:
value = getattr(self, field, None) value = getattr(self, field, None)
out.append(" {:15}: {}".format(field, value)) oldvalue = self.data[field]
if value != oldvalue:
out.append(" {:15}: {} ({})".format(field, value, oldvalue))
else:
out.append(" {:15}: {}".format(field, value))
return "\n".join(out) return "\n".join(out)
+11
View File
@@ -6,6 +6,7 @@ class Document(DbRecord):
table = "document" table = "document"
pk_field = "docid" pk_field = "docid"
pk_is_auto = True
fields = ('docid', 'doctype', 'mimetype', 'filename', 'extension', fields = ('docid', 'doctype', 'mimetype', 'filename', 'extension',
'hash', 'docsize', 'doctime', 'docdate', 'title', 'pages', 'remarks', 'hash', 'docsize', 'doctime', 'docdate', 'title', 'pages', 'remarks',
'roleaccess') 'roleaccess')
@@ -13,3 +14,13 @@ class Document(DbRecord):
def __init__(self, db, docid=None): def __init__(self, db, docid=None):
super().__init__(db, docid) super().__init__(db, docid)
self.title = _("Document({})") self.title = _("Document({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+15 -3
View File
@@ -1,15 +1,27 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Equipment(DbRecord): class Equipment(DbRecord):
table = "equipment" table = "equipment"
pk_field = "eid" pk_field = "eid"
fields = ('eid', 'vid' 'ename', 'shortname', 'model', 'ecat', 'serial', pk_is_auto = True
'supplier', 'manufacturer', 'purchdate', 'price', 'weight', 'remarks', fields = ('eid', 'vid', 'ename', 'shortname', 'model', 'ecat',
'flags') 'serial', 'supplier', 'manufacturer', 'purchdate', 'price', 'weight',
'remarks', 'econd', 'flags')
def __init__(self, db, eid=None): def __init__(self, db, eid=None):
super().__init__(db, eid) super().__init__(db, eid)
self.title = _("Equipment({})") self.title = _("Equipment({})")
def save(self, commit=True):
if not super().save(Table.EQUIPMENT):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+14 -2
View File
@@ -1,14 +1,26 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Fuse(DbRecord): class Fuse(DbRecord):
table = "fuse" table = "fuse"
pk_field = "fuseid" pk_field = "fuseid"
fields = ('fuseid', 'vid', 'fnumber', 'ftype', 'current', 'cableid', pk_is_auto = True
'eid', 'location', 'description', 'remarks') fields = ('fuseid', 'vid', 'fnumber', 'ftype', 'current',
'cableid', 'eid', 'location', 'description', 'color', 'remarks')
def __init__(self, db, fuseid=None): def __init__(self, db, fuseid=None):
super().__init__(db, fuseid) super().__init__(db, fuseid)
self.title = _("Fuse({})") self.title = _("Fuse({})")
def save(self, commit=True):
if not super().save(Table.FUSES):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+15 -2
View File
@@ -1,14 +1,27 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Inventory(DbRecord): class Inventory(DbRecord):
table = "inventory" table = "inventory"
pk_field = "invid" pk_field = "invid"
fields = ('invid', 'invname', 'conttype', 'sid', 'boxid', 'eid', 'number', pk_is_auto = True
'weight', 'price', 'purchdate', 'invcond', 'remarks', 'flags') fields = ('invid', 'invname', 'icat', 'conttype', 'sid', 'boxid',
'eid', 'number', 'weight', 'price', 'purchdate', 'invcond', 'remarks',
'flags')
def __init__(self, db, invid=None): def __init__(self, db, invid=None):
super().__init__(db, invid) super().__init__(db, invid)
self.title = _("Inventory({})") self.title = _("Inventory({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+14 -3
View File
@@ -6,10 +6,21 @@ class Maintenance(DbRecord):
table = "maintenance" table = "maintenance"
pk_field = "maintid" pk_field = "maintid"
fields = ('maintid', 'vid', 'eid', 'series', 'activities', 'plan_date', pk_is_auto = True
'completion_date', 'interval_hours', 'last_hours', 'remarks', fields = ('maintid', 'vid', 'eid', 'series', 'activities',
'maintstate') 'plan_date', 'plan_precision', 'completion_date', 'interval_hours',
'last_hours', 'remarks', 'maintstate')
def __init__(self, db, maintid=None): def __init__(self, db, maintid=None):
super().__init__(db, maintid) super().__init__(db, maintid)
self.title = _("Maintenance({})") self.title = _("Maintenance({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+13 -2
View File
@@ -6,9 +6,20 @@ class Measurement(DbRecord):
table = "measurement" table = "measurement"
pk_field = "mid" pk_field = "mid"
fields = ('mid', 'mname', 'vid', 'eid', 'nval', 'val1', 'val2', 'val3', pk_is_auto = True
'unit', 'accuracy', 'mdate', 'note') fields = ('mid', 'mname', 'vid', 'eid', 'nval', 'val1', 'val2',
'val3', 'unit', 'accuracy', 'mdate', 'mcat', 'note')
def __init__(self, db, mid=None): def __init__(self, db, mid=None):
super().__init__(db, mid) super().__init__(db, mid)
self.title = _("Measurement({})") self.title = _("Measurement({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+13 -1
View File
@@ -1,14 +1,26 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
class Project(DbRecord): class Project(DbRecord):
table = "project" table = "project"
pk_field = "prokid" pk_field = "projid"
pk_is_auto = True
fields = ('projid', 'projname', 'vid', 'responsible', 'startdate', fields = ('projid', 'projname', 'vid', 'responsible', 'startdate',
'duration', 'costs_plan', 'costs_final', 'remarks', 'projstate') 'duration', 'costs_plan', 'costs_final', 'remarks', 'projstate')
def __init__(self, db, projid=None): def __init__(self, db, projid=None):
super().__init__(db, projid) super().__init__(db, projid)
self.title = _("Project({})") self.title = _("Project({})")
def save(self, commit=True):
if not super().save(Table.PROJECTS):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+14 -3
View File
@@ -6,10 +6,21 @@ class Provision(DbRecord):
table = "provisions" table = "provisions"
pk_field = "provid" pk_field = "provid"
fields = ('provid', 'provname', 'provcat', 'sid', 'boxid', 'number', pk_is_auto = True
'target', 'weight', 'weight_net', 'unit', 'calories', 'storedate', fields = ('provid', 'provname', 'provcat', 'sid', 'boxid',
'shelflife', 'price', 'remarks') 'number','target', 'weight', 'weight_net', 'unit', 'calories',
'storedate', 'shelflife', 'price', 'remarks')
def __init__(self, db, provid=None): def __init__(self, db, provid=None):
super().__init__(db, provid) super().__init__(db, provid)
self.title = _("Provision({})") self.title = _("Provision({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+16 -4
View File
@@ -1,12 +1,19 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord from .dbrecord import DbRecord
from yms.lookup import Table
# names for fixed dropdown values
GENERIC = 0
TANK = 1
EXT = 2
class Storage(DbRecord): class Storage(DbRecord):
table = "storage" table = "storage"
pk_field = "sid" pk_field = "sid"
fields = ('vid', 'sname', 'stype', 'capacity', 'capaunit', pk_is_auto = True
fields = ('sid', 'vid', 'sname', 'stype', 'capacity', 'capaunit',
'x', 'y', 'z', 'wx', 'wy', 'wz', 'angle', 'color', 'remarks') 'x', 'y', 'z', 'wx', 'wy', 'wz', 'angle', 'color', 'remarks')
def __init__(self, db, sid=None): def __init__(self, db, sid=None):
@@ -14,10 +21,15 @@ class Storage(DbRecord):
self.title = _("Storage({})") self.title = _("Storage({})")
def save(self, commit=True): def save(self, commit=True):
super().save() if not super().save(Table.STORAGE):
return False
if commit: if commit:
self.conn.commit() try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
def delete(self): def delete(self):
# there must be no assiciated data! # there must be no associated data!
pass pass
+14 -2
View File
@@ -6,9 +6,21 @@ class Task(DbRecord):
table = "task" table = "task"
pk_field = "taskid" pk_field = "taskid"
fields = ('taskid', 'vid', 'projid', 'taskname', 'priority', 'taskstate', pk_is_auto = True
'state_ts', 'plandate', 'duedate', 'started', 'finished', 'responsible') fields = ('taskid', 'vid', 'projid', 'taskname', 'priority',
'taskstate', 'state_ts', 'plandate', 'duedate', 'started', 'finished',
'responsible', 'remarks')
def __init__(self, db, taskid=None): def __init__(self, db, taskid=None):
super().__init__(db, taskid) super().__init__(db, taskid)
self.title = _("Task({})") self.title = _("Task({})")
def save(self, commit=True):
if not super().save():
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
+14
View File
@@ -104,6 +104,13 @@ class User(object):
# create mandatory settings # create mandatory settings
sql = "INSERT INTO settings (userid, sno, valint) VALUES (%s, 1, 0)" sql = "INSERT INTO settings (userid, sno, valint) VALUES (%s, 1, 0)"
self.cur.execute(sql, (newid,)) self.cur.execute(sql, (newid,))
# set list change marker
sql = (
"INSERT INTO revision (revtype, revid, changed) "
"VALUES ('table', 2, NOW()) "
"ON DUPLICATE KEY UPDATE changed = NOW()"
)
self.db.cur.execute()
self.conn.commit() self.conn.commit()
return newid return newid
@@ -112,6 +119,13 @@ class User(object):
self.cur.execute(sql, (self.user_id,)) self.cur.execute(sql, (self.user_id,))
sql = "DELETE FROM user WHERE userid=%s" sql = "DELETE FROM user WHERE userid=%s"
self.cur.execute(sql, (self.user_id,)) self.cur.execute(sql, (self.user_id,))
# set list change marker
sql = (
"INSERT INTO revision (revtype, revid, changed) "
"VALUES ('table', 2, NOW()) "
"ON DUPLICATE KEY UPDATE changed = NOW()"
)
self.db.cur.execute()
self.conn.commit() self.conn.commit()
def setpass(self, newpass): def setpass(self, newpass):
+30 -10
View File
@@ -6,18 +6,20 @@ class Vessel(DbRecord):
table = "vessel" table = "vessel"
pk_field = "vid" pk_field = "vid"
fields = ('vid', 'vtype', 'vesselname', 'model', 'shipyard', 'loa', 'lwl', pk_is_auto = True
'beam', 'draught', 'draught_min', 'displacement', 'ballast', fields = ('vid', 'vtype', 'htype', 'vesselname', 'model',
'beltpos_aft', 'beltpos_bow', 'shapefile', 'sid_default', 'year_built', 'shipyard', 'hull_number', 'loa', 'lwl', 'beam', 'draught',
'remarks') 'draught_min', 'displacement', 'ballast', 'beltpos_aft', 'beltpos_bow',
'shapefile', 'sid_default', 'year_built', 'remarks')
def __init__(self, db, vid=None): def __init__(self, db, vid=None):
super().__init__(db, vid) super().__init__(db, vid)
self.title = _("Vessel({})") self.title = _("Vessel({})")
def create(self): def create(self):
self.clear()
sql = ( sql = (
"SELECT MIN(v1.vid+1) AS newid " "SELECT IFNULL(MIN(v1.vid+1), 1) AS newid "
"FROM vessel AS v1 LEFT JOIN vessel AS v2 ON v2.vid=v1.vid+1 " "FROM vessel AS v1 LEFT JOIN vessel AS v2 ON v2.vid=v1.vid+1 "
"WHERE v1.vid>=0 AND v2.vid IS NULL" "WHERE v1.vid>=0 AND v2.vid IS NULL"
) )
@@ -29,18 +31,36 @@ class Vessel(DbRecord):
else: else:
# create additional vessel # create additional vessel
self.pk_value = row['newid'] self.pk_value = row['newid']
self.clear()
self.vid = self.pk_value self.vid = self.pk_value
self.vesselname = f"Vessel #{self.pk_value}" self.vesselname = "Vessel #{}".format(self.pk_value)
self.vtype = 1 # monohull self.htype = 'mono'
self._insert() self._insert()
# set list change marker
sql = (
"INSERT INTO revision (revtype, revid, changed) "
"VALUES ('table', 1, NOW()) "
"ON DUPLICATE KEY UPDATE changed = NOW()"
)
self.db.cur.execute(sql)
self.conn.commit() self.conn.commit()
def save(self, commit=True): def save(self, commit=True):
super().save() if not super().save():
return False
if commit: if commit:
self.conn.commit() try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
def delete(self): def delete(self):
# there must be no assiciated data! # there must be no assiciated data!
pass pass
# set list change marker
sql = (
"INSERT INTO revision (revtype, revid, changed) "
"VALUES ('table', 1, NOW()) "
"ON DUPLICATE KEY UPDATE changed = NOW()"
)
self.db.cur.execute()
+10
View File
@@ -0,0 +1,10 @@
.field-name {
color: #3D3846;
}
.field-value {
color: black;
}
.invalid {
color: #cc0000;
background-color: #ffdddd;
}
+57
View File
@@ -15,6 +15,31 @@ def add_column(treeview, label, index, xalign=None, col_fg=None, col_bg=None, vi
col.add_attribute(cell, 'background', col_bg) col.add_attribute(cell, 'background', col_bg)
treeview.append_column(col) treeview.append_column(col)
def create_columns(treeview, columns, keys=0, alignments=None):
"""
columns - is a list of column titles
keys - is the number of the first visible column from the left containing
the identifying column key
alignments - l, c or r
"""
i = 0
visible_cols = len(columns) - keys
if alignments:
alignments = alignments.lower()
if len(alignments) < visible_cols:
alignments += "l" * (visible_cols - len(alignments))
for column in columns:
if not alignments:
add_column(treeview, column, i + keys)
else:
if alignments[i] == 'r':
add_column(treeview, column, i + keys, 1.0)
elif alignments[i] == 'c':
add_column(treeview, column, i + keys, 0.5)
else:
add_column(treeview, column, i + keys)
i += 1
def get_value(treeview, column=0): def get_value(treeview, column=0):
""" """
Returns the value of the specified column of the linked model Returns the value of the specified column of the linked model
@@ -43,3 +68,35 @@ def set_value(treeview, column, value):
return True return True
else: else:
return False return False
def set_row_values(treeview, data):
"""
Set every column in row to new value
"""
try:
selection = treeview.get_selection()
except:
return False
if not selection.get_mode() == Gtk.SelectionMode.SINGLE:
return False
(model, iter) = selection.get_selected()
# check if data count matches treeview columns
if len(data) != model.get_n_columns():
print("treeview:refresh_row column count mismatch")
return False
column = 0
for value in data:
# TODO data type checks?
model.set_value(iter, column, value)
column += 1
return True
def remove_selected_rows(treeview):
"""
Removes the currently selected rows from the model
"""
selection = treeview.get_selection()
model, paths = selection.get_selected_rows()
for path in paths:
it = model.get_iter(path)
model.remove(it)
+2276 -1368
View File
File diff suppressed because it is too large. Load diff
+247 -54
View File
@@ -158,6 +158,7 @@
<object class="GtkTreeView" id="tvw_box"> <object class="GtkTreeView" id="tvw_box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_box_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -235,8 +236,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_details"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Box Details</property> <property name="label" translatable="yes">Box Details</property>
@@ -251,15 +253,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=8 --> <!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel" id="lbl_lb_name"> <object class="GtkLabel" id="lbl_lb_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Label</property> <property name="label" translatable="yes">Label</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -271,6 +278,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -283,10 +294,13 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property> <property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -295,10 +309,15 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -306,10 +325,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Content</property> <property name="label" translatable="yes">Content</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">1</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -317,10 +339,14 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">1</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -328,10 +354,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -339,10 +368,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Color</property> <property name="label" translatable="yes">Color</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -350,10 +382,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight</property> <property name="label" translatable="yes">Weight</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">4</property> <property name="top-attach">5</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -361,17 +396,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
</object> <property name="xalign">0</property>
<packing> <style>
<property name="left-attach">1</property> <class name="field-value"/>
<property name="top-attach">2</property> </style>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_color">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -379,25 +407,47 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_weight"> <object class="GtkLabel" id="lbl_color">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">4</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_weight">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_weight_net"> <object class="GtkLabel" id="lbl_lb_weight_net">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight net</property> <property name="label" translatable="yes">Weight net</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -405,10 +455,14 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -416,10 +470,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Price</property> <property name="label" translatable="yes">Price</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -427,10 +484,43 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_content1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Storage</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_storage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing> </packing>
</child> </child>
</object> </object>
@@ -507,6 +597,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -523,15 +614,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=7 n-rows=9 --> <!-- n-columns=7 n-rows=10 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Label</property> <property name="label" translatable="yes">Label</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -546,7 +642,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">1</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -567,7 +663,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">1</property> <property name="top-attach">2</property>
<property name="width">6</property> <property name="width">6</property>
</packing> </packing>
</child> </child>
@@ -579,7 +675,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -592,7 +688,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">2</property> <property name="left-attach">2</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -605,7 +701,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">4</property> <property name="left-attach">4</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -620,7 +716,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -635,7 +731,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">3</property> <property name="left-attach">3</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -650,7 +746,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">5</property> <property name="left-attach">5</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -661,7 +757,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -672,7 +768,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -680,10 +776,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">8</property> <property name="top-attach">9</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -700,7 +797,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">8</property> <property name="top-attach">9</property>
<property name="width">6</property> <property name="width">6</property>
</packing> </packing>
</child> </child>
@@ -712,7 +809,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -725,7 +822,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">6</property> <property name="left-attach">6</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -736,7 +833,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -746,7 +843,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
<property name="width">6</property> <property name="width">6</property>
</packing> </packing>
</child> </child>
@@ -759,7 +856,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
<property name="width">3</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
@@ -772,7 +869,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
<property name="width">3</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
@@ -785,7 +882,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
<property name="width">3</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
@@ -797,24 +894,64 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">4</property> <property name="top-attach">5</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="but_color"> <object class="GtkEntry" id="ent_color">
<property name="label" translatable="yes">#FFFFFF</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <signal name="activate" handler="on_ent_color_activate" swapped="no"/>
<property name="relief">half</property> <signal name="focus-out-event" handler="on_ent_color_focus_out_event" swapped="no"/>
<signal name="clicked" handler="on_but_color_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">4</property> <property name="top-attach">5</property>
<property name="width">3</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkColorButton" id="but_color">
<property name="width-request">64</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-alpha">True</property>
<property name="show-editor">True</property>
<signal name="color-set" handler="on_but_color_set" swapped="no"/>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Storage</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_storage">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="width">6</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
@@ -858,6 +995,62 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="revealed">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -895,7 +1088,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+219 -18
View File
@@ -172,6 +172,7 @@
<object class="GtkTreeView" id="tvw_cables"> <object class="GtkTreeView" id="tvw_cables">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_cables_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -249,6 +250,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_detail"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
@@ -266,16 +268,19 @@
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=13 --> <!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property> <property name="row-spacing">6</property>
<property name="column-spacing">4</property> <property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -287,6 +292,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -298,6 +307,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -310,6 +322,9 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Tech.-name</property> <property name="label" translatable="yes">Tech.-name</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -321,6 +336,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Length</property> <property name="label" translatable="yes">Length</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -332,6 +350,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Conductors</property> <property name="label" translatable="yes">Conductors</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -343,6 +364,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Diameter</property> <property name="label" translatable="yes">Diameter</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -354,6 +378,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Cross section</property> <property name="label" translatable="yes">Cross section</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -365,6 +392,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight</property> <property name="label" translatable="yes">Weight</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -376,6 +406,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Color</property> <property name="label" translatable="yes">Color</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -387,6 +420,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Supplier</property> <property name="label" translatable="yes">Supplier</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -398,6 +434,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Manufacturer</property> <property name="label" translatable="yes">Manufacturer</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -409,6 +448,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Condition</property> <property name="label" translatable="yes">Condition</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -420,6 +462,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -431,6 +477,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -442,6 +492,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -453,6 +507,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -464,6 +522,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -475,6 +537,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -486,6 +552,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">False</property> <property name="hexpand">False</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -497,6 +567,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -508,6 +582,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -519,6 +597,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -530,6 +612,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -541,6 +627,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -552,6 +642,12 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -632,6 +728,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -649,14 +746,20 @@
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=13 --> <!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
<attribute name="foreground" value="#000000000000"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -679,6 +782,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<attributes>
<attribute name="weight" value="semibold"/>
<attribute name="foreground" value="#000000000000"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -701,6 +808,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Length</property> <property name="label" translatable="yes">Length</property>
<attributes>
<attribute name="weight" value="semibold"/>
<attribute name="foreground" value="#000000000000"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -712,6 +823,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Conductors</property> <property name="label" translatable="yes">Conductors</property>
<attributes>
<attribute name="weight" value="semibold"/>
<attribute name="foreground" value="#000000000000"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -734,6 +849,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Cross section</property> <property name="label" translatable="yes">Cross section</property>
<attributes>
<attribute name="weight" value="semibold"/>
<attribute name="foreground" value="#000000000000"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -800,6 +919,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -883,16 +1003,6 @@
<property name="top-attach">7</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child> <child>
<object class="GtkComboBox" id="cmb_supplier"> <object class="GtkComboBox" id="cmb_supplier">
<property name="visible">True</property> <property name="visible">True</property>
@@ -940,6 +1050,45 @@
<property name="top-attach">12</property> <property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkEntry" id="ent_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
<signal name="activate" handler="on_ent_color_activate" swapped="no"/>
<signal name="focus-out-event" handler="on_ent_color_focus_out_event" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="but_color">
<property name="width-request">64</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-alpha">True</property>
<signal name="color-set" handler="on_but_color_set" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -947,14 +1096,66 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="layout-style">end</property> <property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkButton" id="but_save"> <object class="GtkButton" id="but_save">
<property name="label" translatable="yes">Save</property> <property name="label" translatable="yes">Save</property>
@@ -987,7 +1188,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+322 -47
View File
@@ -110,6 +110,10 @@
<object class="GtkTreeView" id="tvw_companies"> <object class="GtkTreeView" id="tvw_companies">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_companies_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object> </object>
</child> </child>
</object> </object>
@@ -183,9 +187,12 @@
<object class="GtkBox" id="box_comp_edit"> <object class="GtkBox" id="box_comp_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Edit company</property> <property name="label" translatable="yes">Edit company</property>
@@ -200,15 +207,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=15 --> <!-- n-columns=2 n-rows=16 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -220,6 +232,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -242,7 +257,7 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type2</property> <property name="label" translatable="yes">Secondary type</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -281,7 +296,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_shortname">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">20</property> <property name="max-length">20</property>
@@ -406,14 +421,15 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">14</property> <property name="top-attach">15</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_street">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">40</property> <property name="max-length">40</property>
@@ -424,7 +440,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_zip">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">10</property> <property name="max-length">10</property>
@@ -435,7 +451,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_city">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">30</property> <property name="max-length">30</property>
@@ -446,7 +462,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_country">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">30</property> <property name="max-length">30</property>
@@ -457,7 +473,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_contact">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">30</property> <property name="max-length">30</property>
@@ -468,7 +484,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_phone">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">30</property> <property name="max-length">30</property>
@@ -480,7 +496,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_email">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">50</property> <property name="max-length">50</property>
@@ -492,7 +508,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_web">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">40</property> <property name="max-length">40</property>
@@ -503,7 +519,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_customerno">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">20</property> <property name="max-length">20</property>
@@ -514,7 +530,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkEntry" id="ent_contractno">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="max-length">20</property> <property name="max-length">20</property>
@@ -525,9 +541,66 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkTextView"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="txt_remarks">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">15</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">14</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckButton" id="chk_historic">
<property name="label" translatable="yes">historic</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_deleted">
<property name="label" translatable="yes">deleted</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -541,6 +614,62 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="revealed">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -579,7 +708,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack-type">end</property> <property name="pack-type">end</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
@@ -594,8 +723,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Company details</property> <property name="label" translatable="yes">Company details</property>
@@ -610,12 +740,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=15 --> <!-- n-columns=2 n-rows=16 -->
<object class="GtkGrid" id="grd_detail"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
@@ -626,10 +758,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_type">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -637,10 +772,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_type2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type secondary</property> <property name="label" translatable="yes">Type secondary</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -648,10 +786,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_shortname">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Short name</property> <property name="label" translatable="yes">Short name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -659,10 +800,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_street">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Street</property> <property name="label" translatable="yes">Street</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -670,10 +814,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_zip">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">ZIP</property> <property name="label" translatable="yes">ZIP</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -681,10 +828,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_city">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">City</property> <property name="label" translatable="yes">City</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -692,10 +842,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_country">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Country</property> <property name="label" translatable="yes">Country</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -707,6 +860,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -718,6 +876,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -729,6 +892,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -740,6 +908,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -751,6 +924,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -762,6 +940,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -773,6 +956,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -784,6 +972,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -791,11 +984,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_contact">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Contact</property> <property name="label" translatable="yes">Contact</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -803,11 +998,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_phone">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Phone</property> <property name="label" translatable="yes">Phone</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -815,11 +1012,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_email">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Email</property> <property name="label" translatable="yes">Email</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -827,11 +1026,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_web">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Web</property> <property name="label" translatable="yes">Web</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -839,11 +1040,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_customerno">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Customer no.</property> <property name="label" translatable="yes">Customer no.</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -851,11 +1054,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_contractno">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Contract no.</property> <property name="label" translatable="yes">Contract no.</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -863,15 +1068,18 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_remarks">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">14</property> <property name="top-attach">15</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -879,6 +1087,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -890,6 +1103,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -901,6 +1119,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -912,6 +1135,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -919,10 +1147,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_custno"> <object class="GtkLabel" id="lbl_customerno">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -934,6 +1167,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -945,6 +1183,43 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">15</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_flags">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">14</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_flags">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -993,12 +1268,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="but_cance"> <object class="GtkButton" id="but_close">
<property name="label" translatable="yes">Cancel</property> <property name="label" translatable="yes">Close</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_cancel_clicked" swapped="no"/> <signal name="clicked" handler="on_but_close_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
+398 -9
View File
@@ -2,6 +2,164 @@
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.40.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkDialog" id="dlg_scanner">
<property name="can-focus">False</property>
<property name="modal">True</property>
<property name="destroy-with-parent">True</property>
<property name="type-hint">dialog</property>
<property name="skip-taskbar-hint">True</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="but_scan_preview">
<property name="label" translatable="yes">Preview</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_scan_scan">
<property name="label" translatable="yes">Scan</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_scan_close">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_scan_close_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkDialog" id="dlg_upload">
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="but_upload_close">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_upload_close_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -147,6 +305,7 @@
<object class="GtkTreeView" id="tvw_documents"> <object class="GtkTreeView" id="tvw_documents">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_documents_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -225,7 +384,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Document Details</property> <property name="label" translatable="yes">Document Details</property>
@@ -240,7 +399,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=8 --> <!-- n-columns=3 n-rows=9 -->
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -249,6 +408,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Title</property> <property name="label" translatable="yes">Title</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -260,6 +422,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -271,6 +437,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Filename</property> <property name="label" translatable="yes">Filename</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -282,6 +451,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Image extents</property> <property name="label" translatable="yes">Image extents</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -293,6 +465,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Mimetype</property> <property name="label" translatable="yes">Mimetype</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -304,6 +479,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -315,6 +494,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -326,6 +509,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -337,6 +524,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">File size</property> <property name="label" translatable="yes">File size</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -348,6 +538,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Upload date</property> <property name="label" translatable="yes">Upload date</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -359,6 +552,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Document type</property> <property name="label" translatable="yes">Document type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -370,6 +566,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -381,6 +581,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -392,6 +596,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -403,10 +611,14 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -415,15 +627,63 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_roleaccess">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Role access</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_roleaccess">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkImage" id="img_preview">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="yalign">0</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
<property name="height">9</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
@@ -494,6 +754,8 @@
<object class="GtkBox" id="box_doc_edit"> <object class="GtkBox" id="box_doc_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
@@ -511,10 +773,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=4 --> <!-- n-columns=2 n-rows=5 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
@@ -557,7 +821,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -586,7 +850,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -594,6 +858,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Document type</property> <property name="label" translatable="yes">Document type</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -610,6 +877,30 @@
<property name="top-attach">0</property> <property name="top-attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Access level</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_accesslevel">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -617,10 +908,78 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkDrawingArea">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="revealed">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="spacing">2</property>
<property name="layout-style">end</property> <property name="layout-style">end</property>
<child> <child>
<object class="GtkButton" id="but_save"> <object class="GtkButton" id="but_save">
@@ -633,7 +992,7 @@
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -644,17 +1003,47 @@
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_cancel_clicked" swapped="no"/> <signal name="clicked" handler="on_but_cancel_clicked" swapped="no"/>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_upload">
<property name="label" translatable="yes">Upload</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_upload_clicked" swapped="no"/>
</object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_scan">
<property name="label" translatable="yes">Scan</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_scan_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
</object> </object>
+381 -32
View File
@@ -12,6 +12,11 @@
<property name="step-increment">1</property> <property name="step-increment">1</property>
<property name="page-increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkImage" id="img_calendar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -318,6 +323,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_detail"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
@@ -334,15 +340,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=11 --> <!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel" id="lbl_lb_name"> <object class="GtkLabel" id="lbl_lb_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -354,6 +365,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Short name</property> <property name="label" translatable="yes">Short name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -365,6 +379,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Manufacturer</property> <property name="label" translatable="yes">Manufacturer</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -376,6 +393,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Model</property> <property name="label" translatable="yes">Model</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -387,6 +407,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Serial no.</property> <property name="label" translatable="yes">Serial no.</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -398,6 +421,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight</property> <property name="label" translatable="yes">Weight</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -409,6 +435,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Price</property> <property name="label" translatable="yes">Price</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -420,6 +449,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Date purchase</property> <property name="label" translatable="yes">Date purchase</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -431,6 +463,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Supplier</property> <property name="label" translatable="yes">Supplier</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -442,6 +477,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Category</property> <property name="label" translatable="yes">Category</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -454,10 +492,13 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property> <property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">10</property> <property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -465,6 +506,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -476,6 +522,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -487,6 +538,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -498,6 +554,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -509,6 +570,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">False</property> <property name="hexpand">False</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -520,6 +586,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -531,6 +602,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -538,10 +614,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_date_purch"> <object class="GtkLabel" id="lbl_purchdate">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -553,6 +634,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -564,6 +650,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -576,12 +667,78 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_flags">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_flags">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">10</property> <property name="top-attach">10</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_lb_condition">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Condition</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_condition">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -637,6 +794,21 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="but_convert">
<property name="label" translatable="yes">Convert</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_convert_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -657,7 +829,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Edit Equipment</property> <property name="label" translatable="yes">Edit Equipment</property>
@@ -672,7 +844,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=11 --> <!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -681,6 +853,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -785,7 +960,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox"> <object class="GtkComboBox" id="cmb_manufacturer">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
@@ -814,16 +989,6 @@
<property name="top-attach">4</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_purchdate">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
@@ -851,14 +1016,15 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">10</property> <property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox"> <object class="GtkComboBox" id="cmb_supplier">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
@@ -868,7 +1034,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox"> <object class="GtkComboBox" id="cmb_category">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
@@ -878,17 +1044,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry"> <object class="GtkSpinButton" id="spi_weight">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="adjustment">adj_weight</property> <property name="adjustment">adj_weight</property>
@@ -900,7 +1056,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spi_price">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="adjustment">adj_price</property> <property name="adjustment">adj_price</property>
@@ -911,6 +1067,144 @@
<property name="top-attach">6</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="txt_remarks">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Condition</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_condition">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_purchdate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_purchdate">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_purchdate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_calendar</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckButton" id="chk_ordered">
<property name="label" translatable="yes">ordered</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_removed">
<property name="label" translatable="yes">removed</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_deleted">
<property name="label" translatable="yes">deleted</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -918,6 +1212,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -956,7 +1305,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack-type">end</property> <property name="pack-type">end</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+263 -25
View File
@@ -26,7 +26,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<child> <child>
<!-- n-columns=3 n-rows=3 --> <!-- n-columns=3 n-rows=4 -->
<object class="GtkGrid"> <object class="GtkGrid">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -99,7 +99,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -119,7 +119,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -132,6 +132,30 @@
<property name="top-attach">1</property> <property name="top-attach">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Location</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_flt_location">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object> </object>
</child> </child>
<child type="label"> <child type="label">
@@ -157,6 +181,7 @@
<object class="GtkTreeView" id="tvw_fuses"> <object class="GtkTreeView" id="tvw_fuses">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_fuses_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -234,8 +259,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_details"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Fuse Details</property> <property name="label" translatable="yes">Fuse Details</property>
@@ -250,17 +276,22 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=8 --> <!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property> <property name="row-spacing">6</property>
<property name="column-spacing">4</property> <property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel" id="lbl_fnumber"> <object class="GtkLabel" id="lbl_fnumber">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -272,6 +303,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Number</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -283,6 +317,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -294,6 +331,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Current</property> <property name="label" translatable="yes">Current</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -305,6 +345,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Cable</property> <property name="label" translatable="yes">Cable</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -316,6 +359,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Equipment</property> <property name="label" translatable="yes">Equipment</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -327,6 +373,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Location</property> <property name="label" translatable="yes">Location</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -338,6 +387,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Description</property> <property name="label" translatable="yes">Description</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -349,10 +401,14 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -360,6 +416,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -371,6 +432,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -382,6 +448,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -393,10 +464,17 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -404,6 +482,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -415,6 +498,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -426,12 +514,47 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">3</property> <property name="top-attach">3</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Color</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_color">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -505,7 +628,10 @@
<object class="GtkBox" id="box_fuse_edit"> <object class="GtkBox" id="box_fuse_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -522,15 +648,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=8 --> <!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Number</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -564,6 +695,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Current</property> <property name="label" translatable="yes">Current</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -608,10 +742,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -651,6 +786,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="adjustment">adj_current</property> <property name="adjustment">adj_current</property>
<property name="digits">1</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -677,17 +813,6 @@
<property name="top-attach">5</property> <property name="top-attach">5</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_location">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
@@ -698,14 +823,72 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Color</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
<signal name="activate" handler="on_ent_color_activate" swapped="no"/>
<signal name="focus-out-event" handler="on_ent_color_focus_out_event" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="but_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="color-set" handler="on_but_color_set" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBox" id="cmb_location">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -713,6 +896,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -753,7 +991,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+229
View File
@@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
version="1.1"
id="svg66"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs42">
<radialGradient
id="a"
cx="31.113001"
cy="19.009001"
r="8.6620998"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.5632,0,0,1.2196,-55.984,14.041)">
<stop
offset="0"
id="stop2" />
<stop
offset="1"
stop-opacity="0"
id="stop4" />
</radialGradient>
<radialGradient
id="h"
cx="11.329"
cy="10.584"
r="15.532"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.4634694,0.39303442)">
<stop
offset="0"
stop-color="#f3f4ff"
id="stop7" />
<stop
offset="1"
stop-color="#9193af"
id="stop9" />
</radialGradient>
<radialGradient
id="d"
cx="11.902"
cy="10.045"
r="29.292999"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.7072971,0.45851765)">
<stop
offset="0"
stop-color="#fffffd"
id="stop12" />
<stop
offset="1"
stop-color="#cbcbc9"
id="stop14" />
</radialGradient>
<radialGradient
id="f"
cx="23.375"
cy="10.973"
r="3.3478"
gradientTransform="matrix(3.6304,0,0,3.7421,-60.363428,-28.884518)"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#c4a000"
id="stop17" />
<stop
offset="1"
stop-color="#c4a000"
stop-opacity="0"
id="stop19" />
</radialGradient>
<radialGradient
id="c"
cx="8.7468004"
cy="6.8283"
r="29.889999"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.3880212,0.3727718)">
<stop
offset="0"
stop-color="#9497b3"
id="stop22" />
<stop
offset="1"
stop-color="#4c4059"
id="stop24" />
</radialGradient>
<linearGradient
id="b"
x1="8.9155998"
x2="9.8855"
y1="37.196999"
y2="52.091"
gradientTransform="matrix(3.1238,0,0,0.96969,-29.901048,-19.061377)"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#9aa29a"
id="stop27" />
<stop
offset="1"
stop-color="#b5beb5"
id="stop29" />
</linearGradient>
<linearGradient
id="e"
x1="6.3421998"
x2="22.218"
y1="7.7893"
y2="25.884001"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.7072971,0.45851765)">
<stop
offset="0"
stop-color="#a0a0a0"
id="stop32" />
<stop
offset="1"
stop-color="#fff"
id="stop34" />
</linearGradient>
<linearGradient
id="g"
x1="19.667"
x2="20.33"
y1="4.2571001"
y2="5.2845998"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.122572,0.30148183)">
<stop
offset="0"
stop-color="#c4a000"
id="stop37" />
<stop
offset="1"
stop-color="#c4a000"
stop-opacity="0"
id="stop39" />
</linearGradient>
</defs>
<g
id="g407"
transform="matrix(0.36405586,0,0,0.35772375,-0.72336166,-0.19088956)">
<path
fill="url(#b)"
fill-rule="evenodd"
d="M 18.588,1.4037 4.227,18.0967 5.4857,19.3399 18.5877,1.4039 Z"
color="#000000"
id="path46"
style="fill:url(#b)" />
<path
fill="#fefefe"
fill-rule="evenodd"
d="M 18.467,1.3138 5.66,19.0728 7.4895,20.6881 18.4665,1.3141 Z"
id="path48" />
<path
fill="url(#c)"
fill-rule="evenodd"
stroke="#605773"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="0.69855"
d="m 31.161,16.911 a 14.911,14.911 0 1 1 -29.821,0 14.911,14.911 0 1 1 29.821,0 z"
transform="matrix(1.4315,0,0,1.4315,0.56946,-1.6546)"
id="path50"
style="fill:url(#c)" />
<path
fill="url(#d)"
fill-rule="evenodd"
stroke="url(#e)"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="0.7114"
d="m 31.161,16.911 a 14.911,14.911 0 1 1 -29.821,0 14.911,14.911 0 1 1 29.821,0 z"
transform="matrix(1.1638,0,0,1.1638,4.8248,2.7776)"
id="path52"
style="fill:url(#d);stroke:url(#e)" />
<path
fill="url(#f)"
fill-rule="evenodd"
stroke="url(#g)"
stroke-width="0.56499"
d="m 16.679,6.6387 a 8.5,8.5 0 0 1 6.6533,-3.2636 l 0.04231,8.4999 z"
color="#000000"
transform="matrix(1.77,0,0,1.77,-17.024,1.6107)"
id="path54"
style="fill:url(#f);stroke:url(#g)" />
<path
fill="#f3f3f3"
fill-rule="evenodd"
stroke="#000000"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="0.999994"
d="m 26.70436,22.691697 a 2.526938,2.526938 0 1 1 -5.053669,0 2.526938,2.526938 0 1 1 5.053669,0 z"
id="path56" />
<path
fill="none"
stroke="#000000"
stroke-linecap="round"
d="M 22.177,20.718 13.1561,13.1403"
id="path58" />
<path
fill="none"
stroke="#000000"
stroke-linecap="round"
stroke-width="2"
d="m 19.409,29.777 2.96,-4.4933"
id="path60" />
<path
fill="#b6b9b1"
fill-rule="evenodd"
d="m 25.331338,8.7434534 a 1.7011706,1.7011706 0 1 1 -3.402231,0 1.7011706,1.7011706 0 1 1 3.402231,0 z m 0,27.2179996 a 1.7011706,1.7011706 0 1 1 -3.402231,0 1.7011706,1.7011706 0 1 1 3.402231,0 z m -13.609,-13.6091 a 1.7011706,1.7011706 0 1 1 -3.4022313,0 1.7011706,1.7011706 0 1 1 3.4022313,0 z m 27.2186,0 a 1.7011706,1.7011706 0 1 1 -3.402231,0 1.7011706,1.7011706 0 1 1 3.402231,0 z"
id="path62" />
<path
fill="none"
stroke="url(#h)"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="0.73657"
d="m 31.161,16.911 a 14.911,14.911 0 1 1 -29.821,0 14.911,14.911 0 1 1 29.821,0 z"
id="path64"
transform="matrix(1.3577,0,0,1.3577,1.7699,-0.49374)"
style="stroke:url(#h)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

+49
View File
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg
viewBox="0 0 1536 1536"
xmlns="http://www.w3.org/2000/svg">
<g
id="database"
transform="matrix(1.2722662,0,0,1.272228,-90.933152,-28.35833)">
<path
d="m 117,608.4 v 178.5 c 1.5,93.7 155.7,169.5 395,169.5 239.3,0 393.4,-75.8 395,-169.5 V 608.4 Z"
fill="#1b9bdb"
style="stroke-width:0.617813" />
<path
d="m 907,607.7 c 0,99.4 -154.8,180 -395,180 -240.2,0 -395,-80.6 -395,-180 0,-99.4 154.8,-180 395,-180 240.2,0 395,80.5 395,180 z"
fill="#ffffff"
style="stroke-width:0.617813" />
<path
d="m 117,428.4 v 158.5 c 1.5,93.7 155.7,179.5 395,179.5 239.3,0 393.4,-85.8 395,-179.5 V 428.4 Z"
fill="#1b9bdb"
style="stroke-width:0.617813" />
<path
d="m 907,427.7 c 0,99.4 -154.8,180 -395,180 -240.2,0 -395,-80.6 -395,-180 0,-99.4 154.8,-180 395,-180 240.2,0 395,80.5 395,180 z"
fill="#ffffff"
style="stroke-width:0.617813" />
<path
d="m 117,248.4 v 158.5 c 1.5,93.7 155.7,179.5 395,179.5 239.3,0 393.4,-85.8 395,-179.5 V 248.4 Z"
fill="#1b9bdb"
style="stroke-width:0.617813" />
<path
d="m 907,247.7 c 0,99.4 -154.8,180 -395,180 -240.2,0 -395,-80.6 -395,-180 0,-99.4 154.8,-180 395,-180 240.2,0 395,80.5 395,180 z"
fill="#3ed6ff"
style="stroke-width:0.617813" />
</g>
<g
id="vessel"
transform="matrix(1.1909726,0,0,1.1909662,-198.75012,-148.39229)">
<path
d="M 1037.0086,942.8165 C 974.9073,737.83301 942.30445,523.89181 951.83243,309.49199 c 1.5097,-38.97292 5.19683,-77.86596 8.09496,-116.78033 1.33545,-17.93774 14.12957,-29.73918 29.76885,-28.01762 15.18766,1.67139 24.69326,15.34216 22.63436,33.07917 -33.49361,282.57064 3.9464,579.18885 117.5337,840.84319 14.0515,28.6031 34.323,54.1283 42.0974,85.5486 -0.8685,0.8127 -1.7384,1.6268 -2.6068,2.4395 22.4824,0.4363 45.4611,-0.9256 67.6396,2.0896 24.6445,3.8083 31.7539,27.8852 14.8155,46.1268 -42.8084,33.5071 -93.4092,57.5965 -144.1675,76.5923 -45.2046,15.5791 -92.8194,15.752 -140.07182,14.7971 -86.06691,-2.4785 -172.62034,-4.5918 -258.15753,-14.5378 -49.89263,-6.6633 -89.41252,-33.7999 -122.0572,-71.3733 -13.21372,-15.2083 -26.37865,-30.4626 -39.73874,-45.5441 -9.4764,-10.6974 -10.62506,-25.0345 -2.49944,-35.8518 7.82173,-10.413 21.13582,-11.584 34.42482,-7.7519 58.20923,12.4036 118.76875,12.9598 177.93008,19.0738 116.70842,6.7176 232.51074,16.4769 349.60533,15.8078 -107.60982,-101.9209 -250.59373,-174.55152 -386.30655,-76.5421 -36.41405,23.8245 -62.39401,63.1905 -94.97736,7.8272 -161.7569,-288.68926 58.74593,-585.96682 271.1984,-776.50727 10.62367,-9.71744 23.00936,-11.36791 32.93463,-4.62244 10.06468,6.84027 13.4744,18.81456 8.23018,32.2149 -107.65021,209.91817 -24.71143,451.69299 97.1213,635.25935 0.5771,-0.28437 1.1529,-0.56456 1.73,-0.84614 z M 629.22054,855.6216 c 2.64024,35.38899 6.80412,87.08895 19.83243,124.46576 3.86278,12.49983 15.35351,17.36761 25.40425,13.65265 10.09116,-3.73169 14.12679,-14.04296 10.64179,-26.96238 -50.10731,-188.23341 43.24326,-376.97144 157.7854,-522.04023 7.43699,-8.44334 11.91451,-23.02159 4.19454,-31.75907 -12.41217,-8.27327 -26.32149,3.53793 -34.90295,12.81905 C 698.60268,542.0512 635.33044,690.09335 629.22054,855.6216 Z"
fill="#000000"
style="fill:#044a6c;fill-opacity:1;stroke-width:0.689852" />
<path
d="m 976.33894,1356.0705 c -106.98667,25.935 -160.80619,60.3789 -268.18457,0.9479 -83.80725,-45.1288 -152.96774,47.5988 -271.91213,-6.3594 -59.29377,-30.832 -86.0014,-16.994 -139.15153,16.1855 -12.44423,7.2878 -23.33834,6.6061 -31.00534,-2.0644 -7.54153,-8.5284 -8.05034,-21.3029 1.8596,-31.0008 49.1605,-48.1007 101.79234,-72.3253 166.37634,-46.3094 81.32174,40.1062 120.05401,16.0991 200.59093,-0.9702 92.29392,-18.6557 148.72441,75.2624 246.39219,32.0253 70.72316,-27.9312 115.42315,-28.2797 187.00917,-3.485 45.8612,16.2051 88.8145,-7.7826 131.3747,-23.0369 66.9956,-28.7494 133.4782,6.9866 198.992,22.6201 42.7219,10.7058 34.2534,66.196 -10.6752,61.8231 -29.3883,-6.5698 -59.0972,-13.3655 -87.2644,-24.2748 -92.043,-34.5247 -143.9527,62.0098 -261.4404,19.63 -20.3914,-6.2952 -41.45474,-10.4283 -62.96136,-15.731 z"
fill="#000000"
style="fill:#044a6c;fill-opacity:1;stroke-width:0.689852" />
<path
d="m 629.22333,855.62439 c 6.09457,-165.49758 69.39608,-313.59968 182.95406,-429.82561 8.56334,-9.26022 22.53958,-21.18433 34.90574,-12.81626 7.66282,8.87408 3.26754,23.24881 -4.19872,31.75627 -114.52681,145.02977 -207.89968,333.85143 -157.78122,522.04302 3.48361,12.91663 -0.55202,23.2293 -10.64318,26.96099 -10.05074,3.71635 -21.54008,-1.15282 -25.40564,-13.65126 -13.02693,-37.33638 -17.20892,-89.08095 -19.83104,-124.46715 z"
fill="#ffffff"
style="stroke-width:0.689852" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

+356 -97
View File
@@ -17,6 +17,11 @@
<property name="step-increment">1</property> <property name="step-increment">1</property>
<property name="page-increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkImage" id="img_calendar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -241,6 +246,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_detail"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
@@ -257,15 +263,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=12 --> <!-- n-columns=2 n-rows=11 -->
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel" id="lbl_lb_name"> <object class="GtkLabel" id="lbl_lb_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -273,10 +284,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_type"> <object class="GtkLabel" id="lbl_lb_container">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Container</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -284,10 +298,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_storage"> <object class="GtkLabel" id="lbl_lb_equipment">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Storage</property> <property name="label" translatable="yes">Equipment</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -295,10 +312,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_box"> <object class="GtkLabel" id="lbl_lb_number">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Box</property> <property name="label" translatable="yes">Number</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -306,10 +326,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_equipment"> <object class="GtkLabel" id="lbl_lb_weight">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Equipment</property> <property name="label" translatable="yes">Weight</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -317,10 +340,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_number"> <object class="GtkLabel" id="lbl_lb_price">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Price</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -328,47 +354,31 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_weight"> <object class="GtkLabel" id="lbl_lb_purchdate">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight</property> <property name="label" translatable="yes">Purchase Date</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_lb_price">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Price</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_purchdate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Purchase Date</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">8</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="lbl_lb_condition"> <object class="GtkLabel" id="lbl_lb_condition">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Condition</property> <property name="label" translatable="yes">Condition</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">9</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -377,10 +387,13 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property> <property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">11</property> <property name="top-attach">10</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -388,7 +401,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="label" translatable="yes">ddd</property> <property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -400,6 +417,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -407,10 +429,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_storage"> <object class="GtkLabel" id="lbl_equipment">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -418,10 +445,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_box"> <object class="GtkLabel" id="lbl_number">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -429,10 +461,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_equipment"> <object class="GtkLabel" id="lbl_weight">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -440,10 +477,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_number"> <object class="GtkLabel" id="lbl_price">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -451,47 +493,35 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_weight"> <object class="GtkLabel" id="lbl_purchdate">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">6</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_price">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_purchdate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="lbl_condition"> <object class="GtkLabel" id="lbl_condition">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">9</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -500,10 +530,16 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">11</property> <property name="top-attach">10</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -511,10 +547,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Category</property> <property name="label" translatable="yes">Category</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">10</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -522,10 +561,45 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">10</property> <property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_category1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_flags">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">9</property>
</packing> </packing>
</child> </child>
</object> </object>
@@ -583,6 +657,21 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="but_convert">
<property name="label" translatable="yes">Convert</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_convert_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -602,6 +691,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -618,15 +708,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=12 --> <!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -637,7 +732,10 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Container</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -645,10 +743,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_edit_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Storage</property> <property name="label" translatable="yes">Storage</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -656,10 +757,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_edit_box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Box</property> <property name="label" translatable="yes">Box</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -682,6 +786,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Number</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -737,10 +844,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">11</property> <property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -755,19 +863,10 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="ent_remarks"> <object class="GtkComboBox" id="cmb_conttype">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_type">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<signal name="changed" handler="on_cmb_conttype_changed" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -775,7 +874,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="cmd_storage"> <object class="GtkComboBox" id="cmb_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
@@ -814,16 +913,6 @@
<property name="top-attach">9</property> <property name="top-attach">9</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_date">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child> <child>
<object class="GtkSpinButton" id="spi_number"> <object class="GtkSpinButton" id="spi_number">
<property name="visible">True</property> <property name="visible">True</property>
@@ -880,6 +969,121 @@
<property name="top-attach">10</property> <property name="top-attach">10</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Flags</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="txt_remarks">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckButton" id="chk_ordered">
<property name="label" translatable="yes">ordered</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_removed">
<property name="label" translatable="yes">removed</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_deleted">
<property name="label" translatable="yes">deleted</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_purchdate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_purchdate">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_purchdate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_calendar</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -887,6 +1091,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -924,7 +1183,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+2 -2
View File
@@ -4,11 +4,11 @@
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkWindow" id="wnd_main"> <object class="GtkWindow" id="wnd_main">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="title" translatable="yes">YMS</property> <property name="title">YMS</property>
<property name="window-position">center</property> <property name="window-position">center</property>
<property name="default-width">800</property> <property name="default-width">800</property>
<property name="default-height">600</property> <property name="default-height">600</property>
<property name="icon">../../icons/yms.svg</property> <property name="icon">icons/yms.svg</property>
<signal name="destroy" handler="on_destroy" swapped="no"/> <signal name="destroy" handler="on_destroy" swapped="no"/>
<child> <child>
<object class="GtkNotebook" id="ntb_modules"> <object class="GtkNotebook" id="ntb_modules">
+266 -24
View File
@@ -2,6 +2,31 @@
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.40.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkAdjustment" id="adj_interval">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_last">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_series">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkImage" id="img_completion">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkImage" id="img_plandate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -127,6 +152,7 @@
<object class="GtkTreeView" id="tvw_maintenance"> <object class="GtkTreeView" id="tvw_maintenance">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_maintenance_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -204,6 +230,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_detail"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
@@ -224,11 +251,16 @@
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel" id="lbl_lb_activities"> <object class="GtkLabel" id="lbl_lb_activities">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Activities</property> <property name="label" translatable="yes">Activities</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -240,6 +272,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -251,6 +288,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Equipment</property> <property name="label" translatable="yes">Equipment</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -262,6 +302,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -273,6 +318,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Series</property> <property name="label" translatable="yes">Series</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -284,6 +332,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Interval hours</property> <property name="label" translatable="yes">Interval hours</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -295,6 +346,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Last hours</property> <property name="label" translatable="yes">Last hours</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -306,6 +360,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Plan date</property> <property name="label" translatable="yes">Plan date</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -317,6 +374,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Completion date</property> <property name="label" translatable="yes">Completion date</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -328,6 +388,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Status</property> <property name="label" translatable="yes">Status</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -339,6 +402,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -350,6 +417,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -361,6 +433,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -372,6 +449,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -383,6 +465,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -394,6 +481,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -405,6 +497,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -416,6 +513,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -446,6 +550,7 @@
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -494,7 +599,10 @@
<object class="GtkBox" id="box_maint_edit"> <object class="GtkBox" id="box_maint_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -515,11 +623,16 @@
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Activities</property> <property name="label" translatable="yes">Activities</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -531,6 +644,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Equipment</property> <property name="label" translatable="yes">Equipment</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -608,6 +724,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -615,7 +732,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="txt_activities"> <object class="GtkEntry" id="ent_activities">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
@@ -629,6 +746,7 @@
<object class="GtkComboBox" id="cmb_equipment"> <object class="GtkComboBox" id="cmb_equipment">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -639,6 +757,8 @@
<object class="GtkSpinButton" id="spi_series"> <object class="GtkSpinButton" id="spi_series">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_series</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -649,6 +769,8 @@
<object class="GtkSpinButton" id="spi_interval"> <object class="GtkSpinButton" id="spi_interval">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_interval</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -659,38 +781,19 @@
<object class="GtkSpinButton" id="spi_last_hours"> <object class="GtkSpinButton" id="spi_last_hours">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_last</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">4</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_plandate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="ent_completion">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child> <child>
<object class="GtkComboBox" id="cmb_status"> <object class="GtkComboBox" id="cmb_status">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -716,6 +819,90 @@
<property name="top-attach">8</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="box_plandate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_plandate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">10</property>
<property name="width-chars">12</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_plandate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_plandate</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_plan_precision">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_completion">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_completion">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">10</property>
<property name="width-chars">12</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_completion">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_completion</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -723,6 +910,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -760,7 +1002,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
File diff suppressed because it is too large. Load diff
+184 -19
View File
@@ -17,6 +17,11 @@
<property name="step-increment">1</property> <property name="step-increment">1</property>
<property name="page-increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkImage" id="img_startdate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -165,6 +170,7 @@
<object class="GtkTreeView" id="tvw_projects"> <object class="GtkTreeView" id="tvw_projects">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_projects_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -183,12 +189,13 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="layout-style">end</property> <property name="layout-style">end</property>
<child> <child>
<object class="GtkButton"> <object class="GtkButton" id="but_new">
<property name="label" translatable="yes">New</property> <property name="label" translatable="yes">New</property>
<property name="name">but_new</property> <property name="name">but_new</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_new_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -197,12 +204,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton" id="but_edit">
<property name="label" translatable="yes">Edit</property> <property name="label" translatable="yes">Edit</property>
<property name="name">but_edit</property> <property name="name">but_edit</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_edit_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -211,11 +219,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton" id="but_detail">
<property name="label" translatable="yes">Delete</property> <property name="label" translatable="yes">Details</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_detail_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -241,6 +250,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_detail"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
@@ -261,11 +271,16 @@
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -277,6 +292,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Responsible</property> <property name="label" translatable="yes">Responsible</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -288,6 +306,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Date start</property> <property name="label" translatable="yes">Date start</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -299,6 +320,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Duration, days</property> <property name="label" translatable="yes">Duration, days</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -310,6 +334,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Costs plan</property> <property name="label" translatable="yes">Costs plan</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -321,6 +348,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Costs final</property> <property name="label" translatable="yes">Costs final</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -332,6 +362,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Status</property> <property name="label" translatable="yes">Status</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -343,6 +376,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -354,6 +388,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -365,6 +403,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -376,6 +418,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -387,6 +433,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -398,6 +448,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -409,6 +463,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -420,6 +478,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -431,6 +493,12 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -439,7 +507,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
@@ -455,6 +523,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_delete_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -464,11 +533,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="but_edit"> <object class="GtkButton" id="but_edit2">
<property name="label" translatable="yes">Edit</property> <property name="label" translatable="yes">Edit</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_edit_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -482,6 +552,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_close_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -507,12 +578,18 @@
<object class="GtkBox" id="box_proj_edit"> <object class="GtkBox" id="box_proj_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property> <property name="label" translatable="yes">Edit Project</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -525,11 +602,16 @@
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -541,6 +623,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Responsible</property> <property name="label" translatable="yes">Responsible</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -635,17 +720,6 @@
<property name="top-attach">1</property> <property name="top-attach">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="ent_date_start">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child> <child>
<object class="GtkSpinButton" id="spi_duration"> <object class="GtkSpinButton" id="spi_duration">
<property name="visible">True</property> <property name="visible">True</property>
@@ -708,6 +782,42 @@
<property name="top-attach">7</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="box_date_start">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_date_start">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_date_start">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_startdate</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -715,6 +825,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -752,7 +917,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+561 -63
View File
@@ -2,6 +2,46 @@
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.40.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkAdjustment" id="adj_calories">
<property name="upper">99999</property>
<property name="step-increment">10</property>
<property name="page-increment">100</property>
</object>
<object class="GtkAdjustment" id="adj_number">
<property name="upper">1000</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_price">
<property name="upper">1000</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_target">
<property name="upper">1000</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_weight">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_weight_net">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkImage" id="img_shelflife">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkImage" id="img_storedate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">x-office-calendar-symbolic</property>
</object>
<object class="GtkStack" id="topobject"> <object class="GtkStack" id="topobject">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@@ -26,7 +66,7 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Kategorie</property> <property name="label" translatable="yes">Category</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -114,7 +154,7 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Filter Providions (here selection description)</property> <property name="label" translatable="yes">Filter Provisions</property>
</object> </object>
</child> </child>
</object> </object>
@@ -133,6 +173,7 @@
<object class="GtkTreeView" id="tvw_provisions"> <object class="GtkTreeView" id="tvw_provisions">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_provisions_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -211,10 +252,13 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Edit provision</property> <property name="label" translatable="yes">Edit provision</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -223,15 +267,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=10 --> <!-- n-columns=2 n-rows=14 -->
<object class="GtkGrid" id="grd_editor"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -276,6 +325,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Number</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -290,7 +342,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -301,7 +353,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -312,7 +364,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -323,7 +375,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">8</property> <property name="top-attach">11</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -334,13 +386,14 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">9</property> <property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="ent_name"> <object class="GtkEntry" id="ent_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -351,6 +404,7 @@
<object class="GtkComboBox" id="cmb_category"> <object class="GtkComboBox" id="cmb_category">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -361,6 +415,7 @@
<object class="GtkComboBox" id="cmb_storage"> <object class="GtkComboBox" id="cmb_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -371,6 +426,7 @@
<object class="GtkComboBox" id="cmb_box"> <object class="GtkComboBox" id="cmb_box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -381,16 +437,19 @@
<object class="GtkComboBox" id="cmb_unit"> <object class="GtkComboBox" id="cmb_unit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="spi_number"> <object class="GtkSpinButton" id="spi_number">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_number</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -401,16 +460,9 @@
<object class="GtkSpinButton" id="spi_weight"> <object class="GtkSpinButton" id="spi_weight">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> <property name="hexpand">True</property>
<packing> <property name="adjustment">adj_weight</property>
<property name="left-attach">1</property> <property name="digits">2</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spi_weight_net">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -418,25 +470,197 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="ent_storedate"> <object class="GtkSpinButton" id="spi_weight_net">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_weight_net</property>
<property name="digits">2</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">8</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="ent_shelflife"> <object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">13</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="txt_remarks">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">13</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_storedate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkEntry" id="ent_storedate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="width-chars">12</property>
<property name="max-width-chars">10</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_storedate">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_storedate</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Target</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spi_target">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adj_target</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Calories</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spi_calories">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adj_calories</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">9</property> <property name="top-attach">9</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Price</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spi_price">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="text" translatable="yes">0,00</property>
<property name="adjustment">adj_price</property>
<property name="digits">2</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_shelflife">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="ent_shelflife">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="but_shelflife">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">img_shelflife</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">12</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -444,6 +668,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -481,7 +760,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
@@ -496,11 +775,15 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">View Provision</property> <property name="label" translatable="yes">View Provision</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -509,15 +792,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=10 --> <!-- n-columns=2 n-rows=14 -->
<object class="GtkGrid" id="grd_details"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -525,7 +813,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_category">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Category</property> <property name="label" translatable="yes">Category</property>
@@ -536,10 +824,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Storage</property> <property name="label" translatable="yes">Storage</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -550,7 +841,12 @@
<object class="GtkLabel" id="lbl_name"> <object class="GtkLabel" id="lbl_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Placeholder</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -561,6 +857,12 @@
<object class="GtkLabel" id="lbl_category"> <object class="GtkLabel" id="lbl_category">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -571,6 +873,12 @@
<object class="GtkLabel" id="lbl_storage"> <object class="GtkLabel" id="lbl_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -578,10 +886,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Box</property> <property name="label" translatable="yes">Box</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -589,10 +900,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_number">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Number</property> <property name="label" translatable="yes">Number</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -600,21 +914,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_weight">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Weight</property> <property name="label" translatable="yes">Weight</property>
</object> <style>
<packing> <class name="field-name"/>
<property name="left-attach">0</property> </style>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Weight net</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -622,10 +928,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_weight_net">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Unit</property> <property name="label" translatable="yes">Weight net</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -633,10 +942,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_unit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Storedate</property> <property name="label" translatable="yes">Unit</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -644,20 +956,43 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_lb_storedate">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Shelflife</property> <property name="label" translatable="yes">Storedate</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">9</property> <property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_shelflife">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Shelflife</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">12</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_box"> <object class="GtkLabel" id="lbl_box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -668,6 +1003,12 @@
<object class="GtkLabel" id="lbl_number"> <object class="GtkLabel" id="lbl_number">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -678,16 +1019,12 @@
<object class="GtkLabel" id="lbl_weight"> <object class="GtkLabel" id="lbl_weight">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> <property name="hexpand">True</property>
<packing> <property name="selectable">True</property>
<property name="left-attach">1</property> <property name="xalign">0</property>
<property name="top-attach">5</property> <style>
</packing> <class name="field-value"/>
</child> </style>
<child>
<object class="GtkLabel" id="lbl_weight_net">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -695,9 +1032,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_unit"> <object class="GtkLabel" id="lbl_weight_net">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -705,25 +1048,176 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_storedate"> <object class="GtkLabel" id="lbl_unit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">8</property> <property name="top-attach">8</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_storedate">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="lbl_shelflife"> <object class="GtkLabel" id="lbl_shelflife">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_price">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Price</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_price">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">9</property> <property name="top-attach">9</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="lbl_lb_target">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Target</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_target">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_shelflife1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">13</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_remarks">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">13</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_lb_calories">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Calories</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_calories">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">10</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -742,11 +1236,13 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_delete_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -755,6 +1251,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_edit_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -768,6 +1265,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<signal name="clicked" handler="on_but_close_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
+47 -8
View File
@@ -26,6 +26,7 @@
<object class="GtkNotebook" id="ntb_status"> <object class="GtkNotebook" id="ntb_status">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="switch-page" handler="on_ntb_status_switch_page" swapped="no"/>
<child> <child>
<object class="GtkBox" id="box_info"> <object class="GtkBox" id="box_info">
<property name="visible">True</property> <property name="visible">True</property>
@@ -48,9 +49,12 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">This is an early release of YMS native GUI. <property name="label" translatable="yes">This is an early release of YMS native GUI.
Please use the web frontend wich is already You can use also the web frontend wich is already
in an usable state. in an usable state.
Feel free to report issues and test results as well as
improvement suggestions.
For further assistance please consult the related For further assistance please consult the related
thread in "Segeln Forum"</property> thread in "Segeln Forum"</property>
</object> </object>
@@ -87,18 +91,53 @@ thread in "Segeln Forum"</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkBox" id="box_tables">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">False</property>
<property name="shadow-type">in</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkTreeView" id="tvw_tables"> <object class="GtkScrolledWindow" id="scw_tables">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<child internal-child="selection"> <property name="shadow-type">in</property>
<object class="GtkTreeSelection"/> <child>
<object class="GtkTreeView" id="tvw_tables">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="but_tables_reload">
<property name="label" translatable="yes">Reload</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_but_tables_reload_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@@ -178,7 +217,7 @@ thread in "Segeln Forum"</property>
<object class="GtkLabel" id="lbl_version"> <object class="GtkLabel" id="lbl_version">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">YMS version x.x.x</property> <property name="label">YMS version x.x.x</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
+265 -45
View File
@@ -152,6 +152,7 @@
<object class="GtkTreeView" id="tvw_storage"> <object class="GtkTreeView" id="tvw_storage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<signal name="row-activated" handler="on_tvw_storage_row_activated" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
@@ -229,11 +230,12 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lbl_title_detail">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Storage Detais</property> <property name="label" translatable="yes">Storage Details</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
@@ -245,15 +247,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=7 --> <!-- n-columns=2 n-rows=8 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_details">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -265,38 +272,25 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">0</property> <property name="top-attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_remarks">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Type</property> <property name="label" translatable="yes">Type</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -308,6 +302,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Position (x, y, z)</property> <property name="label" translatable="yes">Position (x, y, z)</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -319,6 +316,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Dimension (x, y, z)</property> <property name="label" translatable="yes">Dimension (x, y, z)</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -330,6 +330,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Angle</property> <property name="label" translatable="yes">Angle</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -341,6 +344,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Capacity</property> <property name="label" translatable="yes">Capacity</property>
<style>
<class name="field-name"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -352,6 +358,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -363,6 +374,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -374,6 +390,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -385,6 +406,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -396,12 +422,81 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
<property name="top-attach">5</property> <property name="top-attach">5</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Color</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_color">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="use-markup">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
<style>
<class name="field-name"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_remarks">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<style>
<class name="field-value"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -475,7 +570,10 @@
<object class="GtkBox" id="box_stor_edit"> <object class="GtkBox" id="box_stor_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="lbl_title_edit"> <object class="GtkLabel" id="lbl_title_edit">
<property name="visible">True</property> <property name="visible">True</property>
@@ -492,15 +590,20 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=7 n-rows=7 --> <!-- n-columns=7 n-rows=8 -->
<object class="GtkGrid"> <object class="GtkGrid" id="grd_editor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="row-spacing">4</property>
<property name="column-spacing">8</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property> <property name="label" translatable="yes">Name</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -512,6 +615,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Typ</property> <property name="label" translatable="yes">Typ</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@@ -535,7 +641,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">X</property> <property name="label">X</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -548,7 +654,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">Y</property> <property name="label">Y</property>
</object> </object>
<packing> <packing>
<property name="left-attach">3</property> <property name="left-attach">3</property>
@@ -561,7 +667,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">Z</property> <property name="label">Z</property>
</object> </object>
<packing> <packing>
<property name="left-attach">5</property> <property name="left-attach">5</property>
@@ -616,9 +722,9 @@
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">2</property>
<property name="top-attach">0</property> <property name="top-attach">0</property>
<property name="width">6</property> <property name="width">5</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -627,9 +733,9 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">2</property>
<property name="top-attach">1</property> <property name="top-attach">1</property>
<property name="width">6</property> <property name="width">5</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -649,7 +755,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">WX</property> <property name="label">WX</property>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">1</property>
@@ -662,7 +768,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">WY</property> <property name="label">WY</property>
</object> </object>
<packing> <packing>
<property name="left-attach">3</property> <property name="left-attach">3</property>
@@ -675,7 +781,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-start">4</property> <property name="margin-start">4</property>
<property name="margin-end">4</property> <property name="margin-end">4</property>
<property name="label" translatable="yes">WZ</property> <property name="label">WZ</property>
</object> </object>
<packing> <packing>
<property name="left-attach">5</property> <property name="left-attach">5</property>
@@ -778,10 +884,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Remarks</property> <property name="label" translatable="yes">Remarks</property>
<property name="yalign">0</property>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -797,13 +904,13 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="left-attach">1</property> <property name="left-attach">2</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
<property name="width">6</property> <property name="width">5</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="cmb_unit"> <object class="GtkComboBox" id="cmb_capaunit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
</object> </object>
@@ -828,10 +935,47 @@
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Degrees</property> <property name="label" translatable="yes">Color</property>
</object> </object>
<packing> <packing>
<property name="left-attach">4</property> <property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="but_color">
<property name="width-request">64</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="show-editor">True</property>
<signal name="color-set" handler="on_but_color_set" swapped="no"/>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="ent_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
<signal name="activate" handler="on_ent_color_activate" swapped="no"/>
<signal name="focus-out-event" handler="on_ent_color_focus_out_event" swapped="no"/>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Deg</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property> <property name="top-attach">4</property>
</packing> </packing>
</child> </child>
@@ -847,6 +991,27 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -854,6 +1019,61 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="spacing">6</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="spacing">16</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox">
<property name="visible">True</property> <property name="visible">True</property>
@@ -891,7 +1111,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>
+1250
View File
File diff suppressed because it is too large. Load diff
View File
Whitespace-only changes.
+571 -49
View File
@@ -1,29 +1,43 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
""" """
Spezial: Special:
Notebook mit Vessel, User, Lists, Settings Notebook with Vessel, User, Lists, Settings
""" """
import os import os
import pyudev
from gi.repository import GLib, Gtk, Gdk, Rsvg from gi.repository import GLib, Gtk, Gdk, Rsvg
from datetime import datetime
import subprocess
import locale
import xml.etree.ElementTree as ET
import json
from .view import View from .view import View
from yms import gtkutils, combobox, treeview from yms import gtkutils, combobox, treeview
from yms.lookup import Dropdown from yms.lookup import Dropdown, DDNAME
from yms.model import user
class BaseView(View): class BaseView(View):
def __init__(self, context): def __init__(self, context):
super().__init__(context, _("Base Data"), "base.ui") super().__init__(context, _("Base Data"), "base.ui")
#self.title = _("Base Data") self.context = context
#builder = Gtk.Builder()
#builder.set_translation_domain(context.textdomain) self.user = user.User(context.db) # current user record
#builder.add_from_file(os.path.join(context.ui_path, "base.ui")) self.newuser = False
#builder.connect_signals(self)
#self.topwidget = builder.get_object("topobject") self.backupdevice = None # USB-Stick detected only on demand
#gtkutils.init_named_controls(self, builder)
# Settings
self.sys_currency = context.db.load_setting(4)[0] or '€'
self.entry['sys_currency'].set_text(self.sys_currency)
self.sys_max_width = context.db.load_setting(20)[1] or 1024
self.spin['sys_max_width'].set_value(self.sys_max_width)
self.sys_max_height = context.db.load_setting(21)[1] or 768
self.spin['sys_max_height'].set_value(self.sys_max_height)
# combos # combos
roles = {'captain': 'Captain', 'helmsman': 'Helmsman', 'sailor': 'Sailor'} roles = {'captain': 'Captain', 'helmsman': 'Helmsman', 'sailor': 'Sailor'}
@@ -31,6 +45,14 @@ class BaseView(View):
langs = {'de': 'Deutsch', 'en': 'English'} langs = {'de': 'Deutsch', 'en': 'English'}
combobox.load_from_dict(self.combo['user_lang'], langs) combobox.load_from_dict(self.combo['user_lang'], langs)
today = datetime.now()
datedict = {
key: f"{prefix} - {today.strftime(fmt)}"
for key, (fmt, prefix) in context.datefmt_map.items()
}
self.datefmt = context.db.load_setting(2, False)[0] or 'Y-m-d'
combobox.load_from_dict(self.combo['datefmt'], datedict, self.datefmt)
# shipyard # shipyard
self.db.cur.execute("SELECT compid, compname FROM company WHERE comptype=3 ORDER BY compname") self.db.cur.execute("SELECT compid, compname FROM company WHERE comptype=3 ORDER BY compname")
shipyards = dict(self.db.cur.fetchall()) shipyards = dict(self.db.cur.fetchall())
@@ -56,49 +78,83 @@ class BaseView(View):
self.context.vessel.vesselname = "Ghost" self.context.vessel.vesselname = "Ghost"
# default storage for current vessel # default storage for current vessel
sql = "SELECT sid, sname FROM storage WHERE stype=0 AND vid=%s ORDER BY sname" self.dd_storage = self.context.lookup.storage(self.context.vessel.vid)
self.db.cur.execute(sql, (self.context.vessel.vid,)) combobox.load_from_dict(self.combo['storage'], {-1: _("─── none ───")} | self.dd_storage)
storages = dict(self.db.cur.fetchall()) self.context.subscribe("storage_modified", self.storage_modified)
combobox.load_from_dict(self.combo['storage'], {-1: _("─── none ───")} | storages)
# Vessel types
self.dd_vtype = self.context.lookup.dropdown(Dropdown.VESSEL_TYPE)
combobox.load_from_dict(self.combo['vtype'], {-1: _("─── none ───")} | self.dd_vtype, -1)
self.context.subscribe("dd_vtype_modified", self.vtype_modified)
# Hull types
self.dd_htype = self.context.lookup.enum('vessel.htype')
combobox.load_from_dict(self.combo['htype'], self.dd_htype, 'mono')
# List of available shapes for combobox selection
shapes = self.load_shapes()
combobox.load_from_dict(self.combo['hull_shape'], {"-1": _("─── none ───")} | shapes)
# get list of vessels # get list of vessels
vessellist = {} vessellist = self.context.lookup.vessel()
self.db.dcur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid") if len(vessellist) > 0:
for row in self.db.dcur.fetchall(): combobox.load_from_dict(self.combo['vessel'], vessellist, self.context.vessel.vid)
vessellist[row['vid']] = ( # TODO ? vessel load triggered from combobox init
row['vesselname'] if row['model'] is None # self.context.publish("vessel_modified", self.context.EVENT_UPD, None)
else row['vesselname'] + " - " + row['model']
)
combobox.load_from_dict(self.combo['vessel'], vessellist, self.context.vessel.vid)
# vessel load triggered from combobox init
# prepare lists # prepare lists
self.lst_user = Gtk.ListStore(int, str) self.lst_user = Gtk.ListStore(int, str)
self.db.cur.execute("SELECT userid, login FROM user WHERE userid>0 ORDER BY login") self.load_list_user()
for row in self.db.cur.fetchall():
self.lst_user.append(row)
treeview.add_column(self.tree['user'], 'ID', 0) treeview.add_column(self.tree['user'], 'ID', 0)
treeview.add_column(self.tree['user'], 'Login', 1) treeview.add_column(self.tree['user'], 'Login', 1)
self.tree['user'].set_model(self.lst_user) self.tree['user'].set_model(self.lst_user)
# list of dropdown lists # list of dropdown lists (static!)
self.lst_lists = Gtk.ListStore(int, str, int) self.lst_lists = Gtk.ListStore(int, str, int)
# self.db.cur.execute("SELECT ddval, ddtext FROM dropdown WHERE ddid=0 AND ddval>0 ORDER BY ddval")
sql = ( sql = (
"SELECT dd.ddval, dd.ddtext, COUNT(n.ddval) AS records " "SELECT dd.ddval, dd.ddtext, FIND_IN_SET('locked', dd.flags) AS locked, "
"COUNT(n.ddval) AS records "
"FROM dropdown AS dd LEFT JOIN dropdown AS n ON dd.ddval=n.ddid " "FROM dropdown AS dd LEFT JOIN dropdown AS n ON dd.ddval=n.ddid "
"WHERE dd.ddid=0 " "WHERE dd.ddid=0 "
"GROUP BY dd.ddval, dd.ddtext " "GROUP BY dd.ddval, dd.ddtext "
"ORDER BY dd.ddval" "ORDER BY dd.ddval"
) )
self.db.cur.execute(sql) self.db.dcur.execute(sql)
for row in self.db.cur.fetchall(): for row in self.db.dcur.fetchall():
self.lst_lists.append(row) data = []
treeview.add_column(self.tree['ddlists'], _('ID'), 0) data.append(row['ddval'])
treeview.add_column(self.tree['ddlists'], _('List'), 1) if row['locked']:
treeview.add_column(self.tree['ddlists'], _('Records'), 2) # Unicode Lock-Symbol
data.append("{} \U0001F512".format(row['ddtext']))
else:
data.append(row['ddtext'])
data.append(row['records'])
self.lst_lists.append(data)
treeview.create_columns(
self.tree['ddlists'],
(_('ID'), _('List'), _('Records'))
)
self.tree['ddlists'].set_model(self.lst_lists) self.tree['ddlists'].set_model(self.lst_lists)
self.lst_list = Gtk.ListStore(int, str, str, int, str, str)
treeview.create_columns(
self.tree['ddlist'],
(_('ID'), _('Text'), _('Short'), _('Sort'), _('Color'), _('Flags'))
)
self.tree['ddlist'].set_model(self.lst_list)
# Select first list
selection = self.tree['ddlists'].get_selection()
path = Gtk.TreePath.new_from_indices([1])
selection.select_path(path)
self.ddid_cur = None # Current selected dropdown entry
self.ddval_cur = None
self.ddid_iter = None # to easy update selected item
self.ddval_iter = None # to easy update selected item
self.dd_newrecord = False
# Settings date format selection list # Settings date format selection list
# self.context.datefmt_map # self.context.datefmt_map
@@ -121,13 +177,224 @@ class BaseView(View):
# WIP generic remarks handling # WIP generic remarks handling
self.text['vessel_remarks'].set_size_request(200, 70) self.text['vessel_remarks'].set_size_request(200, 70)
def load_list(self):
# placeholder
pass
def load_list_user(self):
selected_id = treeview.get_value(self.tree['user'])
self.lst_user.clear()
self.db.cur.execute("SELECT userid, login FROM user WHERE userid>0 ORDER BY login")
selection = self.tree['user'].get_selection()
for row in self.db.cur.fetchall():
treeiter = self.lst_user.append(row)
if row[0] == selected_id:
# restore previous selected row
selection.select_iter(treeiter)
def load_list_dropdown(self, listid):
self.lst_list.clear()
sql = (
"SELECT ddval, ddtext, ddshort, sort, color, flags "
"FROM dropdown "
"WHERE ddid=%s "
"ORDER BY ddval"
)
self.db.cur.execute(sql, (listid,))
for row in self.db.cur.fetchall():
self.lst_list.append(row)
def load_dropdowns(self): def load_dropdowns(self):
# non static dropdown (re-)load feature # non static dropdown (re-)load feature
# default storage for current vessel # default storage for current vessel
sql = "SELECT sid, sname FROM storage WHERE stype=0 AND vid=%s ORDER BY sname" sql = "SELECT sid, sname FROM storage WHERE stype=0 AND vid=%s ORDER BY sname"
self.db.cur.execute(sql, (self.context.vessel.vid,)) self.db.cur.execute(sql, (self.context.vessel.vid,))
storages = dict(self.db.cur.fetchall()) self.dd_storage = dict(self.db.cur.fetchall())
combobox.refresh_dict(self.combo['storage'], {-1: _("─── none ───")} | storages) combobox.refresh_dict(self.combo['storage'], {-1: _("─── none ───")} | self.dd_storage)
def vtype_modified(self, eventtype, data):
self.dd_vtype[data[0]] = data[1]
lst = self.combo['vtype'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def storage_modified(self, eventtype, data):
self.dd_storage[data[0]] = data[1]
lst = self.combo['storage'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def load_shapes(self):
# TODO / WIP process shapeindex
# returns dict of filename: title
indexfile = os.path.join(self.context.cfg['docpath'], "shapeindex.json")
if os.path.isfile(indexfile):
# load json
with open(indexfile, "r", encoding="utf-8") as fh:
sflist = json.load(fh)
print("Shapeindex file found and loaded")
else:
# create shapeindex (first simple version)
sflist = {}
for fname in os.listdir(self.context.cfg['shapedir']):
if fname.lower().endswith(".svg"):
shapefile = os.path.join(self.context.cfg['shapedir'], fname)
try:
root = ET.parse(shapefile).getroot()
title_element = root.find("{http://www.w3.org/2000/svg}title")
if title_element is not None and title_element.text:
title = title_element.text.strip()
else:
title = os.path.splitext(fname)[0]
except ET.ParseError:
title = os.path.splitext(fname)[0]
sflist[fname] = title
with open(indexfile, "w", encoding="utf-8") as fh:
json.dump(sflist, fh, ensure_ascii=False, indent=4)
print("Created new shapeindex file")
return sflist
def find_usb_sticks(self):
result = []
for name in os.listdir("/sys/block"):
device = "/sys/block/" + name
removable = device + "/removable"
if not os.path.exists(removable):
continue
with open(removable) as f:
if f.read().strip() != "1":
continue
device_path = os.path.realpath(device + "/device")
if "/usb" in device_path.lower():
result.append(name)
return result
def is_mounted(self, device):
with open("/proc/mounts") as f:
for line in f:
mounted_device = line.split()[0]
if mounted_device == device:
return True
return False
def on_but_usbdevice_clicked(self, widget):
self.backupdevice = None
devlist = self.find_usb_sticks()
if len(devlist) == 0:
self.label['usb_device'].set_text('n/a')
return
if len(devlist) != 1:
print(devlist)
print("Multiple devices not supported yet")
self.label['usb_device'].set_text('multiple')
return
usbdev = devlist[0]
self.label['usb_device'].set_text(f"/dev/{usbdev}")
"""
serial number via python3-pyudev:
import pyudev
Settings
7 - usb backup device serial
8 - usb backup partition uuid
9 - last backup timestamp
"""
# first get stick hardware data
udevctx = pyudev.Context()
device = pyudev.Devices.from_sys_path(udevctx, os.path.join("/sys/class/block", usbdev))
serial = device.get("ID_SERIAL_SHORT")
vendor = device.get("ID_VENDOR")
model = device.get("ID_MODEL")
self.label['usb_serial'].set_text(serial or 'n/a')
self.label['usb_vendor'].set_text(vendor or 'n/a')
self.label['usb_model'].set_text(model or 'n/a')
# TODO second get partition, filesystem type and label
# there must be only one ext4 partition on disk
partitions = [
child for child in device.children
if child.device_type == "partition"
]
partition = partitions[0]
print(f"Partition={partition}")
if len(partitions) != 1:
print("error: more than one partition!")
return
partuuid = partition.properties.get("ID_PART_ENTRY_UUID")
fstype = partition.get("ID_FS_TYPE")
plabel = partition.get("ID_FS_LABEL")
self.label['usb_partition'].set_text(plabel)
self.label['usb_uuid'].set_text(partuuid)
self.label['usb_fstype'].set_text(fstype)
if fstype != "ext4":
print(f"error: invalid fileystem type {fstype}, ext4 expected")
return
self.backupdevice = f"/dev/{usbdev}1" # partition!
# check if device is mounted
if not self.is_mounted(self.backupdevice):
print("device is not mounted. trying to mount now")
pass
# For backup there must be an directory names ymsbackup which contains
# backup description and backup sets
# Desription and identification file backup.json?
# if plabel != 'BACKUP' or not os.path.isdir('ymsbackup')
mountpoint = os.path.join("/media", os.getlogin(), "BACKUP")
if not os.path.isdir(mountpoint):
print(f"Device is not mounted at {mountpoint}")
def on_but_usbinit_clicked(self, widget):
if self.backupdevice is None:
return
# UUID of devive -> settings
# check if backups already exist
answer = gtkutils.questionbox(
_("Initialize USB-Stick\n"
"All data on that device will be lost!\n"
"Are you really sure?"
), title="YMS")
if answer == False:
return
if self.label['usb_fstype'].get_text() != 'ext4':
print("formatting {self.backupdevice} with ext4")
#try:
# subprocess.run(["sudo", "mkfs.ext4", "-L", "BACKUP", self.backupdevice], check=True)
#except subprocess.CalledProcessError as e:
# print("formatting failed: ", e)
myself = os.getlogin()
mountpoint = os.path.join("/media", myself, "backup")
basedir = os.path.join(mountpoint, 'ymsbackup')
print(basedir)
# mkdir basedir
# chown (os.getlogin(), 'yms')
# chmod 770
else:
#
pass
def on_cmb_vessel_changed(self, widget): def on_cmb_vessel_changed(self, widget):
self.context.vessel.load(combobox.get_list_value(widget)) self.context.vessel.load(combobox.get_list_value(widget))
@@ -136,6 +403,7 @@ class BaseView(View):
self.db.conn.commit() self.db.conn.commit()
# Refresh dependent data # Refresh dependent data
self.load_dropdowns() self.load_dropdowns()
self.context.publish("vessel_modified", self.context.EVENT_UPD, (self.context.vessel.pk_value, ))
# Show data # Show data
self.display_vessel(self.context.vessel) self.display_vessel(self.context.vessel)
@@ -147,9 +415,13 @@ class BaseView(View):
if answer == False: if answer == False:
return return
self.context.vessel.create() self.context.vessel.create()
print(self.context.vessel)
model = self.combo['vessel'].get_model() model = self.combo['vessel'].get_model()
model.append((self.context.vessel.vid, self.context.vessel.vesselname)) if model is None:
combobox.activate_row(self.combo['vessel'], self.context.vessel.vid) combobox.load_from_dict(self.combo['vessel'], {self.context.vessel.vid: self.context.vessel.vesselname}, self.context.vessel.vid)
else:
model.append((self.context.vessel.vid, self.context.vessel.vesselname))
combobox.activate_row(self.combo['vessel'], self.context.vessel.vid)
self.edit_vessel(self.context.vessel) self.edit_vessel(self.context.vessel)
self.stack['vessel'].set_visible_child(self.box['vessel_edit']) self.stack['vessel'].set_visible_child(self.box['vessel_edit'])
@@ -158,11 +430,17 @@ class BaseView(View):
self.stack['vessel'].set_visible_child(self.box['vessel_edit']) self.stack['vessel'].set_visible_child(self.box['vessel_edit'])
def on_but_vessel_save_clicked(self, widget): def on_but_vessel_save_clicked(self, widget):
print("Save vessel")
vessel = self.context.vessel vessel = self.context.vessel
vessel.vesselname = self.entry['vesselname'].get_text() vessel.vesselname = self.entry['vesselname'].get_text()
vessel.model = self.entry['model'].get_text() vessel.model = self.entry['model'].get_text()
vessel.vtype = combobox.get_list_value(self.combo['vtype'])
if vessel.vtype == -1:
vessel.vtype = None
vessel.year_built = self.spin['year_built'].get_value_as_int() vessel.year_built = self.spin['year_built'].get_value_as_int()
vessel.hull_number = self.entry['hull_number'].get_text()
vessel.shipyard = combobox.get_list_value(self.combo['shipyard'])
if vessel.shipyard == -1:
vessel.shipyard = None
vessel.loa = self.spin['loa'].get_value() vessel.loa = self.spin['loa'].get_value()
vessel.lwl = self.spin['lwl'].get_value() vessel.lwl = self.spin['lwl'].get_value()
vessel.beam = self.spin['beam'].get_value() vessel.beam = self.spin['beam'].get_value()
@@ -170,31 +448,78 @@ class BaseView(View):
vessel.draught_min = self.spin['draught_min'].get_value() vessel.draught_min = self.spin['draught_min'].get_value()
vessel.displacement = self.spin['displacement'].get_value_as_int() vessel.displacement = self.spin['displacement'].get_value_as_int()
vessel.ballast = self.spin['ballast'].get_value_as_int() vessel.ballast = self.spin['ballast'].get_value_as_int()
vessel.beltpos_bow = self.spin['belt_bow'].get_value()
vessel.beltpos_aft = self.spin['belt_aft'].get_value()
vessel.htype = combobox.get_list_value(self.combo['htype'])
vessel.shapefile = combobox.get_list_value(self.combo['hull_shape'])
if vessel.shapefile == '-1':
vessel.shapefile = None
vessel.remarks = gtkutils.get_text_contents(self.text['vessel_remarks']) vessel.remarks = gtkutils.get_text_contents(self.text['vessel_remarks'])
vessel.save() vessel.save()
self.context.publish("vessel_modified", self.context.EVENT_UPD, (vessel.vid, ))
self.stack['vessel'].set_visible_child(self.box['vessel']) self.stack['vessel'].set_visible_child(self.box['vessel'])
self.display_vessel(self.context.vessel)
def on_but_vessel_cancel_clicked(self, widget): def on_but_vessel_cancel_clicked(self, widget):
self.stack['vessel'].set_visible_child(self.box['vessel']) self.stack['vessel'].set_visible_child(self.box['vessel'])
def on_but_vessel_delete_clicked(self, widget): def on_but_vessel_delete_clicked(self, widget):
pass # TODO check if there are no associated data with vessel
answer = gtkutils.questionbox(
_("Delete vessel!\n"
"Are you sure?"
), title="YMS")
if answer == False:
return
# TODO
def on_but_settings_save_clicked(self, widget): def on_but_settings_save_clicked(self, widget):
print("Save settings") # System settings
#self.entry['sys_currency'] new_currency = self.entry['sys_currency'].get_text()
#self.spin['sys_max_width'] if self.sys_currency != new_currency:
#self.spin['sys_max_height'] self.db.save_setting(4, new_currency, None)
self.sys_currency = new_currency
new_max_width = self.spin['sys_max_width'].get_value_as_int()
if self.sys_max_width != new_max_width:
self.db.save_setting(20, None, new_max_width)
self.sys_max_width = new_max_width
new_max_height = self.spin['sys_max_height'].get_value_as_int()
if self.sys_max_height != new_max_height:
self.db.save_setting(21, None, new_max_height)
self.sys_max_height = new_max_height
# User settings
new_datefmt = combobox.get_list_value(self.combo['datefmt'])
if self.datefmt != new_datefmt:
self.db.save_setting(2, new_datefmt, None)
self.context.datefmt = new_datefmt
self.db.conn.commit()
def display_vessel(self, vessel): def display_vessel(self, vessel):
self.label['vesselname'].set_text(vessel.vesselname) self.label['vesselname'].set_text(vessel.vesselname)
self.label['model'].set_text(vessel.model or '') self.label['model'].set_text(vessel.model or '')
self.label['year_built'].set_text(self.format_int(vessel.year_built, default='n/a')) self.label['shipyard'].set_text(str(vessel.shipyard))
self.label['year_built'].set_text(self.format_int(vessel.year_built, False, default='n/a'))
self.label['hull_number'].set_text(vessel.hull_number or '')
self.label['loa'].set_text(self.format_float(vessel.loa, 2, suffix="m"))
self.label['lwl'].set_text(self.format_float(vessel.lwl, 2, suffix="m"))
self.label['beam'].set_text(self.format_float(vessel.beam, 2, suffix="m"))
self.label['draught'].set_text(self.format_float(vessel.draught, 2, suffix="m"))
self.label['draught_min'].set_text(self.format_float(vessel.draught_min, 2, suffix="m"))
self.label['displacement'].set_text(self.format_int(vessel.displacement, 2, suffix="kg"))
self.label['ballast'].set_text(self.format_int(vessel.ballast, 2, suffix="kg"))
self.label['belt_bow'].set_text(self.format_float(vessel.beltpos_bow, 2, suffix="m"))
self.label['belt_aft'].set_text(self.format_float(vessel.beltpos_aft, 2, suffix="m"))
self.label['hull_shape'].set_text(vessel.shapefile or '')
self.label['storage_def'].set_text(str(vessel.sid_default))
self.label['remarks'].set_text(vessel.remarks or '')
def edit_vessel(self, vessel): def edit_vessel(self, vessel):
self.entry['vesselname'].set_text(vessel.vesselname) self.entry['vesselname'].set_text(vessel.vesselname)
self.entry['model'].set_text(vessel.model or '') self.entry['model'].set_text(vessel.model or '')
combobox.activate_row(self.combo['vtype'], vessel.vtype or -1)
self.spin['year_built'].set_value(vessel.year_built or 0) self.spin['year_built'].set_value(vessel.year_built or 0)
self.entry['hull_number'].set_text(vessel.hull_number or '')
combobox.activate_row(self.combo['shipyard'], vessel.shipyard or -1)
self.spin['loa'].set_value(vessel.loa or 0) self.spin['loa'].set_value(vessel.loa or 0)
self.spin['lwl'].set_value(vessel.lwl or 0) self.spin['lwl'].set_value(vessel.lwl or 0)
self.spin['beam'].set_value(vessel.beam or 0) self.spin['beam'].set_value(vessel.beam or 0)
@@ -202,9 +527,13 @@ class BaseView(View):
self.spin['draught_min'].set_value(vessel.draught_min or 0) self.spin['draught_min'].set_value(vessel.draught_min or 0)
self.spin['displacement'].set_value(vessel.displacement or 0) self.spin['displacement'].set_value(vessel.displacement or 0)
self.spin['ballast'].set_value(vessel.ballast or 0) self.spin['ballast'].set_value(vessel.ballast or 0)
self.text['vessel_remarks'].get_buffer().set_text(vessel.remarks or '') self.spin['belt_bow'].set_value(vessel.beltpos_bow or 0)
combobox.activate_row(self.combo['shipyard'], vessel.shipyard or -1) self.spin['belt_aft'].set_value(vessel.beltpos_aft or 0)
combobox.activate_row(self.combo['htype'], vessel.htype)
combobox.activate_row(self.combo['hull_shape'], vessel.shapefile or "-1")
combobox.activate_row(self.combo['storage'], vessel.sid_default or -1) combobox.activate_row(self.combo['storage'], vessel.sid_default or -1)
self.text['vessel_remarks'].get_buffer().set_text(vessel.remarks or '')
self.entry['vesselname'].grab_focus()
def display_user(self, user): def display_user(self, user):
self.entry['user_login'].set_text(user.login) self.entry['user_login'].set_text(user.login)
@@ -227,7 +556,6 @@ class BaseView(View):
self.lst_user.append((self.context.user.user_id, self.context.user.login)) self.lst_user.append((self.context.user.user_id, self.context.user.login))
def on_but_user_del_clicked(self, widget): def on_but_user_del_clicked(self, widget):
print("Delete user")
answer = gtkutils.questionbox( answer = gtkutils.questionbox(
_("Delete user!\n" _("Delete user!\n"
"Are you sure?" "Are you sure?"
@@ -277,3 +605,197 @@ class BaseView(View):
else: else:
# Password to short # Password to short
pass pass
def clear_dd_entry(self):
# Clear list entry editor
self.spin['dd_val'].set_text('')
self.entry['dd_text'].set_text('')
self.entry['dd_short'].set_text('')
self.spin['dd_sort'].set_text('')
self.entry['dd_color'].set_text('')
# TODO set color button to undef shown as 100% transparent
# self.button['dd_color']
self.check['dd_fixed'].set_active(False)
self.check['dd_locked'].set_active(False)
def on_but_dd_color_set(self, button):
rgba = button.get_rgba()
r = round(rgba.red * 255)
g = round(rgba.green * 255)
b = round(rgba.blue * 255)
a = round(rgba.alpha * 255)
if a > 0:
self.entry['dd_color'].set_text(f"#{r:02X}{g:02X}{b:02X}")
else:
self.entry['dd_color'].set_text('')
def on_ent_dd_color_activate(self, entry):
self.set_color_from_entry(entry, self.button['dd_color'])
def on_ent_dd_color_focus_out_event(self, entry, event):
self.set_color_from_entry(entry, self.button['dd_color'])
return False
def on_but_list_new_clicked(self, widget):
self.dd_newrecord = True
self.ddval_cur = None
self.clear_dd_entry()
# get next free value for ddid, ddval
sql = (
"SELECT MIN(n.ddval) AS nextval "
"FROM ("
"SELECT 1 AS ddval "
"UNION ALL "
"SELECT DISTINCT ddval+1 "
"FROM dropdown "
"WHERE ddid=%(ddid)s AND ddval>0"
") AS n "
"LEFT JOIN dropdown AS m ON m.ddval=n.ddval AND m.ddid=%(ddid)s "
"WHERE m.ddval IS NULL"
)
self.db.cur.execute(sql, {'ddid': self.ddid_cur})
self.ddval_cur = self.db.cur.fetchone()[0] or 1
if not self.ddval_cur:
# TODO message internal error to user
print("internal error while creating new value")
return
self.spin['dd_val'].set_value(self.ddval_cur)
self.button['list_save'].set_sensitive(True)
self.entry['dd_text'].grab_focus()
def on_but_list_save_clicked(self, widget):
if self.dd_newrecord:
sql = (
"INSERT INTO dropdown (ddid, ddval, ddtext, ddshort, sort, color, flags) "
"VALUES (%s, %s, %s, %s, %s, %s, %s)"
)
values = (
self.ddid_cur,
self.spin['dd_val'].get_value_as_int(), # autogenerated by new button
self.entry['dd_text'].get_text(),
self.entry['dd_short'].get_text(),
self.spin['dd_sort'].get_value_as_int(),
self.entry['dd_color'].get_text().lstrip('#'),
self.get_checks(('dd_locked', 'dd_fixed'), prefix='dd_')
)
if self.db.execute_write(sql, values, 1):
self.db.conn.commit()
else:
# TODO message sql error to user
print(self.db.last_error())
print(sql, values)
return
# TODO
# message success to user
# refresh list
data = (
self.spin['dd_val'].get_value_as_int(),
self.entry['dd_text'].get_text(),
self.entry['dd_short'].get_text(),
self.spin['dd_sort'].get_value_as_int(),
self.entry['dd_color'].get_text().lstrip('#'),
'' # TODO flags
)
treeiter = self.lst_list.append(data)
selection = self.tree['ddlist'].get_selection()
selection.select_iter(treeiter)
# increase entry in main list
count = treeview.get_value(self.tree['ddlists'], 2)
treeview.set_value(self.tree['ddlists'], 2, count+1)
# send event
eventname = "dd_{}_modified".format(DDNAME[self.ddid_cur])
self.context.publish(eventname, self.context.EVENT_ADD, (data[0], data[1]))
else:
if self.ddid_cur is None or self.ddval_cur is None:
print("internal error: ids not set")
return
sql = (
"UPDATE dropdown SET ddtext=%s, ddshort=%s, sort=%s, color=%s, flags=%s "
"WHERE ddid=%s AND ddval=%s"
)
values = (
self.entry['dd_text'].get_text(),
self.entry['dd_short'].get_text(),
self.spin['dd_sort'].get_value_as_int(),
self.entry['dd_color'].get_text().lstrip('#'),
self.get_checks(('dd_locked', 'dd_fixed'), prefix='dd_'),
self.ddid_cur,
self.ddval_cur
)
if self.db.execute_write(sql, values):
self.db.conn.commit()
else:
# TODO message sql error to user
print(self.db.last_error())
print(sql, values)
return
# refresh list
data = (
self.spin['dd_val'].get_value_as_int(),
self.entry['dd_text'].get_text(),
self.entry['dd_short'].get_text(),
self.spin['dd_sort'].get_value_as_int(),
self.entry['dd_color'].get_text().lstrip('#'),
'' # TODO flags
)
treeview.set_row_values(self.tree['ddlist'], data)
# send event
eventname = "dd_{}_modified".format(DDNAME[self.ddid_cur])
self.context.publish(eventname, self.context.EVENT_UPD, (data[0], data[1]))
self.dd_newrecord = False
# TODO
# message success to user
# refresh list
def on_but_list_delete_clicked(self, widget):
answer = gtkutils.questionbox(
_("Delete list entry!\n"
"Are you sure?"
), title="YMS")
if answer == False:
return
def on_tvw_ddlists_row_activated(self, widget, path, column):
# load single list
self.ddid_iter = widget.get_selection().get_selected()[1]
self.ddid_cur = treeview.get_value(widget, 0)
self.ddval_cur = None
self.load_list_dropdown(self.ddid_cur)
self.clear_dd_entry()
self.button['list_save'].set_sensitive(False)
def on_tvw_ddlist_row_activated(self, widget, path, column):
# load list entry details
self.ddval_iter = widget.get_selection().get_selected()[1]
self.ddval_cur = treeview.get_value(widget, 0)
sql = (
"SELECT ddtext, ddshort, sort, color, flags "
"FROM dropdown "
"WHERE ddid=%s AND ddval=%s "
"ORDER BY ddval"
)
self.db.dcur.execute(sql, (self.ddid_cur, self.ddval_cur))
row = self.db.dcur.fetchone()
if not row:
# internal error
print(f"internal error ddval #{self.ddval_cur} not found")
self.ddval_cur = None
return
# fill edit fields
self.spin['dd_val'].set_value(self.ddval_cur)
self.entry['dd_text'].set_text(row['ddtext'] or '')
self.entry['dd_short'].set_text(row['ddshort'] or '')
if row['sort']:
self.spin['dd_sort'].set_value(row['sort'])
else:
self.spin['dd_sort'].set_text('')
self.entry['dd_color'].set_text(row['color'] or '')
flags = (row['flags'] or '').split(',')
self.check['dd_fixed'].set_active('fixed' in flags)
self.check['dd_locked'].set_active('locked' in flags)
self.button['list_save'].set_sensitive(True)
self.dd_newrecord = False
+193 -23
View File
@@ -5,27 +5,21 @@ from gi.repository import GLib, Gtk, Gdk
from .view import View from .view import View
from yms import gtkutils, combobox, treeview from yms import gtkutils, combobox, treeview
from yms.lookup import Dropdown
from yms.model import box from yms.model import box
class BoxesView(View): class BoxesView(View):
def __init__(self, context): def __init__(self, context):
super().__init__(context, _("Box"), "boxes.ui") super().__init__(context, _("Boxes"), "boxes.ui")
self.context = context
# box already used for controls so other name here # box already used for controls so other name here
self.sbox = box.Box(context.db) # current record self.sbox = box.Box(context.db) # current record
self.newrecord = False self.newrecord = False
self.lst_box = Gtk.ListStore(int, str, str, str) self.lst_box = Gtk.ListStore(int, str, str, str)
sql = ( self.load_list()
"SELECT b.boxid, b.label, b.content, b.remarks "
"FROM box AS b JOIN storage AS s USING (sid) "
"WHERE s.vid=%s "
"ORDER BY b.label"
)
self.db.cur.execute(sql, (context.vessel.vid,))
for row in self.db.cur.fetchall():
self.lst_box.append(row)
treeview.add_column(self.tree['box'], _('ID'), 0) treeview.add_column(self.tree['box'], _('ID'), 0)
treeview.add_column(self.tree['box'], _('Label'), 1) treeview.add_column(self.tree['box'], _('Label'), 1)
@@ -33,41 +27,178 @@ class BoxesView(View):
treeview.add_column(self.tree['box'], _('Remarks'), 3) treeview.add_column(self.tree['box'], _('Remarks'), 3)
self.tree['box'].set_model(self.lst_box) self.tree['box'].set_model(self.lst_box)
self.dd_storage = self.context.lookup.storage(context.vessel.vid)
combobox.load_from_dict(self.combo['storage'], {-1: _("─── none ───")} | self.dd_storage)
self.dd_boxtype = self.context.lookup.dropdown(Dropdown.BOX_TYPE)
combobox.load_from_dict(self.combo['type'], {-1: _("─── none ───")} | self.dd_boxtype)
# subscribe to data change events
self.context.subscribe("storage_modified", self.storage_modified)
self.context.subscribe("dd_boxtype_modified", self.boxtype_modified)
def get_list_row(self):
return (
self.sbox.boxid,
self.sbox.label,
self.sbox.content,
self.sbox.remarks
)
def add_row(self):
treeiter = self.lst_box.append(self.get_list_row())
self.tree['box'].get_selection().select_iter(treeiter)
def refresh_row(self):
treeview.set_row_values(self.tree['box'], self.get_list_row())
def load_list(self): def load_list(self):
pass selected_id = treeview.get_value(self.tree['box'])
self.lst_box.clear()
sql = (
"SELECT b.boxid, b.label, b.content, b.remarks "
"FROM box AS b JOIN storage AS s USING (sid) "
"WHERE s.vid=%s "
"ORDER BY b.label"
)
self.db.cur.execute(sql, (self.context.vessel.vid,))
selection = self.tree['box'].get_selection()
for row in self.db.cur.fetchall():
treeiter = self.lst_box.append(row)
if row[0] == selected_id:
# restore previous selected row
selection.select_iter(treeiter)
def boxtype_modified(self, eventtype, data):
self.dd_box[data[0]] = data[1]
lst = self.combo['type'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def storage_modified(self, eventtype, data):
self.dd_storage[data[0]] = data[1]
lst = self.combo['storage'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def clear_record(self):
self.entry['label'].set_text('')
combobox.activate_row(self.combo['storage'], 1)
combobox.activate_row(self.combo['type'], -1)
self.entry['content'].set_text('')
self.spin['wx'].set_value(0)
self.spin['wy'].set_value(0)
self.spin['wz'].set_value(0)
self.entry['color'].set_text('#000000')
rgba = Gdk.RGBA()
rgba.parse('#000000')
self.button['color'].set_rgba(rgba)
self.spin['price'].set_value(0)
self.spin['weight'].set_value(0)
self.spin['weight_net'].set_value(0)
self.text['remarks'].get_buffer().set_text('')
self.entry['label'].grab_focus()
def display_record(self): def display_record(self):
self.label['label'].set_text(self.sbox.label) self.label['label'].set_text(self.sbox.label)
# storage sid
self.label['content'].set_text(self.sbox.content or '')
if self.sbox.boxtype > 0:
self.label['type'].set_text(self.dd_boxtype[self.sbox.boxtype])
else:
self.label['type'].set_text('')
self.label['color'].set_text(self.sbox.color or '')
if self.sbox.color:
self.label['color'].set_markup(f'#{self.sbox.color} <span foreground="#{self.sbox.color}">●</span>')
else:
self.label['color'].set_text('')
self.label['weight'].set_text(self.format_float(self.sbox.weight, 2, suffix='kg'))
self.label['weight_net'].set_text(self.format_float(self.sbox.weight_net, 2, suffix='kg'))
self.label['price'].set_text(self.format_float(self.sbox.price, 2, suffix='€'))
self.label['remarks'].set_text(self.sbox.remarks or '') self.label['remarks'].set_text(self.sbox.remarks or '')
def edit_record(self): def edit_record(self):
self.entry['label'].set_text(self.sbox.label) self.entry['label'].set_text(self.sbox.label)
combobox.activate_row(self.combo['storage'], self.sbox.sid or 1)
combobox.activate_row(self.combo['type'], self.sbox.boxtype)
self.entry['content'].set_text(self.sbox.content or '') self.entry['content'].set_text(self.sbox.content or '')
self.spin['wx'].set_value(self.sbox.wx or 0) self.spin['wx'].set_value(self.sbox.wx or 0)
self.spin['wy'].set_value(self.sbox.wy or 0) self.spin['wy'].set_value(self.sbox.wy or 0)
self.spin['wz'].set_value(self.sbox.wz or 0) self.spin['wz'].set_value(self.sbox.wz or 0)
self.entry['color'].set_text('#' + self.sbox.color)
rgba = Gdk.RGBA()
rgba.parse('#' + self.sbox.color)
self.button['color'].set_rgba(rgba)
self.spin['price'].set_value(self.sbox.price or 0)
self.spin['weight'].set_value(self.sbox.weight or 0)
self.spin['weight_net'].set_value(self.sbox.weight_net or 0)
self.text['remarks'].get_buffer().set_text(self.sbox.remarks or '') self.text['remarks'].get_buffer().set_text(self.sbox.remarks or '')
self.entry['label'].grab_focus()
def save_record(self):
# fields must have been validated beforehand
self.sbox.label = self.entry['label'].get_text()
self.sbox.sid = combobox.get_list_value(self.combo['storage'])
self.sbox.boxtype = combobox.get_list_value(self.combo['type'])
self.sbox.content = self.entry['content'].get_text()
self.sbox.wx = self.spin['wx'].get_value_as_int()
self.sbox.wy = self.spin['wy'].get_value_as_int()
self.sbox.wz = self.spin['wz'].get_value_as_int()
self.sbox.color = self.entry['color'].get_text().lstrip('#')
self.sbox.price = self.spin['price'].get_value()
self.sbox.weight = self.spin['weight'].get_value()
self.sbox.weight_net = self.spin['weight_net'].get_value()
self.sbox.remarks = gtkutils.get_text_contents(self.text['remarks'])
# buttons on list page # buttons on list page
def on_but_new_clicked(self, widget): def on_but_new_clicked(self, widget):
self.newrecord = True self.newrecord = True
self.label['title_edit'].set_text("Add new Box") self.label['title_edit'].set_text(_("Add new Box"))
self.clear_record()
self.topwidget.set_visible_child(self.box['box_edit']) self.topwidget.set_visible_child(self.box['box_edit'])
def on_but_edit_clicked(self, widget): def on_but_edit_clicked(self, widget):
boxid = treeview.get_value(self.tree['box'], 0)
if not boxid:
return
self.newrecord = False self.newrecord = False
self.label['title_edit'].set_text("Edit Box") self.label['title_edit'].set_text(_("Edit Box"))
sid = treeview.get_value(self.tree['box'], 0) if not self.record_lock('box', boxid):
self.sbox.load(sid) return
self.sbox.load(boxid)
self.edit_record() self.edit_record()
self.topwidget.set_visible_child(self.box['box_edit']) self.topwidget.set_visible_child(self.box['box_edit'])
def on_but_detail_clicked(self, widget): def on_but_detail_clicked(self, widget):
sid = treeview.get_value(self.tree['box'], 0) boxid = treeview.get_value(self.tree['box'], 0)
self.sbox.load(sid) if not boxid:
return
self.sbox.load(boxid)
self.display_record() self.display_record()
self.topwidget.set_visible_child(self.box['box_detail']) self.topwidget.set_visible_child(self.box['box_detail'])
self.button['close'].grab_focus()
def on_tvw_box_row_activated(self, widget, path, column):
boxid = treeview.get_value(widget, 0)
self.sbox.load(boxid)
self.display_record()
self.topwidget.set_visible_child(self.box['box_detail'])
self.button['close'].grab_focus()
# buttons on detail page # buttons on detail page
# edit2 uses edit callback # edit2 uses edit callback
@@ -75,18 +206,57 @@ class BoxesView(View):
self.topwidget.set_visible_child(self.box['box']) self.topwidget.set_visible_child(self.box['box'])
def on_but_delete_clicked(self, widget): def on_but_delete_clicked(self, widget):
answer = gtkutils.questionbox(
_("Delete box!\n"
"Are you sure?"), title="YMS"
)
if answer == False:
return
self.topwidget.set_visible_child(self.box['box']) self.topwidget.set_visible_child(self.box['box'])
self.newrecord = False self.newrecord = False
# buttons on edit page # buttons on edit page
def on_but_save_clicked(self, widget): def on_but_save_clicked(self, widget):
print("save not implemented yet") # check mandatory fields
if not self.entry['label'].get_text().strip():
# TODO error marker
return
self.save_record()
print(self.sbox)
if not self.sbox.save():
pass
self.record_unlock()
if self.newrecord:
#self.load_list()
self.add_row()
self.context.publish("box_modified", self.context.EVENT_ADD, (self.sbox.pk_value, self.sbox.label))
else:
self.refresh_row()
self.context.publish("box_modified", self.context.EVENT_UPD, (self.sbox.pk_value, self.sbox.label))
self.newrecord = False self.newrecord = False
self.display_record()
self.topwidget.set_visible_child(self.box['box_detail'])
def on_but_color_set(self, button):
rgba = button.get_rgba()
r = round(rgba.red * 255)
g = round(rgba.green * 255)
b = round(rgba.blue * 255)
a = round(rgba.alpha * 255)
#self.last_valid_rgb = f"{r:02X}{g:02X}{b:02X}"
if a > 0:
self.entry['color'].set_text(f"#{r:02X}{g:02X}{b:02X}")
else:
self.entry['color'].set_text('')
def on_ent_color_activate(self, entry):
self.set_color_from_entry(entry)
def on_ent_color_focus_out_event(self, entry, event):
self.set_color_from_entry(entry)
return False
def on_but_cancel_clicked(self, widget): def on_but_cancel_clicked(self, widget):
self.record_unlock()
self.topwidget.set_visible_child(self.box['box']) self.topwidget.set_visible_child(self.box['box'])
self.newrecord = False
def on_but_color_clicked(self, widget):
pass
+240 -22
View File
@@ -1,10 +1,11 @@
# SPDX-License-Identifier: WTFPL # SPDX-License-Identifier: WTFPL
import os import os
from gi.repository import Gtk from gi.repository import Gtk, Gdk
from .view import View from .view import View
from yms import gtkutils, combobox, treeview from yms import gtkutils, combobox, treeview
from yms.lookup import Dropdown
from yms.model import cable from yms.model import cable
class CablesView(View): class CablesView(View):
@@ -15,54 +16,271 @@ class CablesView(View):
self.cable = cable.Cable(context.db) # current record self.cable = cable.Cable(context.db) # current record
self.newrecord = False self.newrecord = False
self.lst_cables = Gtk.ListStore(int, str, str) self.lst_cables = Gtk.ListStore(int, str, str, str)
sql = ( self.load_list()
"SELECT cableid, cablename, cablecond "
"FROM cable "
"WHERE vid=%s "
"ORDER BY cableid"
)
self.db.dcur.execute(sql, (context.vessel.vid,))
for row in self.db.dcur.fetchall():
data = (
row['cableid'],
row['cablename'],
row['cablecond']
)
self.lst_cables.append(data)
treeview.add_column(self.tree['cables'], _('ID'), 0) treeview.add_column(self.tree['cables'], _('ID'), 0)
treeview.add_column(self.tree['cables'], _('Name'), 1) treeview.add_column(self.tree['cables'], _('Name'), 1)
treeview.add_column(self.tree['cables'], _('Condition'), 2) treeview.add_column(self.tree['cables'], _('Condition'), 2)
treeview.add_column(self.tree['cables'], _('Length'), 3)
self.tree['cables'].set_model(self.lst_cables) self.tree['cables'].set_model(self.lst_cables)
# Cable type
self.dd_type = self.context.lookup.dropdown(Dropdown.CABLE_TYPE)
combobox.load_from_dict(self.combo['type'], {-1: _("─── none ───")} | self.dd_type)
# Cable tech type
self.dd_tech = self.context.lookup.dropdown(Dropdown.CABLE_TECHNAME)
combobox.load_from_dict(self.combo['techname'], {-1: _("─── none ───")} | self.dd_tech)
# Supplier
self.dd_supplier = self.context.lookup.company(1)
combobox.load_from_dict(self.combo['supplier'], {-1: _("─── none ───")} | self.dd_supplier)
# Manufacturer
self.dd_manufacturer = self.context.lookup.company(2)
combobox.load_from_dict(self.combo['manufacturer'], {-1: _("─── none ───")} | self.dd_manufacturer)
# Condition
self.dd_condition = self.context.lookup.enum('cable.cablecond')
combobox.load_from_dict(self.combo['condition'], self.dd_condition, 'unknown')
# subscribe to data change events
#self.context.subscribe("dd_type_modified", self.type_modified)
#self.context.subscribe("dd_techname_modified", self.techname_modified)
def get_list_row(self):
return (
self.cable.cableid,
self.cable.cablename,
self.dd_condition.get(self.cable.cablecond, ''),
self.format_float(self.cable.length, suffix="m")
)
def add_row(self):
treeiter = self.lst_cables.append(self.get_list_row())
self.tree['cables'].get_selection().select_iter(treeiter)
def refresh_row(self):
treeview.set_row_values(self.tree['cables'], self.get_list_row())
def load_list(self):
selected_id = treeview.get_value(self.tree['cables'])
self.lst_cables.clear()
sql = (
"SELECT cableid, cablename, cablecond, length "
"FROM cable "
"WHERE vid=%s "
"ORDER BY cableid"
)
self.db.dcur.execute(sql, (self.context.vessel.vid,))
selection = self.tree['cables'].get_selection()
for row in self.db.dcur.fetchall():
data = (
row['cableid'],
row['cablename'],
row['cablecond'],
self.format_float(row['length'], suffix='m')
)
treeiter = self.lst_cables.append(data)
if row['cableid'] == selected_id:
# restore previous selected row
selection.select_iter(treeiter)
def type_modified(self, eventtype, data):
self.dd_type[data[0]] = data[1]
lst = self.combo['type'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def techname_modified(self, eventtype, data):
self.dd_techname[data[0]] = data[1]
lst = self.combo['techname'].get_model()
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst.append(data)
else:
# not implemented
pass
def display_record(self):
self.label['name'].set_text(self.cable.cablename or '')
if self.cable.cabletype:
self.label['type'].set_text(self.dd_type[self.cable.cabletype])
else:
self.label['type'].set_text('')
if self.cable.techname:
self.label['techname'].set_text(self.dd_tech[self.cable.techname])
else:
self.label['techname'].set_text('')
self.label['length'].set_text(self.format_float(self.cable.length, suffix="m"))
self.label['conductors'].set_text(self.format_int(self.cable.conductors))
self.label['diameter'].set_text(self.format_float(self.cable.diameter, 1, suffix="mm"))
self.label['xsection'].set_text(self.format_float(self.cable.xsection, 1, suffix="mm²"))
self.label['weight'].set_text(self.format_float(self.cable.weight, suffix="kg/m"))
if self.cable.color:
self.label['color'].set_markup(f'#{self.cable.color} <span foreground="#{self.cable.color}">●</span>')
else:
self.label['color'].set_text('')
self.label['supplier'].set_text(str(self.cable.supplier))
self.label['manufacturer'].set_text(str(self.cable.manufacturer))
self.label['condition'].set_text(self.cable.cablecond)
self.label['remarks'].set_text(self.cable.remarks or '')
def edit_record(self):
# fill UI fields from database record
self.entry['name'].set_text(self.cable.cablename or '')
combobox.activate_row(self.combo['type'], self.cable.cabletype or -1)
combobox.activate_row(self.combo['techname'], self.cable.techname or -1)
self.spin['length'].set_value(self.cable.length or 0)
self.spin['conductors'].set_value(self.cable.conductors or 0)
self.spin['diameter'].set_value(self.cable.diameter or 0)
self.spin['xsection'].set_value(self.cable.xsection or 0)
self.spin['weight'].set_value(self.cable.weight or 0)
self.entry['color'].set_text(self.format_color(self.cable.color))
if self.cable.color is None:
rgba = Gdk.RGBA(0, 0, 0, 0)
else:
rgba = Gdk.RGBA()
rgba.parse('#' + self.cable.color)
self.button['color'].set_rgba(rgba)
combobox.activate_row(self.combo['supplier'], self.cable.supplier or -1)
combobox.activate_row(self.combo['manufacturer'], self.cable.manufacturer or -1)
combobox.activate_row(self.combo['condition'], self.cable.cablecond or 'unknown')
self.text['remarks'].get_buffer().set_text(self.cable.remarks or '')
self.entry['name'].grab_focus()
def save_record(self):
# fields must have been validated beforehand
self.cable.vid = self.context.vessel.vid
self.cable.cablename = self.entry['name'].get_text().strip()
self.cable.cabletype = combobox.get_list_value(self.combo['type'])
if self.cable.cabletype == -1:
self.cable.cabletype = None
self.cable.length = int(self.spin['length'].get_value())
self.cable.conductors = int(self.spin['conductors'].get_value())
self.cable.diameter = self.spin['diameter'].get_value()
self.cable.xsection = self.spin['xsection'].get_value()
self.cable.weight = int(self.spin['weight'].get_value())
if self.button['color'].get_rgba().alpha > 0:
self.cable.color = self.entry['color'].get_text().lstrip('#')
else:
self.cable.color = None
self.cable.supplier = combobox.get_list_value(self.combo['supplier'])
if self.cable.supplier == -1:
self.cable.supplier = None
self.cable.manufacturer = combobox.get_list_value(self.combo['manufacturer'])
if self.cable.manufacturer == -1:
self.cable.manufacturer = None
self.cable.cablecond = combobox.get_list_value(self.combo['condition'])
self.cable.remarks = gtkutils.get_text_contents(self.text['remarks'])
def on_but_color_set(self, button):
rgba = button.get_rgba()
r = round(rgba.red * 255)
g = round(rgba.green * 255)
b = round(rgba.blue * 255)
a = round(rgba.alpha * 255)
if a > 0:
self.entry['color'].set_text(f"#{r:02X}{g:02X}{b:02X}")
else:
self.entry['color'].set_text('')
def on_ent_color_activate(self, entry):
self.set_color_from_entry(entry, self.button['color'])
def on_ent_color_focus_out_event(self, entry, event):
self.set_color_from_entry(entry, self.button['color'])
return False
# buttons on list page # buttons on list page
def on_but_new_clicked(self, widget): def on_but_new_clicked(self, widget):
self.newrecord = True
self.cable.clear()
self.edit_record()
self.topwidget.set_visible_child(self.box['cable_edit']) self.topwidget.set_visible_child(self.box['cable_edit'])
def on_but_edit_clicked(self, widget): def on_but_edit_clicked(self, widget):
cableid = treeview.get_value(self.tree['cables'], 0)
if not cableid:
return
self.newrecord = False
self.label['title_edit'].set_text(_("Edit Cable"))
if not self.record_lock('cable', cableid):
return
self.cable.load(cableid)
self.edit_record()
self.topwidget.set_visible_child(self.box['cable_edit']) self.topwidget.set_visible_child(self.box['cable_edit'])
def on_but_detail_clicked(self, widget): def on_but_detail_clicked(self, widget):
cableid = treeview.get_value(self.tree['cables'], 0)
if not cableid:
return
self.cable.load(cableid)
self.display_record()
self.topwidget.set_visible_child(self.box['cable_detail']) self.topwidget.set_visible_child(self.box['cable_detail'])
self.button['close'].grab_focus()
def on_tvw_cables_row_activated(self, widget, path, column):
cableid = treeview.get_value(widget, 0)
self.cable.load(cableid)
self.display_record()
self.topwidget.set_visible_child(self.box['cable_detail'])
# buttons on detail page # buttons on detail page
# edit2 uses edit callback # edit2 uses edit callback
def on_but_close_clicked(self, widget): def on_but_close_clicked(self, widget):
self.topwidget.set_visible_child(self.box['cables']) self.topwidget.set_visible_child(self.box['cables'])
def on_but_delete_clicked(self, widget): def on_but_delete_clicked(self, widget):
answer = gtkutils.questionbox(
_("Delete cable!\n"
"Are you sure?"), title="YMS"
)
if answer == False:
return
self.topwidget.set_visible_child(self.box['cables']) self.topwidget.set_visible_child(self.box['cables'])
# buttons on edit page # buttons on edit page
def on_but_save_clicked(self, widget): def on_but_save_clicked(self, widget):
pass # check mandatory fields:
# name, type, length, conductors, xsection
cname = self.entry['name'].get_text().strip()
if not cname:
# TODO error marker
return
self.save_record()
print(self.cable)
if not self.cable.save():
print("ERROR saving cable")
# TODO error in infobox
print(self.context.db.last_error())
return
self.record_unlock()
if self.newrecord:
#self.load_list()
self.add_row()
self.context.publish("cable_modified", self.context.EVENT_ADD,
(self.cable.pk_value, self.cable.cablename)
)
else:
self.refresh_row()
self.context.publish("cable_modified", self.context.EVENT_UPD,
(self.cable.pk_value, self.cable.cablename)
)
self.newrecord = False
self.display_record()
self.topwidget.set_visible_child(self.box['cable_detail'])
def on_but_cancel_clicked(self, widget): def on_but_cancel_clicked(self, widget):
self.record_unlock()
self.topwidget.set_visible_child(self.box['cables']) self.topwidget.set_visible_child(self.box['cables'])
def display_record(self):
pass
def edit_record(self):
pass
+199 -23
View File
@@ -5,56 +5,201 @@ from gi.repository import Gtk
from .view import View from .view import View
from yms import gtkutils, combobox, treeview from yms import gtkutils, combobox, treeview
from yms.lookup import Dropdown
from yms.model import company from yms.model import company
class CompaniesView(View): class CompaniesView(View):
def __init__(self, context): def __init__(self, context):
super().__init__(context, _("Companies"), "companies.ui") super().__init__(context, _("Companies"), "companies.ui")
self.context = context
self.comp = company.Company(context.db) # current record self.comp = company.Company(context.db) # current record
self.newrecord = False self.newrecord = False
# company types # company types
self.db.cur.execute("SELECT ddval, ddtext FROM dropdown WHERE ddid=2 ORDER BY ddval") self.dd_comptype = self.context.lookup.dropdown(Dropdown.COMPANY_TYPE)
self.comptype = dict(self.db.cur.fetchall()) combobox.load_from_dict(self.combo['flt_type'], {-2: _("─── all ───"), -1: _("─── none ───")} | self.dd_comptype, -2)
combobox.load_from_dict(self.combo['flt_type'], {-2: _("─── all ───")} | self.comptype, -2) combobox.load_from_dict(self.combo['comptype'], self.dd_comptype, company.SUPPLIER)
combobox.load_from_dict(self.combo['comptype2'], {-1: _("─── none ───")} | self.dd_comptype)
# companied self.dd_flags = context.lookup.enum('company.flags')
# companies
self.lst_companies = Gtk.ListStore(int, str, str, str) self.lst_companies = Gtk.ListStore(int, str, str, str)
self.db.cur.execute("SELECT compid, compname, comptype, remarks FROM company ORDER BY compname") self.load_list()
for row in self.db.cur.fetchall():
self.lst_companies.append((row[0], row[1], self.comptype[row[2]], row[3]))
treeview.add_column(self.tree['companies'], _('ID'), 0) treeview.add_column(self.tree['companies'], _('ID'), 0)
treeview.add_column(self.tree['companies'], _('Name'), 1) treeview.add_column(self.tree['companies'], _('Name'), 1)
treeview.add_column(self.tree['companies'], _('Type'), 2) treeview.add_column(self.tree['companies'], _('Type'), 2)
treeview.add_column(self.tree['companies'], _('Remarks'), 3) treeview.add_column(self.tree['companies'], _('Remarks'), 3)
self.tree['companies'].set_model(self.lst_companies) self.tree['companies'].set_model(self.lst_companies)
def display_company(self, company): # subscribe to data change events
self.entry['compname'].set_text(company.compname) self.context.subscribe("dd_comptype_modified", self.comptype_modified)
# Type
# Type2 def get_list_row(self):
self.entry['shortname'].set_text(company.shortname) return (
self.entry['street'].set_text(company.street) self.comp.compid,
self.entry['zip'].set_text(company.zip) self.comp.compname,
self.entry['city'].set_text(company.city) self.dd_comptype.get(self.comp.comptype, ''),
self.entry['country'].set_text(company.country) self.comp.remarks
self.entry['contact'].set_text(company.contact) )
self.entry['phone'].set_text(company.phone)
self.entry['email'].set_text(company.email) def add_row(self):
self.entry['web'].set_text(company.web) treeiter = self.lst_companies.append(self.get_list_row())
self.entry['customerno'].set_text(company.customerno) self.tree['companies'].get_selection().select_iter(treeiter)
self.entry['contractno'].set_text(company.contractno)
def refresh_row(self):
treeview.set_row_values(self.tree['companies'], self.get_list_row())
def load_list(self):
selected_id = treeview.get_value(self.tree['companies'])
self.lst_companies.clear()
sql = (
"SELECT compid, compname, comptype, remarks "
"FROM company "
"WHERE compid >= 0 "
"ORDER BY compname"
)
self.db.cur.execute(sql)
selection = self.tree['companies'].get_selection()
for row in self.db.cur.fetchall():
treeiter = self.lst_companies.append((row[0], row[1], self.dd_comptype[row[2]], row[3]))
if row[0] == selected_id:
# restore previous selected row
selection.select_iter(treeiter)
def comptype_modified(self, eventtype, data):
self.dd_comptype[data[0]] = data[1]
lst1 = self.combo['flt_type'].get_model()
lst2 = self.combo['comptype'].get_model()
lst3 = self.combo['comptype2'].get_model()
if eventtype == self.context.EVENT_UPD:
for l in (lst1, lst2, lst3):
for row in l:
if row[0] == data[0]:
row[1] = data[1]
return
elif eventtype == self.context.EVENT_ADD:
lst1.append(data)
lst2.append(data)
lst3.append(data)
else:
# not implemented
pass
def clear_record(self):
self.comp.clear()
self.entry['compname'].set_text('')
self.entry['shortname'].set_text('')
self.entry['street'].set_text('')
self.entry['zip'].set_text('')
self.entry['city'].set_text('')
self.entry['country'].set_text('')
self.entry['contact'].set_text('')
self.entry['phone'].set_text('')
self.entry['email'].set_text('')
self.entry['web'].set_text('')
self.entry['customerno'].set_text('')
self.entry['contractno'].set_text('')
combobox.activate_row(self.combo['comptype'], company.SUPPLIER)
combobox.activate_row(self.combo['comptype2'], -1)
self.entry['compname'].grab_focus()
def display_record(self):
self.label['name'].set_text(self.comp.compname)
self.label['shortname'].set_text(self.comp.shortname or '')
self.label['type'].set_text(self.dd_comptype.get(self.comp.comptype, ''))
self.label['type2'].set_text(self.dd_comptype.get(self.comp.comptype2, ''))
self.label['street'].set_text(self.comp.street or '')
self.label['zip'].set_text(self.comp.zip or '')
self.label['city'].set_text(self.comp.city or '')
self.label['country'].set_text(self.comp.country or '')
self.label['contact'].set_text(self.comp.contact or '')
self.label['phone'].set_text(self.comp.phone or '')
self.label['email'].set_text(self.comp.email or '')
self.label['web'].set_text(self.comp.web or '')
self.label['customerno'].set_text(self.comp.customerno or '')
self.label['contractno'].set_text(self.comp.contractno or '')
self.label['flags'].set_text(self.comp.flags or '')
# TODO translation
self.label['remarks'].set_text(self.comp.remarks or '')
def edit_record(self):
self.entry['compname'].set_text(self.comp.compname)
combobox.activate_row(self.combo['comptype'], self.comp.comptype)
combobox.activate_row(self.combo['comptype2'], self.comp.comptype2 or -1)
self.entry['shortname'].set_text(self.comp.shortname or '')
self.entry['street'].set_text(self.comp.street or '')
self.entry['zip'].set_text(self.comp.zip or '')
self.entry['city'].set_text(self.comp.city or '')
self.entry['country'].set_text(self.comp.country or '')
self.entry['contact'].set_text(self.comp.contact or '')
self.entry['phone'].set_text(self.comp.phone or '')
self.entry['email'].set_text(self.comp.email or '')
self.entry['web'].set_text(self.comp.web or '')
self.entry['customerno'].set_text(self.comp.customerno or '')
self.entry['contractno'].set_text(self.comp.contractno or '')
flags = (self.comp.flags or '').split(',')
for flag in self.dd_flags:
self.check[flag].set_active(flag in flags)
self.text['remarks'].get_buffer().set_text(self.comp.remarks or '')
self.entry['compname'].grab_focus()
def save_record(self):
# fields must have been validated beforehand
self.comp.compname = self.entry['compname'].get_text()
self.comp.comptype = combobox.get_list_value(self.combo['comptype'])
self.comp.comptype2 = combobox.get_list_value(self.combo['comptype2'])
if self.comp.comptype2 < 0:
self.comp.comptype2 = None
self.comp.shortname = self.entry['shortname'].get_text()
self.comp.street = self.entry['street'].get_text()
self.comp.zip = self.entry['zip'].get_text()
self.comp.city = self.entry['city'].get_text()
self.comp.country = self.entry['country'].get_text()
self.comp.contact = self.entry['contact'].get_text()
self.comp.phone = self.entry['phone'].get_text()
self.comp.email = self.entry['email'].get_text()
self.comp.web = self.entry['web'].get_text()
self.comp.customerno = self.entry['customerno'].get_text()
self.comp.contractno = self.entry['contractno'].get_text()
self.comp.flags = self.get_checks(('historic', 'deleted'))
self.comp.remarks = gtkutils.get_text_contents(self.text['remarks'])
# buttons on list page # buttons on list page
def on_but_new_clicked(self, widget): def on_but_new_clicked(self, widget):
self.newrecord = True
self.label['title_edit'].set_text(_("Add new Company"))
self.clear_record()
self.topwidget.set_visible_child(self.box['comp_edit']) self.topwidget.set_visible_child(self.box['comp_edit'])
def on_but_edit_clicked(self, widget): def on_but_edit_clicked(self, widget):
self.newrecord = False
compid = treeview.get_value(self.tree['companies'], 0)
if not compid:
return
if not self.record_lock('company', compid):
return
self.comp.load(compid)
self.edit_record()
self.label['title_edit'].set_text(_("Edit Company"))
self.topwidget.set_visible_child(self.box['comp_edit']) self.topwidget.set_visible_child(self.box['comp_edit'])
def on_but_detail_clicked(self, widget): def on_but_detail_clicked(self, widget):
compid = treeview.get_value(self.tree['companies'], 0)
if not compid:
return
self.comp.load(compid)
self.display_record()
self.topwidget.set_visible_child(self.box['comp_detail'])
def on_tvw_companies_row_activated(self, widget, path, column):
compid = treeview.get_value(widget, 0)
self.comp.load(compid)
self.display_record()
self.topwidget.set_visible_child(self.box['comp_detail']) self.topwidget.set_visible_child(self.box['comp_detail'])
# buttons on detail page # buttons on detail page
@@ -63,11 +208,42 @@ class CompaniesView(View):
self.topwidget.set_visible_child(self.box['companies']) self.topwidget.set_visible_child(self.box['companies'])
def on_but_delete_clicked(self, widget): def on_but_delete_clicked(self, widget):
answer = gtkutils.questionbox(
_("Delete company!\n"
"Are you sure?"), title="YMS"
)
if answer == False:
return
self.topwidget.set_visible_child(self.box['companies']) self.topwidget.set_visible_child(self.box['companies'])
# buttons on edit page # buttons on edit page
def on_but_save_clicked(self, widget): def on_but_save_clicked(self, widget):
pass # check mandatory fields:
compname = self.entry['compname'].get_text().strip()
# TODO type
if not compname:
# TODO error marker
return
self.save_record()
print(self.comp)
if not self.comp.save():
pass
self.record_unlock()
if self.newrecord:
#self.load_list()
self.add_row()
self.context.publish("company_modified", self.context.EVENT_ADD,
(self.comp.pk_value, self.comp.comptype, self.comp.compname)
)
else:
self.refresh_row()
self.context.publish("company_modified", self.context.EVENT_UPD,
(self.comp.pk_value, self.comp.comptype, self.comp.compname)
)
self.newrecord = False
self.display_record()
self.topwidget.set_visible_child(self.box['comp_detail'])
def on_but_cancel_clicked(self, widget): def on_but_cancel_clicked(self, widget):
self.record_unlock()
self.topwidget.set_visible_child(self.box['companies']) self.topwidget.set_visible_child(self.box['companies'])
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more