Initial git commit for OpenLog beginning with v5.2.4.

This commit is contained in:
2026-02-10 14:44:21 -05:00
commit 45b432fb72
72 changed files with 39503 additions and 0 deletions

4
BUGS Normal file
View File

@@ -0,0 +1,4 @@
BUGS
1. Adding a reference to a note using the magnifying glass icon is possible even if not logged in. This results in a blank tech and shift.
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There needs to be a specific view only state.)

202
CHANGELOG Normal file
View File

@@ -0,0 +1,202 @@
CHANGELOG
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
1.0 - 2000-??-??
- Initial release.
2.0 - 2001-??-??
- Added referencing capability
- Various bugfixes
2.2 - 2002-??-??
- Added day navigation links at top of screen to replace forward and
back buttons.
- Added printer friendly functionality.
- Various bugfixes.
3.0 - 2005-03-12
- Total redesign of pages.
- Replaced day navigation links with clickable calendar.
- Improved search page by putting the search criteria and results on
the same page.
- Made various notices and error messages consistent.
- Simplified reference chain display on main page by removing
referenced note numbers and adding a magnifying glass icon
that takes you to the reference chain page. Referenced note
numbers still available on reference chain page.
- Added a plus sign icon to the note on the main page and reference
chain page so that you don't have to go to the edit page to
add a note referencing the current note.
- Many, many, many code cleanups.
- Now works with standard php configuration. No longer requires
register_globals to be turned on.
- simplified the printer friendly functionality.
- Added link management functionality.
3.1 - 2005-03-28
- Fixed bug where the footer message was not being displayed.
- Fixed bug that caused the contents of some fields in tables to be
halfway down the field (and possibly off-screen and not
visible) when the contents of other fields were very long.
- Fixed bug where links show up on the printer friendly main page.
3.2 - 2005-03-30
- Fixed inconsistent prompt text on search page.
- Fixed problem of whitespace characters at beginning and end of
search text being included in the where clause resulting in
no results returned.
- Fixed incorrect version number on about page.
- Moved openlog.sql into the utilities directory with all the other
one-time use stuff. Updated docs accordingly.
3.3 - 2005-06-02
- Fixed printer friendly pages so they do not show the navigation and
forms. This prevents the note column from being compressed to
just a few characters wide when printed.
3.4 - 2007-01-04
- Fixed bug where items in dropdown lists were displayed in some
random order. Now they are shown in the order they were added
on the administration page.
- Fixed bug where the reference links on the reference chain page
didn't work. They took you to the search page, which was
redundant and produced "no notes match criteria" message.
Links in references column now take you to the edit page
for the linked note.
- Added a security classification banner function that displays an
appropriately colored and labeled banner at the top and
bottom of all pages that display anything from the database.
Banner is controlled in the config.php file.
3.5 - 2008-01-02
- Added a time field to the database. It works like the date, i.e.,
it automatically fills with the current time of the database
server, but may be changed on the add entry and edit pages if
desired. YOU MUST RUN THE dbupdate-3.5.sql UTILITY AS
DESCRIBED IN THE UPGRADE FILE OR YOUR
PAGES WILL NOT DISPLAY CORRECTLY! Your database will not be
damaged if you omit this step, but the logbook will not be
much use. If you are installing OpenLog for the first time,
you will not need to run the update utility, since the initial
database creation takes care of it.
3.6 - 2008-01-30
- The timestamp field added in version 3.5 was not universally popular.
Added an option to the config file to select whether to show it
on the main page (it will still be inserted into the database
and remain editable).
- Added a configurable logbook name. You can now set the name of the
logbook in the config file so if you are running multiple
logbooks, you'll know which one you're looking at.
- Added options in the config file to determine the displayed order
of employee names and subject names.
4.0 - 2008-02-20
- Moved all configuration from a file (config.php) to a table in the
database. Added a configuration page so that all configuration
can be done in the web browser.
- Techs can now tell OpenLog to remember who they are using a browser
cookie. Techs can set their current shift, and the Add Entry
page will preselect the tech and shift. Also added a
customization page so that each tech can have their own color
scheme, etc.
- Created an installation shell script that automates the task of
getting the distribution in the right place in the filesystem
with the correct file ownership.
- Created a php installation/upgrade routine that detects whether the
distribution has been configured and prompts for the database
name/logbook name etc. OpenLog either sets up a new
installation or upgrades an existing configuration without the
user having to deal with command prompt stuff.
4.1 - 2008-02-26
- Fixed copyright dates in all files.
- Fixed bug where backslashes appeared in notes on systems where
magic_quotes_gpc was turned on.
- Fixed bug where custom tech name was inserted on new or edited
notes even when another tech name was selected.
- Fixed install.sh script to not show hostname in url in final
instructions since it was not reliable.
- Fixed bug where timestamps for notes entered for past or future
dates were set to the time the note was entered. This made
notes entered last night appear after notes made this morning
on the main page.
- Trimmed all text files (including this one;-) to 80 columns so they
wouldn't produce wierd line spacing on terminal displays.
4.2 - 2008-03-08
- Fixed About page to accurately describe configuration changes.
- URLs entered as http://domain.com are automatically converted to
clickable links in the note text.
- Added configuration setting to control the size of chunks to break
long url strings into, preventing a long url from distorting
the page.
- Reversed the chronological order of the CHANGELOG file so the
newest stuff is at the top.
4.3 - 2013-03-15
- Fixed install.sh script to make it detect the httpd process name
and user instead of using hardcoded values.
5.0 - 2015-08-10
- Reworked install.sh script to remove web server version specific
defaults.
- Added install.bat script to handle installation on Windows servers.
- Added PHP sessions to enable tech logins and privilege separation.
- Added maintenance form and parts tracking functionality.
- Added the ability to set flags for notes and maintenance forms.
- Improved search capability.
5.1 - 2015-11-17
- Added scheduled maintenance functionality.
5.1.1 - 2016-01-28
- Various bugfixes
5.2.0 - 2016-10-18
- Use jquery-ui for calendaring functions
- Replaced deprecated php functions split() and ereg*() with
explode() and preg*() functions to make OpenLog compatible
with php 7.
- Added a field to the logentry page to allow the user to insert a
properly formatted URL into a note.
5.2.1 - 2024-07-09
- Removed install.php and moved installation/upgrade process to
install.sh shell script with default database files and a db.php
template file.
- Various compatibility fixes to make OpenLog work with php-8.x.
5.2.2 - 2025-02-26
- Removed corrupt line from the beginning of database-initial.sql
that caused the population of the database to fail during
install. Upgrades not affected.
- Changed functions.php so that the application uses a sans-serif
font by default.
5.2.3 - 2025-12-01
- In lognotes.php, get today's data from the database instead of the
php date() function, since that had returned tomorrow's date in
some instances.
- In logentry.php, only run parts code if parts functionality is
enabled. This prevents a fatal php error that occurred when
trying to get the max value of an empty array.
- In settings.php, the LOG_ERRORS constant was not being read
properly. Assigned its value to a variable to be used in the if
statement.
5.2.4 - 2025-12-02
- In logentry.php, the parts bug from 5.2.2 was only partially
fixed. Made the corrections to the edit code as well as the
new entry.
- In logentry.php, the default times for notes entered using dates
other than today's date contained a trailing coln that mysql
didn't like. Removed trailing colons.
- Cleaned up the REQUEST importation in multiple files to default to
NULL values for parameters not supplied to prevent warning
messages in the logs.
- In the install.sh script, removed the prompts for optional package
installation. Code is still there, just turned off by default.

35
INSTALL Normal file
View File

@@ -0,0 +1,35 @@
INSTALL
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
Installation of OpenLog is straightforward.
1. Gather the required information.
You'll need to know how to configure your web server. This means where
you want to put the files to be served and any configuration required to
allow clients to reach them. You'll also need to know the username and
password of the MySQL administrator.
2. Unpack
Unpack the distribution in a convenient place (such as /tmp or My Documents).
A directory will be created called OpenLog-x.x.x.
3. Review License
Change to the openlog-x.x.x directory and review the LICENSE file.
4. Run the install script
If installing on a Linux or Unix based system, type ./install.sh at a
command prompt. If installing on a Windows based system, double click
install.bat. Follow the prompts.
5. Check and set Configuration
Click on the Administration menu option on the main page to adjust the initial
settings. You will need to log in as OpenLogAdmin. The initial default password
is "OpenLog-1". From the Administration page, you can click on the links at the
top to add techs, subjects, shifts, etc.
7. Start using OpenLog.

384
LICENSE Normal file
View File

@@ -0,0 +1,384 @@
The following license applies to all OpenLog code
Copyright (C) 2016 by Rod Wright :
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
The following license applies to jquery code :
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/

19
TODO.txt Normal file
View File

@@ -0,0 +1,19 @@
TODO.txt
1. Create a weblink hot button on the add logbook entry page to insert a weblink. DONE
2. Allow admins to create global templates.
3. Create a way to restore the global page colors. (db change reqd)
4. Pick a logbook subject to associate with a scheduled task to populate for the logbook entry. (db change reqd)
5. Add info messages to scheduled task page edits.
6. Allow scheduled tasks to be completed as a group instead of having to complete each member.
7. Implement popup calendars for date entry fields. DONE
8. Improve template management interface. It can be confusing. It needs its own page.
9. Remove refs from templates. (db change reqd)
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd)
11. allow partids to be autogenerated if user doesn't supply one (db change reqd)
12. If there are no flags, don't offer to set them on reference chain
13. make some flags immutable so they won't be synced on reference chain.
14 Add title text to flags in search results.
15. Nag about scheduled events even if not logged in
16. Fix bug where back button frequently causes ERR_CACHE_MISS errors in browser. DONE
17. Fix bug where date is not shown on printer friendly lognotes page.

607
database-initial.sql Normal file
View File

@@ -0,0 +1,607 @@
-- MariaDB dump 10.19 Distrib 10.6.18-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: ol521
-- ------------------------------------------------------
-- Server version 10.6.18-MariaDB-0ubuntu0.22.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `banners`
--
DROP TABLE IF EXISTS `banners`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `banners` (
`bannerid` int(11) NOT NULL AUTO_INCREMENT,
`bannername` tinytext DEFAULT NULL,
`bannercolor` tinytext DEFAULT NULL,
`textcolor` tinytext DEFAULT NULL,
PRIMARY KEY (`bannerid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `banners`
--
LOCK TABLES `banners` WRITE;
/*!40000 ALTER TABLE `banners` DISABLE KEYS */;
INSERT INTO `banners` VALUES
(1,'no banner','#000000','#000000'),
(2,'UNCLASSIFIED','#009900','#FFFFFF'),
(3,'CONFIDENTIAL','#000099','#FFFFFF'),
(4,'SECRET','#990000','#FFFFFF'),
(5,'TOP SECRET','#FF6600','#FFFFFF');
/*!40000 ALTER TABLE `banners` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `configs`
--
DROP TABLE IF EXISTS `configs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `configs` (
`confid` int(11) NOT NULL AUTO_INCREMENT,
`confname` text DEFAULT NULL,
`confvalue` text DEFAULT NULL,
PRIMARY KEY (`confid`),
UNIQUE (`confname`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `configs`
--
LOCK TABLES `configs` WRITE;
/*!40000 ALTER TABLE `configs` DISABLE KEYS */;
INSERT INTO `configs` VALUES
(1,'ol_version','5.2.4'),
(2,'log_name','OpenLog'),
(3,'banner','1'),
(4,'background_color','#003333'),
(5,'p_background_color','#FFFFFF'),
(6,'sidebar_color','#336666'),
(7,'p_sidebar_color','#FFFFFF'),
(8,'menubg_color','#000000'),
(9,'p_menubg_color','#FFFFFF'),
(10,'text_color','#FFFFFF'),
(11,'p_text_color','#000000'),
(12,'link_color','#00FF00'),
(13,'p_link_color','#000000'),
(14,'vlink_color','#00FF00'),
(15,'p_vlink_color','#000000'),
(16,'heading_color','#00FFFF'),
(17,'p_heading_color','#000000'),
(18,'footer_message','Please report bugs to software@thermionic.net.'),
(19,'show_ts','1'),
(20,'url_chunk_size','70'),
(21,'tech_alpha','1'),
(22,'subj_alpha','1'),
(23,'unix_server_session_dir','/tmp/openlog/openlog/sessions'),
(24,'win_server_session_dir','c:\\Windows\\Temp\\openlog\\\\openlog\\sessions'),
(25,'session_ttl_days','30'),
(26,'log_style','1'),
(27,'uid_text','Part ID Number'),
(28,'parts_functions','1'),
(29,'schedmaint_functions','1'),
(30,'log_errors','0');
/*!40000 ALTER TABLE `configs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `customs`
--
DROP TABLE IF EXISTS `customs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customs` (
`customid` int(11) NOT NULL AUTO_INCREMENT,
`customtech` int(11) DEFAULT NULL,
`customconfnum` int(11) DEFAULT NULL,
`customconfvalue` text DEFAULT NULL,
PRIMARY KEY (`customid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `customs`
--
LOCK TABLES `customs` WRITE;
/*!40000 ALTER TABLE `customs` DISABLE KEYS */;
/*!40000 ALTER TABLE `customs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `devicegroups`
--
DROP TABLE IF EXISTS `devicegroups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `devicegroups` (
`groupid` int(11) NOT NULL AUTO_INCREMENT,
`groupdevice` int(11) DEFAULT NULL,
`memberdevice` int(11) DEFAULT NULL,
PRIMARY KEY (`groupid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `devicegroups`
--
LOCK TABLES `devicegroups` WRITE;
/*!40000 ALTER TABLE `devicegroups` DISABLE KEYS */;
/*!40000 ALTER TABLE `devicegroups` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `devices`
--
DROP TABLE IF EXISTS `devices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `devices` (
`deviceid` int(11) NOT NULL AUTO_INCREMENT,
`devicename` tinytext DEFAULT NULL,
`devicedesc` text DEFAULT NULL,
`group_flag` int(11) DEFAULT NULL,
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`deviceid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `devices`
--
LOCK TABLES `devices` WRITE;
/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `events`
--
DROP TABLE IF EXISTS `events`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `events` (
`eventid` int(11) NOT NULL AUTO_INCREMENT,
`task` int(11) DEFAULT NULL,
`device` int(11) DEFAULT NULL,
`start_date` date DEFAULT NULL,
`last_date` date DEFAULT NULL,
`deferred_flag` int(11) DEFAULT NULL,
`deferred_date` date DEFAULT NULL,
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`eventid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `events`
--
LOCK TABLES `events` WRITE;
/*!40000 ALTER TABLE `events` DISABLE KEYS */;
/*!40000 ALTER TABLE `events` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `flags`
--
DROP TABLE IF EXISTS `flags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `flags` (
`flagid` int(11) NOT NULL AUTO_INCREMENT,
`flagname` tinytext DEFAULT NULL,
`flagsym` tinytext DEFAULT NULL,
`flagcolor` tinytext DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`flagid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `flags`
--
LOCK TABLES `flags` WRITE;
/*!40000 ALTER TABLE `flags` DISABLE KEYS */;
/*!40000 ALTER TABLE `flags` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `links`
--
DROP TABLE IF EXISTS `links`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `links` (
`linkid` int(11) NOT NULL AUTO_INCREMENT,
`linkpriority` int(11) NOT NULL,
`displaytxt` text DEFAULT NULL,
`urltxt` text DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`linkid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `links`
--
LOCK TABLES `links` WRITE;
/*!40000 ALTER TABLE `links` DISABLE KEYS */;
/*!40000 ALTER TABLE `links` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lognotes`
--
DROP TABLE IF EXISTS `lognotes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lognotes` (
`lognoteid` int(11) NOT NULL AUTO_INCREMENT,
`date` date DEFAULT NULL,
`time` time DEFAULT NULL,
`shift` int(11) NOT NULL,
`tech` int(11) NOT NULL,
`subject` int(11) NOT NULL,
`lognote` text DEFAULT NULL,
`refs` tinytext DEFAULT NULL,
PRIMARY KEY (`lognoteid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lognotes`
--
LOCK TABLES `lognotes` WRITE;
/*!40000 ALTER TABLE `lognotes` DISABLE KEYS */;
/*!40000 ALTER TABLE `lognotes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `logpartactions`
--
DROP TABLE IF EXISTS `logpartactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `logpartactions` (
`lpactionid` int(11) NOT NULL AUTO_INCREMENT,
`lpactionname` tinytext DEFAULT NULL,
`status` int(11) DEFAULT NULL,
PRIMARY KEY (`lpactionid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `logpartactions`
--
LOCK TABLES `logpartactions` WRITE;
/*!40000 ALTER TABLE `logpartactions` DISABLE KEYS */;
INSERT INTO `logpartactions` VALUES
(1,'removed',1),
(2,'installed',1),
(3,'repaired',1),
(4,'replaced',1),
(5,'incoming',1),
(6,'outgoing',1);
/*!40000 ALTER TABLE `logpartactions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `logparts`
--
DROP TABLE IF EXISTS `logparts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `logparts` (
`logpartid` int(11) NOT NULL AUTO_INCREMENT,
`lognoteid` int(11) DEFAULT NULL,
`partid` int(11) DEFAULT NULL,
`action` int(11) DEFAULT NULL,
PRIMARY KEY (`logpartid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `logparts`
--
LOCK TABLES `logparts` WRITE;
/*!40000 ALTER TABLE `logparts` DISABLE KEYS */;
/*!40000 ALTER TABLE `logparts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `maintactions`
--
DROP TABLE IF EXISTS `maintactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `maintactions` (
`maintactionid` int(11) NOT NULL AUTO_INCREMENT,
`actiondate` date DEFAULT NULL,
`actiontime` time DEFAULT NULL,
`maintformnum` int(11) NOT NULL,
`actiontech` int(11) NOT NULL,
`action` text DEFAULT NULL,
PRIMARY KEY (`maintactionid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `maintactions`
--
LOCK TABLES `maintactions` WRITE;
/*!40000 ALTER TABLE `maintactions` DISABLE KEYS */;
/*!40000 ALTER TABLE `maintactions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `maintforms`
--
DROP TABLE IF EXISTS `maintforms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `maintforms` (
`maintformid` int(11) NOT NULL AUTO_INCREMENT,
`mfdate` date DEFAULT NULL,
`mftime` time DEFAULT NULL,
`mftech` int(11) DEFAULT NULL,
`mfpart` int(11) NOT NULL,
`mfpartloc` text DEFAULT NULL,
`mfmalfunction` text DEFAULT NULL,
`nha` tinytext DEFAULT NULL,
`repord` tinytext DEFAULT NULL,
`lognoteid` int(11) DEFAULT NULL,
`pending` int(11) DEFAULT NULL,
PRIMARY KEY (`maintformid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `maintforms`
--
LOCK TABLES `maintforms` WRITE;
/*!40000 ALTER TABLE `maintforms` DISABLE KEYS */;
/*!40000 ALTER TABLE `maintforms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `notetemplates`
--
DROP TABLE IF EXISTS `notetemplates`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notetemplates` (
`templateid` int(11) NOT NULL AUTO_INCREMENT,
`templatename` tinytext DEFAULT NULL,
`shift` int(11) NOT NULL,
`tech` int(11) NOT NULL,
`subject` int(11) NOT NULL,
`lognote` text DEFAULT NULL,
`refs` tinytext DEFAULT NULL,
PRIMARY KEY (`templateid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `notetemplates`
--
LOCK TABLES `notetemplates` WRITE;
/*!40000 ALTER TABLE `notetemplates` DISABLE KEYS */;
/*!40000 ALTER TABLE `notetemplates` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `parts`
--
DROP TABLE IF EXISTS `parts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `parts` (
`partid` int(11) NOT NULL AUTO_INCREMENT,
`uid` tinytext DEFAULT NULL,
`partnum` tinytext DEFAULT NULL,
`sernum` tinytext DEFAULT NULL,
`partname` tinytext DEFAULT NULL,
PRIMARY KEY (`partid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `parts`
--
LOCK TABLES `parts` WRITE;
/*!40000 ALTER TABLE `parts` DISABLE KEYS */;
/*!40000 ALTER TABLE `parts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `shifts`
--
DROP TABLE IF EXISTS `shifts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shifts` (
`shiftid` int(11) NOT NULL AUTO_INCREMENT,
`shiftname` tinytext DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`shiftid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `shifts`
--
LOCK TABLES `shifts` WRITE;
/*!40000 ALTER TABLE `shifts` DISABLE KEYS */;
INSERT INTO `shifts` VALUES
(1,'First Shift',1);
/*!40000 ALTER TABLE `shifts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `styles`
--
DROP TABLE IF EXISTS `styles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `styles` (
`styleid` int(11) NOT NULL AUTO_INCREMENT,
`styletype` tinytext DEFAULT NULL,
`stylename` tinytext DEFAULT NULL,
PRIMARY KEY (`styleid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `styles`
--
LOCK TABLES `styles` WRITE;
/*!40000 ALTER TABLE `styles` DISABLE KEYS */;
INSERT INTO `styles` VALUES
(1,'logdisplay','classic'),
(2,'logdisplay','clean');
/*!40000 ALTER TABLE `styles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `subjects`
--
DROP TABLE IF EXISTS `subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `subjects` (
`subjectid` int(11) NOT NULL AUTO_INCREMENT,
`subjectname` tinytext DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`subjectid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subjects`
--
LOCK TABLES `subjects` WRITE;
/*!40000 ALTER TABLE `subjects` DISABLE KEYS */;
INSERT INTO `subjects` VALUES
(1,'Miscellaneous',1);
/*!40000 ALTER TABLE `subjects` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tasks`
--
DROP TABLE IF EXISTS `tasks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tasks` (
`taskid` int(11) NOT NULL AUTO_INCREMENT,
`taskname` tinytext DEFAULT NULL,
`taskdesc` text DEFAULT NULL,
`frequency` int(11) DEFAULT NULL,
`period` tinytext DEFAULT NULL,
`weekdays_only` int(11) DEFAULT NULL,
`nextdue_relative` int(11) DEFAULT NULL,
`refdoc_name` tinytext DEFAULT NULL,
`refdoc_url` tinytext DEFAULT NULL,
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`taskid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tasks`
--
LOCK TABLES `tasks` WRITE;
/*!40000 ALTER TABLE `tasks` DISABLE KEYS */;
/*!40000 ALTER TABLE `tasks` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `techs`
--
DROP TABLE IF EXISTS `techs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `techs` (
`techid` int(11) NOT NULL AUTO_INCREMENT,
`techname` tinytext DEFAULT NULL,
`admin` int(11) DEFAULT NULL,
`shift` int(11) DEFAULT NULL,
`techpass` text DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`techid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `techs`
--
LOCK TABLES `techs` WRITE;
/*!40000 ALTER TABLE `techs` DISABLE KEYS */;
INSERT INTO `techs` VALUES
(1,'OpenLogAdmin',1,1,'$2y$10$6eCxUFNzoAkycMJpZ.zvaOfoByYhqi0YicQbut3XGc/TRxyxiUwcm',1);
/*!40000 ALTER TABLE `techs` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-07-09 14:36:00

32
database-update.sql Normal file
View File

@@ -0,0 +1,32 @@
-- database-update.sql
-- ---------- version 5.2.1 -------------
-- Make confname a unique column
ALTER TABLE configs ADD UNIQUE(confname);
-- Delete db name, user, and password configs
DELETE FROM configs where confname="ol_dbname";
DELETE FROM configs where confname="ol_dbuser";
DELETE FROM configs where confname="ol_dbpass";
-- Add config option for server side error logging
INSERT IGNORE INTO configs(confname,confvalue) values('log_errors','0')
-- Update version number
UPDATE configs SET confvalue="5.2.1" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.2 -------------
-- Update version number
UPDATE configs SET confvalue="5.2.2" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.3 -------------
-- Update version number
UPDATE configs SET confvalue="5.2.3" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.4 -------------
-- Update version number
UPDATE configs SET confvalue="5.2.4" WHERE confname="ol_version";
-- --------------------------------------

43
db.php.template Normal file
View File

@@ -0,0 +1,43 @@
<?php
/*
db.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
/*
************************************************************************
** WARNING! This file is automatically generated during installation **
** DO NOT EDIT **
************************************************************************
*/
$appname="APPNAME";
$dbname="DBNAME";
$username="DBUSER";
$dbpass="DBPASS";
function dberrmsg($dbname) {
echo "
<html>
<head>
<title>Database Error!</title>
</head>
<body>
Could not connect to the $dbname database. Please ensure the MySQL server is running. If this is
the first time you have used $appname, please consult the INSTALL file included in the distribution.
</body>
</html>
";
exit();
}
$db=@mysqli_connect("localhost",$username,$dbpass,$dbname);
if (mysqli_errno($db)) {
dberrmsg($dbname);
}
?>

19
db.php_update Normal file
View File

@@ -0,0 +1,19 @@
# opendrs-update.sh
install_path=$1
# ---------- version 5.2.1 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.2 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.3 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.4 -------------
# No changes to the db.php file
# ---------------------------------------

203
distfiles/CHANGELOG Normal file
View File

@@ -0,0 +1,203 @@
CHANGELOG
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
1.0 - 2000-??-??
- Initial release.
2.0 - 2001-??-??
- Added referencing capability
- Various bugfixes
2.2 - 2002-??-??
- Added day navigation links at top of screen to replace forward and
back buttons.
- Added printer friendly functionality.
- Various bugfixes.
3.0 - 2005-03-12
- Total redesign of pages.
- Replaced day navigation links with clickable calendar.
- Improved search page by putting the search criteria and results on
the same page.
- Made various notices and error messages consistent.
- Simplified reference chain display on main page by removing
referenced note numbers and adding a magnifying glass icon
that takes you to the reference chain page. Referenced note
numbers still available on reference chain page.
- Added a plus sign icon to the note on the main page and reference
chain page so that you don't have to go to the edit page to
add a note referencing the current note.
- Many, many, many code cleanups.
- Now works with standard php configuration. No longer requires
register_globals to be turned on.
- simplified the printer friendly functionality.
- Added link management functionality.
3.1 - 2005-03-28
- Fixed bug where the footer message was not being displayed.
- Fixed bug that caused the contents of some fields in tables to be
halfway down the field (and possibly off-screen and not
visible) when the contents of other fields were very long.
- Fixed bug where links show up on the printer friendly main page.
3.2 - 2005-03-30
- Fixed inconsistent prompt text on search page.
- Fixed problem of whitespace characters at beginning and end of
search text being included in the where clause resulting in
no results returned.
- Fixed incorrect version number on about page.
- Moved openlog.sql into the utilities directory with all the other
one-time use stuff. Updated docs accordingly.
3.3 - 2005-06-02
- Fixed printer friendly pages so they do not show the navigation and
forms. This prevents the note column from being compressed to
just a few characters wide when printed.
3.4 - 2007-01-04
- Fixed bug where items in dropdown lists were displayed in some
random order. Now they are shown in the order they were added
on the administration page.
- Fixed bug where the reference links on the reference chain page
didn't work. They took you to the search page, which was
redundant and produced "no notes match criteria" message.
Links in references column now take you to the edit page
for the linked note.
- Added a security classification banner function that displays an
appropriately colored and labeled banner at the top and
bottom of all pages that display anything from the database.
Banner is controlled in the config.php file.
3.5 - 2008-01-02
- Added a time field to the database. It works like the date, i.e.,
it automatically fills with the current time of the database
server, but may be changed on the add entry and edit pages if
desired. YOU MUST RUN THE dbupdate-3.5.sql UTILITY AS
DESCRIBED IN THE UPGRADE FILE OR YOUR
PAGES WILL NOT DISPLAY CORRECTLY! Your database will not be
damaged if you omit this step, but the logbook will not be
much use. If you are installing OpenLog for the first time,
you will not need to run the update utility, since the initial
database creation takes care of it.
3.6 - 2008-01-30
- The timestamp field added in version 3.5 was not universally popular.
Added an option to the config file to select whether to show it
on the main page (it will still be inserted into the database
and remain editable).
- Added a configurable logbook name. You can now set the name of the
logbook in the config file so if you are running multiple
logbooks, you'll know which one you're looking at.
- Added options in the config file to determine the displayed order
of employee names and subject names.
4.0 - 2008-02-20
- Moved all configuration from a file (config.php) to a table in the
database. Added a configuration page so that all configuration
can be done in the web browser.
- Techs can now tell OpenLog to remember who they are using a browser
cookie. Techs can set their current shift, and the Add Entry
page will preselect the tech and shift. Also added a
customization page so that each tech can have their own color
scheme, etc.
- Created an installation shell script that automates the task of
getting the distribution in the right place in the filesystem
with the correct file ownership.
- Created a php installation/upgrade routine that detects whether the
distribution has been configured and prompts for the database
name/logbook name etc. OpenLog either sets up a new
installation or upgrades an existing configuration without the
user having to deal with command prompt stuff.
4.1 - 2008-02-26
- Fixed copyright dates in all files.
- Fixed bug where backslashes appeared in notes on systems where
magic_quotes_gpc was turned on.
- Fixed bug where custom tech name was inserted on new or edited
notes even when another tech name was selected.
- Fixed install.sh script to not show hostname in url in final
instructions since it was not reliable.
- Fixed bug where timestamps for notes entered for past or future
dates were set to the time the note was entered. This made
notes entered last night appear after notes made this morning
on the main page.
- Trimmed all text files (including this one;-) to 80 columns so they
wouldn't produce wierd line spacing on terminal displays.
4.2 - 2008-03-08
- Fixed About page to accurately describe configuration changes.
- URLs entered as http://domain.com are automatically converted to
clickable links in the note text.
- Added configuration setting to control the size of chunks to break
long url strings into, preventing a long url from distorting
the page.
- Reversed the chronological order of the CHANGELOG file so the
newest stuff is at the top.
4.3 - 2013-03-15
- Fixed install.sh script to make it detect the httpd process name
and user instead of using hardcoded values.
5.0 - 2015-08-10
- Reworked install.sh script to remove web server version specific
defaults.
- Added install.bat script to handle installation on Windows servers.
- Added PHP sessions to enable tech logins and privilege separation.
- Added maintenance form and parts tracking functionality.
- Added the ability to set flags for notes and maintenance forms.
- Improved search capability.
5.1 - 2015-11-17
- Added scheduled maintenance functionality.
5.1.1 - 2016-01-28
- Various bugfixes
5.2.0 - 2016-10-18
- Use jquery-ui for calendaring functions
- Replaced deprecated php functions split() and ereg*() with
explode() and preg*() functions to make OpenLog compatible
with php 7.
- Added a field to the logentry page to allow the user to insert a
properly formatted URL into a note.
5.2.1 - 2024-07-09
- Removed install.php and moved installation/upgrade process to
install.sh shell script with default database files and a db.php
template file.
- Various compatibility fixes to make OpenLog work with php-8.x.
5.2.2 - 2025-02-26
- Removed corrupt line from the beginning of database-initial.sql
that caused the population of the database to fail during
install. Upgrades not affected.
- Changed functions.php so that the application uses a sans-serif
font by default.
5.2.3 - 2025-12-01
- In lognotes.php, get today's data from the database instead of the
php date() function, since that had returned tomorrow's date in
some instances.
- In logentry.php, only run parts code if parts functionality is
enabled. This prevents a fatal php error that occurred when
trying to get the max value of an empty array.
- In settings.php, the LOG_ERRORS constant was not being read
properly. Assigned its value to a variable to be used in the if
statement.
5.2.4 - 2025-12-02
- In logentry.php, the parts bug from 5.2.2 was only partially
fixed. Made the corrections to the edit code as well as the
new entry.
- In logentry.php, the default times for notes entered using dates
other than today's date contained a trailing coln that mysql
didn't like. Removed trailing colons.
- Cleaned up the REQUEST importation in multiple files to default to
NULL values for parameters not supplied to prevent warning
messages in the logs.
- In the install.sh script, removed the prompts for optional package
installation. Code is still there, just turned off by default.

35
distfiles/INSTALL Normal file
View File

@@ -0,0 +1,35 @@
INSTALL
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
Installation of OpenLog is straightforward.
1. Gather the required information.
You'll need to know how to configure your web server. This means where
you want to put the files to be served and any configuration required to
allow clients to reach them. You'll also need to know the username and
password of the MySQL administrator.
2. Unpack
Unpack the distribution in a convenient place (such as /tmp or My Documents).
A directory will be created called OpenLog-x.x.x.
3. Review License
Change to the openlog-x.x.x directory and review the LICENSE file.
4. Run the install script
If installing on a Linux or Unix based system, type ./install.sh at a
command prompt. If installing on a Windows based system, double click
install.bat. Follow the prompts.
5. Check and set Configuration
Click on the Administration menu option on the main page to adjust the initial
settings. You will need to log in as OpenLogAdmin. The initial default password
is "OpenLog-1". From the Administration page, you can click on the links at the
top to add techs, subjects, shifts, etc.
7. Start using OpenLog.

384
distfiles/LICENSE Normal file
View File

@@ -0,0 +1,384 @@
The following license applies to all OpenLog code
Copyright (C) 2016 by Rod Wright :
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
The following license applies to jquery code :
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/

96
distfiles/about.php Normal file
View File

@@ -0,0 +1,96 @@
<?php
/*
about.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$version=OL_VERSION;
$print=$_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","About OpenLog","About OpenLog",$print);
pagetable("begin");
if(!$print){
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
echo "
<h3 align=\"center\">
OpenLog $version
</h3><br>
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
or see the LICENSE file in the distribution to read it. OpenLog is Copyright (C) 2025 by Rod Wright.</p>
<p>
Although the code
that makes OpenLog work is Open Source, proprietary information may be safely entered into the OpenLog database without fear of affecting the status
of either that information or of OpenLog. This does not conflict with the terms of the GPL, since no database is distributed with OpenLog. If you give a copy of OpenLog to someone else (which you are encouraged to do), you do not need to give them your database
or anything contained therein.</p>
<p>
OpenLog is a simple online logbook application. It allows anyone with a web browser to read, enter, and search for
notes on any subject. The available shifts, employees, and subjects are easily configured. Notes can be referred to
other notes and the entire chain of referenced notes can be displayed in a single page. This makes it convenient to
track ongoing projects or actions on a particular piece of equipment over a long period of time. OpenLog also incorporates
part tracking functions that allow discrepancies and maintenence actions to be documented. Notes, parts, and maintenance
forms can be can be searched for based on a number of criteria. The look and feel of the OpenLog pages are easily changed.
Settings that affect all users can be changed in the Administration menu. User specific settings can be changed in the
My Profile menu. No browser specific HTML is used in OpenLog, so it should be useable in any browser, and it has been
tested using Google Chrome, Mozilla Firefox and Microsoft Internet Explorer.
</p>
<p>
To read about the <a href=\"CHANGELOG\" >changes</a> in this latest version of OpenLog, click on the link or see the CHANGELOG file in the distribution.
</p>
<p>Several pieces of Open Source software make OpenLog possible.
<br>
<table border=0 cellpadding=20>
<tr>
<td><a href=\"http://www.linux.org\" target=\"_blank\"><img src=\"images/linux.png\" border=0></a></td><td><b>Linux</b></td><td>All
development and most of the testing of OpenLog was done on computers running the
<a href=\"http://www.linux.org\" target=\"_blank\">Linux</a> operating system.</td>
</tr>
<tr>
<td><a href=\"http://www.php.net\" target=\"_blank\"><img src=\"images/php-small-trans-dark.gif\"
border=0></a></td><td><b>PHP</b></td><td>OpenLog is written in <a href=\"http://www.php.net\" target=\"_blank\">PHP</a>, a hypertext
preprocessor, which makes possible the dynamic content of the pages.</td>
</tr>
<tr>
<td><a href=\"http://www.mysql.com\" target=\"_blank\"><img src=\"images/poweredbymysql-125.png\"
border=0></a></td><td><b>MySQL</b></td><td>OpenLog stores its data in a <a href=\"http://www.mysql.com\" target=\"_blank\">MySQL</a>
database.</td>
</tr>
<tr>
<td><a href=\"http://http.apache.org\" target=\"_blank\"><img src=\"images/apache_pb.gif\"
border=0></a></td><td><b>Apache</b></td><td>OpenLog was developed using the <a href=\"httpd.apache.org\" target=\"_blank\">Apache</a> web
server.</td>
</tr>
<tr>
<td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\"
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenLog are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and are licensed under a
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
</tr>
</table>
</p>
";
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

1590
distfiles/admin.php Normal file

File diff suppressed because it is too large Load Diff

929
distfiles/functions.php Normal file
View File

@@ -0,0 +1,929 @@
<?php
/*
functions.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
// test for correct installation
if (!file_exists("db.php")) {
echo "
<html>
<head>
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>Installation error</title>
</head>
<body>
Could not find the db.php file required for this installation.
</body>
</html>
";
exit();
}
include("db.php");
include("settings.php");
// build the basic color array
$basic_colors=array(
"White" => "#FFFFFF",
"Silver" => "#C0C0C0",
"Gray" => "#808080",
"Black" => "#000000",
"Red" => "#FF0000",
"Maroon" => "#800000",
"Orange" => "#FFA500",
"Yellow" => "#FFFF00",
"Olive" => "#808000",
"Lime" => "#00FF00",
"Green" => "#008000",
"Aqua" => "#00FFFF",
"Teal" => "#008080",
"Blue" => "#0000FF",
"Navy" => "#000080",
"Fuchsia" => "#FF00FF",
"Purple" => "#800080");
// Generic functions
function framework($option,$htmltitle,$pagetitle,$print) {
// generates html code for the beginning and end of all pages
if ($option=="begin") {
// generates everything down to the first horiz rule inclusive
// htmltitle is the page title that appears in the window titlebar
// pagetitle is what will appear as the title of the page itself
// print is whether to format for printing or not
if ($print) {
$bgcolor=P_BACKGROUND_COLOR;
$textcolor=P_TEXT_COLOR;
$linkcolor=P_LINK_COLOR;
$vlinkcolor=P_VLINK_COLOR;
$hdgcolor=P_HEADING_COLOR;
} else {
$bgcolor=BACKGROUND_COLOR;
$textcolor=TEXT_COLOR;
$linkcolor=LINK_COLOR;
$vlinkcolor=VLINK_COLOR;
$hdgcolor=HEADING_COLOR;
}
echo "
<html>
<head>
<title>$htmltitle</title>
<style type=\"text/css\">
* {font-family: Arial, Helvetica, sans-serif;}
table.mfentry {width: 550px; table-layout:fixed;}
td.forcewrap {word-wrap: break-word;}
</style>
<link href=\"jquery-ui/jquery-ui.css\" rel=\"stylesheet\">
<style>div.ui-datepicker{font-size:12px;}</style>
</head>
";
echo "
<body bgcolor=\"$bgcolor\" text=\"$textcolor\" link=\"$linkcolor\" vlink=\"$vlinkcolor\">
";
if ($htmltitle || $pagetitle) {
echo "
<font size=5 color=\"$hdgcolor\"><b> $htmltitle - $pagetitle</b></font><br>
";
}
} else if ($option=="end") {
// generates everything from the last horiz rule down to end of page
echo "
<hr><br><br>
";
if (defined("FOOTER_MESSAGE")) {
$footer_msg=FOOTER_MESSAGE;
echo "
<center>$footer_msg</center><br>
";
}
echo "
<script src=\"jquery-ui/external/jquery/jquery.js\"></script>
<script src=\"jquery-ui/jquery-ui.js\"></script>
<script>
$( \"#singledatepicker\" ).datepicker({
showOn: \"button\",
buttonImage: \"jquery-ui/images/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#startdatepicker\" ).datepicker({
showOn: \"button\",
buttonImage: \"jquery-ui/images/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select start date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#enddatepicker\" ).datepicker({
showOn: \"button\",
buttonImage: \"jquery-ui/images/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select end date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#completedatepicker\" ).datepicker({
showOn: \"button\",
buttonImage: \"jquery-ui/images/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select completed date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#deferdatepicker\" ).datepicker({
showOn: \"button\",
buttonImage: \"jquery-ui/images/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select defer date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
var caldate = document.getElementById(\"caldate\");
var defdate = caldate.textContent;
$( \"#lognotescalendar\" ).datepicker({
inline: true,
altField: \"#targetdate\",
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\",
onSelect: function(){
$(\"#calendar\").submit();
}
}).datepicker(\"setDate\", defdate);
function insertUrlAtCaret(outputAreaId, inputAreaId) {
var rawlinktext=document.getElementById(inputAreaId).value;
var url='<a href=\"' + rawlinktext.replace(/ /g,'\%20') + '\">' + rawlinktext + '</a>';
var txtarea = document.getElementById(outputAreaId);
var scrollPos = txtarea.scrollTop;
var caretPos = txtarea.selectionStart;
var front = (txtarea.value).substring(0, caretPos);
var back = (txtarea.value).substring(txtarea.selectionEnd, txtarea.value.length);
txtarea.value = front + url + back;
caretPos = caretPos + url.length;
txtarea.selectionStart = caretPos;
txtarea.selectionEnd = caretPos;
txtarea.focus();
txtarea.scrollTop = scrollPos;
}
</script>
</body>
</html>
";
} else {
echo "
<br>Invalid option \"$option\" passed to framework(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pagetable($option) {
if ($option=="begin") {
echo "
<br>
<table border=\"0\" width=\"100%\" cellpadding=\"10\">
<tr>
";
} else if ($option=="end") {
echo "
</tr></table>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pagetable(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pageblock($block,$option) {
global $sbcolor;
if ($block=="left") {
if ($option=="begin") {
echo "
<td width=\"210\" bgcolor=\"$sbcolor\" valign=\"top\">
";
} else if ($option=="end") {
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else if ($block=="right") {
if ($option=="begin") {
echo "
<td valign=\"top\">
";
} else if ($option=="end") {
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else {
echo "
<br>Invalid block \"$block\" passed to pageblock(). Valid blocks are \"left\" and \"right\".<br>
";
exit(1);
}
}
function sidemenu($noprint=false) {
// Displays sidebar menu
global $db,$mbgcolor,$noprint;
$doparts=PARTS_FUNCTIONS;
$doschedmaint=SCHEDMAINT_FUNCTIONS;
echo "
<hr><br>
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"lognotes.php\" title=\"Show today's notes\"><b>Logbook</b></a></td></tr>
<tr><td align=\"center\"><a href=\"logentry.php\" title=\"Add new log entry or manage templates\">Add Logbook Entry</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php?target[]=log\">Search Logbook</a></td></tr>
</table>
<hr>
";
if ($doparts) {
echo "
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"maintform.php\"><b>Maintenance Forms</b></a></td></tr>
<tr><td align=\"center\"><a href=\"maintformentry.php\">New Maintenance Form</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php?target[]=maintform\">Search Maintenance Forms</a></td></tr>
</table>
<hr>
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"parts.php\"><b>Parts</b></a></td></tr>
<tr><td align=\"center\"><a href=\"partentry.php\">Add New Part</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php?target[]=part\">Search Parts</a></td></tr>
</table>
<hr>
";
}
if ($doschedmaint) {
echo "
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"schedmaint.php\"><b>Scheduled Maintenance</b></a></td></tr>
</table>
<hr>
";
}
echo "
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"admin.php\" title=\"Control global settings. Must be an administrator.\"><b>Administration</b></a></td></tr>
<tr><td align=\"center\"><a href=\"profile.php\">My Profile</a></td></tr>
</table>
";
if (!isset($_SESSION['login'])) {
echo "
<hr>
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"login.php\"><b>Log In</b></a></td></tr>
</table>
";
} else {
$loginid=$_SESSION['login'];
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select techname from techs where techid=\"$loginid\""))[0];
echo "
<hr>
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\">Logged in as $loggedinas</td></tr><tr><td align=\"center\"><a href=\"login.php?cancel=1\"><b>Log Out</b></a></td></tr>
</table>
";
}
if (!$noprint) {
echo "
<hr>
<center>
<form method=\"post\" target=\"_blank\"><input type=\"submit\" name=\"print\" value=\"Printer Friendly\"></form>
</center>
<hr>
";
}
echo "
<br>
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"about.php\">About</a></td></tr>
</table>
";
}
function banner($print) {
// displays a banner
global $db;
$bannerid=BANNER;
// get banner parameters from banner table
$banrow=mysqli_fetch_assoc(mysqli_query($db,"select * from banners where bannerid=\"$bannerid\""));
if (!$banrow) {
$bannerid=1;
} else {
$bannertext=$banrow["bannername"];
if ($print) {
$bannercolor="#FFFFFF";
$bannertxtcolor="#000000";
} else {
$bannercolor=$banrow["bannercolor"];
$bannertxtcolor=$banrow["textcolor"];
}
}
if ($bannerid != 1) {
echo "
<table width=\"100%\">
<tr bgcolor=\"$bannercolor\" align=\"center\"><td colspan=2><font size=\"+1\" color=\"$bannertxtcolor\"><b>$bannertext</b></font></td></tr></table>
";
}
}
function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
// look up a single field in a database given a value for a single field
$out_data=mysqli_fetch_row(mysqli_query($dbhandle,"select $out_field from $table where $in_field=\"$in_data\""));
return($out_data[0]);
}
function calendar($year,$month,$day,$link_url) {
// takes a numeric year, month, day, and the basic url for the day links as arguments
// Shows a calendar with clickable dates.
// Based on an embeddable calendar by Yves Glodt.
// See http://www.mind.lu/~yg/stuff/
$YearToShow = $year;
$MonthToShow = $month;
$DayToShow = $day;
$NumberOfDays = date(t,mktime(0,0,0,$MonthToShow+1,0,$YearToShow,-1));
if ($month==1) {
$mbackyear=$year-1;
$mbackmonth=12;
} else {
$mbackyear=$year;
$mbackmonth=$month-1;
}
if ($month==12) {
$mfwdyear=$year+1;
$mfwdmonth=1;
} else {
$mfwdyear=$year;
$mfwdmonth=$month+1;
}
$ybackyear=$year-1;
$ybackmonth=$month;
$yfwdyear=$year+1;
$yfwdmonth=$month;
$MonthNames = array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
echo <<<EOT
<table border="1" cellpadding="1" cellspacing="0">
<tr>
<td colspan="7" align="center">
<a href="$link_url?y=$mbackyear&m=$mbackmonth&d=$day"><img src="icons/control-180.png" border="0" title="Prev month" alt="Prev month"></a>
&nbsp;&nbsp;<font size="+1">$MonthNames[$MonthToShow]</font>&nbsp;&nbsp;
<a href="$link_url?y=$mfwdyear&m=$mfwdmonth&d=$day"><img src="icons/control.png" border="0" title="Next month" alt="Next month"></a>
<br>
<a href="$link_url?y=$ybackyear&m=$ybackmonth&d=$day"><img src="icons/control-double-180.png" border="0" title="Prev year" alt="Prev year"></a>
&nbsp;&nbsp;<font size="+1">$YearToShow</font>&nbsp;&nbsp;
<a href="$link_url?y=$yfwdyear&m=$yfwdmonth&d=$day"><img src="icons/control-double.png"border="0" title="Next year" alt="Next year"></a>
</td>
</tr>
<tr align="center">
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
EOT;
$FirstDayOfWeek = date(l,mktime(0,0,0,$MonthToShow,1,$YearToShow));
switch ($FirstDayOfWeek) {
case 'Monday':
$offset = 1;
break;
case 'Tuesday':
$offset = 2;
break;
case 'Wednesday':
$offset = 3;
break;
case 'Thursday':
$offset = 4;
break;
case 'Friday':
$offset = 5;
break;
case 'Saturday':
$offset = 6;
break;
default:
$offset = 0;
}
if ($offset > 0) {
print "<tr align=\"center\">\n";
echo str_repeat("<td class=\"n\">&nbsp;</td>\n",$offset);
}
for ($i=1; $i <= $NumberOfDays; $i++) {
$DayOfWeek = date(l,mktime(0,0,0,$MonthToShow,$i,$YearToShow));
if($DayOfWeek == 'Sunday') {
print "<tr align=\"center\">\n";
}
if ($i != $DayToShow) {
print "<td><a href=\"$link_url?y=$YearToShow&m=$MonthToShow&d=$i\">$i</a></td>\n";
} else {
print "<td><a href=\"$link_url?y=$YearToShow&m=$MonthToShow&d=$i\"><b><font size=\"+1\" color=\"#FF0000\">$i</font></b></a></td>\n";
}
if($DayOfWeek == 'Saturday') {
print "</tr>\n";
}
}
if ( ( ($offset == 5) && ($NumberOfDays > 30) ) || ( ($offset == 6) && ($NumberOfDays > 29) ) ) {
if (42-$NumberOfDays-$offset > 0) {
echo str_repeat("<td class=\"n\">&nbsp;</td>\n",42-$NumberOfDays-$offset);
}
print "</tr>\n";
} elseif ( ($NumberOfDays != 28) || ($offset > 0) ) {
if (35-$NumberOfDays-$offset > 0) {
echo str_repeat("<td class=\"n\">&nbsp;</td>\n",35-$NumberOfDays-$offset);
print "</tr>\n";
}
}
print "</table>\n";
}
function colorpicker($baseurl) {
// takes a standard url and tacks the color number on to the end of it
// giving a palette of links
echo "
<map name=\"palette\">
<area shape=\"rect\" alt=\"#330033\" href=\"$baseurl 330033\" coords=\"171,109,186,121\">
<area shape=\"rect\" alt=\"#330099\" href=\"$baseurl 330099\" coords=\"153,109,168,121\">
<area shape=\"rect\" alt=\"#000066\" href=\"$baseurl 000066\" coords=\"135,109,150,121\">
<area shape=\"rect\" alt=\"#003333\" href=\"$baseurl 003333\" coords=\"117,109,132,121\">
<area shape=\"rect\" alt=\"#003300\" href=\"$baseurl 003300\" coords=\"99,109,114,121\">
<area shape=\"rect\" alt=\"#333300\" href=\"$baseurl 333300\" coords=\"81,109,96,121\">
<area shape=\"rect\" alt=\"#663333\" href=\"$baseurl 663333\" coords=\"63,109,78,121\">
<area shape=\"rect\" alt=\"#663300\" href=\"$baseurl 663300\" coords=\"45,109,60,121\">
<area shape=\"rect\" alt=\"#330000\" href=\"$baseurl 330000\" coords=\"27,109,43,121\">
<area shape=\"rect\" alt=\"#000000\" href=\"$baseurl 000000\" coords=\"9,109,24,121\">
<area shape=\"rect\" alt=\"#663366\" href=\"$baseurl 663366\" coords=\"171,93,186,105\">
<area shape=\"rect\" alt=\"#333399\" href=\"$baseurl 333399\" coords=\"153,93,168,105\">
<area shape=\"rect\" alt=\"#000099\" href=\"$baseurl 000099\" coords=\"135,93,150,105\">
<area shape=\"rect\" alt=\"#336666\" href=\"$baseurl 336666\" coords=\"117,93,132,105\">
<area shape=\"rect\" alt=\"#006600\" href=\"$baseurl 006600\" coords=\"99,93,114,105\">
<area shape=\"rect\" alt=\"#666600\" href=\"$baseurl 666600\" coords=\"81,93,96,105\">
<area shape=\"rect\" alt=\"#996633\" href=\"$baseurl 996633\" coords=\"63,93,78,105\">
<area shape=\"rect\" alt=\"#993300\" href=\"$baseurl 993300\" coords=\"45,93,60,105\">
<area shape=\"rect\" alt=\"#660000\" href=\"$baseurl 660000\" coords=\"27,93,42,105\">
<area shape=\"rect\" alt=\"#333333\" href=\"$baseurl 333333\" coords=\"9,93,24,105\">
<area shape=\"rect\" alt=\"#993399\" href=\"$baseurl 993399\" coords=\"171,77,186,89\">
<area shape=\"rect\" alt=\"#6600CC\" href=\"$baseurl 6600CC\" coords=\"153,77,168,89\">
<area shape=\"rect\" alt=\"#3333FF\" href=\"$baseurl 3333FF\" coords=\"135,77,150,89\">
<area shape=\"rect\" alt=\"#339999\" href=\"$baseurl 339999\" coords=\"117,77,132,89\">
<area shape=\"rect\" alt=\"#009900\" href=\"$baseurl 009900\" coords=\"99,77,114,89\">
<area shape=\"rect\" alt=\"#999900\" href=\"$baseurl 999900\" coords=\"81,77,96,89\">
<area shape=\"rect\" alt=\"#CC9933\" href=\"$baseurl CC9933\" coords=\"63,77,78,89\">
<area shape=\"rect\" alt=\"#CC6600\" href=\"$baseurl CC6600\" coords=\"45,77,60,89\">
<area shape=\"rect\" alt=\"#990000\" href=\"$baseurl 990000\" coords=\"27,77,42,89\">
<area shape=\"rect\" alt=\"#666666\" href=\"$baseurl 666666\" coords=\"9,77,24,89\">
<area shape=\"rect\" alt=\"#CC33CC\" href=\"$baseurl CC33CC\" coords=\"171,61,186,73\">
<area shape=\"rect\" alt=\"#6633FF\" href=\"$baseurl 6633FF\" coords=\"153,61,168,73\">
<area shape=\"rect\" alt=\"#3366FF\" href=\"$baseurl 3366FF\" coords=\"135,61,150,73\">
<area shape=\"rect\" alt=\"#00CCCC\" href=\"$baseurl 00CCCC\" coords=\"117,61,132,73\">
<area shape=\"rect\" alt=\"#33CC00\" href=\"$baseurl 33CC00\" coords=\"99,61,114,73\">
<area shape=\"rect\" alt=\"#FFCC00\" href=\"$baseurl FFCC00\" coords=\"81,61,96,73\">
<area shape=\"rect\" alt=\"#FFCC33\" href=\"$baseurl FFCC33\" coords=\"63,61,78,73\">
<area shape=\"rect\" alt=\"#FF6600\" href=\"$baseurl FF6600\" coords=\"45,61,60,73\">
<area shape=\"rect\" alt=\"#CC0000\" href=\"$baseurl CC0000\" coords=\"27,61,42,73\">
<area shape=\"rect\" alt=\"#999999\" href=\"$baseurl 999999\" coords=\"9,61,24,73\">
<area shape=\"rect\" alt=\"#CC66CC\" href=\"$baseurl CC66CC\" coords=\"171,45,186,57\">
<area shape=\"rect\" alt=\"#6666CC\" href=\"$baseurl 6666CC\" coords=\"153,45,168,57\">
<area shape=\"rect\" alt=\"#33CCFF\" href=\"$baseurl 33CCFF\" coords=\"135,45,150,57\">
<area shape=\"rect\" alt=\"#66CCCC\" href=\"$baseurl 66CCCC\" coords=\"117,45,132,57\">
<area shape=\"rect\" alt=\"#33FF33\" href=\"$baseurl 33FF33\" coords=\"99,45,114,57\">
<area shape=\"rect\" alt=\"#FFFF00\" href=\"$baseurl FFFF00\" coords=\"81,45,96,57\">
<area shape=\"rect\" alt=\"#FFCC66\" href=\"$baseurl FFCC66\" coords=\"63,45,78,57\">
<area shape=\"rect\" alt=\"#FF9900\" href=\"$baseurl FF9900\" coords=\"45,45,60,57\">
<area shape=\"rect\" alt=\"#FF0000\" href=\"$baseurl FF0000\" coords=\"27,45,42,57\">
<area shape=\"rect\" alt=\"#C0C0C0\" href=\"$baseurl C0C0C0\" coords=\"9,45,24,57\">
<area shape=\"rect\" alt=\"#FF99FF\" href=\"$baseurl FF99FF\" coords=\"171,29,186,41\">
<area shape=\"rect\" alt=\"#9999FF\" href=\"$baseurl 9999FF\" coords=\"153,29,168,41\">
<area shape=\"rect\" alt=\"#66FFFF\" href=\"$baseurl 66FFFF\" coords=\"135,29,150,41\">
<area shape=\"rect\" alt=\"#33FFFF\" href=\"$baseurl 33FFFF\" coords=\"117,29,132,41\">
<area shape=\"rect\" alt=\"#66FF99\" href=\"$baseurl 66FF99\" coords=\"99,29,114,41\">
<area shape=\"rect\" alt=\"#FFFF33\" href=\"$baseurl FFFF33\" coords=\"81,29,96,41\">
<area shape=\"rect\" alt=\"#FFFF66\" href=\"$baseurl FFFF66\" coords=\"63,29,78,41\">
<area shape=\"rect\" alt=\"#FF9966\" href=\"$baseurl FF9966\" coords=\"45,29,60,41\">
<area shape=\"rect\" alt=\"#FF6666\" href=\"$baseurl FF6666\" coords=\"27,29,42,41\">
<area shape=\"rect\" alt=\"#CCCCCC\" href=\"$baseurl CCCCCC\" coords=\"9,29,24,41\">
<area shape=\"rect\" alt=\"#FFCCFF\" href=\"$baseurl FFCCFF\" coords=\"171,13,186,25\">
<area shape=\"rect\" alt=\"#CCCCFF\" href=\"$baseurl CCCCFF\" coords=\"153,13,168,25\">
<area shape=\"rect\" alt=\"#CCFFFF\" href=\"$baseurl CCFFFF\" coords=\"135,13,150,25\">
<area shape=\"rect\" alt=\"#99FFFF\" href=\"$baseurl 99FFFF\" coords=\"117,13,132,25\">
<area shape=\"rect\" alt=\"#99FF99\" href=\"$baseurl 99FF99\" coords=\"99,13,114,25\">
<area shape=\"rect\" alt=\"#FFFFCC\" href=\"$baseurl FFFFCC\" coords=\"81,13,96,25\">
<area shape=\"rect\" alt=\"#FFFF99\" href=\"$baseurl FFFF99\" coords=\"63,13,78,25\">
<area shape=\"rect\" alt=\"#FFCC99\" href=\"$baseurl FFCC99\" coords=\"45,13,60,25\">
<area shape=\"rect\" alt=\"#FFCCCC\" href=\"$baseurl FFCCCC\" coords=\"27,13,42,25\">
<area shape=\"rect\" alt=\"#FFFFFF\" href=\"$baseurl FFFFFF\" coords=\"9,13,24,25\">
</map>
<img src=\"images/color-palette_1.png\" border=\"0\" usemap=\"#palette\">
";
}
// Project functions
function getsetting($setting_name,$tech_id) {
// get the value of a setting for a tech
global $db;
$confinfo=mysqli_fetch_assoc(mysqli_query($db,"select confid,confvalue from configs where confname=\"$setting_name\""));
$confid=$confinfo["confid"];
$confvalue=$confinfo["confvalue"];
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
if (mysqli_num_rows($custqry)) {
$custvalue=mysqli_fetch_row($custqry)[0];
}
// if value in custom table, use it
if (mysqli_num_rows($custqry)) {
$retvalue=$custvalue;
$table="customs";
} else {
$retvalue=$confvalue;
$table="configs";
}
$result=array('value' => $retvalue,'table' => $table,'id' => $confid);
return $result;
}
function putsetting($setting_name,$setting_value,$tech_id) {
// set the value of a setting for a tech
global $db;
$confinfo=mysqli_fetch_assoc(mysqli_query($db,"select confid,confvalue from configs where confname=\"$setting_name\""));
$confid=$confinfo["confid"];
$confvalue=$confinfo["confvalue"];
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
if (mysqli_num_rows($custqry)) {
if ($setting_value == $confvalue) {
mysqli_query($db,"delete from customs where customtech=\"$tech_id\" and customconfnum=\"$confid\"");
}
$custvalue=mysqli_fetch_row($custqry)[0];
if ($custvalue != $setting_value) {
mysqli_query($db,"update customs set customconfvalue=\"$setting_value\" where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
}
} else {
mysqli_query($db,"insert into customs(customtech,customconfnum,customconfvalue) values(\"$tech_id\",\"$confid\",\"$setting_value\")");
}
}
function islink($il_note) {
// takes a noteid number as an argument
// determines if the argument is a link in a reference chain
// returns 1 if note is a link, 0 if not
global $db;
$il_pq=mysqli_fetch_row(mysqli_query($db,"select refs from lognotes where lognoteid=\"$il_note\""));
if ($il_pq[0]=="") {
$il_hasprev=0;
} else {
$il_hasprev=1;
}
$il_sq=mysqli_num_rows(mysqli_query($db,"select lognoteid from lognotes where refs like \"%$il_note%\""));
if ($il_sq) {
$il_hassubs=1;
} else {
$il_hassubs=0;
}
if($il_hassubs || $il_hasprev) {
return 1;
} else {
return 0;
}
}
function generate_chain($chainlink) {
// generate a reference chain
// takes a single parameter, a noteid
// finds all notes that are members of a chain containing the supplied noteid
// returns a sorted array of all notes in chain
global $db;
$refsqry=mysqli_query($db,"select lognoteid,refs from lognotes where refs!=\"\"");
$nanote=array();
$narefs=array();
while ($allrefs=mysqli_fetch_row($refsqry)) {
$spltrefs=explode(",",$allrefs[1]);
$iptr=0;
while ($iptr<count($spltrefs)) {
array_push($nanote,$allrefs[0]);
array_push($narefs,$spltrefs[$iptr]);
$iptr=$iptr+1;
}
}
$chainarray=array($chainlink);
$results=array();
$mptr=0;
while($mptr<count($chainarray)) {
$nptr=0;
while($nptr<count($nanote)) {
if(($nanote[$nptr]==$chainarray[$mptr]) && ( ! in_array($narefs[$nptr],$chainarray))) {
array_push($chainarray,$narefs[$nptr]);
}
$nptr=$nptr+1;
}
$rptr=0;
while($rptr<count($narefs)) {
if(($narefs[$rptr]==$chainarray[$mptr]) && ( ! in_array($nanote[$rptr],$chainarray))) {
array_push($chainarray,$nanote[$rptr]);
}
$rptr=$rptr+1;
}
$mptr=$mptr+1;
}
sort($chainarray);
return($chainarray);
}
function convertweblinks($rawstring) {
// takes a string, finds urls, and returns the string with urls converted to clickable links
$urlchunksize=URL_CHUNK_SIZE;
// define regex pattern for urls
$urlpatt="/<weblink\b[^>]*>(.*?)<\/weblink>/";
preg_match_all($urlpatt,$rawstring,$weblinks, PREG_SET_ORDER);
foreach ($weblinks as $urlblock) {
// split up really long url
$spliturl=str_split($urlblock[1],$urlchunksize);
unset($urlstack);
foreach ($spliturl as $urlchunk) {
$urlstack[]="<a href=\"$urlblock[1]\" target=\"_blank\">$urlchunk</a>";
}
$hyperlink=implode("<br>",$urlstack);
$rawstring=str_replace($urlblock[0],$hyperlink,$rawstring);
}
return $rawstring;
}
function showlinklist($print) {
global $db;
$linkresult=mysqli_query($db,"select linkid from links where status=\"1\"");
if (mysqli_num_rows($linkresult) && !$print) {
echo "
<b>Links</b><br>
";
$link=mysqli_query($db,"select displaytxt,urltxt from links where status=\"1\" order by linkpriority asc");
while ($linkrow = mysqli_fetch_row($link)) {
printf("<a href=\"%s\">%s</a><br>",$linkrow[1],$linkrow[0]);
}
}
}
function nag($tech_id) {
// nags the user if something is pending
global $db;
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
// maintenance forms
$mfpending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$tech_id\" and pending=1"));
if ($mfpending) {
echo "<font color=\"#FF0000\">NOTICE</font>: You have one or more maintenance forms to complete. <a href=\"maintform.php\">Click here to complete them</a>.<br><hr>";
}
// scheduled maintenance events
$ucevents=get_upcoming_events();
$due=false;
$overdue=false;
foreach ($ucevents as $event) {
if ($event['duedate'] == $today) $due=true;
if ($event['duedate'] < $today) $overdue=true;
}
if ($due) {
echo "<font color=\"#FF0000\">NOTICE</font>: One or more scheduled maintenance events are due today. <a href=\"schedmaint.php\">Click here to view them</a>.<br><hr>";
}
if ($overdue) {
echo "<font color=\"#FF0000\" size=\"+1\">NOTICE</font>: One or more scheduled maintenance events are <font color=\"#FF0000\">OVERDUE</font>. <a href=\"schedmaint.php\">Click here to view them</a>.<br><hr>";
}
}
function get_part_data($partinputdata) {
// given an associative array of partid, uid, partnum, sernum,
// return an associative array of
// partid, uid, partnum, sernum, partname, result
// where result=0 for success, 1 for no data found, 2 for mismatch
global $db;
// pull input data from input array
if ($partinputdata['partid'] && $partinputdata['partid'] != "") $partid= $partinputdata['partid'];
if ($partinputdata['uid'] && $partinputdata['uid'] != "") $uid= $partinputdata['uid'];
if ($partinputdata['partnum'] && $partinputdata['partnum'] != "") $partnum= $partinputdata['partnum'];
if ($partinputdata['sernum'] && $partinputdata['sernum'] != "") $sernum= $partinputdata['sernum'];
// for part data supplied, see what info is available
// if a partid is supplied, pull other info from parts
if ($partid) { // if partid supplied
$partqry=mysqli_query($db,"select * from parts where partid=\"$partid\"");
} else if ($uid && (!$partnum && !$sernum)) { // if uid only supplied
$partqry=mysqli_query($db,"select * from parts where uid like \"$uid\"");
} else if (($partnum && $sernum) && !$uid) { // if pn/sn only supplied
$partqry=mysqli_query($db,"select * from parts where partnum=\"$partnum\" and sernum=\"$sernum\"");
} else if ($uid && $partnum && $sernum ) { //if uid and pn/sn supplied
$partqry=mysqli_query($db,"select * from parts where uid like \"$uid\" and partnum=\"$partnum\" and sernum=\"$sernum\"");
$checkmm=1;
$mismatchqry=mysqli_query($db,"select * from parts where
(uid like \"$uid\" and ((partnum !=\"$partnum\" and partnum !=\"\")or (sernum !=\"$sernum\" and sernum !=\"\"))) or
((uid not like \"$uid\" and uid not like \"\") and (partnum =\"$partnum\" and sernum =\"$sernum\"))
");
} else if ($uid && $partnum && ! $sernum ) { //if uid and pn only supplied
$partqry=mysqli_query($db,"select * from parts where uid like \"$uid\" and partnum=\"$partnum\"");
$checkmm=1;
$mismatchqry=mysqli_query($db,"select partid from parts where
(uid like \"$uid\" and partnum !=\"$partnum\") or
(uid not like \"$uid\" and partnum =\"$partnum\")
");
} else if ($uid && ! $partnum && $sernum ) { //if uid and sn only supplied
$partqry=mysqli_query($db,"select * from parts where uid like \"$uid\" and sernum=\"$sernum\"");
$checkmm=1;
$mismatchqry=mysqli_query($db,"select partid from parts where
(uid like \"$uid\" and sernum !=\"$sernum\") or
(uid not like \"$uid\" and sernum =\"$sernum\")
");
} else {
// not enough input data supplied, so return result of 1
$result=1;
}
if (! $result) {
if (mysqli_num_rows($partqry)) {
$partdata=mysqli_fetch_assoc($partqry);
} else {
$result=1;
}
}
// detect mismatched input data
if ($checkmm) {
if (mysqli_num_rows($mismatchqry)) {
$result=2;
//while ($mmdata=mysqli_fetch_assoc($mismatchqry)) {
//var_dump($mmdata);
//}
}
}
if ($result) {
$partdata=array();
$partdata['result']=$result;
} else {
$partdata['result']=0;
}
return $partdata;
}
function get_upcoming_events() {
// build array of upcoming events
// takes no arguments
// returns an array containing arrays of upcoming event data
global $db;
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$uceventsqry=mysqli_query($db,"select * from events where active_flag=\"1\" and (deferred_flag=\"0\" or (deferred_flag=\"1\" and deferred_date <= \"$today\"))");
$ucevents=array();
while ($uceventrow=mysqli_fetch_assoc($uceventsqry)) {
// provide eventid,task,device,start_date,last_date,deferred_flag,deferred_date,active_flag
extract($uceventrow,EXTR_PREFIX_ALL,"eventdata");
// provide deviceid,devicename,devicedesc,group_flag,active_flag
$devicedata=mysqli_fetch_assoc(mysqli_query($db,"select * from devices where deviceid=\"$eventdata_device\""));
extract($devicedata,EXTR_PREFIX_ALL,"devicedata");
// provide taskid,taskname,taskdesc,frequency,period,weekdays_only,nextdue_relative,refdoc_name,refdoc_url,active_flag
$taskdata=mysqli_fetch_assoc(mysqli_query($db,"select * from tasks where taskid=\"$eventdata_task\""));
extract($taskdata,EXTR_PREFIX_ALL,"taskdata");
if ( ! ($taskdata_period == "once" && $eventdata_last_date >= $eventdata_start_date)) { // ignore completed one-time events
$start=date_create($eventdata_start_date); // create start date object
if ($eventdata_last_date=="0000-00-00") { // event has never been done. last date object will be start date object
$lastdatestrg="never";
$last=$start;
} else { // create last date object
$lastdatestrg="$eventdata_last_date";
$last=date_create($eventdata_last_date);
}
if ($taskdata_period=="once") { // nextdue object will be start date object
$nextdue=$start;
} else { // determine nextdue object from last date object (relative) or interval from start date object (absolute)
if ($lastdatestrg=="never") { // event has been scheduled to start today but has not been completed
$nextdue=$start;
} else if ($last==$start) { // event was completed for the first time on the start date
$nextdue=$start;
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
} else {
if ($taskdata_nextdue_relative) { // calculate from day of last done date
$nextdue=$last;
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
} else { // calculate from day of start date
$nextdue=$start;
$testdate=date_create("1970-01-01");
while ($testdate <= $last) {
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
$testdate=$nextdue;
}
}
}
}
if ($taskdata_weekdays_only) { // move forward off the weekend if required
$nextduedow=date("w",date_timestamp_get($nextdue));
if ($nextduedow==0) { // due on a Sunday
date_add($nextdue, date_interval_create_from_date_string("1 days"));
}
if ($nextduedow==6) { // due on a Saturday
date_add($nextdue, date_interval_create_from_date_string("2 days"));
}
}
$duedate=date_format($nextdue, 'Y-m-d');
$daysaway=date_diff(date_create($today),$nextdue)->format('%a');
$direction=date_diff(date_create($today),$nextdue)->format('%R');
if ($direction=="+") {
if ($daysaway == 0) {
$duedatestrg="<font color=\"#FF0000\"> $duedate </font>";
} else if ($daysaway < 4) {
$duedatestrg="<font color=\"#FFFF00\"> $duedate </font>";
} else {
$duedatestrg="<font color=\"#00FF00\"> $duedate </font>";
}
} else {
$duedatestrg="<font size=\"+1\" color=\"#FF0000\"><b> $duedate </b></font><img src=\"icons/exclamation-red.png\" border=\"0\">";
}
$uceventline=array(
'eventdata_eventid'=>$eventdata_eventid,
'duedate'=>$duedate,
'duedatestrg'=>$duedatestrg,
'devicedata_devicedesc'=>$devicedata_devicedesc,
'devicedata_devicename'=>$devicedata_devicename,
'taskdata_taskdesc'=>$taskdata_taskdesc,
'taskdata_taskname'=>$taskdata_taskname,
'lastdatestrg'=>$lastdatestrg
);
$ucevents[]=$uceventline;
}
}
return $ucevents;
}
function format_message($msgtype,$msgtxt) {
// displays a formatted message
// $msgtype is 0 for success or anything else for failure
// $msgtxt is the string to display
if ($msgtype == 0) {
$state="ui-state-highlight";
$icon="ui-icon-info";
} else {
$state="ui-state-error";
$icon="ui-icon-alert";
}
if ($msgtxt == "") $msgtxt="PROGRAM ERROR: No message text was supplied.";
echo "
<div class=\"$state ui-corner-all\" style=\"margin-top: 20px; padding: 0 .7em;\">
<p><span class=\"ui-icon $icon\" style=\"float: left; margin-right: .3em;\"></span>
$msgtxt</p>
</div><br><br>
";
}
?>

384
distfiles/gpl.php Normal file
View File

@@ -0,0 +1,384 @@
<?php
/*
gpl.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$print=$_REQUEST['print'];
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","OpenLog License","OpenLog License",$print);
pagetable("begin");
if(!$print){
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
echo "
<pre>
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
</pre>
";
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

BIN
distfiles/icons/control.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

BIN
distfiles/icons/cross.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

BIN
distfiles/icons/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
distfiles/icons/tick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
distfiles/images/linux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -0,0 +1,513 @@
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<title>jQuery UI Example Page</title>
<link href="jquery-ui.css" rel="stylesheet">
<style>
body{
font: 62.5% "Trebuchet MS", sans-serif;
margin: 50px;
}
.demoHeaders {
margin-top: 2em;
}
#dialog-link {
padding: .4em 1em .4em 20px;
text-decoration: none;
position: relative;
}
#dialog-link span.ui-icon {
margin: 0 5px 0 0;
position: absolute;
left: .2em;
top: 50%;
margin-top: -8px;
}
#icons {
margin: 0;
padding: 0;
}
#icons li {
margin: 2px;
position: relative;
padding: 4px 0;
cursor: pointer;
float: left;
list-style: none;
}
#icons span.ui-icon {
float: left;
margin: 0 4px;
}
.fakewindowcontain .ui-widget-overlay {
position: absolute;
}
select {
width: 200px;
}
</style>
</head>
<body>
<h1>Welcome to jQuery UI!</h1>
<div class="ui-widget">
<p>This page demonstrates the widgets and theme you selected in Download Builder. Please make sure you are using them with a compatible jQuery version.</p>
</div>
<h1>YOUR COMPONENTS:</h1>
<!-- Accordion -->
<h2 class="demoHeaders">Accordion</h2>
<div id="accordion">
<h3>First</h3>
<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
<h3>Second</h3>
<div>Phasellus mattis tincidunt nibh.</div>
<h3>Third</h3>
<div>Nam dui erat, auctor a, dignissim quis.</div>
</div>
<!-- Autocomplete -->
<h2 class="demoHeaders">Autocomplete</h2>
<div>
<input id="autocomplete" title="type &quot;a&quot;">
</div>
<!-- Button -->
<h2 class="demoHeaders">Button</h2>
<button id="button">A button element</button>
<form style="margin-top: 1em;">
<div id="radioset">
<input type="radio" id="radio1" name="radio"><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked"><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio"><label for="radio3">Choice 3</label>
</div>
</form>
<!-- Tabs -->
<h2 class="demoHeaders">Tabs</h2>
<div id="tabs">
<ul>
<li><a href="#tabs-1">First</a></li>
<li><a href="#tabs-2">Second</a></li>
<li><a href="#tabs-3">Third</a></li>
</ul>
<div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
<div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div>
<div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div>
</div>
<!-- Dialog NOTE: Dialog is not generated by UI in this demo so it can be visually styled in themeroller-->
<h2 class="demoHeaders">Dialog</h2>
<p><a href="#" id="dialog-link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Open Dialog</a></p>
<h2 class="demoHeaders">Overlay and Shadow Classes <em>(not currently used in UI widgets)</em></h2>
<div style="position: relative; width: 96%; height: 200px; padding:1% 2%; overflow:hidden;" class="fakewindowcontain">
<p>Lorem ipsum dolor sit amet, Nulla nec tortor. Donec id elit quis purus consectetur consequat. </p><p>Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. </p><p>Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. </p><p>Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. </p><p>Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. </p><p>Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. </p>
<!-- ui-dialog -->
<div class="ui-overlay"><div class="ui-widget-overlay"></div><div class="ui-widget-shadow ui-corner-all" style="width: 302px; height: 152px; position: absolute; left: 50px; top: 30px;"></div></div>
<div style="position: absolute; width: 280px; height: 130px;left: 50px; top: 30px; padding: 10px;" class="ui-widget ui-widget-content ui-corner-all">
<div class="ui-dialog-content ui-widget-content" style="background: none; border: 0;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
</div>
<!-- ui-dialog -->
<div id="dialog" title="Dialog Title">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<h2 class="demoHeaders">Framework Icons (content color preview)</h2>
<ul id="icons" class="ui-widget ui-helper-clearfix">
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-n"><span class="ui-icon ui-icon-carat-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-ne"><span class="ui-icon ui-icon-carat-1-ne"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-e"><span class="ui-icon ui-icon-carat-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-se"><span class="ui-icon ui-icon-carat-1-se"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-s"><span class="ui-icon ui-icon-carat-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-sw"><span class="ui-icon ui-icon-carat-1-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-w"><span class="ui-icon ui-icon-carat-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-nw"><span class="ui-icon ui-icon-carat-1-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-2-n-s"><span class="ui-icon ui-icon-carat-2-n-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-carat-2-e-w"><span class="ui-icon ui-icon-carat-2-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-n"><span class="ui-icon ui-icon-triangle-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-ne"><span class="ui-icon ui-icon-triangle-1-ne"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-e"><span class="ui-icon ui-icon-triangle-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-se"><span class="ui-icon ui-icon-triangle-1-se"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-s"><span class="ui-icon ui-icon-triangle-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-sw"><span class="ui-icon ui-icon-triangle-1-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-w"><span class="ui-icon ui-icon-triangle-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-nw"><span class="ui-icon ui-icon-triangle-1-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-2-n-s"><span class="ui-icon ui-icon-triangle-2-n-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-2-e-w"><span class="ui-icon ui-icon-triangle-2-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-n"><span class="ui-icon ui-icon-arrow-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-ne"><span class="ui-icon ui-icon-arrow-1-ne"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-e"><span class="ui-icon ui-icon-arrow-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-se"><span class="ui-icon ui-icon-arrow-1-se"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-s"><span class="ui-icon ui-icon-arrow-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-sw"><span class="ui-icon ui-icon-arrow-1-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-w"><span class="ui-icon ui-icon-arrow-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-nw"><span class="ui-icon ui-icon-arrow-1-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-n-s"><span class="ui-icon ui-icon-arrow-2-n-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-ne-sw"><span class="ui-icon ui-icon-arrow-2-ne-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-e-w"><span class="ui-icon ui-icon-arrow-2-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-se-nw"><span class="ui-icon ui-icon-arrow-2-se-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-n"><span class="ui-icon ui-icon-arrowstop-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-e"><span class="ui-icon ui-icon-arrowstop-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-s"><span class="ui-icon ui-icon-arrowstop-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-w"><span class="ui-icon ui-icon-arrowstop-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-n"><span class="ui-icon ui-icon-arrowthick-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-ne"><span class="ui-icon ui-icon-arrowthick-1-ne"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-e"><span class="ui-icon ui-icon-arrowthick-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-se"><span class="ui-icon ui-icon-arrowthick-1-se"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-s"><span class="ui-icon ui-icon-arrowthick-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-sw"><span class="ui-icon ui-icon-arrowthick-1-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-w"><span class="ui-icon ui-icon-arrowthick-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-nw"><span class="ui-icon ui-icon-arrowthick-1-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-n-s"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-ne-sw"><span class="ui-icon ui-icon-arrowthick-2-ne-sw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-e-w"><span class="ui-icon ui-icon-arrowthick-2-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-se-nw"><span class="ui-icon ui-icon-arrowthick-2-se-nw"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-n"><span class="ui-icon ui-icon-arrowthickstop-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-e"><span class="ui-icon ui-icon-arrowthickstop-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-s"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-w"><span class="ui-icon ui-icon-arrowthickstop-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-w"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-n"><span class="ui-icon ui-icon-arrowreturnthick-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-e"><span class="ui-icon ui-icon-arrowreturnthick-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-s"><span class="ui-icon ui-icon-arrowreturnthick-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-w"><span class="ui-icon ui-icon-arrowreturn-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-n"><span class="ui-icon ui-icon-arrowreturn-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-e"><span class="ui-icon ui-icon-arrowreturn-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-s"><span class="ui-icon ui-icon-arrowreturn-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-w"><span class="ui-icon ui-icon-arrowrefresh-1-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-n"><span class="ui-icon ui-icon-arrowrefresh-1-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-e"><span class="ui-icon ui-icon-arrowrefresh-1-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-s"><span class="ui-icon ui-icon-arrowrefresh-1-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-4"><span class="ui-icon ui-icon-arrow-4"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-4-diag"><span class="ui-icon ui-icon-arrow-4-diag"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-extlink"><span class="ui-icon ui-icon-extlink"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-newwin"><span class="ui-icon ui-icon-newwin"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-refresh"><span class="ui-icon ui-icon-refresh"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-shuffle"><span class="ui-icon ui-icon-shuffle"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-transfer-e-w"><span class="ui-icon ui-icon-transfer-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-transferthick-e-w"><span class="ui-icon ui-icon-transferthick-e-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-folder-collapsed"><span class="ui-icon ui-icon-folder-collapsed"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-folder-open"><span class="ui-icon ui-icon-folder-open"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-document"><span class="ui-icon ui-icon-document"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-document-b"><span class="ui-icon ui-icon-document-b"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-note"><span class="ui-icon ui-icon-note"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-mail-closed"><span class="ui-icon ui-icon-mail-closed"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-mail-open"><span class="ui-icon ui-icon-mail-open"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-suitcase"><span class="ui-icon ui-icon-suitcase"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-comment"><span class="ui-icon ui-icon-comment"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-person"><span class="ui-icon ui-icon-person"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-print"><span class="ui-icon ui-icon-print"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-trash"><span class="ui-icon ui-icon-trash"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-locked"><span class="ui-icon ui-icon-locked"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-unlocked"><span class="ui-icon ui-icon-unlocked"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-bookmark"><span class="ui-icon ui-icon-bookmark"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-tag"><span class="ui-icon ui-icon-tag"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-home"><span class="ui-icon ui-icon-home"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-flag"><span class="ui-icon ui-icon-flag"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-calculator"><span class="ui-icon ui-icon-calculator"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-cart"><span class="ui-icon ui-icon-cart"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-pencil"><span class="ui-icon ui-icon-pencil"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-clock"><span class="ui-icon ui-icon-clock"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-disk"><span class="ui-icon ui-icon-disk"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-calendar"><span class="ui-icon ui-icon-calendar"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-zoomin"><span class="ui-icon ui-icon-zoomin"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-zoomout"><span class="ui-icon ui-icon-zoomout"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-search"><span class="ui-icon ui-icon-search"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-wrench"><span class="ui-icon ui-icon-wrench"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-gear"><span class="ui-icon ui-icon-gear"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-heart"><span class="ui-icon ui-icon-heart"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-star"><span class="ui-icon ui-icon-star"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-link"><span class="ui-icon ui-icon-link"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-cancel"><span class="ui-icon ui-icon-cancel"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-plus"><span class="ui-icon ui-icon-plus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-plusthick"><span class="ui-icon ui-icon-plusthick"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-minus"><span class="ui-icon ui-icon-minus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-minusthick"><span class="ui-icon ui-icon-minusthick"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-close"><span class="ui-icon ui-icon-close"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-closethick"><span class="ui-icon ui-icon-closethick"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-key"><span class="ui-icon ui-icon-key"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-lightbulb"><span class="ui-icon ui-icon-lightbulb"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-scissors"><span class="ui-icon ui-icon-scissors"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-clipboard"><span class="ui-icon ui-icon-clipboard"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-copy"><span class="ui-icon ui-icon-copy"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-contact"><span class="ui-icon ui-icon-contact"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-image"><span class="ui-icon ui-icon-image"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-video"><span class="ui-icon ui-icon-video"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-script"><span class="ui-icon ui-icon-script"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-alert"><span class="ui-icon ui-icon-alert"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-info"><span class="ui-icon ui-icon-info"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-notice"><span class="ui-icon ui-icon-notice"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-help"><span class="ui-icon ui-icon-help"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-check"><span class="ui-icon ui-icon-check"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-bullet"><span class="ui-icon ui-icon-bullet"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-radio-off"><span class="ui-icon ui-icon-radio-off"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-radio-on"><span class="ui-icon ui-icon-radio-on"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-pin-w"><span class="ui-icon ui-icon-pin-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-pin-s"><span class="ui-icon ui-icon-pin-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-play"><span class="ui-icon ui-icon-play"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-pause"><span class="ui-icon ui-icon-pause"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-seek-next"><span class="ui-icon ui-icon-seek-next"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-seek-prev"><span class="ui-icon ui-icon-seek-prev"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-seek-end"><span class="ui-icon ui-icon-seek-end"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-seek-first"><span class="ui-icon ui-icon-seek-first"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-stop"><span class="ui-icon ui-icon-stop"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-eject"><span class="ui-icon ui-icon-eject"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-volume-off"><span class="ui-icon ui-icon-volume-off"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-volume-on"><span class="ui-icon ui-icon-volume-on"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-power"><span class="ui-icon ui-icon-power"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-signal-diag"><span class="ui-icon ui-icon-signal-diag"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-signal"><span class="ui-icon ui-icon-signal"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-battery-0"><span class="ui-icon ui-icon-battery-0"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-battery-1"><span class="ui-icon ui-icon-battery-1"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-battery-2"><span class="ui-icon ui-icon-battery-2"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-battery-3"><span class="ui-icon ui-icon-battery-3"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-plus"><span class="ui-icon ui-icon-circle-plus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-minus"><span class="ui-icon ui-icon-circle-minus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-close"><span class="ui-icon ui-icon-circle-close"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-e"><span class="ui-icon ui-icon-circle-triangle-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-s"><span class="ui-icon ui-icon-circle-triangle-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-w"><span class="ui-icon ui-icon-circle-triangle-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-n"><span class="ui-icon ui-icon-circle-triangle-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-e"><span class="ui-icon ui-icon-circle-arrow-e"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-s"><span class="ui-icon ui-icon-circle-arrow-s"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-w"><span class="ui-icon ui-icon-circle-arrow-w"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-n"><span class="ui-icon ui-icon-circle-arrow-n"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-zoomin"><span class="ui-icon ui-icon-circle-zoomin"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-zoomout"><span class="ui-icon ui-icon-circle-zoomout"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-check"><span class="ui-icon ui-icon-circle-check"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-plus"><span class="ui-icon ui-icon-circlesmall-plus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-minus"><span class="ui-icon ui-icon-circlesmall-minus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-close"><span class="ui-icon ui-icon-circlesmall-close"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-plus"><span class="ui-icon ui-icon-squaresmall-plus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-minus"><span class="ui-icon ui-icon-squaresmall-minus"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-close"><span class="ui-icon ui-icon-squaresmall-close"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-dotted-vertical"><span class="ui-icon ui-icon-grip-dotted-vertical"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-dotted-horizontal"><span class="ui-icon ui-icon-grip-dotted-horizontal"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-solid-vertical"><span class="ui-icon ui-icon-grip-solid-vertical"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-solid-horizontal"><span class="ui-icon ui-icon-grip-solid-horizontal"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-gripsmall-diagonal-se"><span class="ui-icon ui-icon-gripsmall-diagonal-se"></span></li>
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-diagonal-se"><span class="ui-icon ui-icon-grip-diagonal-se"></span></li>
</ul>
<!-- Slider -->
<h2 class="demoHeaders">Slider</h2>
<div id="slider"></div>
<!-- Datepicker -->
<h2 class="demoHeaders">Datepicker</h2>
<div id="datepicker"></div>
<!-- Progressbar -->
<h2 class="demoHeaders">Progressbar</h2>
<div id="progressbar"></div>
<!-- Progressbar -->
<h2 class="demoHeaders">Selectmenu</h2>
<select id="selectmenu">
<option>Slower</option>
<option>Slow</option>
<option selected="selected">Medium</option>
<option>Fast</option>
<option>Faster</option>
</select>
<!-- Spinner -->
<h2 class="demoHeaders">Spinner</h2>
<input id="spinner">
<!-- Menu -->
<h2 class="demoHeaders">Menu</h2>
<ul style="width:100px;" id="menu">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3
<ul>
<li>Item 3-1</li>
<li>Item 3-2</li>
<li>Item 3-3</li>
<li>Item 3-4</li>
<li>Item 3-5</li>
</ul>
</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
<!-- Tooltip -->
<h2 class="demoHeaders">Tooltip</h2>
<p id="tooltip">
<a href="#" title="That&apos;s what this widget is">Tooltips</a> can be attached to any element. When you hover
the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
</p>
<!-- Highlight / Error -->
<h2 class="demoHeaders">Highlight / Error</h2>
<div class="ui-widget">
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Hey!</strong> Sample ui-state-highlight style.</p>
</div>
</div>
<br>
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> Sample ui-state-error style.</p>
</div>
</div>
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script>
$( "#accordion" ).accordion();
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#autocomplete" ).autocomplete({
source: availableTags
});
$( "#button" ).button();
$( "#radioset" ).buttonset();
$( "#tabs" ).tabs();
$( "#dialog" ).dialog({
autoOpen: false,
width: 400,
buttons: [
{
text: "Ok",
click: function() {
$( this ).dialog( "close" );
}
},
{
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
// Link to open the dialog
$( "#dialog-link" ).click(function( event ) {
$( "#dialog" ).dialog( "open" );
event.preventDefault();
});
$( "#datepicker" ).datepicker({
inline: true
});
$( "#slider" ).slider({
range: true,
values: [ 17, 67 ]
});
$( "#progressbar" ).progressbar({
value: 20
});
$( "#spinner" ).spinner();
$( "#menu" ).menu();
$( "#tooltip" ).tooltip();
$( "#selectmenu" ).selectmenu();
// Hover states on the static widgets
$( "#dialog-link, #icons li" ).hover(
function() {
$( this ).addClass( "ui-state-hover" );
},
function() {
$( this ).removeClass( "ui-state-hover" );
}
);
</script>
</body>
</html>

1225
distfiles/jquery-ui-1.11.4/jquery-ui.css vendored Normal file

File diff suppressed because it is too large Load Diff

16617
distfiles/jquery-ui-1.11.4/jquery-ui.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,833 @@
/*!
* jQuery UI CSS Framework 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/theming/
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
display: none;
}
.ui-helper-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.ui-helper-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
line-height: 1.3;
text-decoration: none;
font-size: 100%;
list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
border-collapse: collapse;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-clearfix {
min-height: 0; /* support: IE7 */
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0); /* support: IE8 */
}
.ui-front {
z-index: 100;
}
/* Interaction Cues
----------------------------------*/
.ui-state-disabled {
cursor: default !important;
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
display: block;
text-indent: -99999px;
overflow: hidden;
background-repeat: no-repeat;
}
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-draggable-handle {
-ms-touch-action: none;
touch-action: none;
}
.ui-resizable {
position: relative;
}
.ui-resizable-handle {
position: absolute;
font-size: 0.1px;
display: block;
-ms-touch-action: none;
touch-action: none;
}
.ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-autohide .ui-resizable-handle {
display: none;
}
.ui-resizable-n {
cursor: n-resize;
height: 7px;
width: 100%;
top: -5px;
left: 0;
}
.ui-resizable-s {
cursor: s-resize;
height: 7px;
width: 100%;
bottom: -5px;
left: 0;
}
.ui-resizable-e {
cursor: e-resize;
width: 7px;
right: -5px;
top: 0;
height: 100%;
}
.ui-resizable-w {
cursor: w-resize;
width: 7px;
left: -5px;
top: 0;
height: 100%;
}
.ui-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
}
.ui-resizable-sw {
cursor: sw-resize;
width: 9px;
height: 9px;
left: -5px;
bottom: -5px;
}
.ui-resizable-nw {
cursor: nw-resize;
width: 9px;
height: 9px;
left: -5px;
top: -5px;
}
.ui-resizable-ne {
cursor: ne-resize;
width: 9px;
height: 9px;
right: -5px;
top: -5px;
}
.ui-selectable {
-ms-touch-action: none;
touch-action: none;
}
.ui-selectable-helper {
position: absolute;
z-index: 100;
border: 1px dotted black;
}
.ui-sortable-handle {
-ms-touch-action: none;
touch-action: none;
}
.ui-accordion .ui-accordion-header {
display: block;
cursor: pointer;
position: relative;
margin: 2px 0 0 0;
padding: .5em .5em .5em .7em;
min-height: 0; /* support: IE7 */
font-size: 100%;
}
.ui-accordion .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-icons .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
position: absolute;
left: .5em;
top: 50%;
margin-top: -8px;
}
.ui-accordion .ui-accordion-content {
padding: 1em 2.2em;
border-top: 0;
overflow: auto;
}
.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
}
.ui-button {
display: inline-block;
position: relative;
padding: 0;
line-height: normal;
margin-right: .1em;
cursor: pointer;
vertical-align: middle;
text-align: center;
overflow: visible; /* removes extra width in IE */
}
.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
text-decoration: none;
}
/* to make room for the icon, a width needs to be set here */
.ui-button-icon-only {
width: 2.2em;
}
/* button elements seem to need a little more width */
button.ui-button-icon-only {
width: 2.4em;
}
.ui-button-icons-only {
width: 3.4em;
}
button.ui-button-icons-only {
width: 3.7em;
}
/* button text element */
.ui-button .ui-button-text {
display: block;
line-height: normal;
}
.ui-button-text-only .ui-button-text {
padding: .4em 1em;
}
.ui-button-icon-only .ui-button-text,
.ui-button-icons-only .ui-button-text {
padding: .4em;
text-indent: -9999999px;
}
.ui-button-text-icon-primary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 1em .4em 2.1em;
}
.ui-button-text-icon-secondary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 2.1em .4em 1em;
}
.ui-button-text-icons .ui-button-text {
padding-left: 2.1em;
padding-right: 2.1em;
}
/* no icon support for input elements, provide padding by default */
input.ui-button {
padding: .4em 1em;
}
/* button icon element(s) */
.ui-button-icon-only .ui-icon,
.ui-button-text-icon-primary .ui-icon,
.ui-button-text-icon-secondary .ui-icon,
.ui-button-text-icons .ui-icon,
.ui-button-icons-only .ui-icon {
position: absolute;
top: 50%;
margin-top: -8px;
}
.ui-button-icon-only .ui-icon {
left: 50%;
margin-left: -8px;
}
.ui-button-text-icon-primary .ui-button-icon-primary,
.ui-button-text-icons .ui-button-icon-primary,
.ui-button-icons-only .ui-button-icon-primary {
left: .5em;
}
.ui-button-text-icon-secondary .ui-button-icon-secondary,
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
right: .5em;
}
/* button sets */
.ui-buttonset {
margin-right: 7px;
}
.ui-buttonset .ui-button {
margin-left: 0;
margin-right: -.3em;
}
/* workarounds */
/* reset extra padding in Firefox, see h5bp.com/l */
input.ui-button::-moz-focus-inner,
button.ui-button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ui-datepicker {
width: 17em;
padding: .2em .2em 0;
display: none;
}
.ui-datepicker .ui-datepicker-header {
position: relative;
padding: .2em 0;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
position: absolute;
top: 2px;
width: 1.8em;
height: 1.8em;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
top: 1px;
}
.ui-datepicker .ui-datepicker-prev {
left: 2px;
}
.ui-datepicker .ui-datepicker-next {
right: 2px;
}
.ui-datepicker .ui-datepicker-prev-hover {
left: 1px;
}
.ui-datepicker .ui-datepicker-next-hover {
right: 1px;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
display: block;
position: absolute;
left: 50%;
margin-left: -8px;
top: 50%;
margin-top: -8px;
}
.ui-datepicker .ui-datepicker-title {
margin: 0 2.3em;
line-height: 1.8em;
text-align: center;
}
.ui-datepicker .ui-datepicker-title select {
font-size: 1em;
margin: 1px 0;
}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
width: 45%;
}
.ui-datepicker table {
width: 100%;
font-size: .9em;
border-collapse: collapse;
margin: 0 0 .4em;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
}
.ui-datepicker td {
border: 0;
padding: 1px;
}
.ui-datepicker td span,
.ui-datepicker td a {
display: block;
padding: .2em;
text-align: right;
text-decoration: none;
}
.ui-datepicker .ui-datepicker-buttonpane {
background-image: none;
margin: .7em 0 0 0;
padding: 0 .2em;
border-left: 0;
border-right: 0;
border-bottom: 0;
}
.ui-datepicker .ui-datepicker-buttonpane button {
float: right;
margin: .5em .2em .4em;
cursor: pointer;
padding: .2em .6em .3em .6em;
width: auto;
overflow: visible;
}
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
float: left;
}
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi {
width: auto;
}
.ui-datepicker-multi .ui-datepicker-group {
float: left;
}
.ui-datepicker-multi .ui-datepicker-group table {
width: 95%;
margin: 0 auto .4em;
}
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 50%;
}
.ui-datepicker-multi-3 .ui-datepicker-group {
width: 33.3%;
}
.ui-datepicker-multi-4 .ui-datepicker-group {
width: 25%;
}
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-buttonpane {
clear: left;
}
.ui-datepicker-row-break {
clear: both;
width: 100%;
font-size: 0;
}
/* RTL support */
.ui-datepicker-rtl {
direction: rtl;
}
.ui-datepicker-rtl .ui-datepicker-prev {
right: 2px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next {
left: 2px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-prev:hover {
right: 1px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next:hover {
left: 1px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane {
clear: right;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
float: left;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
.ui-datepicker-rtl .ui-datepicker-group {
float: right;
}
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}
.ui-dialog {
overflow: hidden;
position: absolute;
top: 0;
left: 0;
padding: .2em;
outline: 0;
}
.ui-dialog .ui-dialog-titlebar {
padding: .4em 1em;
position: relative;
}
.ui-dialog .ui-dialog-title {
float: left;
margin: .1em 0;
white-space: nowrap;
width: 90%;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-dialog .ui-dialog-titlebar-close {
position: absolute;
right: .3em;
top: 50%;
width: 20px;
margin: -10px 0 0 0;
padding: 1px;
height: 20px;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
}
.ui-dialog .ui-dialog-buttonpane {
text-align: left;
border-width: 1px 0 0 0;
background-image: none;
margin-top: .5em;
padding: .3em 1em .5em .4em;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: .5em .4em .5em 0;
cursor: pointer;
}
.ui-dialog .ui-resizable-se {
width: 12px;
height: 12px;
right: -5px;
bottom: -5px;
background-position: 16px 16px;
}
.ui-draggable .ui-dialog-titlebar {
cursor: move;
}
.ui-menu {
list-style: none;
padding: 0;
margin: 0;
display: block;
outline: none;
}
.ui-menu .ui-menu {
position: absolute;
}
.ui-menu .ui-menu-item {
position: relative;
margin: 0;
padding: 3px 1em 3px .4em;
cursor: pointer;
min-height: 0; /* support: IE7 */
/* support: IE10, see #8844 */
list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
}
.ui-menu .ui-menu-divider {
margin: 5px 0;
height: 0;
font-size: 0;
line-height: 0;
border-width: 1px 0 0 0;
}
.ui-menu .ui-state-focus,
.ui-menu .ui-state-active {
margin: -1px;
}
/* icon support */
.ui-menu-icons {
position: relative;
}
.ui-menu-icons .ui-menu-item {
padding-left: 2em;
}
/* left-aligned */
.ui-menu .ui-icon {
position: absolute;
top: 0;
bottom: 0;
left: .2em;
margin: auto 0;
}
/* right-aligned */
.ui-menu .ui-menu-icon {
left: auto;
right: 0;
}
.ui-progressbar {
height: 2em;
text-align: left;
overflow: hidden;
}
.ui-progressbar .ui-progressbar-value {
margin: -1px;
height: 100%;
}
.ui-progressbar .ui-progressbar-overlay {
background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
height: 100%;
filter: alpha(opacity=25); /* support: IE8 */
opacity: 0.25;
}
.ui-progressbar-indeterminate .ui-progressbar-value {
background-image: none;
}
.ui-selectmenu-menu {
padding: 0;
margin: 0;
position: absolute;
top: 0;
left: 0;
display: none;
}
.ui-selectmenu-menu .ui-menu {
overflow: auto;
/* Support: IE7 */
overflow-x: hidden;
padding-bottom: 1px;
}
.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
font-size: 1em;
font-weight: bold;
line-height: 1.5;
padding: 2px 0.4em;
margin: 0.5em 0 0 0;
height: auto;
border: 0;
}
.ui-selectmenu-open {
display: block;
}
.ui-selectmenu-button {
display: inline-block;
overflow: hidden;
position: relative;
text-decoration: none;
cursor: pointer;
}
.ui-selectmenu-button span.ui-icon {
right: 0.5em;
left: auto;
margin-top: -8px;
position: absolute;
top: 50%;
}
.ui-selectmenu-button span.ui-selectmenu-text {
text-align: left;
padding: 0.4em 2.1em 0.4em 1em;
display: block;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ui-slider {
position: relative;
text-align: left;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
-ms-touch-action: none;
touch-action: none;
}
.ui-slider .ui-slider-range {
position: absolute;
z-index: 1;
font-size: .7em;
display: block;
border: 0;
background-position: 0 0;
}
/* support: IE8 - See #6727 */
.ui-slider.ui-state-disabled .ui-slider-handle,
.ui-slider.ui-state-disabled .ui-slider-range {
filter: inherit;
}
.ui-slider-horizontal {
height: .8em;
}
.ui-slider-horizontal .ui-slider-handle {
top: -.3em;
margin-left: -.6em;
}
.ui-slider-horizontal .ui-slider-range {
top: 0;
height: 100%;
}
.ui-slider-horizontal .ui-slider-range-min {
left: 0;
}
.ui-slider-horizontal .ui-slider-range-max {
right: 0;
}
.ui-slider-vertical {
width: .8em;
height: 100px;
}
.ui-slider-vertical .ui-slider-handle {
left: -.3em;
margin-left: 0;
margin-bottom: -.6em;
}
.ui-slider-vertical .ui-slider-range {
left: 0;
width: 100%;
}
.ui-slider-vertical .ui-slider-range-min {
bottom: 0;
}
.ui-slider-vertical .ui-slider-range-max {
top: 0;
}
.ui-spinner {
position: relative;
display: inline-block;
overflow: hidden;
padding: 0;
vertical-align: middle;
}
.ui-spinner-input {
border: none;
background: none;
color: inherit;
padding: 0;
margin: .2em 0;
vertical-align: middle;
margin-left: .4em;
margin-right: 22px;
}
.ui-spinner-button {
width: 16px;
height: 50%;
font-size: .5em;
padding: 0;
margin: 0;
text-align: center;
position: absolute;
cursor: default;
display: block;
overflow: hidden;
right: 0;
}
/* more specificity required here to override default borders */
.ui-spinner a.ui-spinner-button {
border-top: none;
border-bottom: none;
border-right: none;
}
/* vertically center icon */
.ui-spinner .ui-icon {
position: absolute;
margin-top: -8px;
top: 50%;
left: 0;
}
.ui-spinner-up {
top: 0;
}
.ui-spinner-down {
bottom: 0;
}
/* TR overrides */
.ui-spinner .ui-icon-triangle-1-s {
/* need to fix icons sprite */
background-position: -65px -16px;
}
.ui-tabs {
position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
padding: .2em;
}
.ui-tabs .ui-tabs-nav {
margin: 0;
padding: .2em .2em 0;
}
.ui-tabs .ui-tabs-nav li {
list-style: none;
float: left;
position: relative;
top: 0;
margin: 1px .2em 0 0;
border-bottom-width: 0;
padding: 0;
white-space: nowrap;
}
.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
float: left;
padding: .5em 1em;
text-decoration: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active {
margin-bottom: -1px;
padding-bottom: 1px;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
cursor: text;
}
.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
cursor: pointer;
}
.ui-tabs .ui-tabs-panel {
display: block;
border-width: 0;
padding: 1em 1.4em;
background: none;
}
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
}
body .ui-tooltip {
border-width: 2px;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,410 @@
/*!
* jQuery UI CSS Framework 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/theming/
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI%2CArial%2Csans-serif&fsDefault=1.1em&fwDefault=bold&cornerRadius=6px&bgColorHeader=%23333333&bgTextureHeader=gloss_wave&borderColorHeader=%23333333&fcHeader=%23ffffff&iconColorHeader=%23ffffff&bgColorContent=%23000000&bgTextureContent=flat&borderColorContent=%23666666&fcContent=%23ffffff&iconColorContent=%23cccccc&bgColorDefault=%23555555&bgTextureDefault=glass&borderColorDefault=%23666666&fcDefault=%23eeeeee&iconColorDefault=%23cccccc&bgColorHover=%230078a3&bgTextureHover=glass&borderColorHover=%2359b4d4&fcHover=%23ffffff&iconColorHover=%23ffffff&bgColorActive=%23f58400&bgTextureActive=inset_soft&borderColorActive=%23ffaf0f&fcActive=%23ffffff&iconColorActive=%23222222&bgColorHighlight=%23eeeeee&bgTextureHighlight=highlight_soft&borderColorHighlight=%23cccccc&fcHighlight=%232e7db2&iconColorHighlight=%234b8e0b&bgColorError=%23ffc73d&bgTextureError=glass&borderColorError=%23ffb73d&fcError=%23111111&iconColorError=%23a83300&bgColorOverlay=%235c5c5c&bgTextureOverlay=flat&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=%23cccccc&bgTextureShadow=flat&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px&bgImgOpacityHeader=25&bgImgOpacityContent=25&bgImgOpacityDefault=20&bgImgOpacityHover=40&bgImgOpacityActive=30&bgImgOpacityHighlight=80&bgImgOpacityError=40&tr%26ffDefault=Helvetica%2CArial%2Csans-serif
*/
/* Component containers
----------------------------------*/
.ui-widget {
font-family: Segoe UI,Arial,sans-serif;
font-size: 1.1em;
}
.ui-widget .ui-widget {
font-size: 1em;
}
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button {
font-family: Segoe UI,Arial,sans-serif;
font-size: 1em;
}
.ui-widget-content {
border: 1px solid #666666;
background: #000000;
color: #ffffff;
}
.ui-widget-content a {
color: #ffffff;
}
.ui-widget-header {
border: 1px solid #333333;
background: #333333 url("images/ui-bg_gloss-wave_25_333333_500x100.png") 50% 50% repeat-x;
color: #ffffff;
font-weight: bold;
}
.ui-widget-header a {
color: #ffffff;
}
/* Interaction states
----------------------------------*/
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid #666666;
background: #555555 url("images/ui-bg_glass_20_555555_1x400.png") 50% 50% repeat-x;
font-weight: bold;
color: #eeeeee;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited {
color: #eeeeee;
text-decoration: none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
border: 1px solid #59b4d4;
background: #0078a3 url("images/ui-bg_glass_40_0078a3_1x400.png") 50% 50% repeat-x;
font-weight: bold;
color: #ffffff;
}
.ui-state-hover a,
.ui-state-hover a:hover,
.ui-state-hover a:link,
.ui-state-hover a:visited,
.ui-state-focus a,
.ui-state-focus a:hover,
.ui-state-focus a:link,
.ui-state-focus a:visited {
color: #ffffff;
text-decoration: none;
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: 1px solid #ffaf0f;
background: #f58400 url("images/ui-bg_inset-soft_30_f58400_1x100.png") 50% 50% repeat-x;
font-weight: bold;
color: #ffffff;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited {
color: #ffffff;
text-decoration: none;
}
/* Interaction Cues
----------------------------------*/
.ui-state-highlight,
.ui-widget-content .ui-state-highlight,
.ui-widget-header .ui-state-highlight {
border: 1px solid #cccccc;
background: #eeeeee url("images/ui-bg_highlight-soft_80_eeeeee_1x100.png") 50% top repeat-x;
color: #2e7db2;
}
.ui-state-highlight a,
.ui-widget-content .ui-state-highlight a,
.ui-widget-header .ui-state-highlight a {
color: #2e7db2;
}
.ui-state-error,
.ui-widget-content .ui-state-error,
.ui-widget-header .ui-state-error {
border: 1px solid #ffb73d;
background: #ffc73d url("images/ui-bg_glass_40_ffc73d_1x400.png") 50% 50% repeat-x;
color: #111111;
}
.ui-state-error a,
.ui-widget-content .ui-state-error a,
.ui-widget-header .ui-state-error a {
color: #111111;
}
.ui-state-error-text,
.ui-widget-content .ui-state-error-text,
.ui-widget-header .ui-state-error-text {
color: #111111;
}
.ui-priority-primary,
.ui-widget-content .ui-priority-primary,
.ui-widget-header .ui-priority-primary {
font-weight: bold;
}
.ui-priority-secondary,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
width: 16px;
height: 16px;
}
.ui-icon,
.ui-widget-content .ui-icon {
background-image: url("images/ui-icons_cccccc_256x240.png");
}
.ui-widget-header .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png");
}
.ui-state-default .ui-icon {
background-image: url("images/ui-icons_cccccc_256x240.png");
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon {
background-image: url("images/ui-icons_ffffff_256x240.png");
}
.ui-state-active .ui-icon {
background-image: url("images/ui-icons_222222_256x240.png");
}
.ui-state-highlight .ui-icon {
background-image: url("images/ui-icons_4b8e0b_256x240.png");
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
background-image: url("images/ui-icons_a83300_256x240.png");
}
/* positioning */
.ui-icon-blank { background-position: 16px 16px; }
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-on { background-position: -96px -144px; }
.ui-icon-radio-off { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
.ui-corner-tl {
border-top-left-radius: 6px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
border-top-right-radius: 6px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
border-bottom-left-radius: 6px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
border-bottom-right-radius: 6px;
}
/* Overlays */
.ui-widget-overlay {
background: #5c5c5c;
opacity: .8;
filter: Alpha(Opacity=80); /* support: IE8 */
}
.ui-widget-shadow {
margin: -7px 0 0 -7px;
padding: 7px;
background: #cccccc;
opacity: .6;
filter: Alpha(Opacity=60); /* support: IE8 */
border-radius: 8px;
}

File diff suppressed because one or more lines are too long

842
distfiles/logentry.php Normal file
View File

@@ -0,0 +1,842 @@
<?php
/*
logentry.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
header ("Location: login.php");
}
$techid=$_SESSION['login'] ?? NULL;
$isadmin=dblookup($db,"techs","techid","admin",$techid);
$efftechid=$_REQUEST['efftechid'] ?? NULL;
$noteid=$_REQUEST['noteid'] ?? NULL;
$print=$_REQUEST['print'] ?? NULL;
$refto=$_REQUEST['refto'] ?? NULL;
$date=$_REQUEST['date'] ?? NULL;
$time=$_REQUEST['time'] ?? NULL;
$note=$_REQUEST['note'] ?? NULL;
$shift=$_REQUEST['shift'] ?? NULL;
$subject=$_REQUEST['subject'] ?? NULL;
$refs=$_REQUEST['refs'] ?? NULL;
$submit=$_REQUEST['submit'] ?? NULL;
$add=$_REQUEST['add'] ?? NULL;
$edit=$_REQUEST['edit'] ?? NULL;
$delete=$_REQUEST['delete'] ?? NULL;
$templateid=$_REQUEST['templateid'] ?? NULL;
$loadtemplate=$_REQUEST['loadtemplate'] ?? NULL;
$savetemplate=$_REQUEST['savetemplate'] ?? NULL;
$copytemplate=$_REQUEST['copytemplate'] ?? NULL;
$deltemplate=$_REQUEST['deltemplate'] ?? NULL;
$templatename=$_REQUEST['templatename'] ?? NULL;
$removepart=$_REQUEST['removepart'] ?? NULL;
$syncflags=$_REQUEST['syncflags'] ?? NULL;
$flags=$_POST['flags'] ?? [];
$uids=$_POST['uids'] ?? [];
$partnums=$_POST['partnums'] ?? [];
$sernums=$_POST['sernums'] ?? [];
$actions=$_POST['actions'] ?? [];
$mfreqs=$_POST['mfreqs'] ?? [];
$schedmaintcomplete=$_REQUEST['schedmaintcomplete'] ?? NULL;
$partview=$_REQUEST['partview'] ?? NULL;
$doparts=PARTS_FUNCTIONS;
$logname=LOG_NAME;
$techalpha=TECH_ALPHA;
$subjalpha=SUBJ_ALPHA;
$uidtext=UID_TEXT;
$defaultshift=dblookup($db,"techs","techid","shift",$techid);
if ($print=="Printer Friendly") {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
if ($partview) $edit=1;
if (!$add && !$edit && !$delete && !$submit) $add=1;
if ($add) {
framework("begin","$logname","Note Entry",$print);
$authorized=1;
}
if ($edit || $delete) {
framework("begin","$logname","Note Edit",$print);
$owner=dblookup($db,"lognotes","lognoteid","tech",$noteid);
if (($techid==$owner) || $isadmin) $authorized=1;
}
//var_dump($_REQUEST);
// ******** begin database manipulation ********
// determine today's date and make it the default
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$now=mysqli_fetch_row(mysqli_query($db,"select current_time"))[0];
if ($add) {
if ($submit) {
// add the entry if submit is pressed
if ($note) {
// sanitize and fix blank date and time
$date=mysqli_real_escape_string($db,$date);
$time=mysqli_real_escape_string($db,$time);
if (!$date) $date=$today;
if (!$time) $time=$now;
// determine whether supplied date is future or past
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$date\",CURRENT_DATE)"));
// if future, set time to 00:00:01, if past, set to 23:59:59
if ($datediff[0]<0) {
$time="23:59:59";
}
if ($datediff[0]>0) {
$time="00:00:01";
}
// remove html tags from note text and sanitize
$note=strip_tags($note,"<a>");
$note=mysqli_real_escape_string($db,$note);
// remove cruft from references and sanitize
$refs=preg_replace("#[a-zA-Z]{1,}#","",$refs);
$refs=mysqli_real_escape_string($db,$refs);
if ($doparts==1) {
// inspect part data
$maxplidx=max(
max(array_keys($uids)),
max(array_keys($partnums)),
max(array_keys($sernums))
);
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
// for each part line, see what info is available
// if uid or pn/sn supplied, pull other info from parts
if ($uids[$plidx] != "") {
// see if this uid is in parts table.
$uidqry=mysqli_query($db,"select * from parts where uid=\"$uids[$plidx]\"");
if (mysqli_num_rows($uidqry)) {
// if so, populate pn/sn
$uiddata=mysqli_fetch_assoc($uidqry);
$partnums[$plidx]=$uiddata['partnum'];
$sernums[$plidx]=$uiddata['sernum'];
}
}
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if this pn/sn is in parts table.
$pnsnqry=mysqli_query($db,"select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
if (mysqli_num_rows($pnsnqry)) {
// if so, populate uid
$pnsndata=mysqli_fetch_assoc($pnsnqry);
$uids[$plidx]=$pnsndata['uid'];
}
}
}
}
if ($authorized) {
// add the record to lognotes
mysqli_query($db,"insert into lognotes(date,time,shift,tech,subject,lognote,refs) values (\"$date\", \"$time\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\",\"$refs\")");
$newnoteid=mysqli_insert_id($db);
// add this noteid to the appropriate flag_tables
$chainmembers=generate_chain($newnoteid);
foreach ($flags as $flagtblnum) {
$flagtblname="flag_".$flagtblnum;
// set flag for this note
mysqli_query($db,"insert into $flagtblname(target,id) values(\"lognotes\",\"$newnoteid\")");
if ($syncflags) {
//set flag for reference chain notes
foreach ($chainmembers as $refdnote) {
mysqli_query($db,"insert into $flagtblname(target,id) values(\"lognotes\",\"$refdnote\")");
}
}
}
if ($doparts==1) {
// now run through the part lines
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
// update the parts table
// if this line includes a uid and a pn/sn
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if it's in the parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
}
// if this line includes a uid only
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
// see if this uid is in parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(uid) values(\"$uids[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
}
// if this line includes a pn/sn only
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if this pn/sn is in the parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
}
} else {
// no part info was entered
}
}
}
}
}
} elseif ($loadtemplate) {
if ($templateid) {
$templatevalues=mysqli_fetch_assoc(mysqli_query($db,"select * from notetemplates where templateid=\"$templateid\""));
$defaultshift=$templatevalues["shift"];
$defaultsubject=$templatevalues["subject"];
$note=$templatevalues["lognote"];
$refto=$templatevalues["refs"];
$techid=$templatevalues["tech"];
}
} elseif ($savetemplate) {
if ($note) {
// remove cruft from note text
$note=strip_tags($note,"<a>");
$note=mysqli_real_escape_string($db,$note);
// remove cruft from references
$refs=preg_replace("#[a-zA-Z]{1,}#","",$refs);
if ($authorized) {
if ($templateid) {
// update the existing template
mysqli_query($db,"update notetemplates set templatename=\"$templatename\", shift=\"$shift\", subject=\"$subject\", lognote=\"$note\", refs=\"$refs\" where templateid=\"$templateid\"");
// update the flag_ tables
$flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0];
if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"notetemplates\" and id=\"$templateid\""))) {
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"notetemplates\",\"$templateid\")");
}
} else {
if(mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"notetemplates\" and id=\"$templateid\""))) {
mysqli_query($db,"delete from $thisflag_tbl where target=\"notetemplates\" and id=\"$templateid\"");
}
}
}
} else {
// check if supplied name already exists
if (! mysqli_num_rows(mysqli_query($db,"select templateid from notetemplates where templatename=\"$templatename\""))) {
// add the record to notetemplates
mysqli_query($db,"insert into notetemplates(templatename,shift,tech,subject,lognote,refs) values (\"$templatename\", \"$shift\",\"$techid\",\"$subject\",\"$note\",\"$refs\")");
$newtemplateid=mysqli_insert_id($db);
// add this templateid to the appropriate flag_tables
foreach ($flags as $flagtblnum) {
$flagtblname="flag_".$flagtblnum;
mysqli_query($db,"insert into $flagtblname(target,id) values(\"notetemplates\",\"$newtemplateid\")");
}
$templateid=$newtemplateid;
} else {
$save_nameexists=TRUE;
}
}
}
}
} elseif ($copytemplate) {
if ($note) {
// remove cruft from note text
$note=strip_tags($note,"<a>");
$note=mysqli_real_escape_string($db,$note);
// remove cruft from references
$refs=preg_replace("#[a-zA-Z]{1,}#","",$refs);
if ($authorized) {
// check if supplied name already exists
if (! mysqli_num_rows(mysqli_query($db,"select templateid from notetemplates where templatename=\"$templatename\""))) {
// add the record to notetemplates
mysqli_query($db,"insert into notetemplates(templatename,shift,tech,subject,lognote,refs) values (\"$templatename\", \"$shift\",\"$techid\",\"$subject\",\"$note\",\"$refs\")");
$newtemplateid=mysqli_insert_id($db);
// add this templateid to the appropriate flag_tables
foreach ($flags as $flagtblnum) {
$flagtblname="flag_".$flagtblnum;
mysqli_query($db,"insert into $flagtblname(target,id) values(\"notetemplates\",\"$newtemplateid\")");
}
$templateid=$newtemplateid;
} else {
$copy_nameexists=TRUE;
}
}
}
} elseif ($deltemplate) {
// delete from notetemplates table
mysqli_query($db,"delete from notetemplates where templateid=\"$templateid\"");
// delete occurances from the flag_ tables
$flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) {
$delflag_tbl="flag_".$thisflagid[0];
mysqli_query($db,"delete from $delflag_tbl where target=\"notetemplates\" and id=\"$templateid\"");
}
unset($templateid);
}
}
if ($edit) {
if ($removepart && $authorized) mysqli_query($db,"delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
if ($submit) {
if ($note) {
// remove cruft from note text
$note=strip_tags($note,"<a>");
$note=mysqli_real_escape_string($db,$note);
// remove cruft from references
$refs=preg_replace("#[a-zA-Z]{1,}#","",$refs);
if ($doparts==1) {
// inspect part data
$maxplidx=max(
max(array_keys($uids)),
max(array_keys($partnums)),
max(array_keys($sernums))
);
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
// for each part line, see what info is available
// if uid or pn/sn supplied, pull other info from parts
if ($uids[$plidx] != "") {
// see if this uid is in parts table.
$uidqry=mysqli_query($db,"select * from parts where uid=\"$uids[$plidx]\"");
if (mysqli_num_rows($uidqry)) {
// if so, populate pn/sn
$uiddata=mysqli_fetch_assoc($uidqry);
$partnums[$plidx]=$uiddata['partnum'];
$sernums[$plidx]=$uiddata['sernum'];
}
}
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if this pn/sn is in parts table.
$pnsnqry=mysqli_query($db,"select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
if (mysqli_num_rows($pnsnqry)) {
// if so, populate uid
$pnsndata=mysqli_fetch_assoc($pnsnqry);
$uids[$plidx]=$pnsndata['uid'];
}
}
}
}
if ($authorized) {
// update lognotes table
mysqli_query($db,"update lognotes set date=\"$date\", time=\"$time\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\", refs=\"$refs\" where lognoteid=\"$noteid\"");
// update the flag_tables
$flagids=mysqli_query($db,"select flagid from flags");
$chainmembers=generate_chain($noteid);
while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0];
if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"lognotes\" and id=\"$noteid\""))) {
// set flag for this noteid
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"lognotes\",\"$noteid\")");
// set flag for reference chain notes
if ($syncflags) {
foreach($chainmembers as $refdnote) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"lognotes\" and id=\"$refdnote\""))) {
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"lognotes\",\"$refdnote\")");
}
}
}
}
} else {
if(mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"lognotes\" and id=\"$noteid\""))) {
// clear flag for this note
mysqli_query($db,"delete from $thisflag_tbl where target=\"lognotes\" and id=\"$noteid\"");
}
}
}
if ($doparts==1) {
// run through the new part lines
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
// update the parts table
// if this line includes a uid and a pn/sn
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if it's in the parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
}
// if this line includes a uid only
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
// see if this uid is in parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(uid) values(\"$uids[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
}
// if this line includes a pn/sn only
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
// see if this pn/sn is in the parts table
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
// if not, add it to parts
mysqli_query($db,"insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
$lpid=mysqli_insert_id($db);
} else {
// if so get the partid for the logparts table
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
}
// add it to logparts table
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
// create a maintenance form if required
if ($mfreqs[$plidx]=="on") {
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
}
} else {
// no part info was entered
}
}
}
}
}
}
// refresh the note in question from the database
$getnote=mysqli_query($db,"select * from lognotes where lognoteid=\"$noteid\"");
$notetoedit=mysqli_fetch_assoc($getnote);
}
if ($delete) {
// delete from lognotes table
mysqli_query($db,"delete from lognotes where lognoteid=\"$noteid\"");
// delete occurances from the flag_ tables
$flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) {
$delflag_tbl="flag_".$thisflagid[0];
mysqli_query($db,"delete from $delflag_tbl where target=\"lognotes\" and id=\"$noteid\"");
}
// delete occurances from the logparts table
mysqli_query($db,"delete from logparts where lognoteid=\"$noteid\"");
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
// display the form
if ($add) {
$notedate=$today;
$notetime=$now;
}
if ($edit || $delete) {
$notedate=$notetoedit["date"];
$notetime=$notetoedit["time"];
$defaultshift=$notetoedit["shift"];
$defaultsubject=$notetoedit["subject"];
$note=$notetoedit["lognote"];
$refto=$notetoedit["refs"];
$techid=$notetoedit["tech"];
}
$techname=dblookup($db,"techs","techid","techname",$techid);
$copy_nameexists=$copy_nameexists ?? NULL;
$save_nameexists=$save_nameexists ?? NULL;
if ($submit) {
if ($note) {
if ($add) {
format_message(0,"<strong>Note added.</strong> You may enter another note or <a href=\"lognotes.php\">return to main page.</a>");
}
if ($edit) {
format_message(0,"<strong>Note changed.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
}
} else {
format_message(1,"You didn't enter any note text. Please try again.");
}
}
if ($delete) {
format_message(0,"<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
}
if ($copy_nameexists) {
format_message(1,"Template copy failed because the name you supplied already exists.");
}
if ($save_nameexists) {
format_message(1,"Template save failed because the name you supplied already exists.");
}
echo "
<form method=\"post\" action=\"logentry.php\">
";
if ($_SESSION['login']) {
// generate template line
echo "
<table border=\"0\" cellpadding=\"10\"><tr><td>
<select name=\"templateid\" title=\"Select the template you'd like to load and click the Load Template button.\">
";
if ($loadtemplate) $templatename=dblookup($db,"notetemplates","templateid","templatename",$templateid);
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"$techid\" order by templatename asc");
if ($loadtemplate) {
printf("<option value=\"%s\">%s</option>","0","Select template");
} else {
printf("<option value=\"%s\" selected>%s</option>","0","Select template");
}
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
if ($loadtemplate && ($templateitem["templateid"] == $templateid)) {
printf("<option value=\"%s\" selected>%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
} else {
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
}
}
echo "
</select>&nbsp;&nbsp;<input type=\"submit\" name=\"loadtemplate\" value=\"Load Template\">
</td><td>
<input type=\"submit\" name=\"savetemplate\" value=\"Save As:\" title=\"Enter the name you'd like to use in the field to the right.\">&nbsp;
<input type=\"text\" size=\"25\" name=\"templatename\" value=\"$templatename\" title=\"Name of the template you'd like to save or modify\">
</td>
";
if ($loadtemplate) {
echo "
<!-- <input type=\"hidden\" name=\"templateid\" value=\"$templateid\"> -->
<td>
<input type=\"submit\" name=\"deltemplate\" value=\"Delete\" title=\"Delete the template whose name is shown in the field to the left.\">
<input type=\"submit\" name=\"copytemplate\" value=\"Copy\" title=\"Copy the template whose data is shown below to the new name in the field to the left.\">
</td>
";
}
echo "
</tr></table>
<hr>
";
}
// start note entry section
echo "
<table border=\"0\" cellpadding=\"5\">
<tr>
<td align=\"center\" colspan=\"2\"><b>Date: </b>&nbsp;
<input type=\"text\" name=\"date\" size=\"10\" maxlength=\"10\" value=\"$notedate\" id=\"singledatepicker\" title=\"Format: YYYY-MM-DD\"></td>
<td align=\"center\"><b>Time: </b>&nbsp;
<input type=\"text\" name=\"time\" size=\"8\" maxlength=\"8\" value=\"$notetime\" title=\"Format: HH:MM:SS\"></td>
";
if ($isadmin) {
// allow tech selection
echo "
<td><b>Tech: </b>&nbsp;
<select name=\"efftechid\">
";
if ($techalpha) $torder="techname"; else $torder="techid";
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
while ($techitem=mysqli_fetch_assoc($techrow)) {
if ($techitem["status"] == 1) {
if ($techitem["techid"]==$techid) {
printf("<option value=\"%s\" selected>%s</option>",$techitem["techid"],$techitem["techname"]);
} else {
printf("<option value=\"%s\">%s</option>",$techitem["techid"],$techitem["techname"]);
}
}
}
echo "
</select></td>
";
} else {
echo "
<td align=\"center\">
<input type=\"hidden\" name=\"efftechid\" value=\"$techid\">
<b>Tech: </b>&nbsp;$techname
</td>
";
}
echo "
</tr>
<tr>
<td><b>Shift: </b>&nbsp;
<select name=\"shift\">
";
$shiftrow=mysqli_query($db,"select * from shifts");
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem["status"] == 1) {
if ($shiftitem["shiftid"]==$defaultshift) {
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
} else {
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
}
}
}
echo "
</select></td>
<td colspan=\"2\"><b>Subject: </b>&nbsp;
<select name=\"subject\">
";
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
$subjrow=mysqli_query($db,"select * from subjects order by $sorder asc");
while ($subjitem=mysqli_fetch_assoc($subjrow)) {
if ($subjitem["status"]==1) {
$defaultsubject=$defaultsubject ?? NULL;
if ($subjitem["subjectid"]==$defaultsubject) {
printf("<option value=\"%s\" selected>%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
} else {
printf("<option value=\"%s\">%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
}
}
}
echo "
</select></td>
</tr></table>
<b>Note:</b>&nbsp;<img src=\"icons/question.png\" title=\"Enter note text below. To insert a link to a web page, enter it in the link field below the Note box and click Insert Link. \"><br>
<textarea rows=\"10\" cols=\"60\" name=\"note\" id=\"notetextarea\" wrap=\"soft\">";
if ($edit || $templateid || $schedmaintcomplete) echo "$note";
echo "</textarea><br>
<input type=\"text\" size=\"50\" id=\"linktextfield\" placeholder=\"Enter a URL to insert here\">&nbsp;<a href=\"#\" onclick=\"insertUrlAtCaret('notetextarea','linktextfield');return false;\">Insert Link</a><br>
";
// get an array of flagids set for this noteid
$allflags=mysqli_query($db,"select flagid from flags");
unset($theseflags);
$theseflags=[];
while ($thisflag=mysqli_fetch_row($allflags)) {
$thisflagtbl="flag_".$thisflag[0];
if ($templateid) {
if (mysqli_num_rows(mysqli_query($db,"select id from $thisflagtbl where target=\"notetemplates\" and id=\"$templateid\""))) {
$theseflags[]=$thisflag[0];
}
} else {
if (mysqli_num_rows(mysqli_query($db,"select id from $thisflagtbl where target=\"lognotes\" and id=\"$noteid\""))) {
$theseflags[]=$thisflag[0];
}
}
}
if ($add) {
$flagslist=mysqli_query($db,"select * from flags where status=1");
} else {
$flagslist=mysqli_query($db,"select * from flags");
}
$flagsperline=8;
$flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if (in_array($flagcheckbox["flagid"],$theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
} else {
$flagid=$flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
}
}
if ($flagcount<$flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount=1;
}
}
echo "
<br><input type=\"checkbox\" name=\"syncflags\" value=\"1\"><font title=\"Set the selected flags on the other notes in the reference chain\">Set flags on reference chain</font>
<br><br><b>References: </b>&nbsp;
<input type=\"text\" name=\"refs\" size=\"20\" value=\"$refto\" title=\"One or more Note ID numbers separated by commas\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
if ($add) {
if ($authorized) {
echo "
<input type=\"hidden\" name=\"add\" value=\"1\">
<input type=\"submit\" name=\"submit\" value=\"Submit Note\">";
}
if ($doparts) {
$defaultaction=0;
echo "
<br><br>
<table border=\"0\" cellpadding=\"5\">
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
";
for ($partline=0;$partline <=5;$partline++) {
echo "
<tr>
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
<td align=\"center\"><input type=\"text\" name=\"partnums[$partline]\" size=\"20\"></td>
<td align=\"center\"><input type=\"text\" name=\"sernums[$partline]\" size=\"20\"></td>
<td align=\"center\"><select name=\"actions[$partline]\">
<option value=\"select\">Select Action</option>
";
$actrow=mysqli_query($db,"select * from logpartactions");
while ($actitem=mysqli_fetch_assoc($actrow)) {
if ($actitem["status"]==1) {
if ($actitem["lpactionid"]==$defaultaction) {
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
} else {
printf("<option value=\"%s\">%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
}
}
}
echo "
</select>
</td>
<td align=\"center\"><input type=\"checkbox\" name=\"mfreqs[$partline]\" id=\"mfreqs[$partline]\"></td>
</tr>
";
}
echo "
</table>
";
}
}
if ($edit) {
if ($authorized) {
echo "
<input type=\"hidden\" name=\"edit\" value=\"1\">
<input type=\"hidden\" name=\"noteid\" value=\"$noteid\">
<input type=\"submit\" name=\"submit\" value=\"Change this note\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>
<input type=\"submit\" name=\"delete\" value=\"Delete this note\"><font color=\"#FF0000\"><b>Deleted notes are irretrievable!</b></font>
";
} else {
echo "<br><br>Only the owner of a note or an administrator can change or delete it.";
}
if ($doparts) {
echo "
<br><br>
<table border=\"0\" cellpadding=\"5\">
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
";
// populate the existing part lines
$linekey=0;
$elineqry=mysqli_query($db,"select logpartid, partid, action from logparts where lognoteid=\"$noteid\"");
while ($eline=mysqli_fetch_assoc($elineqry)) {
$iconpartid=$eline['logpartid'];
$lpidvar=$eline['partid'];
$eparts=mysqli_fetch_assoc(mysqli_query($db,"select uid,partnum,sernum from parts where partid=\"$lpidvar\""));
$epuid=$eparts['uid'];
$eppn=$eparts['partnum'];
$epsn=$eparts['sernum'];
$defaultaction=$eline['action'];
echo "
<tr>
<td align=\"left\"><a href=\"partentry.php?edit=1&partid=$lpidvar\" title=\"Click to edit this part\"><img src=\"icons/notebook--pencil.png\"></a>
<a href=\"logentry.php?edit=1&noteid=$noteid&removepart=$iconpartid\" title=\"Click to remove part from this note\"><img src=\"icons/minus-button.png\"></a>&nbsp;&nbsp;$epuid</td>
<td align=\"center\">$eppn</td>
<td align=\"center\">$epsn</td>
<td align=\"center\">
";
$actrow=mysqli_query($db,"select * from logpartactions");
while ($actitem=mysqli_fetch_assoc($actrow)) {
if ($actitem["lpactionid"]==$defaultaction) {
echo "$actitem[lpactionname]";
}
}
echo "
</td>
";
// find maint form for this line and show link
$mflinknum=mysqli_fetch_assoc(mysqli_query($db,"select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\""))["maintformid"];
echo "
<td align=\"center\"><a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a></td>
</tr>
";
}
// add six empty part lines
$defaultaction=0;
for ($partline=$linekey;$partline <=$linekey+5;$partline++) {
echo "
<tr>
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
<td align=\"center\"><input type=\"text\" name=\"partnums[$partline]\" size=\"20\"></td>
<td align=\"center\"><input type=\"text\" name=\"sernums[$partline]\" size=\"20\"></td>
<td align=\"center\"><select name=\"actions[$partline]\">
<option value=\"select\">Select Action</option>
";
$actrow=mysqli_query($db,"select * from logpartactions");
while ($actitem=mysqli_fetch_assoc($actrow)) {
if ($actitem["status"]==1) {
if ($actitem["lpactionid"]==$defaultaction) {
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
} else {
printf("<option value=\"%s\">%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
}
}
}
echo "
</select>
</td>
<td align=\"center\"><input type=\"checkbox\" name=\"mfreqs[$partline]\" id=\"mfreqs[$partline]\"></td>
</tr>
";
}
echo "
</table>
";
}
}
echo "
</form>
<br>
";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

102
distfiles/login.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
/*
login.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$print=$_REQUEST['print'];
$tech=$_REQUEST['tech'];
$pass=$_REQUEST['pass'];
$login=$_REQUEST['login'];
$cancel=$_REQUEST['cancel'];
if ($cancel) {
session_destroy();
}
$techalpha=TECH_ALPHA;
$logname=LOG_NAME;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$logname","Login Page",$print);
pagetable("begin");
if(!$print){
pageblock("left","begin");
sidemenu("no print");
pageblock("left","end");
}
pageblock("right","begin");
if ($login) {
// log me in
$pwhash=mysqli_fetch_row(mysqli_query($db,"select techpass from techs where techid=\"$tech\""))[0];
if (password_verify($pass, $pwhash)) {
$_SESSION['login']=$tech;
$techname=dblookup($db,"techs","techid","techname",$tech);
echo "
Welcome $techname. Please select a menu option at the left to continue.
";
} else {
$adminqry=mysqli_query($db,"select techname from techs where admin=1 and status=1");
echo "
Incorrect password. Please <a href=\"login.php\">try again</a>.<br><br>
Forgot your password? Contact an administrator:<br><br>
";
while ($admintech=mysqli_fetch_row($adminqry)[0]) {
echo "$admintech <br>";
}
}
} else if ($cancel) {
echo "
You are logged out. Please select a menu option at the left to continue.<br><hr>
";
} else {
if (!isset($_SESSION['login'])) {
// show the login form
echo "
<form method=\"post\" action=\"login.php\">
<b>Tech: </b>&nbsp;
<select name=\"tech\">
";
if ($techalpha) $torder="techname"; else $torder="techid";
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
while ($techitem=mysqli_fetch_assoc($techrow)) {
if ($techitem["status"]==1) {
printf("<option value=\"%s\">%s</option>",$techitem["techid"],$techitem["techname"]);
}
}
echo "</select><br><br>
Password: &nbsp;<input type=\"password\" name=\"pass\" size=\"40\"><br><br>
<input type=\"submit\" name=\"login\" value=\"Log In\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"cancel\" value=\"Cancel\"><br>
</form>
<br><hr>
";
} else {
$loginid=$_SESSION['login'];
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select techname from techs where techid=\"$loginid\""))[0];
echo "
You are already logged in as $loggedinas. Please select a menu option at the left to continue.<br><hr>
";
}
}
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

261
distfiles/lognotes.php Normal file
View File

@@ -0,0 +1,261 @@
<?php
/*
lognotes.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
//$tgt_year=$_REQUEST['y'];
//$tgt_month=$_REQUEST['m'];
//$tgt_day=$_REQUEST['d'];
$tgt_date=$_REQUEST['tgt_date'] ?? "";
$print=$_REQUEST['print'] ?? "";
if (isset($_SESSION['login'])) $techid=$_SESSION['login'];
$logname=LOG_NAME;
$tablestyle=LOG_STYLE;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
// use default date values if not supplied
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
if ($tgt_date=="") $tgt_date=$today;
// define shifttable_classic function
function shifttable_classic($shift, $tgt_date, $db) {
// convert the shift number to a name for display
$doparts=PARTS_FUNCTIONS;
$showtime=SHOW_TS;
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr=mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,refs,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><table border=\"1\" width=\"100%\">\n";
echo "<tr><th width=\"70\">Note ID</th><th width=\"70\">Tech</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$reftonote=$tablerow["lognoteid"];
$refs="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$reftonote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($tablerow["lognoteid"])) {
$refs=$refs."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$reftonote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
//convert subject number to name
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
// create links of urls in note
$fmtnote=convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring="";
$allflagqry=mysqli_query($db,"select flagid from flags");
while ($allflagids=mysqli_fetch_row($allflagqry)) {
$flagid=$allflagids[0];
$flag_tbl="flag_".$flagid;
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$reftonote\""))) {
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
$flagcolor=$flagparam["flagcolor"];
$flagsym=$flagparam["flagsym"];
$flagname=$flagparam["flagname"];
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
}
if ($flagstring) {
$fmtnote=$fmtnote."<br>".$flagstring."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote=$fmtnote."<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$reftonote\""))) {
$fmtnote=$fmtnote."<a href=\"logentry.php?partview=1&noteid=$reftonote\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\" title=\"Edit this note\">%s</a>&nbsp;&nbsp;%s</td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],$tablerow["time"],
$tname,
$subjname,
$fmtnote,
$refs
);
} else {
printf(
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\">%s</a></td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tname,
$subjname,
$fmtnote,
$refs
);
}
}
echo "</table>\n";
} else {
// print the shift header
echo "<b>No entries for $shname</b>";
}
echo "<br><br>\n";
}
// define the shifttable_clean function
function shifttable_clean($shift, $tgt_date, $db) {
// convert the shift number to a name for display
$doparts=PARTS_FUNCTIONS;
$showtime=SHOW_TS;
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr=mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,refs,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><br>";
echo "<table border=\"0\" width=\"100%\"><tr><td>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$reftonote=$tablerow["lognoteid"];
$refs="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$reftonote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($tablerow["lognoteid"])) {
$refs=$refs."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$reftonote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
//convert subject number to name
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
// create links of urls in note
$fmtnote=convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring="";
$allflagqry=mysqli_query($db,"select flagid from flags");
while ($allflagids=mysqli_fetch_row($allflagqry)) {
$flagid=$allflagids[0];
$flag_tbl="flag_".$flagid;
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$reftonote\""))) {
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
$flagcolor=$flagparam["flagcolor"];
$flagsym=$flagparam["flagsym"];
$flagname=$flagparam["flagname"];
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
}
if ($flagstring) {
$fmtnote=$fmtnote."<br>".$flagstring."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote=$fmtnote."<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$reftonote\""))) {
$fmtnote=$fmtnote."<a href=\"logentry.php?edit=1&noteid=$reftonote\" title=\"Click here to see note and parts data.\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\" title=\"Note ID. Click to edit.\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$refs,
$fmtnote
);
} else {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tname,
$subjname,
$refs,
$fmtnote
);
}
}
echo "</td></tr></table>\n";
} else {
// print the shift header
echo "<b>No entries for $shname</b>";
}
echo "<br><br>\n";
}
framework("begin","$logname","Online Logbook",$print);
pagetable("begin");
if(!$print) {
pageblock("left","begin");
//calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php");
echo "<div id=\"caldate\" style=\"display: none;\">";
echo htmlspecialchars($tgt_date);
echo "</div>
<div id=\"lognotescalendar\"></div>
<form method=\"post\" id=\"calendar\" action=\"lognotes.php\">
<input type=\"hidden\" id=\"targetdate\" name=\"tgt_date\" value=\"$tgt_date\">
</form>
";
sidemenu();
echo "<br><br>";
showlinklist($print);
pageblock("left","end");
} else {
echo "
<center><b>$tgt_year-$tgt_month-$tgt_day</b></center><br>
";
}
pageblock("right","begin");
banner($print);
if (isset($techid)) nag($techid);
//$date=date("Y-m-d",mktime(0,0,0,$tgt_month,$tgt_day,$tgt_year));
$qry=mysqli_query($db,"select shiftid from shifts where status=1 order by shiftid asc");
while ($shnum=mysqli_fetch_row($qry)) {
if ($tablestyle==1) {
shifttable_classic($shnum[0],$tgt_date,$db);
} else if ($tablestyle==2) {
shifttable_clean($shnum[0],$tgt_date,$db);
}
}
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

230
distfiles/maintform.php Normal file
View File

@@ -0,0 +1,230 @@
<?php
/*
maintform.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (isset($_SESSION['login'])) $techid=$_SESSION['login'];
$histdays=$_REQUEST['histdays'];
$submit=$_REQUEST['submit'];
$logname=LOG_NAME;
$uidtext=UID_TEXT;
if ($histdays=="") $histdays=30;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
// define pendtable function
function pendtable($tech_id, $db) {
$uidtext=UID_TEXT;
// print section header
if ($tech_id) {
echo "
<b><font size=\"+1\">Your Pending Maintenance Forms</font></b><br>
";
$pmf=mysqli_query($db,"select * from maintforms where mftech=\"$tech_id\" and pending=\"1\" order by mfdate desc, mftime desc");
} else {
echo "
<b><font size=\"+1\">All Pending Maintenance Forms</font></b><br>
";
$pmf=mysqli_query($db,"select * from maintforms where pending=\"1\" order by mfdate desc, mftime desc");
}
echo "
<br><table border=\"1\" width=\"100%\">
<tr>
<th>ID</th>
<th>Date</th>
";
if (!$tech_id) echo "<th>Tech</th>";
echo "
<th>$uidtext</th>
<th>Part Number</th>
<th>Serial Number</th>
<th>Part Name</th>
<th>Logbook<br>Note ID</th>
</tr>
";
while ($pendrow = mysqli_fetch_assoc($pmf)) {
// look up part data
$uid=dblookup($db,"parts","partid","uid",$pendrow["mfpart"]);
if ($uid=="") $uid="&nbsp;";
$partno=dblookup($db,"parts","partid","partnum",$pendrow["mfpart"]);
if ($partno=="") $partno="&nbsp;";
$serno=dblookup($db,"parts","partid","sernum",$pendrow["mfpart"]);
if ($serno=="") $serno="&nbsp;";
$partname=dblookup($db,"parts","partid","partname",$pendrow["mfpart"]);
if ($partname=="") $partname="&nbsp;";
// look up tech name
$tname=dblookup($db,"techs","techid","techname",$pendrow["mftech"]);
if ($pendrow["lognoteid"]==0) {
$noteidval="&nbsp;";
$notetag="%s%s";
} else {
$noteidval=$pendrow["lognoteid"];
$notetag="<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>";
}
if (!$tech_id) {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$pendrow["maintformid"],$pendrow["maintformid"],
$pendrow["mfdate"],
$tname,
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
);
} else {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$pendrow["maintformid"],$pendrow["maintformid"],
$pendrow["mfdate"],
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
);
}
}
echo "
</table>
";
}
// define histtable function
function histtable($hist_days,$db) {
$uidtext=UID_TEXT;
$dayopts=array(30,90,180,365);
// print section header
echo "
<form method=\"post\" action=\"maintform.php\">
<b><font size=\"+1\">All Maintenance Forms From the Past </font></b>
<select name=\"histdays\">
";
foreach ($dayopts as $chunk) {
if ($chunk==$hist_days) {
echo "<option value=\"$chunk\" selected>$chunk</option>";
} else {
echo "<option value=\"$chunk\">$chunk</option>";
}
}
$histqry=mysqli_query($db,"select * from maintforms where mfdate > subdate(now(), interval $hist_days day) order by mfdate desc, mftime desc");
echo "
</select>
<b><font size=\"+1\"> Days</font></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"submit\" value=\"Update List\"></form><br>
<table border=\"1\" width=\"100%\">
<tr>
<th>ID</th>
<th>Date</th>
<th>Tech</th>
<th>$uidtext</th>
<th>Part Number</th>
<th>Serial Number</th>
<th>Part Name</th>
<th>Logbook<br>Note ID</th>
</tr>
";
while ($histrow = mysqli_fetch_assoc($histqry)) {
// look up part data
$uid=dblookup($db,"parts","partid","uid",$histrow["mfpart"]);
$partno=dblookup($db,"parts","partid","partnum",$histrow["mfpart"]);
if ($partno=="") $partno="&nbsp;";
$serno=dblookup($db,"parts","partid","sernum",$histrow["mfpart"]);
if ($serno=="") $serno="&nbsp;";
$partname=dblookup($db,"parts","partid","partname",$histrow["mfpart"]);
if ($partname=="") $partname="&nbsp;";
// look up tech name
$tname=dblookup($db,"techs","techid","techname",$histrow["mftech"]);
if ($histrow["lognoteid"]==0) {
$noteidval="&nbsp;";
$notetag="%s%s";
} else {
$noteidval=$histrow["lognoteid"];
$notetag="<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>";
}
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$histrow["maintformid"],$histrow["maintformid"],
$histrow["mfdate"],
$tname,
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
);
}
echo "
</table>
";
}
framework("begin","$logname","Maintenance Forms",$print);
pagetable("begin");
if(!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo "<br>";
$haspending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$techid\" and pending=\"1\""));
if ($haspending) {
pendtable($techid,$db);
echo "<br><hr><br>";
}
pendtable(0,$db);
echo "<br><hr><br>";
histtable($histdays,$db);
echo "<br><br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

View File

@@ -0,0 +1,664 @@
<?php
/*
maintformentry.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
header ("Location: login.php");
}
$loggedinas=$_SESSION['login'];
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
function getmfdata($maintformid) {
// pull maintenance form data from maintforms table
global $db;
$mfdata=mysqli_fetch_assoc(mysqli_query($db,"select * from maintforms where maintformid=\"$maintformid\""));
return $mfdata;
}
function getactiondata($maintactionid) {
// pull maintenance action data from maintactions table
global $db;
$actiondata=mysqli_fetch_assoc(mysqli_query($db,"select * from maintactions where maintactionid=\"$maintactionid\""));
return $actiondata;
}
$print=$_REQUEST['print'];
$maintformid=$_REQUEST['maintformid'];
$lognoteid=$_REQUEST['lognoteid'];
$mfdate=$_REQUEST['date'];
$mftime=$_REQUEST['time'];
$mfsubmit=$_REQUEST['mfsubmit'];
$mfadd=$_REQUEST['mfadd'];
$mfedit=$_REQUEST['mfedit'];
$mfdelete=$_REQUEST['mfdelete'];
$mfpartloc=$_REQUEST['mfpartloc'];
$mfmalfunction=$_REQUEST['mfmalfunction'];
$nha=$_REQUEST['nha'];
$repord=$_REQUEST['repord'];
$mfpart=$_REQUEST['mfpart'];
$uid=$_REQUEST['uid'];
$partnum=$_REQUEST['partnum'];
$sernum=$_REQUEST['sernum'];
$partname=$_REQUEST['partname'];
$actionadd=$_REQUEST['actionadd'];
$actionedit=$_REQUEST['actionedit'];
$actiondelete=$_REQUEST['actiondelete'];
$maintactionid=$_REQUEST['maintactionid'];
$actiondate=$_REQUEST['actiondate'];
$actiontime=$_REQUEST['actiontime'];
$actiontech=$_REQUEST['actiontech'];
$action=$_REQUEST['action'];
$actionaddsubmit=$_REQUEST['actionaddsubmit'];
$actioneditsubmit=$_REQUEST['actioneditsubmit'];
$printfmt=$_REQUEST['printfmt'];
if ($printfmt) $print=1;
$flags=$_POST['flags'];
$logname=LOG_NAME;
$uidtext=UID_TEXT;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
if ($printfmt) {
framework("begin","","",$print);
} else if ($mfedit) {
framework("begin","$logname","Maintenance Form Edit",$print);
if ($loggedinas) $mfauthorized=1;
} else if ($mfdelete) {
framework("begin","$logname","Maintenance Form Edit",$print);
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
if (($loggedinas==$mfowner) || $isadmin) $mfauthorized=1;
} else if ($actionadd) {
framework("begin","$logname","Maintenance Action Entry",$print);
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
if ($loggedinas) {
$mfauthorized=1;
$actionauthorized=1;
}
} else if ($actionedit || $actiondelete) {
framework("begin","$logname","Maintenance Action Edit",$print);
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
if ($loggedinas) $mfauthorized=1;
$actionowner=dblookup($db,"maintactions","maintactionid","actiontech",$maintactionid);
if (($loggedinas==$actionowner) || $isadmin) $actionauthorized=1;
} else {
$mfadd=1;
framework("begin","$logname","Maintenance Form Entry",$print);
$mftech=$loggedinas;
$mfauthorized=1;
}
// ******** begin database manipulation ********
// determine today's date and make it the default
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$now=mysqli_fetch_row(mysqli_query($db,"select current_time"))[0];
//var_dump($_REQUEST);
if ((($mfedit || $actionadd || $actionedit) && ! $mfsubmit) || $printfmt) {
// pull mf data from database
$mftoedit=getmfdata($maintformid);
$partdatainput=array();
if ($mftoedit['mfpart']) $partdatainput['partid']=$mftoedit['mfpart'];
if ($uid) $partdatainput['uid']=$uid;
if ($partnum) $partdatainput['partnum']=$partnum;
if ($sernum) $partdatainput['sernum']=$sernum;
$partinfo=get_part_data($partdatainput);
if ($partinfo['result']==2) {
$pdatamismatch=1;
} else {
unset($pdatamismatch);
if ($partinfo['partid']) $mfpart=$partinfo['partid'];
if ($partinfo['uid']) $uid=$partinfo['uid'];
if ($partinfo['partnum']) $partnum=$partinfo['partnum'];
if ($partinfo['sernum']) $sernum=$partinfo['sernum'];
if ($partinfo['partname']) $partname=$partinfo['partname'];
}
}
if ($mfadd) {
if ($mfsubmit) {
// add the entry if submit is pressed
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
// determine whether supplied date is future or past
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$mfdate\",CURRENT_DATE)"));
// if future, set time to 00:00:01, if past, set to 23:59:59
if ($datediff[0]<0) {
$mftime="23:59:59:";
}
if ($datediff[0]>0) {
$mftime="00:00:01:";
}
// remove cruft from malfunction text
$mfmalfunction=htmlentities($mfmalfunction);
if (!get_magic_quotes_gpc()) {
$mfmalfunction=addslashes($mfmalfunction);
}
if ($mfauthorized) {
$partdatainput=array();
if ($uid) $partdatainput['uid']=$uid;
if ($partnum) $partdatainput['partnum']=$partnum;
if ($sernum) $partdatainput['sernum']=$sernum;
$partinfo=get_part_data($partdatainput);
// add to parts table
if ($partinfo['result']==1) {
// if this part has not been seen before, add it to the parts table and get partid
mysqli_query($db,"insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
$mfpart=mysqli_insert_id($db);
} else if ($partinfo['result']==2) {
$pdatamismatch=1;
} else {
// if it is in parts table, get partid for this record
$mfpart=$partinfo['partid'];
}
if ($uid =="" || $partnum == "" || $sernum == "") {
// have the maintenance form stay pending due to incomplete part data
$pending=1;
}
// add the record to maintforms
if (! $pdatamismatch) {
mysqli_query($db,"insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
$newmaintformid=mysqli_insert_id($db);
$mfidtoprint=$newmaintformid;
// add this maintformid to the appropriate flag_tables
foreach ($flags as $flagtblnum) {
$flagtblname="flag_".$flagtblnum;
mysqli_query($db,"insert into $flagtblname(target,id) values(\"maintforms\",\"$newmaintformid\")");
}
}
}
}
}
}
if ($mfedit) {
$mfidtoprint=$maintformid;
if ($mfsubmit && $mfauthorized) {
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
// remove cruft from malfunction text
$mfmalfunction=htmlentities($mfmalfunction);
if (!get_magic_quotes_gpc()) {
$mfmalfunction=addslashes($mfmalfunction);
}
// update parts table
if ($uid =="" || $partnum == "" || $sernum == "") {
// have the maintenance form stay pending due to incomplete part data
$pending=1;
}
if (! $pdatamismatch) {
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\"");
}
// update the record in maintforms
if (! $pdatamismatch) {
mysqli_query($db,"update maintforms set mfdate=\"$mfdate\", mftime=\"$mftime\", mfpart=\"$mfpart\", mfpartloc=\"$mfpartloc\",
mfmalfunction=\"$mfmalfunction\", nha=\"$nha\", repord=\"$repord\", lognoteid=\"$lognoteid\", pending=\"$pending\" where maintformid=\"$maintformid\"");
// update the appropriate flag_tables
$flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0];
if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"maintforms\" and id=\"$maintformid\""))) {
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"maintforms\",\"$maintformid\")");
}
} else {
if(mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"maintforms\" and id=\"$maintformid\""))) {
mysqli_query($db,"delete from $thisflag_tbl where target=\"maintforms\" and id=\"$maintformid\"");
}
}
}
}
}
}
// refresh the maintenance form in question from the database
$mftoedit=getmfdata($maintformid);
}
if ($mfdelete && $mfauthorized) {
// delete from maintforms table
mysqli_query($db,"delete from maintforms where maintformid=\"$maintformid\"");
// delete occurances from the flag_ tables
$flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) {
$delflag_tbl="flag_".$thisflagid[0];
mysqli_query($db,"delete from $delflag_tbl where target=\"maintforms\" and id=\"$maintformid\"");
}
}
if ($actionadd) {
if ($actionaddsubmit) {
if ($action) {
// determine whether supplied date is future or past
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$actiondate\",CURRENT_DATE)"));
// if future, set time to 00:00:01, if past, set to 23:59:59
if ($datediff[0]<0) {
$actiontime="23:59:59:";
}
if ($datediff[0]>0) {
$actiontime="00:00:01:";
}
// remove cruft from action text
$action=htmlentities($action);
if (!get_magic_quotes_gpc()) {
$action=addslashes($action);
}
// add to maintactions table
mysqli_query($db,"insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
values (\"$actiondate\",\"$actiontime\",\"$maintformid\",\"$loggedinas\",\"$action\")");
echo mysqli_error($db);
}
}
}
if ($actionedit) {
if ($actioneditsubmit && $actionauthorized) {
// update the action
// remove cruft from action text
$action=htmlentities($action);
if (!get_magic_quotes_gpc()) {
$action=addslashes($action);
}
// update maintactions table
mysqli_query($db,"update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\"");
}
// refresh the action in question from the database
$actiontoedit=getactiondata($maintactionid);
}
if ($actiondelete && $actionauthorized) {
// delete the action
mysqli_query($db,"delete from maintactions where maintactionid=\"$maintactionid\"");
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
// display the form
if ($mfadd || $actionadd) {
$mfdate=$today;
$mftime=$now;
$actiondate=$today;
$actiontime=$now;
}
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) {
$mfdate=$mftoedit["mfdate"];
$mftime=$mftoedit["mftime"];
$mfpart=$mftoedit["mfpart"];
$mfpartloc=$mftoedit["mfpartloc"];
$mfmalfunction=$mftoedit["mfmalfunction"];
$nha=$mftoedit["nha"];
$repord=$mftoedit["repord"];
$lognoteid=$mftoedit["lognoteid"];
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) $mftech=$mftoedit["mftech"];
if (! $mftime) $mftime=$now;
}
if (($mfedit || $actionadd || $actionedit) && ! ($mfsubmit || $actionaddsubmit || $actioneditsubmit)) {
$partinfo=array();
$partinfoinput['partid']=$mfpart;
$partinfo=get_part_data($partinfoinput);
$mfpart=$partinfo['partid'];
$uid=$partinfo['uid'];
$partnum=$partinfo['partnum'];
$sernum=$partinfo['sernum'];
$partname=$partinfo['partname'];
$pluresult=$partinfo['result'];
if ($pluresult==2) $pdatamismatch=1; else unset($pdatamismatch);
}
$techname=dblookup($db,"techs","techid","techname",$mftech);
if ($mfsubmit) {
if ($mfmalfunction) {
if (($uid || ($partnum && $sernum)) || $mfpart) {
if ($mfadd) {
format_message(0,"Maintenance Form added. You may enter another one or <a href=\"maintform.php\">return to Maintenance Forms page.</a>");
}
if ($mfedit) {
format_message(0,"Maintenance Form changed. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
}
} else {
format_message(1,"You didn't enter any part information. Please try again.");
}
} else {
format_message(1,"You didn't enter any malfunction description. Please try again.");
}
}
if ($mfdelete) {
format_message(0,"Maintenance Form Deleted. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
}
if ($pdatamismatch) {
$advtxt="
<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;
<b>Warning:</b> The $uidtext doesn't match the Part Number/Serial Number associated
with it in our database. Please ensure the part information
you entered is correct and try again. If you know it to be correct, please use
the <a href=\"parts.php\">Parts</a> page to correct the database.</b>
";
} else {
$advtxt="
<font size=\"-1\">You can enter a $uidtext or Part Number/Serial Number or both.</font>
";
}
if ($printfmt) {
// show entire maint form
echo "
<hr>
<table width=\"100%\" border=\"0\">
<tr><td align=\"center\"><font size=\"+1\"><b>Maintenance Form</b></font></td></tr>
</table>
<hr>
<table width=\"100%\" border=\"0\">
<tr><td><b>Form ID:</b><br> $maintformid </td><td><b>Date:</b><br> $mfdate </td><td><b>Time:</b><br> $mftime </td><td><b> Tech:</b><br> $techname </td><td><b>Log Note ID:</b><br> $lognoteid </td><td><b>Repair Order:</b><br> $repord </td></tr>
</table><hr>
<table width=\"100%\" border=\"0\">
<tr><td colspan=\"4\"><b><u>Part Data</u></b><br><br></td></tr>
<tr><td><b>$uidtext:</b><br> $uid </td><td><b>Part Number:</b><br> $partnum </td><td><b>Serial Number:</b><br> $sernum </td><td><b>Part Name:</b><br> $partname </td></tr>
<tr><td><b>Part Location:</b><br> $mfpartloc </td><td><b>Next Higher Assembly:</b><br> $nha </td></tr>
</table><hr>
<b><u>Malfuction Description</u></b><br>
<table width=\"100%\" border=\"0\">
<tr><td>$mfmalfunction</td></tr>
</table><br>
<b><u>Flags</u></b><br>
<table width=\"100%\" border=\"0\">
";
// get an array of flagids set for this maintformid
$allflags=mysqli_query($db,"select flagid from flags");
unset($theseflags);
while ($thisflag=mysqli_fetch_row($allflags)) {
$thisflagtbl="flag_".$thisflag[0];
if (mysqli_num_rows(mysqli_query($db,"select id from $thisflagtbl where target=\"maintforms\" and id=\"$maintformid\""))) {
$theseflags[]=$thisflag[0];
}
}
$flagslist=mysqli_query($db,"select * from flags");
while ($flagsymbol=mysqli_fetch_assoc($flagslist)) {
if (in_array($flagsymbol["flagid"],$theseflags)) {
echo $flagsymbol['flagsym']."&nbsp;&nbsp;";
}
}
echo "
</table><hr>
<b><u>Maintenance Actions</u></b><br>
";
$maintactionqry=mysqli_query($db,"select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
while ($actiontable=mysqli_fetch_assoc($maintactionqry)) {
$actiondate=$actiontable["actiondate"];
$actiontime=$actiontable["actiontime"];
$tname=dblookup($db,"techs","techid","techname",$actiontable["actiontech"]);
$actiontext=convertweblinks($actiontable["action"]);
// print the actions
echo "<table border=\"0\" cellpadding=\"5\">
<tr>
<td><b>Tech:</b>&nbsp;&nbsp;$tname</td>
<td><b>Date:</b>&nbsp;&nbsp;$actiondate</td>
<td><b>Time:</b>&nbsp;&nbsp;$actiontime</td>
</tr></table>
<table width=\"100%\" border=\"0\" cellpadding=\"5\">
<tr>
<td colspan=\"4\">$actiontext</td>
</tr>
</table>
<hr>
";
}
} else {
echo "
<form method=\"post\" action=\"maintformentry.php\">
<table class=\"mfentry\" border=\"0\" cellpadding=\"8\">
<tr>
<td valign=\"bottom\"><b>Date <br><font size=\"-1\">(YYYY-MM-DD):</font></b><br>
<input type=\"text\" name=\"date\" size=\"10\" maxlength=\"10\" id=\"singledatepicker\" value=\"$mfdate\"></td>
<td valign=\"bottom\"><b>Time:</b><br>
<input type=\"text\" name=\"time\" size=\"8\" maxlength=\"8\" value=\"$mftime\"></td>
<td valign=\"bottom\"><b>Tech:</b><br>
$techname</td>
<td valign=\"bottom\"><b>Log Note ID:</b><br>
<input type=\"text\" name=\"lognoteid\" size=\"8\" value=\"$lognoteid\"></td>
</tr>
</table>
<table class=\"mfentry\" border=\"0\" cellpadding=\"8\">
<tr>
<td class=\"forcewrap\" colspan=\"3\"><font size=\"-1\">$advtxt</td>
</tr>
<input type=\"hidden\" name=\"mfpart\" value=\"$mfpart\">
<tr>
<td valign=\"bottom\"><b>$uidtext:</b><br>
<input type=\"text\" name=\"uid\" size=\"8\" value=\"$uid\"></td>
<td valign=\"bottom\"><b>Part Number:</b><br>
<input type=\"text\" name=\"partnum\" size=\"20\" value=\"$partnum\"></td>
<td valign=\"bottom\"><b>Serial Number:</b><br>
<input type=\"text\" name=\"sernum\" size=\"20\" value=\"$sernum\"></td>
</tr><tr>
<td colspan=\"3\" valign=\"bottom\"><b>Part Name:</b><br>
<input type=\"text\" name=\"partname\" size=\"80\" value=\"$partname\"></td>
</tr><tr>
<td valign=\"bottom\"><b>Part Location:</b><br>
<input type=\"text\" name=\"mfpartloc\" size=\"20\" value=\"$mfpartloc\"></td>
<td valign=\"bottom\"><b>Next Higher Assembly:</b><br>
<input type=\"text\" name=\"nha\" size=\"20\" value=\"$nha\"></td>
<td valign=\"bottom\"><b>Repair Order:</b><br>
<input type=\"text\" name=\"repord\" size=\"12\" value=\"$repord\"></td>
</tr></table>
<hr>
<table border=\"0\" cellpadding=\"8\">
<tr><td><b>Malfunction Description:</b></td></tr>
<tr><td><textarea rows=\"4\" cols=\"65\" name=\"mfmalfunction\" wrap=\"soft\">$mfmalfunction</textarea></td></tr>
<tr><td>
";
// get an array of flagids set for this maintformid
$allflags=mysqli_query($db,"select flagid from flags");
unset($theseflags);
$theseflags=[];
while ($thisflag=mysqli_fetch_row($allflags)) {
$thisflagtbl="flag_".$thisflag[0];
if (mysqli_num_rows(mysqli_query($db,"select id from $thisflagtbl where target=\"maintforms\" and id=\"$maintformid\""))) {
$theseflags[]=$thisflag[0];
}
}
if ($mfadd) {
$flagslist=mysqli_query($db,"select * from flags where status=1");
} else {
$flagslist=mysqli_query($db,"select * from flags");
}
$flagsperline=8;
$flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if (in_array($flagcheckbox["flagid"],$theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
} else {
$flagid=$flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
}
}
if ($flagcount<$flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount=1;
}
}
echo "
</td></tr>
<tr><td>
";
if ($mfadd) {
if ($mfauthorized) {
echo "
<input type=\"hidden\" name=\"mfadd\" value=\"1\">
<input type=\"submit\" name=\"mfsubmit\" value=\"Submit Maintenance Form\">
</td></tr>
";
}
if ($mfsubmit) {
echo "
<tr><td><a href=\"maintformentry.php?printfmt=1&maintformid=$mfidtoprint\" target=\"_blank\">Print This Maintenance Form</a></td></tr>
";
}
echo "</table><br>";
} else {
if ($mfauthorized) {
echo "
<table border=\"0\">
<tr>
<td valign=\"top\">
<input type=\"hidden\" name=\"mfedit\" value=\"1\">
<input type=\"hidden\" name=\"maintformid\" value=\"$maintformid\">
<input type=\"submit\" name=\"mfsubmit\" value=\"Change This Maintenance Form\">
</td><td valign=\"top\">
<input type=\"submit\" name=\"mfdelete\" value=\"Delete This Maintenance Form\"><font color=\"#FF0000\"><br><b>Deleted maintenance forms are irretrievable!</b></font>
</td></tr>
<tr><td><a href=\"maintformentry.php?printfmt=1&maintformid=$mfidtoprint\" target=\"_blank\">Print This Maintenance Form</a></td></tr>
</table>
";
} else {
echo "
<br>Only the owner of a maintenance form or an administrator can delete it.<br><br>
<input type=\"hidden\" name=\"maintformid\" value=\"$maintformid\">
<a href=\"maintformentry.php?printfmt=1&maintformid=$mfidtoprint\" target=\"_blank\">Print This Maintenance Form</a>
";
}
echo "
</td></tr></table>
";
}
echo "
</form>
<hr>
<form method=\"post\" action=\"maintformentry.php?maintformid=$maintformid\">";
if ($actionadd || $actionedit) {
// show the action form
if ($actionadd) {
$matime=$now;
$actiontext="";
$actiontech=$loggedinas;
} else if ($actionedit) {
$actiontext=$actiontoedit['action'];
$actiontech=$actiontoedit['actiontech'];
$actiondate=$actiontoedit['actiondate'];
$actiontime=$actiontoedit['actiontime'];
}
$tname=dblookup($db,"techs","techid","techname",$actiontech);
echo "<table width=\"70\" border=\"0\" cellpadding=\"5\">
<tr>
<td>Tech:&nbsp;&nbsp;$tname
<input type=\"hidden\" name=\"actiontech\" value=\"$actiontech\">
</td>
<td><Date <font size=\"-1\">(YYYY-MM-DD):</font> &nbsp;
<input type=\"text\" name=\"actiondate\" size=\"10\" maxlength=\"10\" value=\"$actiondate\">
</td>
<td>Time: &nbsp;
<input type=\"text\" name=\"actiontime\" size=\"8\" maxlength=\"8\" value=\"$actiontime\">
</td>
</tr>
<tr>
<td colspan=\"3\">Action Taken:<br>
<textarea rows=\"4\" cols=\"65\" name=\"action\" wrap=\"soft\">$actiontext</textarea>
</td>
</tr>
</table><br>
";
if ($actionadd) {
echo "
<input type=\"hidden\" name=\"actionadd\" value=\"1\">
<input type=\"submit\" name=\"actionaddsubmit\" value=\"Add This Action\">
<hr>
";
} else if ($actionedit) {
echo "
<input type=\"hidden\" name=\"maintformid\" value=\"$maintformid\">
<input type=\"hidden\" name=\"maintactionid\" value=\"$maintactionid\">
<input type=\"hidden\" name=\"actionedit\" value=\"1\">
<input type=\"submit\" name=\"actioneditsubmit\" value=\"Change This Action\">
";
}
echo "
<br><br>
";
}
echo "<b>Maintenance Actions</b>&nbsp;&nbsp;&nbsp;&nbsp;";
if ($_SESSION['login'] && $maintformid) echo "<input type=\"submit\" name=\"actionadd\" value=\"Add New Action\">";
echo "<br><br>";
$maintactionqry=mysqli_query($db,"select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
while ($actiontable=mysqli_fetch_assoc($maintactionqry)) {
$maintactionid=$actiontable["maintactionid"];
$actiondate=$actiontable["actiondate"];
$actiontime=$actiontable["actiontime"];
$maintformnum=$actiontable["maintformnum"];
$tname=dblookup($db,"techs","techid","techname",$actiontable["actiontech"]);
$actiontext=convertweblinks($actiontable["action"]);
// print the table
echo "<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr><td>
";
if (($loggedinas==$actiontable["actiontech"]) || $isadmin) {
echo "
<a href=\"maintformentry.php?maintformid=$maintformid&actionedit=1&maintactionid=$maintactionid\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this action\" alt=\"Edit this action\"></a>&nbsp;&nbsp;
<a href=\"maintformentry.php?maintformid=$maintformid&actiondelete=1&maintactionid=$maintactionid\"><img src=\"icons/minus-button.png\" border=\"0\" title=\"Delete this action\" alt=\"Delete this action\"></a>
";
} else {
echo "
<img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Only the owner or an admin can edit an action\" alt=\"Only the owner or an admin can edit an action\">
<img src=\"icons/minus-button.png\" border=\"0\" title=\"Only the owner or an admin can delete an action\" alt=\"Only the owner or an admin can delete an action\">
";
}
echo "
</td>
<td>Tech:&nbsp;&nbsp;$tname</td>
<td>Date:&nbsp;&nbsp;$actiondate</td>
<td>Time:&nbsp;&nbsp;$actiontime</td>
</tr>
<tr>
<td colspan=\"4\">$actiontext</td>
</tr>
</table><br>
";
}
echo "
</form>
";
}
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

176
distfiles/partentry.php Normal file
View File

@@ -0,0 +1,176 @@
<?php
/*
partentry.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (!isset($_SESSION['login'])) {
header ("Location: login.php");
}
$loggedinas=$_SESSION['login'];
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
$print=$_REQUEST['print'];
$add=$_REQUEST['add'];
$edit=$_REQUEST['edit'];
$delete=$_REQUEST['delete'];
$partid=$_REQUEST['partid'];
$uid=$_REQUEST['uid'];
$partnum=$_REQUEST['partnum'];
$sernum=$_REQUEST['sernum'];
$partname=$_REQUEST['partname'];
$submit=$_REQUEST['submit'];
$logname=LOG_NAME;
$uidtext=UID_TEXT;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
if ($edit || $delete) {
framework("begin","$logname","Part Edit",$print);
} else {
$add=1;
framework("begin","$logname","Part Entry",$print);
}
// ******** begin database manipulation ********
//var_dump($_REQUEST);
if ($add) {
if ($submit) {
// add the entry if submit is pressed
if ($uid || ($partnum && $sernum)) {
$partexists=mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uid\" or (partnum=\"$partnum\" and sernum=\"$sernum\")"));
if (! $partexists) {
// add to parts table
mysqli_query($db,"insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
$partid=mysqli_insert_id($db);
}
}
}
}
if ($edit) {
if ($submit) {
if ($uid || ($partnum && $sernum)) {
// update parts table
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$partid\"");
}
}
}
if ($delete) {
// check for occurrence in logparts table
$inlogparts=mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where partid=\"$partid\""));
// check for occurrence in maintforms table
$inmaintforms=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mfpart=\"$partid\""));
// delete from parts table
if(!$inlogparts && !$inmaintforms) {
mysqli_query($db,"delete from parts where partid=\"$partid\"");
}
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
// display the form
$partdatainput=array();
$partdatainput['partid']=$partid;
$partinfo=get_part_data($partdatainput);
if ($partinfo['result']==2) {
$pdatamismatch=1;
} else {
unset($pdatamismatch);
if ($partinfo['uid']) $uid=$partinfo['uid'];
if ($partinfo['partnum']) $partnum=$partinfo['partnum'];
if ($partinfo['sernum']) $sernum=$partinfo['sernum'];
if ($partinfo['partname']) $partname=$partinfo['partname'];
}
if ($delete) {
if ($inmaintforms) {
echo "<br><img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Part has a maintenance form and cannot be deleted.<br><br>";
} elseif ($inlogparts) {
echo "<br><img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Part is referenced in a log note and cannot be deleted.<br><br>";
} else {
echo "<br>Part successfully deleted. <a href=\"parts.php\">Return to Parts</a>.<br>";
}
} else {
if ($submit) {
if ($add) {
if ($partexists) {
echo "<br><img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Part cannot be added because it already exists.<br><br>";
} else {
echo "<br>Part successfully added. <a href=\"parts.php\">Return to Parts</a>.<br>";
}
}
if ($edit) {
echo "<br>Part successfully modified. <a href=\"parts.php\">Return to Parts</a>.<br>";
}
}
echo "
<form method=\"post\" action=\"partentry.php\">
<table class=\"mfentry\" border=\"0\" cellpadding=\"8\">
<input type=\"hidden\" name=\"partid\" value=\"$partid\">
<tr>
<td valign=\"bottom\"><b>$uidtext:</b><br>
<input type=\"text\" name=\"uid\" size=\"8\" value=\"$uid\"></td>
<td valign=\"bottom\"><b>Part Number:</b><br>
<input type=\"text\" name=\"partnum\" size=\"20\" value=\"$partnum\"></td>
<td valign=\"bottom\"><b>Serial Number:</b><br>
<input type=\"text\" name=\"sernum\" size=\"20\" value=\"$sernum\"></td>
</tr><tr>
<td colspan=\"2\" valign=\"bottom\"><b>Part Name:</b><br>
<input type=\"text\" name=\"partname\" size=\"40\" value=\"$partname\"></td>
</tr>
</table>
<hr>
";
if ($add) {
echo "
<table border=\"0\">
<input type=\"hidden\" name=\"add\" value=\"1\">
<input type=\"submit\" name=\"submit\" value=\"Add Part\">
</td></tr></table><br>";
} else {
echo "
<table border=\"0\" cellpadding=\"10\">
<tr>
<td valign=\"top\">
<input type=\"hidden\" name=\"edit\" value=\"1\">
<input type=\"hidden\" name=\"partid\" value=\"$partid\">
<input type=\"submit\" name=\"submit\" value=\"Modify Part Data\">
</td><td valign=\"top\">
<input type=\"submit\" name=\"delete\" value=\"Delete This Part\"><font color=\"#FF0000\"><br><b>Deleted parts are irretrievable!</b></font>
</td></tr>
</table>
";
}
}
echo "
</form>
";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

123
distfiles/parts.php Normal file
View File

@@ -0,0 +1,123 @@
<?php
/*
parts.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (isset($_SESSION['login'])) {
$loggedin=1;
} else {
unset($loggedin);
}
$print=$_REQUEST['print'];
$add=$_REQUEST['add'];
$sort=$_REQUEST['sort'];
$order=$_REQUEST['order'];
$logname=LOG_NAME;
$uidtext=UID_TEXT;
if ($add) {
header ("Location: partentry.php?add=1");
}
if (! $sort) $sort="uid";
if ($order == "asc") {
$order="desc";
} else if ($order == "desc") {
$order="asc";
} else {
$order="asc";
}
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$logname","Parts",$print);
pagetable("begin");
if(!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
if ($loggedin) {
echo "
<br><form method=\"post\" action=\"partentry.php\">
<input type=\"submit\" name=\"add\" value=\"Add New Part\">
</form><br>
";
}
echo "
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr>
<th><a href=\"parts.php?sort=uid&order=$order\" title=\"Sort by $uidtext\">$uidtext</a></th>
<th><a href=\"parts.php?sort=partnum&order=$order\" title=\"Sort by Part Number\">Part Number</a></th>
<th><a href=\"parts.php?sort=sernum&order=$order\" title=\"Sort by Serial Number\">Serial Number</a></th>
<th><a href=\"parts.php?sort=partname&order=$order\" title=\"Sort by Part Name\">Part Name</a></th>
</tr>
";
$partqry=mysqli_query($db,"select * from parts order by $sort $order");
while ($partline=mysqli_fetch_assoc($partqry)) {
if (!$partline['uid']) {
$pluidtxt="none";
} else {
$pluidtxt=$partline['uid'];
}
if ($loggedin) {
printf("
<tr>
<td>
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partline['partid'],$pluidtxt,
$partline['partnum'],
$partline['sernum'],
$partline['partname']
);
} else {
printf("
<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$pluidtxt,
$partline['partnum'],
$partline['sernum'],
$partline['partname']
);
}
echo "
</tr>
";
}
echo "
</table>
";
echo "<br><br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

298
distfiles/profile.php Normal file
View File

@@ -0,0 +1,298 @@
<?php
/*
profile.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (!isset($_SESSION['login'])) {
header ("Location: login.php");
}
$techid=$_SESSION['login'] ?? NULL;
$print=$_REQUEST['print'] ?? NULL;
$table=$_REQUEST['table'] ?? NULL;
$updateinfo=$_REQUEST['updateinfo'] ?? NULL;
$updatedisplay=$_REQUEST['updatedisplay'] ?? NULL;
$setcolor=$_REQUEST['setcolor'] ?? NULL;
$name=$_REQUEST['name'] ?? NULL;
$pass=$_REQUEST['pass'] ?? NULL;
$passconf=$_REQUEST['passconf'] ?? NULL;
$shift=$_REQUEST['shift'] ?? NULL;
$display_urlchunk=$_REQUEST['display_urlchunk'] ?? NULL;
$display_showts=$_REQUEST['display_showts'] ?? NULL;
$display_techalpha=$_REQUEST['display_techalpha'] ?? NULL;
$display_subjalpha=$_REQUEST['display_subjalpha'] ?? NULL;
$display_logstyle=$_REQUEST['display_logstyle'] ?? NULL;
$modcolor=$_REQUEST['modcolor'] ?? NULL;
$hexcolor=$_REQUEST['hexcolor'] ?? NULL;
$resetcustom=$_REQUEST["resetcustom"] ?? NULL;
$logname=LOG_NAME;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$logname","My Profile",$print);
pagetable("begin");
if(!$print){
pageblock("left","begin");
// ******** begin database manipulation ********
if ($updateinfo) {
// name shift password settings
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
} else {
$namesuppld=0;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\""))) {
$nameunique=0;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique=1;
}
} else {
$nameunique=1;
}
// test for matching passwords
if ($pass!="password_is_unchanged") {
if ($pass==$passconf) {
$passmatch=1;
$passhash=password_hash($pass,PASSWORD_DEFAULT);
$namepassupdqry=("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
} else {
$passmatch=0;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
} else {
$passmatch=1;
$namepassupdqry="update techs set techname=\"$name\" where techid=\"$techid\"";
}
if ($namesuppld && $nameunique && $passmatch) {
mysqli_query($db,$namepassupdqry);
mysqli_query($db,"update techs set shift=\"$shift\" where techid=\"$techid\"");
}
}
if ($updatedisplay) {
// display settings
if ($display_showts) $display_showts=1; else $display_showts=0;
if ($display_techalpha=="a") $display_techalpha=1; else $display_techalpha=0;
if ($display_subjalpha=="a") $display_subjalpha=1; else $display_subjalpha=0;
// test for urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld=1;
} else {
$chunksuppld=0;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL chunk size cannot be blank.<br>";
}
if ($chunksuppld) {
putsetting('url_chunk_size',$display_urlchunk,$techid);
putsetting('show_ts',$display_showts,$techid);
putsetting('tech_alpha',$display_techalpha,$techid);
putsetting('subj_alpha',$display_subjalpha,$techid);
putsetting('log_style',$display_logstyle,$techid);
}
}
if ($setcolor) {
// color settings
$hexcolor="#".ltrim($hexcolor);
putsetting($modcolor,$hexcolor,$techid);
}
if ($resetcustom) mysqli_query($db,"delete from customs where customtech=\"$techid\"");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
// pull my current data from tables
$curname=dblookup($db,"techs","techid","techname",$techid);
$curshift=dblookup($db,"techs","techid","shift",$techid);
$pass=$passconf="password_is_unchanged";
// other values from customs
$curlchunk=getsetting('url_chunk_size',$techid)["value"];
$curts=getsetting('show_ts',$techid)["value"];
$curtdo=getsetting('tech_alpha',$techid)["value"];
$cursdo=getsetting('subj_alpha',$techid)["value"];
$curbgc=getsetting('background_color',$techid)["value"];
$cursbc=getsetting('sidebar_color',$techid)["value"];
$curmbgc=getsetting('menubg_color',$techid)["value"];
$curtc=getsetting('text_color',$techid)["value"];
$curlc=getsetting('link_color',$techid)["value"];
$curvlc=getsetting('vlink_color',$techid)["value"];
$curhc=getsetting('heading_color',$techid)["value"];
$curlogstyle=getsetting('log_style',$techid)["value"];
// show the form
echo "
<form method=\"post\" action=\"profile.php\">
<b>My Information</b><br><br>
<table border=\"0\">
<tr><td>
Tech Name (first and last name): &nbsp;<input type=\"text\" name=\"name\" size=\"40\" value=\"$curname\"><br><br>
Password: &nbsp;<input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass\"><br><br>
Repeat Password: &nbsp;<input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
<font size=\"-1\">Need a random password? &nbsp;</font>
";
$rpw=substr(str_shuffle(password_hash(microtime(),PASSWORD_DEFAULT)), 10, 12);
echo "
&nbsp; $rpw<br><br>
<b>Shift: </b>&nbsp;
<select name=\"shift\">
";
$shiftrow=mysqli_query($db,"select * from shifts");
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem["status"] == 1) {
if ($shiftitem["shiftid"]==$curshift) {
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
} else {
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
}
}
}
echo "
</select>
</td></tr>
</table>
<br>
<input type=\"submit\" name=\"updateinfo\" value=\"Update My Information\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset Form\"><br><br>
<hr>
<b>My Display Preferences</b><br><br>
Log style (the look of the log notes display): &nbsp;&nbsp;<select name=\"display_logstyle\">
";
$logstyleqry=mysqli_query($db,"select styleid,stylename from styles where styletype=\"logdisplay\"");
while ($logstylerow=mysqli_fetch_assoc($logstyleqry)) {
if ($logstylerow["styleid"]==$curlogstyle) {
printf("<option value=\"%s\" selected>%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
} else {
printf("<option value=\"%s\">%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
}
}
echo "
</select><br><br>
URL Chunk Size (long URLs will be linewrapped at this many characters):
&nbsp;<input type=\"text\" name=\"display_urlchunk\" size=\"3\" value=\"$curlchunk\"><br><br>
Show timestamps in log notes: &nbsp;&nbsp;
";
if ($curts) {
echo "<input type=\"checkbox\" name=\"display_showts\" checked>";
} else {
echo "<input type=\"checkbox\" name=\"display_showts\">";
}
echo "
<br><br>
Techs display order: &nbsp;&nbsp;
";
if ($curtdo) {
echo "
<input type=\"radio\" name=\"display_techalpha\" value=\"a\" checked>Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_techalpha\" value=\"d\">Database order
";
} else {
echo "
<input type=\"radio\" name=\"display_techalpha\" value=\"a\">Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_techalpha\" value=\"d\" checked>Database order
";
}
echo "
<br><br>
Subjects display order: &nbsp;&nbsp;
";
if ($cursdo) {
echo "
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\" checked>Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\">Database order
";
} else {
echo "
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\">Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\" checked>Database order
";
}
echo "
<br><br>
<input type=\"submit\" name=\"updatedisplay\" value=\"Update My Display Preferences\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset Form\"><br><br>
<hr>
<b>My Color Preferences</b><br><br>
";
switch($modcolor) {
case "background_color":
echo "<table border=\"0\"><tr><td>Page background color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=background_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "sidebar_color":
echo "<table border=\"0\"><tr><td>Sidebar color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=sidebar_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "menubg_color":
echo "<table border=\"0\"><tr><td>Menu background color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=menubg_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "text_color":
echo "<table border=\"0\"><tr><td>Normal text color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=text_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "link_color":
echo "<table border=\"0\"><tr><td>Link color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=link_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "vlink_color":
echo "<table border=\"0\"><tr><td>Visited link color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=vlink_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
case "heading_color":
echo "<table border=\"0\"><tr><td>Heading color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=heading_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
}
echo "
<b>Select the color you'd like to change</b><br><br>
<table border=\"1\" cellpadding=\"10\">
<tr><td><a href=\"profile.php?modcolor=background_color\">Page background color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curbgc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=sidebar_color\">Sidebar color</a></td><td bgcolor=\"$cursbc\"><font color=\"$curtc\">$cursbc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=menubg_color\">Menu background color</a></td><td bgcolor=\"$curmbgc\"><font color=\"$curlc\">$curmbgc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=text_color\">Normal text color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curtc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=link_color\">Link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curlc\">$curlc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=vlink_color\">Visited link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curvlc\">$curvlc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=heading_color\">Heading color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curhc\">$curhc</font></td></tr>
</table>
<br><hr>
<br>
<center><input type=\"submit\" name=\"resetcustom\" value=\"Reset All To Defaults\"></center>
</form>
";
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

103
distfiles/refchain.php Normal file
View File

@@ -0,0 +1,103 @@
<?php
/*
refchain.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$print=$_REQUEST['print'];
$chainnote=$_REQUEST['chainnote'];
$logname=LOG_NAME;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$logname","Reference Chain Display",$print);
// ******** begin database manipulation ********
$master=generate_chain($chainnote);
// ******** end database manipulation ********
pagetable("begin");
if(!$print){
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
// display the chain
$mptr=0;
echo "<br><br><table border=\"1\" width=\"100%\">";
echo "<tr><th>Note ID</th><th>Date &#47; Time</th><th>Shift</th><th>Tech</th><th>Subject</th><th>Note</th><th>References</th></tr>";
while($mptr<count($master)) {
if(mysqli_num_rows(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"))) {
$tablerow = mysqli_fetch_assoc(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"));
$noteid=$tablerow["lognoteid"];
$urldatestr="y=".date("Y",strtotime($tablerow["date"]))."&m=".date("m",strtotime($tablerow["date"]))."&d=".date("d",strtotime($tablerow["date"]));
$refs="&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$noteid\"><img src=\"icons/plus.png\" border=\"0\" alt=\"Add referring note\" title=\"Add referring note\"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"lognotes.php?$urldatestr\" title=\"View note in log\"><img src=\"icons/magnifier--arrow.png\"></a>";
// convert the shift number to a name
$shname=dblookup($db,"shifts","shiftid","shiftname",$tablerow["shift"]);
// convert tech number to name
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
//convert subject number to name
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
// create links of urls in note
$fmtnote=convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring="";
$allflagqry=mysqli_query($db,"select flagid from flags");
while ($allflagids=mysqli_fetch_row($allflagqry)) {
$flagid=$allflagids[0];
$flag_tbl="flag_".$flagid;
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$noteid\""))) {
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
$flagcolor=$flagparam["flagcolor"];
$flagsym=$flagparam["flagsym"];
$flagstring=$flagstring."<font color=\"$flagcolor\">$flagsym</font>&nbsp;&nbsp;";
}
}
if ($flagstring) $fmtnote=$fmtnote."<br>".$flagstring;
printf("
<tr>
<td><a href=\"logentry.php?edit=1&noteid=%s\">%s</a></td>
<td>%s &#47; %s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["date"],$tablerow["time"],
$shname,
$tname,
$subjname,
$fmtnote,
$refs);
} else {
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n",$master[$mptr]);
}
$mptr=$mptr+1;
}
echo "</table><br><br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

889
distfiles/schedmaint.php Normal file
View File

@@ -0,0 +1,889 @@
<?php
/*
blankpage.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
if (isset($_SESSION['login'])) {
$loggedin=true;
} else {
$loggedin=false;
}
$techid=$_SESSION['login'];
$isadmin=dblookup($db,"techs","techid","admin",$techid);
$upcoming=$_REQUEST['upcoming'];
$schedule=$_REQUEST['schedule'];
$tasks=$_REQUEST['tasks'];
$devices=$_REQUEST['devices'];
$action=$_REQUEST['action'];
$complete=$_REQUEST['complete'];
$defer=$_REQUEST['defer'];
$add=$_REQUEST['add'];
$edit=$_REQUEST['edit'];
$update=$_REQUEST['update'];
$delete=$_REQUEST['delete'];
$id=$_REQUEST['id'];
$active_flag=$_REQUEST['active_flag'];
$devicename=$_REQUEST['devicename'];
$devicedesc=$_REQUEST['devicedesc'];
$group_flag=$_REQUEST['group_flag'];
$members=$_REQUEST['members'];
$weekdays_only=$_REQUEST['weekdays_only'];
$nextdue_relative=$_REQUEST['nextdue_relative'];
$taskname=$_REQUEST['taskname'];
$taskdesc=$_REQUEST['taskdesc'];
$frequency=$_REQUEST['frequency'];
$period=$_REQUEST['period'];
$refdoc_name=$_REQUEST['refdoc_name'];
$refdoc_url=$_REQUEST['refdoc_url'];
$deferred_flag=$_REQUEST['deferred_flag'];
$deferred_date=$_REQUEST['deferred_date'];
$start_date=$_REQUEST['start_date'];
$last_date=$_REQUEST['last_date'];
$task=$_REQUEST['task'];
$device=$_REQUEST['device'];
$deferuntil=$_REQUEST['deferuntil'];
$completedate=$_REQUEST['completedate'];
$addlognote=$_REQUEST['addlognote'];
$logname=LOG_NAME;
$print=$_REQUEST['print'];
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
// **** BEGIN DATABASE OPERATIONS ****
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$tomorrow=mysqli_fetch_row(mysqli_query($db,"select adddate((select current_date),1)"))[0];
$errorstack=array();
if ($action) {
if ($complete) {
// sanitize user input
$completedate=mysqli_real_escape_string($db,$completedate);
// update events
mysqli_query($db,"update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0000-00-00\" where eventid=\"$id\"");
if ($addlognote) {
$compltaskname=mysqli_fetch_row(mysqli_query($db,"select tasks.taskname from tasks,events where events.eventid=\"$id\" and tasks.taskid=events.task"))[0];
$compldevicename=mysqli_fetch_row(mysqli_query($db,"select devices.devicename from devices,events where events.eventid=\"$id\" and devices.deviceid=events.device"))[0];
$lognotestrg="Scheduled Maintenance task \"$compltaskname\" completed on device \"$compldevicename\".";
// redirect to logentry
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:logentry.php?schedmaintcomplete=1&note=$lognotestrg");
exit(0);
}
}
if ($defer) {
// update events
mysqli_query($db,"update events set deferred_flag=1, deferred_date=\"$deferuntil\" where eventid=\"$id\"");
}
}
if ($add) {
if ($schedule) {
// do error checking
// check for task selected
if ($task) {
$taskselected=true;
} else {
$taskselected=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;You didn't select a task.<br>";
}
// check for device selected
if ($device) {
$deviceselected=true;
} else {
$deviceselected=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;You didn't select a device.<br>";
}
// sanitize text data
$start_date=mysqli_real_escape_string($db,$start_date);
$last_date=mysqli_real_escape_string($db,$last_date);
$deferred_date=mysqli_real_escape_string($db,$deferred_date);
if ($taskselected && $deviceselected) {
// determine if device represents a group and break out individual devices
if (dblookup($db,"devices","deviceid","group_flag",$device)) {
$memberqry=mysqli_query($db,"select memberdevice from devicegroups where groupdevice=\"$device\"");
$memberlist=array();
while ($memberrow=mysqli_fetch_row($memberqry)) {
$memberlist[]=$memberrow[0];
}
} else {
$memberlist=array($device);
}
// run through the memberlist and modify the table
foreach ($memberlist as $memberdev) {
$addqry=("insert into events(task,device,start_date,last_date,deferred_flag,deferred_date,active_flag)
values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")");
mysqli_query($db,$addqry);
}
}
}
if ($tasks) {
// do error checking
// test for name supplied
if (strlen(trim($taskname))) {
$namesuppld=true;
} else {
$namesuppld=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Task name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select taskid from tasks where taskname=\"$taskname\""))) {
$nameunique=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Task name already exists.<br>";
} else {
$nameunique=true;
}
// sanitize text data
$taskname=mysqli_real_escape_string($db,$taskname);
$taskdesc=mysqli_real_escape_string($db,$taskdesc);
$refdoc_name=mysqli_real_escape_string($db,$refdoc_name);
$refdoc_url=mysqli_real_escape_string($db,$refdoc_url);
if ($namesuppld && $nameunique) {
// modify the table
$addqry=("insert into tasks(taskname,taskdesc,frequency,period,weekdays_only,nextdue_relative,refdoc_name,refdoc_url,active_flag)
values(\"$taskname\",\"$taskdesc\",\"$frequency\",\"$period\",\"$weekdays_only\",\"$nextdue_relative\",\"$refdoc_name\",\"$refdoc_url\",\"$active_flag\")");
mysqli_query($db,$addqry);
}
}
if ($devices) {
// do error checking
// test for name supplied
if (strlen(trim($devicename))) {
$namesuppld=true;
} else {
$namesuppld=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Device name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select deviceid from devices where devicename=\"$devicename\""))) {
$nameunique=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Device name already exists.<br>";
} else {
$nameunique=true;
}
// sanitize name and description
$devicename=mysqli_real_escape_string($db,$devicename);
$devicedesc=mysqli_real_escape_string($db,$devicedesc);
if ($namesuppld && $nameunique) {
// modify the table
$addqry=("insert into devices(devicename,devicedesc,group_flag,active_flag) values(\"$devicename\",\"$devicedesc\",\"$group_flag\",\"$active_flag\")");
mysqli_query($db,$addqry);
}
}
}
if ($edit) {
if ($schedule) {
if ($delete) {
// delete entity
mysqli_query($db,"delete from events where eventid=\"$id\"");
}
if ($update) {
// do error checking
// sanitize text data
$start_date=mysqli_real_escape_string($db,$start_date);
$last_date=mysqli_real_escape_string($db,$last_date);
$deferred_date=mysqli_real_escape_string($db,$deferred_date);
// update the tasks table
mysqli_query($db,"update events
set task=\"$task\",device=\"$device\",start_date=\"$start_date\",last_date=\"$last_date\",deferred_flag=\"$deferred_flag\",
deferred_date=\"$deferred_date\",active_flag=\"$active_flag\"
where eventid=\"$id\"");
}
}
if ($tasks) {
if ($delete) {
// check for scheduled maintenance for this entity
if (mysqli_num_rows(mysqli_query($db,"select eventid from events where task=\"$id\""))) {
$hasevents=true;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Task has been scheduled maintenance and cannot be deleted.<br>";
} else {
$hasevents=false;
}
if (!$hasevents) {
// delete entity
mysqli_query($db,"delete from tasks where taskid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($taskname))) {
$namesuppld=true;
} else {
$namesuppld=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Task name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select taskid from tasks where taskname=\"$taskname\" and taskid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db,"select taskid from tasks where taskname=\"$taskname\""))) {
$nameunique=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Task name already exists.<br>";
} else {
$nameunique=true;
}
} else {
$nameunique=true;
}
// sanitize text data
$taskname=mysqli_real_escape_string($db,$taskname);
$taskdesc=mysqli_real_escape_string($db,$taskdesc);
$refdoc_name=mysqli_real_escape_string($db,$refdoc_name);
$refdoc_url=mysqli_real_escape_string($db,$refdoc_url);
if ($namesuppld && $nameunique) {
// update the tasks table
mysqli_query($db,"update tasks
set taskname=\"$taskname\",taskdesc=\"$taskdesc\",frequency=\"$frequency\",period=\"$period\",weekdays_only=\"$weekdays_only\",
nextdue_relative=\"$nextdue_relative\",refdoc_name=\"$refdoc_name\",refdoc_url=\"$refdoc_url\",active_flag=\"$active_flag\"
where taskid=\"$id\"");
}
}
}
if ($devices) {
if ($delete) {
// check for scheduled maintenance for this device
if (mysqli_num_rows(mysqli_query($db,"select eventid from events where device=\"$id\""))) {
$hasevents=true;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Device has scheduled maintenance and cannot be deleted.<br>";
} else {
$hasevents=false;
}
if (!$hasevents) {
// delete entity
mysqli_query($db,"delete from devices where deviceid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($devicename))) {
$namesuppld=true;
} else {
$namesuppld=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Device name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select deviceid from devices where devicename=\"$devicename\" and deviceid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db,"select deviceid from devices where devicename=\"$devicename\""))) {
$nameunique=false;
$errorstack[]="<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Device name already exists.<br>";
} else {
$nameunique=true;
}
} else {
$nameunique=true;
}
// sanitize name and description
$devicename=mysqli_real_escape_string($db,$devicename);
$devicedesc=mysqli_real_escape_string($db,$devicedesc);
if ($namesuppld && $nameunique) {
// update the devices table
mysqli_query($db,"update devices set devicename=\"$devicename\",devicedesc=\"$devicedesc\",group_flag=\"$group_flag\",active_flag=\"$active_flag\" where deviceid=\"$id\"");
// update the devicegroups table
mysqli_query($db,"delete from devicegroups where groupdevice=\"$id\"");
if ($group_flag) {
foreach ($members as $member) {
mysqli_query($db,"insert into devicegroups(groupdevice,memberdevice) values(\"$id\",\"$member\")");
}
}
}
}
}
}
// **** END DATABASE OPERATIONS ****
framework("begin","$logname","Scheduled Maintenance",$print);
//var_dump($_REQUEST);
pagetable("begin");
pageblock("left","begin");
sidemenu();
pageblock("left","end");
pageblock("right","begin");
banner($print);
if ($loggedin) {
echo "
<form method=\"post\" action=\"schedmaint.php\">
<br><center>
<input type=\"submit\" name=\"upcoming\" value=\"View Upcoming\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"devices\" value=\"Manage Devices\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"tasks\" value=\"Manage Tasks\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"schedule\" value=\"Maintenance Schedule\">
</center><br><hr>
</form>
";
}
// display any errors from database operations
if (count($errorstack)) {
foreach($errorstack as $errorline) {
echo "$errorline<br>";
}
}
if ($action) {
// pull current values from database
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from events where eventid=$id"));
extract($currentvalues);
$taskname=dblookup($db,"tasks","taskid","taskname",$task);
$devicename=dblookup($db,"devices","deviceid","devicename",$device);
// display form to complete or defer
echo "
<table border=\"0\" cellpadding=\"20\"><tr><td><b> Task : </b>&nbsp; $taskname </td><td><b> Device : </b>&nbsp; $devicename </td></tr></table>
<hr><br>
<table border=\"0\" cellpadding=\"10\">
<tr><td>
<b>Complete Scheduled Maintenance</b><br><br>
<form method=\"post\" action=\"schedmaint.php?action=1\">
<table border=\"0\">
<tr><td>Date Completed: &nbsp; <input type=\"text\" name=\"completedate\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" value=\"$today\" title=\"Format: YYYY-MM-DD\"></td></tr>
<tr><td><input type=\"checkbox\" name=\"addlognote\" value=\"1\" checked>Add logbook note</td></tr>
</table><br>
<input type=\"hidden\" name=\"id\" value=\"$id\">
<input type=\"submit\" name=\"complete\" value=\"Complete\">
</td></tr></table>
<br><hr><br>
<table border=\"0\" cellpadding=\"10\">
<tr><td>
<b>Defer Scheduled Maintenance</b><br><br>
<form method=\"post\" action=\"schedmaint.php?action=1\">
<table border=\"0\">
<tr><td>Defer Until: &nbsp; <input type=\"text\" name=\"deferuntil\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" value=\"$tomorrow\" title=\"Format: YYYY-MM-DD\"></tr>
</table><br>
<input type=\"hidden\" name=\"id\" value=\"$id\">
<input type=\"submit\" name=\"defer\" value=\"Defer\">
</td></tr></table>
</form>
";
} else if ($schedule) {
// manage maintenance schedule
if ($edit) {
// set form options for editing
$sectiontitle="<b>Modify Event</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?schedule=1&edit=1\">";
$buttontags="
<input type=\"hidden\" name=\"id\" value=\"$id\">
<input type=\"submit\" name=\"update\" value=\"Update Event\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"delete\" value=\"Delete Event\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
";
// pull current values from database
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from events where eventid=$id"));
extract($currentvalues);
if ($active_flag) {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
} else {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\">";
}
if ($deferred_flag) {
$deferredtag="<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\" checked>";
} else {
$deferredtag="<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\">";
}
if ($start_date=="0000-00-00") $start_date=$today;
if ($last_date=="0000-00-00") $last_date="";
if ($deferred_date=="0000-00-00") $deferred_date="";
$deferuntiltag="<input type=\"text\" name=\"deferred_date\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" value=\"$deferred_date\" title=\"Format: YYYY-MM-DD\">";
$startdatetag="<input type=\"text\" name=\"start_date\" id=\"startdatepicker\" size=\"10\" maxlength=\"10\" value=\"$start_date\" title=\"Format: YYYY-MM-DD\">";
$lastdatetag="<input type=\"text\" name=\"last_date\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" value=\"$last_date\" title=\"Format: YYYY-MM-DD\">";
} else {
// set form options for add
$sectiontitle="<b>Add Scheduled Maintenance</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?schedule=1\">";
$buttontags="
<input type=\"submit\" name=\"add\" value=\"Schedule this task\">
";
// set default values
$deferredtag="<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\">";
$deferuntiltag="<input type=\"text\" name=\"deferred_date\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" title=\"Format: YYYY-MM-DD\">";
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
$startdatetag="<input type=\"text\" name=\"start_date\" id=\"startdatepicker\" size=\"10\" maxlength=\"10\" value=\"$today\" title=\"Format: YYYY-MM-DD\">";
$lastdatetag="<input type=\"text\" name=\"last_date\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" title=\"Format: YYYY-MM-DD\">";
}
// display form
echo "
<table border=\"0\"><tr>
<td><center>$sectiontitle</center>
$formtag
<table border=\"0\" cellpadding=\"10\">
<tr>
<td>Task: &nbsp;<select name=\"task\">
<option value=\"0\">Select a Task</option>
";
$taskrow=mysqli_query($db,"select * from tasks");
while ($taskitem=mysqli_fetch_assoc($taskrow)) {
if ($taskitem["active_flag"] == 1) {
if ($task==$taskitem["taskid"]) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$taskitem["taskid"],$taskitem["taskdesc"],$taskitem["taskname"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$taskitem["taskid"],$taskitem["taskdesc"],$taskitem["taskname"]);
}
}
}
echo "
</select></td>
<td>Device: &nbsp;<select name=\"device\">
<option value=\"0\">Select a Device</option>
";
$devicerow=mysqli_query($db,"select * from devices");
while ($deviceitem=mysqli_fetch_assoc($devicerow)) {
if ($deviceitem["active_flag"] == 1) {
if ($device==$deviceitem["deviceid"]) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$deviceitem["deviceid"],$deviceitem["devicedesc"],$deviceitem["devicename"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$deviceitem["deviceid"],$deviceitem["devicedesc"],$deviceitem["devicename"]);
}
}
}
echo "
</select></td>
</tr>
<tr>
<td>Start Date: &nbsp; $startdatetag </td><td>Last Completed Date: &nbsp; $lastdatetag </td>
</tr>
<tr>
<td>Defer this event: &nbsp; $deferredtag </td><td>Defer Until: &nbsp; $deferuntiltag </td>
</tr>
<tr>
<td>Active: &nbsp; $activetag </td>
</tr>
</table>
$buttontags
</form></td>
</tr>
</table>
<br><hr>
";
// show table of current schedule
$existingdata=mysqli_query($db,"select * from events");
echo "
<b>Existing Events</b>&nbsp;&nbsp;&nbsp;<font size=\"-1\">Click on the Event ID to edit.</font><br><br>
<table border=\"1\">
<tr><th>Event ID</th><th>Task</th><th>Device</th><th>Start Date</th><th>Last<br>Completed</th><th>Deferred</th><th>Deferred<br>Until<th>Active</th></tr>
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
extract($tablerow);
if ($start_date=="0000-00-00") $start_date=$today;
if ($last_date=="0000-00-00") $last_date="";
if ($deferred_date=="0000-00-00") $deferred_date="";
if ($active_flag) {
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
} else {
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
if ($deferred_flag) {
$deferredflag="<img src=\"icons/tick.png\" title=\"deferred\" alt=\"deferred\">";
} else {
$deferredflag="<img src=\"icons/cross.png\" title=\"not deferred\" alt=\"not deferred\">";
}
$taskdata=mysqli_fetch_assoc(mysqli_query($db,"select * from tasks where taskid=\"$task\""));
extract($taskdata,EXTR_PREFIX_ALL,"taskdata");
$devicedata=mysqli_fetch_assoc(mysqli_query($db,"select * from devices where deviceid=\"$device\""));
extract($devicedata,EXTR_PREFIX_ALL,"devicedata");
if ($taskdata_period=="once") {
$tasktitle="One-time event";
} else {
$tasktitle="Repeat every $taskdata_frequency $taskdata_period";
}
printf("
<tr>
<td><a href=\"schedmaint.php?schedule=1&edit=1&id=%s\">%s</a></td>
<td title=\"%s\">%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
</tr>",
$eventid,$eventid,
$tasktitle,$taskdata_taskname,
$devicedata_devicename,
$start_date,
$last_date,
$deferredflag,
$deferred_date,
$statdef);
}
echo "</table>";
} else if ($tasks) {
// manage tasks
if ($edit) {
// set form options for editing
$sectiontitle="<b>Modify Task</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?tasks=1&edit=1\">";
$buttontags="
<input type=\"hidden\" name=\"id\" value=\"$id\">
<input type=\"submit\" name=\"update\" value=\"Update Task\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"delete\" value=\"Delete Task\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
";
// pull current values from database
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from tasks where taskid=$id"));
extract($currentvalues);
$perioddef=$period;
if ($active_flag) {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
} else {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\">";
}
if ($weekdays_only) {
$wdotag="<input type=\"checkbox\" name=\"weekdays_only\" value=\"1\" checked>";
} else {
$wdotag="<input type=\"checkbox\" name=\"weekdays_only\" value=\"1\">";
}
if ($nextdue_relative) {
$nextduetag="<input type=\"radio\" name=\"nextdue_relative\" value=\"0\">Absolute&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"nextdue_relative\" value=\"1\" checked>Relative";
} else {
$nextduetag="<input type=\"radio\" name=\"nextdue_relative\" value=\"0\" checked>Absolute&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"nextdue_relative\" value=\"1\">Relative";
}
} else {
// set form options for add
$sectiontitle="<b>Add New Task</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?tasks=1\">";
$perioddef="once";
$frequency=1;
$buttontags="
<input type=\"submit\" name=\"add\" value=\"Add Task\">
";
// set default values
$wdotag="<input type=\"checkbox\" name=\"weekdays_only\" value=\"1\" checked>";
$nextduetag="<input type=\"radio\" name=\"nextdue_relative\" value=\"0\" checked>Absolute&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"nextdue_relative\" value=\"1\">Relative";
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
}
// display form
echo "
<table border=\"0\">
<tr><td>
<center>$sectiontitle</center>
$formtag
<table border=\"0\">
<tr><td>
Task Name: &nbsp;<input type=\"text\" name=\"taskname\" size=\"40\" value=\"$taskname\"><br><br>
Task Description:<br><textarea rows=\"4\" cols=\"60\" name=\"taskdesc\" wrap=\"soft\">$taskdesc</textarea><br><br>
<hr>
<center>Schedule</center><br>
Repeat every: &nbsp;<input type=\"text\" name=\"frequency\" size=\"3\" value=\"$frequency\">&nbsp;&nbsp;
<select name=\"period\">
";
$periodopts=array("once","days","weeks","months","years");
foreach ($periodopts as $periodchoice) {
if ($periodchoice==$perioddef) {
echo "<option selected>$periodchoice</option>";
} else {
echo "<option>$periodchoice</option>";
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;
Weekdays Only: &nbsp;{$wdotag}<br><br>
Due Date Calculation: &nbsp;<img src=\"icons/question.png\" title=\"Absolute: Next due date is calculated based on the last due date. Relative: Next due date is based on the last completed date.\">&nbsp;&nbsp;$nextduetag<br><br><hr>
Reference Documentation: &nbsp;<input type=\"text\" name=\"refdoc_name\" size=\"40\" value=\"$refdoc_name\"><br><br>
Reference Documentation URL:<br><textarea rows=\"2\" cols=\"60\" name=\"refdoc_url\" wrap=\"soft\">$refdoc_url</textarea><br><br>
Active: &nbsp;$activetag<br><br>
</td></tr>
</table>
$buttontags
</form>
</td></tr></table>
<br><hr>
";
// show table of current tasks
$existingdata=mysqli_query($db,"select * from tasks");
echo "
<b>Existing Tasks</b>&nbsp;&nbsp;&nbsp;<font size=\"-1\">Click on the Task Name to edit.</font><br><br>
<table border=\"1\">
<tr><th>Task Name</th><th>Task Description</th><th>Repeat Every</th><th>Due Date<br>Calculation</th><th>Weekdays<br>Only</th><th>Reference</th><th>Active</th></tr>
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
extract($tablerow);
if ($active_flag) {
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
} else {
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
if ($period=="once") {
$rptstrg="one time only";
} else {
$rptstrg="$frequency $period";
}
if ($nextdue_relative) {
$duecalc="Relative";
} else {
$duecalc="Absolute";
}
if ($refdoc_name) {
$refstrg="$refdoc_name";
if ($refdoc_url) {
$refstrg="<a href=\"$refdoc_url\" target=\"_blank\">$refdoc_name</a>";
}
} else {
$refstrg="";
}
if ($weekdays_only) {
$wdoflag="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
} else {
$wdoflag="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
<tr>
<td><a href=\"schedmaint.php?tasks=1&edit=1&id=%s\">%s</a></td>
<td>%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
<td align=\"center\">%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
</tr>",
$taskid,$taskname,
$taskdesc,
$rptstrg,
$duecalc,
$wdoflag,
$refstrg,
$statdef);
}
echo "</table>";
} else if ($devices) {
// manage devices
if ($edit) {
// set form options for editing
$sectiontitle="<b>Modify Device</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?devices=1&edit=1\">";
$buttontags="
<input type=\"hidden\" name=\"id\" value=\"$id\">
<input type=\"submit\" name=\"update\" value=\"Update Device\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"delete\" value=\"Delete Device\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
";
// pull current values from database
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from devices where deviceid=$id"));
extract($currentvalues);
if ($group_flag) {
$showgrouptable=true;
$grouptag="<input type=\"checkbox\" name=\"group_flag\" value=\"1\" checked>";
} else {
$showgrouptable=false;
$grouptag="<input type=\"checkbox\" name=\"group_flag\" value=\"1\">";
}
if ($active_flag) {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
} else {
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\">";
}
} else {
// set form options for add
$sectiontitle="<b>Add New Device</b><br><br>";
$formtag="<form method=\"post\" action=\"schedmaint.php?devices=1\">";
$showgrouptable=false;
$buttontags="
<input type=\"submit\" name=\"add\" value=\"Add Device\">
";
// set default values
$activetag="<input type=\"checkbox\" name=\"active_flag\" value=\"1\" checked>";
$grouptag="<input type=\"checkbox\" name=\"group_flag\" value=\"1\">";
}
// display form
echo "
$sectiontitle
$formtag
<table border=\"0\">
<tr><td>
Device Name: &nbsp;<input type=\"text\" name=\"devicename\" size=\"40\" value=\"$devicename\"><br><br>
Device Description: &nbsp;<textarea rows=\"2\" cols=\"60\" name=\"devicedesc\" wrap=\"soft\">$devicedesc</textarea><br><br>
<font title=\"Device is a container that represents a group of other devices.
First, check this box before adding or updating this device, then go back and edit it to select the devices it contains.\">
Device represents a group of devices:</font> &nbsp;$grouptag<br><br>
";
if ($showgrouptable) {
$existingdevs=mysqli_query($db,"select * from devices where deviceid!=$id and active_flag=\"1\"");
echo "
<b>Existing members of this group</b><br><br>
<table border=\"1\">
<tr><th>Device Name</th><th>Device Description</th><th>Member</th></tr>
";
while ($grouprow=mysqli_fetch_assoc($existingdevs)) {
extract($grouprow,EXTR_PREFIX_ALL,"gtbl");
if (mysqli_num_rows(mysqli_query($db,"select groupid from devicegroups where memberdevice=$gtbl_deviceid and groupdevice=$id"))) {
$memberdef="<input type=\"checkbox\" name=\"members[]\" value=\"$gtbl_deviceid\" checked>";
} else {
$memberdef="<input type=\"checkbox\" name=\"members[]\" value=\"$gtbl_deviceid\">";
}
printf("
<tr>
<td>%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
</tr>",
$gtbl_devicename,
$gtbl_devicedesc,
$memberdef);
}
echo "</table><br>";
}
echo "
Active: &nbsp;$activetag<br><br>
</td></tr>
</table>
$buttontags
</form>
<br><hr>
";
// show table of current devices
$existingdata=mysqli_query($db,"select * from devices");
echo "
<b>Existing Devices</b>&nbsp;&nbsp;&nbsp;<font size=\"-1\">Click on the Device ID to edit.</font><br><br>
<table border=\"1\">
<tr><th>Device ID</th><th>Device Name</th><th>Device Description</th><th>Group</th><th>Active</th></tr>
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
extract($tablerow);
if ($group_flag) {
$groupdef="<img src=\"icons/tick.png\" title=\"This is a group\" alt=\"This is a group\">";
} else {
$groupdef="<img src=\"icons/cross.png\" title=\"This is a single device\" alt=\"This is a single device\">";
}
if ($active_flag) {
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
} else {
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
<tr>
<td><a href=\"schedmaint.php?devices=1&edit=1&id=%s\">%s</a></td>
<td>%s</td>
<td>%s</td>
<td align=\"center\">%s</td>
<td align=\"center\">%s</td>
</tr>",
$deviceid,$deviceid,
$devicename,
$devicedesc,
$groupdef,
$statdef);
}
echo "</table>";
} else {
$ucevents=get_upcoming_events();
// sort the upcoming events
function uc_cmp($a,$b) { return strcmp($a["duedate"], $b["duedate"]); }
uasort($ucevents,'uc_cmp');
// show upcoming events table
echo "
<font size=\"+1\"><b>Upcoming Scheduled Maintenance</b></font><br><br>
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr>
<th>Next Due</th><th>Device</th><th>Maintenance</th><th>Last Done</th>
</tr>
";
foreach ($ucevents as $ucline) {
extract($ucline);
printf("
<tr>
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\">%s</a></td>
<td><font title=\"%s\">%s</font></td>
<td><font title=\"%s\">%s</font></td>
<td>%s</td>
</tr>",
$eventdata_eventid,$duedatestrg,
$devicedata_devicedesc,$devicedata_devicename,
$taskdata_taskdesc,$taskdata_taskname,
$lastdatestrg
);
}
echo "
</table>
<br><hr><br>
";
// build array of deferred events
$defeventsqry=mysqli_query($db,"select * from events where active_flag=\"1\" and deferred_flag=\"1\" and deferred_date > \"$today\" order by deferred_date asc");
$defevents=array();
while ($defeventrow=mysqli_fetch_assoc($defeventsqry)) {
// provide eventid,task,device,start_date,last_date,deferred_flag,deferred_date,active_flag
extract($defeventrow,EXTR_PREFIX_ALL,"def");
// provide deviceid,devicename,devicedesc,group_flag,active_flag
$devicedata=mysqli_fetch_assoc(mysqli_query($db,"select * from devices where deviceid=\"$def_device\""));
extract($devicedata,EXTR_PREFIX_ALL,"devicedata");
// provide taskid,taskname,taskdesc,frequency,period,weekdays_only,nextdue_relative,refdoc_name,refdoc_url,active_flag
$taskdata=mysqli_fetch_assoc(mysqli_query($db,"select * from tasks where taskid=\"$def_task\""));
extract($taskdata,EXTR_PREFIX_ALL,"taskdata");
if ( ! ($taskdata_period == "once" && $def_last_date > $def_start_date)) {
if ($def_last_date=="0000-00-00") {
$lastdatestrg="never";
} else {
$lastdatestrg="$def_last_date";
}
$defeventline=array(
'def_eventid'=>$def_eventid,
'def_deferred_date'=>$def_deferred_date,
'devicedata_devicedesc'=>$devicedata_devicedesc,
'devicedata_devicename'=>$devicedata_devicename,
'taskdata_taskdesc'=>$taskdata_taskdesc,
'taskdata_taskname'=>$taskdata_taskname,
'lastdatestrg'=>$lastdatestrg
);
$defevents[]=$defeventline;
}
}
// show deferred events table
echo "
<font size=\"+1\"><b>Deferred Scheduled Maintenance</b></font><br><br>
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr>
<th>Deferred Until</th><th>Device</th><th>Maintenance</th><th>Last Done</th>
</tr>
";
foreach ($defevents as $defline) {
extract($defline);
printf("
<tr>
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\"><font color=\"#FFA500\">%s</font></a></td>
<td><font title=\"%s\">%s</font></td>
<td><font title=\"%s\">%s</font></td>
<td>%s</td>
</tr>",
$def_eventid,$def_deferred_date,
$devicedata_devicedesc,$devicedata_devicename,
$taskdata_taskdesc,$taskdata_taskname,
$lastdatestrg
);
}
echo "
</table>
<br><hr>
";
}
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

815
distfiles/search.php Normal file
View File

@@ -0,0 +1,815 @@
<?php
/*
search.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$noprint=1;
if (isset($_SESSION['login'])) {
$loggedin=1;
} else {
unset($loggedin);
}
$print=$_REQUEST['print'] ?? NULL;
$search=$_REQUEST['search'] ?? NULL;
$srchnoteid=$_REQUEST['srchnoteid'] ?? NULL;
$srchmfid=$_REQUEST['srchmfid'] ?? NULL;
$srchbdate=$_REQUEST['srchbdate'] ?? NULL;
$srchedate=$_REQUEST['srchedate'] ?? NULL;
$srchshift=$_REQUEST['srchshift'] ?? NULL;
$srchtech=$_REQUEST['srchtech'] ?? NULL;
$srchsubj=$_REQUEST['srchsubj'] ?? NULL;
$srchtext=$_REQUEST['srchtext'] ?? NULL;
$srchuid=$_REQUEST['srchuid'] ?? NULL;
$srchpn=$_REQUEST['srchpn'] ?? NULL;
$srchsn=$_REQUEST['srchsn'] ?? NULL;
$srchpname=$_REQUEST['srchpname'] ?? NULL;
$srchploc=$_REQUEST['srchploc'] ?? NULL;
$srchnha=$_REQUEST['srchnha'] ?? NULL;
$srchrepord=$_REQUEST['srchrepord'] ?? NULL;
$srchflags=$_REQUEST['srchflags'] ?? NULL;
$target=$_REQUEST['target'] ?? NULL;
$doparts=PARTS_FUNCTIONS;
$logname=LOG_NAME;
$techalpha=TECH_ALPHA;
$subjalpha=SUBJ_ALPHA;
$uidtext=UID_TEXT;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$logname Search","Search",$print);
//var_dump($_REQUEST);
// ******** begin database manipulation ********
// get the date range of lognotes
$todaysdate = mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes");
$logdateresults=mysqli_fetch_row($logdateqry);
$logmindate=$logdateresults[0];
if ($logmindate == "") $logmindate = $todaysdate;
$logmaxdate=$logdateresults[1];
if ($logmaxdate == "") $logmaxdate = $todaysdate;
// get the date range of maintenance forms
$mfdateqry=mysqli_query($db,"select min(mfdate), max(mfdate) from maintforms");
$mfdateresults=mysqli_fetch_row($mfdateqry);
$mfmindate=$mfdateresults[0];
if ($mfmindate == "") $mfmindate = $todaysdate;
$mfmaxdate=$mfdateresults[1];
if ($mfmaxdate == "") $mfmaxdate = $todaysdate;
// determine entire date range
$mindate=min($logmindate, $mfmindate);
$maxdate=max($logmaxdate, $mfmaxdate);
if ($search) {
// strip whitespace from beginning and end of text fields
$srchtext=trim($srchtext);
$srchpname=trim($srchpname);
$srchploc=trim($srchploc);
$srchnha=trim($srchnha);
if (in_array("log",$target)) {
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$logfromtables[]="lognotes";
$logfromtables[]="maintforms";
$logconstraints[]="lognotes.lognoteid=maintforms.lognoteid and maintforms.maintformid=\"$srchmfid\"";
}
// date range
if ($srchbdate != "" && $srchedate != "") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.date between \"$srchbdate\" and \"$srchedate\"";
}
// shift
if ($srchshift !="0") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.shift=\"$srchshift\"";
}
// tech
if ($srchtech !="0") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.tech=\"$srchtech\"";
}
// subject
if ($srchsubj !="0") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.subject=\"$srchsubj\"";
}
// search text
if ($srchtext !="") {
$logfromtables[]="lognotes";
$logconstraints[]="lognotes.lognote like \"%$srchtext%\"";
}
// flags
if ($srchflags != NULL) {
foreach ($srchflags as $flagtblnum) {
$flagtblname="flag_{$flagtblnum}";
$logfromtables[]="lognotes";
$logfromtables[]=$flagtblname;
$logconstraints[]="lognotes.lognoteid={$flagtblname}.id and {$flagtblname}.target=\"lognotes\"";
}
}
// uid
if ($srchuid != "any" && $srchuid != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logfromtables[]="maintforms";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logfromtables[]="maintforms";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$logfromtables[]="lognotes";
$logfromtables[]="logparts";
$logfromtables[]="parts";
$logfromtables[]="maintforms";
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// build the clauses and run the query
$logfromclause=implode(",",array_unique($logfromtables));
$logwhereclause=implode(" and ",$logconstraints);
$logrowqry=mysqli_query($db,"select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
}
if (in_array("maintform",$target)) {
// maintforms search
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$mffromtables[]="maintforms";
$mffromtables[]="lognotes";
$mfconstraints[]="maintforms.lognoteid=lognotes.lognoteid and lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.maintformid=\"$srchmfid\"";
}
// date range
if ($srchbdate != "" && $srchedate != "") {
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.mfdate between \"$srchbdate\" and \"$srchedate\"";
}
// shift
if ($srchshift !="0") {
$mffromtables[]="maintforms";
$mffromtables[]="lognotes";
$mfconstraints[]="maintforms.lognoteid=lognotes.lognoteid and lognotes.shift=\"$srchshift\"";
}
// tech
if ($srchtech !="0") {
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.mftech=\"$srchtech\"";
}
// subject
if ($srchsubj !="0") {
$mffromtables[]="maintforms";
$mffromtables[]="lognotes";
$mfconstraints[]="maintforms.lognoteid=lognotes.lognoteid and lognotes.subject=\"$srchsubj\"";
}
// search text
if ($srchtext !="") {
$mffromtables[]="maintforms";
$mffromtables[]="maintactions";
$mfconstraints[]="maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
}
// flags
foreach ($srchflags as $flagtblnum) {
$flagtblname="flag_{$flagtblnum}";
$mffromtables[]="maintforms";
$mffromtables[]=$flagtblname;
$mfconstraints[]="maintforms.maintformid={$flagtblname}.id and {$flagtblname}.target=\"maintforms\"";
}
// uid
if ($srchuid != "any" && $srchuid != "") {
$mffromtables[]="maintforms";
$mffromtables[]="parts";
$mfconstraints[]="maintforms.mfpart=parts.partid and parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$mffromtables[]="maintforms";
$mffromtables[]="parts";
$mfconstraints[]="maintforms.mfpart=parts.partid and parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$mffromtables[]="maintforms";
$mffromtables[]="parts";
$mfconstraints[]="maintforms.mfpart=parts.partid and parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$mffromtables[]="maintforms";
$mffromtables[]="parts";
$mfconstraints[]="maintforms.mfpart=parts.partid and parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$mffromtables[]="parts";
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$mffromtables[]="parts";
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$mffromtables[]="parts";
$mffromtables[]="maintforms";
$mfconstraints[]="maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// build the clauses and run the query
$mffromclause=implode(",",array_unique($mffromtables));
$mfwhereclause=implode(" and ",$mfconstraints);
$mfrowqry=mysqli_query($db,"select maintforms.* from $mffromclause where $mfwhereclause order by maintforms.mfdate asc, maintforms.mftime asc");
}
if (in_array("part",$target)) {
// parts search
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$pfromtables[]="parts";
$pfromtables[]="logparts";
$pfromtables[]="lognotes";
$pconstraints[]="parts.partid=logparts.partid and logparts.lognoteid=lognotes.lognoteid and lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$pfromtables[]="parts";
$pfromtables[]="maintforms";
$pconstraints[]="parts.partid=maintforms.mfpart and maintforms.maintformid=\"$srchmfid\"";
}
// date range doesn't apply to parts
// shift doesn't apply to parts
// tech doesn't apply to parts
// subject doesn't apply to parts
// search text doesn't apply to parts
// flags doesn't apply to parts
// uid
if ($srchuid != "any" && $srchuid != "") {
$pfromtables[]="parts";
$pconstraints[]="parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$pfromtables[]="parts";
$pconstraints[]="parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$pfromtables[]="parts";
$pconstraints[]="parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$pfromtables[]="parts";
$pconstraints[]="parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$pfromtables[]="parts";
$pfromtables[]="maintforms";
$pconstraints[]="maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$pfromtables[]="parts";
$pfromtables[]="maintforms";
$pconstraints[]="maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$pfromtables[]="parts";
$pfromtables[]="maintforms";
$pconstraints[]="maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// build the clauses and run the query
$pfromclause=implode(",",array_unique($pfromtables));
$pwhereclause=implode(" and ",$pconstraints);
$prowqry=mysqli_query($db,"select parts.* from $pfromclause where $pwhereclause order by parts.uid asc");
}
}
// ******** end database manipulation ********
pagetable("begin");
if(!$print){
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
// display the form
if ($srchnoteid) $noteidval=$srchnoteid; else $noteidval="any";
if ($srchmfid) $mfidval=$srchmfid; else $mfidval="any";
if ($srchbdate) $bdateval=$srchbdate; else $bdateval=$mindate;
if ($srchedate) $edateval=$srchedate; else $edateval=$maxdate;
if ($srchshift) $shiftval=$srchshift; else $shiftval=0;
if ($srchtech) $techval=$srchtech; else $techval=0;
if ($srchsubj) $subjval=$srchsubj; else $subjval=0;
if ($srchtext) $textval=$srchtext; else $textval="";
if ($srchuid) $uidval=$srchuid; else $uidval="any";
if ($srchpn) $pnval=$srchpn; else $pnval="any";
if ($srchsn) $snval=$srchsn; else $snval="any";
if ($srchpname) $pnameval=$srchpname; else $pnameval="any";
if ($srchploc) $plocval=$srchploc; else $plocval="any";
if ($srchnha) $nhaval=$srchnha; else $nhaval="any";
if ($srchrepord) $repordval=$srchrepord; else $repordval="any";
if (!$print) {
echo "
<form method=post action=\"search.php\">
<b>Log Note ID:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchnoteid\" size=\"7\" value=\"$noteidval\" title=\"Only show results with this Logbook Note ID number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Maintenance Form ID:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchmfid\" size=\"7\" value=\"$mfidval\" title=\"Only show results with this Maintenance Form ID number\">
<br><br>
<b>Start Date:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchbdate\" size=\"10\" value=\"$bdateval\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>End Date:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchedate\" size=\"10\" value=\"$edateval\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">
<br><br>
<b>Shift:</b>&nbsp;&nbsp;<select name=\"srchshift\" title=\"Only show results with this shift\">
";
if ($shiftval==0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
$shiftrow=mysqli_query($db,"select * from shifts");
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem['shiftid']==$shiftval) {
printf("<option value=\"%s\" selected>%s</option>",$shiftitem['shiftid'],$shiftitem['shiftname']);
} else {
printf("<option value=\"%s\">%s</option>",$shiftitem['shiftid'],$shiftitem['shiftname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Tech:</b>&nbsp;&nbsp;<select name=\"srchtech\" title=\"Only show results with this tech\">
";
if ($techval==0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
if ($techalpha) $torder="techname"; else $torder="techid";
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
while ($techitem=mysqli_fetch_assoc($techrow)) {
if ($techitem['techid']==$techval) {
printf("<option value=\"%s\" selected>%s</option>",$techitem['techid'],$techitem['techname']);
} else {
printf("<option value=\"%s\">%s</option>",$techitem['techid'],$techitem['techname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Subject:</b>&nbsp;&nbsp;<select name=\"srchsubj\" title=\"Only show results with this subject\">
";
if ($subjval==0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
$subjrow=mysqli_query($db,"select * from subjects order by $sorder asc");
while ($subjitem=mysqli_fetch_assoc($subjrow)) {
if ($subjitem['subjectid']==$subjval) {
printf("<option value=\"%s\" selected>%s</option>",$subjitem['subjectid'],$subjitem['subjectname']);
} else {
printf("<option value=\"%s\">%s</option>",$subjitem['subjectid'],$subjitem['subjectname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
";
if ($doparts) {
echo "
<b>$uidtext:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchuid\" size=\"8\" value=\"$uidval\" title=\"Only show results associated with this $uidtext\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Number:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchpn\" size=\"20\" value=\"$pnval\" title=\"Only show results associated with this part number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Serial Number:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchsn\" size=\"20\" value=\"$snval\" title=\"Only show results associated with this serial number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
<b>Part Name:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchpname\" size=\"40\" value=\"$pnameval\" title=\"Only show results associated with this part name\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Location:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchploc\" size=\"20\" value=\"$plocval\" title=\"Only show results associated with this part location\">
<br><br>
<b>Next Higher Assembly:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchnha\" size=\"20\" value=\"$nhaval\" title=\"Only show results associated with this next higher assembly\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Repair Order:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchrepord\" size=\"12\" value=\"$repordval\" title=\"Only show results associated with this repair order number\">
<br><br>
";
}
echo "
<b>Text in Log Note, Discrepancy, or Maintenance Action:</b><br>
<textarea rows=\"3\" cols=\"70\" name=\"srchtext\" wrap=\"soft\" title=\"Only show results containing text similar to this\">$textval</textarea>
<br><br>
<b>Flags:</b>
";
$flagslist=mysqli_query($db,"select * from flags");
$flagsperline=8;
$flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if ($srchflags[0]=="") $srchflags=[];
if (in_array($flagcheckbox["flagid"],$srchflags)) {
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
} else {
$flagid=$flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
}
}
if ($flagcount<$flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount=1;
}
}
echo "
<br><br>
";
if ($doparts) {
echo "
<b>Search in:</b>&nbsp;&nbsp;
";
if (in_array("log", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\" checked>Logbook&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\">Logbook&nbsp;&nbsp;";
}
if (in_array("maintform", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\" checked>Maintenance Forms&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\">Maintenance Forms&nbsp;&nbsp;";
}
if (in_array("part", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\" checked>Parts&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\">Parts&nbsp;&nbsp;";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
} else {
echo "<input type=\"hidden\" name=\"target[]\" value=\"log\">";
}
echo "
<input type=\"submit\" name=\"search\" value=\"Search\">
";
if ($search) {
$allvars=http_build_query($_REQUEST);
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"search.php?print=1&$allvars\" target=\"_blank\">Print Search Results</a>
";
}
echo "
</form>
<hr>
";
} else {
echo "
<b>Log Note ID:</b>&nbsp;&nbsp; $noteidval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Maintenance Form ID:</b>&nbsp;&nbsp; $mfidval
<br><br>
<b>Start Date:</b>&nbsp;&nbsp; $bdateval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>End Date:</b>&nbsp;&nbsp; $edateval
<br><br>
<b>Shift:</b>&nbsp;&nbsp;
";
if ($shiftval==0) {
echo "any";
} else {
$shiftname=dblookup($db,"shifts","shiftid","shiftname",$shiftval);
echo "$shiftname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Tech:</b>&nbsp;&nbsp;
";
if ($techval==0) {
echo "any";
} else {
$techname=dblookup($db,"techs","techid","techname",$techval);
echo "$techname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Subject:</b>&nbsp;&nbsp;
";
if ($subjval==0) {
echo "any";
} else {
$subjname=dblookup($db,"subjects","subjectid","subjectname",$subjval);
echo "$subjname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
";
if ($doparts) {
echo "
<b>$uidtext:</b>&nbsp;&nbsp; $uidval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Number:</b>&nbsp;&nbsp; $pnval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Serial Number:</b>&nbsp;&nbsp; $snval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
<b>Part Name:</b>&nbsp;&nbsp; $pnameval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Location:</b>&nbsp;&nbsp; $plocval
<br><br>
<b>Next Higher Assembly:</b>&nbsp;&nbsp; $nhaval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Repair Order:</b>&nbsp;&nbsp; $repordval
<br><br>
";
}
echo "
<b>Text in Log Note, Discrepancy, or Maintenance Action:</b><br>
$textval
<br><br>
<b>Flags:</b>
";
$flagslist=mysqli_query($db,"select * from flags");
$flagsperline=8;
$flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if (in_array($flagcheckbox["flagid"],$srchflags)) {
printf("<font color=\"%s\">%s</font>",
$flagcheckbox["flagcolor"],$flagcheckbox["flagsym"]);
}
if ($flagcount<$flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount=1;
}
}
echo "
<br><br>
";
if ($doparts) {
echo "
<b>Search in:</b>&nbsp;&nbsp;
";
if (in_array("log", $target)) {
echo "Logbook&nbsp;&nbsp;";
}
if (in_array("maintform", $target)) {
echo "Maintenance Forms&nbsp;&nbsp;";
}
if (in_array("part", $target)) {
echo "Parts&nbsp;&nbsp;";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
}
echo "
<hr>
";
}
if ($search) {
if (in_array("log",$target)) {
// run lognotes query and show results
if(mysqli_num_rows($logrowqry)) {
echo "
<b>Results from Logbook</b><br><br>
<table border=\"1\" width=\"100%\">
<tr><th>Note ID</th><th>Date/Time</th><th>Shift</th><th>Tech</th><th>Subject</th><th>Note</th><th>References</th></tr>
";
while ($logtablerow = mysqli_fetch_assoc($logrowqry)) {
$logrefs="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?refto=$logtablerow[lognoteid]\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($logtablerow['lognoteid'])) {
$logrefs=$logrefs."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$logtablerow[lognoteid]\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View ref chain\" alt=\"View ref chain\"></a>";
}
// convert the shift number to a name
$logshname=dblookup($db,"shifts","shiftid","shiftname",$logtablerow['shift']);
// convert tech number to name
$logtname=dblookup($db,"techs","techid","techname",$logtablerow['tech']);
//convert subject number to name
$logsubjname=dblookup($db,"subjects","subjectid","subjectname",$logtablerow['subject']);
// create links of urls in note
$logfmtnote=convertweblinks($logtablerow['lognote']);
// generate the flags string
$flagstring="";
$allflagqry=mysqli_query($db,"select flagid from flags");
while ($allflagids=mysqli_fetch_row($allflagqry)) {
$flagid=$allflagids[0];
$flag_tbl="flag_".$flagid;
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$logtablerow[lognoteid]\""))) {
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
$flagcolor=$flagparam["flagcolor"];
$flagsym=$flagparam["flagsym"];
$flagstring=$flagstring."<font color=\"$flagcolor\">$flagsym</font>&nbsp;&nbsp;";
}
}
if ($flagstring) $logfmtnote=$logfmtnote."<br>".$flagstring;
printf("<tr>
<td valign=\"top\"><a href=logentry.php?edit=1&noteid=%s>%s</a></td>
<td valign=\"top\">%s&nbsp;&#047;&nbsp;%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>",
$logtablerow['lognoteid'],$logtablerow['lognoteid'],
$logtablerow['date'],$logtablerow['time'],
$logshname,
$logtname,
$logsubjname,
$logfmtnote,
$logrefs);
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Logbook notes match your search criteria.</font><br><hr>";
}
}
if (in_array("maintform",$target)) {
// run maintforms query and show results
if(mysqli_num_rows($mfrowqry)) {
echo "
<b>Results from Maintenance Forms</b><br><br>
<br><table border=\"1\" width=\"100%\">
<tr>
<th>ID</th>
<th>Date</th>
<th>Tech</th>
<th>$uidtext</th>
<th>Part Number</th>
<th>Serial Number</th>
<th>Part Name</th>
<th>Logbook<br>Note ID</th>
</tr>
";
while ($mfrow = mysqli_fetch_assoc($mfrowqry)) {
// look up part data
$mfuid=dblookup($db,"parts","partid","uid",$mfrow["mfpart"]);
if ($mfuid=="") $mfuid="&nbsp;";
$mfpartno=dblookup($db,"parts","partid","partnum",$mfrow["mfpart"]);
if ($mfpartno=="") $mfpartno="&nbsp;";
$mfserno=dblookup($db,"parts","partid","sernum",$mfrow["mfpart"]);
if ($mfserno=="") $mfserno="&nbsp;";
$mfpartname=dblookup($db,"parts","partid","partname",$mfrow["mfpart"]);
if ($mfpartname=="") $mfpartname="&nbsp;";
// look up tech name
$mftname=dblookup($db,"techs","techid","techname",$mfrow["mftech"]);
if ($mfrow["lognoteid"]==0) {
$mfnoteidval="&nbsp;";
$mfnotetag="%s%s";
} else {
$mfnoteidval=$mfrow["lognoteid"];
$mfnotetag="<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>";
}
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$mfnotetag</td>
</tr>",
$mfrow["maintformid"],$mfrow["maintformid"],
$mfrow["mfdate"],
$mftname,
$mfuid,
$mfpartno,
$mfserno,
$mfpartname,
$mfnoteidval,$mfnoteidval
);
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Maintenance Forms match your search criteria.</font><br><hr>";
}
}
if (in_array("part",$target)) {
// run parts query and show results
if(mysqli_num_rows($prowqry)) {
echo "
<b>Results from Parts</b><br><br>
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr>
<th>Action</th>
<th><a href=\"parts.php?sort=uid&order=$order\" title=\"Sort by $uidtext\">$uidtext</a></th>
<th><a href=\"parts.php?sort=partnum&order=$order\" title=\"Sort by Part Number\">Part Number</a></th>
<th><a href=\"parts.php?sort=sernum&order=$order\" title=\"Sort by Serial Number\">Serial Number</a></th>
<th><a href=\"parts.php?sort=partname&order=$order\" title=\"Sort by Part Name\">Part Name</a></th>
</tr>
";
while ($partrow=mysqli_fetch_assoc($prowqry)) {
if ($loggedin) {
printf("
<tr>
<td>
<a href=\"partentry.php?edit=1&partid=%s\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this part\" alt=\"Edit this part\"></a>
</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partrow['partid'],
$partrow['uid'],
$partrow['partnum'],
$partrow['sernum'],
$partrow['partname']
);
} else {
printf("
<tr>
<td>
<img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"You must be logged in to edit a part\" alt=\"You must be logged in to edit a part\">
</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partrow['uid'],
$partrow['partnum'],
$partrow['sernum'],
$partrow['partname']
);
}
echo "
</tr>
";
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Parts match your search criteria.</font><br><hr>";
}
}
} else {
echo "<font size=\"+1\">Use fields above to define your search.</font>";
}
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

61
distfiles/settings.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
/*
settings.php
OpenLog Online Logbook
Copyright (C) 2025 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
$sttl=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"session_ttl_days\""))[0];
$ostype=strtoupper(substr(php_uname('s'), 0, 3));
if ($ostype == 'WIN') {
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"win_server_session_dir\""))[0];
} else {
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
}
$lifetime=60 * 60 * 24 * $sttl;
if (!is_dir($sdir)) mkdir($sdir, 0700, true);
ini_set('session.cookie_lifetime', $lifetime);
ini_set('session.gc_maxlifetime', $lifetime);
ini_set('session.save_path', $sdir);
$ss=session_status();
if ($ss==PHP_SESSION_NONE) session_start();
// get config options from database and assign them to constants
unset($techid);
if (isset($_SESSION['login']) && $_SESSION['login'] != '') {
$techid=$_SESSION['login'];
}
$configqry=mysqli_query($db,"select confname,confvalue,confid from configs");
while ($configrow = mysqli_fetch_assoc($configqry)) {
$constname=strtoupper($configrow["confname"]);
if (isset($techid)) {
$confid=$configrow["confid"];
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$techid\"");
if (mysqli_num_rows($custqry)) {
$custrow=mysqli_fetch_row($custqry);
$custval=$custrow[0];
} else {
unset($custval);
}
}
if (isset($custval)) {
$constvalue=$custval;
} else {
$constvalue=$configrow["confvalue"];
}
define("$constname","$constvalue");
}
// error reporting
$logerrors=LOG_ERRORS;
if ($logerrors==1) {
error_reporting(E_ALL);
} else {
error_reporting(0);
}
?>

556
install.sh Executable file
View File

@@ -0,0 +1,556 @@
#!/bin/bash
# install.sh
# OpenLog Online Logbook
# Copyright (C) 2025 Rod Wright
# SPDX-License-Identifier: GPL-2.0
APP_NAME="OpenLog"
DEFAULT_DB_NAME="openlog"
APP_VERSION="5.2.4"
DOC_ROOT="/var/www"
INSTALL_LOC="openlog"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
APACHE_CONF_DIR="/etc/apache2/conf-available"
BACKUP_DIR="openlog-previous-installation"
INDEX_FILE="lognotes.php"
CONFIG_TABLE="configs"
CONFIG_NAME_COLUMN="confname"
CONFIG_VALUE_COLUMN="confvalue"
CONFIG_DEFAULT_COLUMN=""
OFFER_OPTIONAL_PKGS=false
function get_new_password() {
# Stores new password in the variable $newpassword
pwgood=false
while ! $pwgood
do
read -p "New password: " -s -r newpassword
echo ""
read -p "Re-type new password: " -s -r rnewpw
echo ""
if [ "$newpassword" = "" -o "$rnewpw" = "" ]
then
echo "Password cannot be blank. Please try again."
echo ""
elif [ "$newpassword" != "$rnewpw" ]
then
echo "Passwords do not match. Please try again."
echo ""
else
pwgood=true
fi
done
}
function install_required_packages() {
# Positional parameters supplied to this function should be quoted
# apt-get installable package names.
# Note: Each package supplied to the for loop below can either be a
# single package name or a list of alternatives separated by the word "or".
# If supplying a list, the last one in the list will be the one that
# gets installed.
for prereq in "$@"
do
echo "Checking for $prereq installation..."
gpattern=""
for pkg_option in $(echo $prereq)
do
if [ "$pkg_option" != "or" ]
then
gpattern+=" -e $pkg_option"
preferred_pkg=$pkg_option
fi
done
if dpkg -l|grep $gpattern >/dev/null 2>&1
then
echo "$prereq is installed. Continuing."
else
echo "$APP_NAME requires $prereq, but it doesn't seem to be installed. "
echo -n "Install $preferred_pkg now? [Y/n]: "
read reqinstall
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
then
echo "$APP_NAME requires $prereq, but you have elected not to install it."
echo "Installation cannot continue."
abort_exit
else
echo ""
echo "Proceeding with $preferred_pkg installation"
echo ""
sleep 3
apt-get install -y $preferred_pkg
echo ""
echo "Finished with $preferred_pkg installation"
echo ""
sleep 3
fi
fi
done
}
function clean_exit() {
# Re-enable unattended-upgrades
if $restart_uu; then systemctl start unattended-upgrades; fi
exit 0
}
function abort_exit() {
# Re-enable unattended-upgrades
if $restart_uu; then systemctl start unattended-upgrades; fi
exit 1
}
# test for superuser rights
if [[ $EUID -ne 0 ]]; then
echo "This script must be run with superuser privileges. Try sudo ./install.sh"
abort_exit
fi
echo ""
echo ""
echo "* * * * * Welcome to $APP_NAME $APP_VERSION Installation * * * * *"
echo ""
echo ""
sleep 3
echo "Preparing for installation. Please wait..."
# Prevent unattended-upgrades from interfering
restart_uu=false
while systemctl status unattended-upgrades >/dev/null 2>&1
do
systemctl stop unattended-upgrades
sleep 5
restart_uu=true
done
apt-get update
# Check for prerequisites and prompt to install
echo "Checking for required packages..."
echo ""
install_required_packages "apache2" "php" "mysql-server or mariadb-server" "uuid-runtime"
echo ""
echo "Finished required package installation."
echo ""
if $OFFER_OPTIONAL_PKGS
then
# Check for optional packages and prompt to install
echo "Checking for optional packages..."
echo ""
echo "Checking for phpmyadmin installation..."
echo ""
if dpkg -l|grep phpmyadmin >/dev/null 2>&1
then
echo ""
echo "phpmyadmin is installed. Continuing."
echo ""
else
echo "phpmyadmin doesn't seem to be installed."
echo "It is an optional package that enables administration of the mysql/mariadb"
echo "database server using a friendly GUI. It is highly recommended."
echo "Note that this has the potential to be a security risk, especially"
echo "if your passwords aren't sufficiently strong."
echo -n "Install it now? [Y/n]: "
read reqinstall
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
then
echo "Proceeding without installing phpmyadmin. Database administration"
echo "will require the use of the mysql/mariadb command line tools."
else
echo ""
echo "Proceeding with phpmyadmin installation"
echo ""
sleep 3
echo ""
echo "During the following installation of phpmyadmin:"
echo ""
echo "- Select apache2 as the web server to configure automatically."
echo ""
echo "- Choose Yes when prompted to install phpmyadmin database and allow it to"
echo " generate a random password(leave the field blank)."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
apt-get install -y phpmyadmin
echo ""
echo ""
echo "In order to log in to the database using phpmyadmin, there must be a"
echo "database user with a password set who has administrator privileges."
echo "After a fresh installation of the MySQL or MariaDB server, the root"
echo "user doesn't have a password, and is unable to log in to the phpmyadmin"
echo "web GUI. You should create a new user with administrative rights now."
echo ""
read -p "New MySQL/MariaDB administrator username: " -r newdbadminuser
echo ""
get_new_password
newdbadminpass=$newpassword
unset newpassword
mysql -e "CREATE USER '$newdbadminuser'@'localhost'
IDENTIFIED VIA mysql_native_password USING password('$newdbadminpass');
GRANT ALL PRIVILEGES ON *.* TO '$newdbadminuser'@'localhost'
REQUIRE NONE WITH GRANT OPTION
MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0;
flush privileges"
echo ""
echo ""
echo "You can now access phpmyadmin using a web browser pointed to:"
echo ""
echo " http://$HOSTNAME/phpmyadmin"
echo ""
echo "*** WARNING!! this url is accessible via unencrypted (http) connections."
echo "This is a huge security risk since the username and password you enter"
echo "on the phpmyadmin login page can be sent in the clear for any potential"
echo "attacker to sniff! You should enable redirection to https for phpmyadmin"
echo "in your apache2 configuration if your site is reachable from the internet."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
echo "Finished with phpmyadmin installation"
echo ""
sleep 3
fi
fi
echo ""
echo "Checking for webmin installation..."
echo ""
if dpkg -l|grep webmin >/dev/null 2>&1
then
echo ""
echo "webmin is installed. Continuing."
echo ""
else
echo "webmin doesn't seem to be installed."
echo "It is an optional package that enables system administration"
echo "using a friendly GUI. It is highly recommended, especially for"
echo "headless servers without any way to log in directly on the machine."
echo "Note that this has the potential to be a security risk, especially"
echo "if your passwords aren't sufficiently strong."
echo -n "Install it now? [Y/n]: "
read reqinstall
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
then
echo "Proceeding without installing webmin. System administration"
echo "will require login to the server either directly or via ssh."
else
echo ""
echo "Proceeding with webmin installation"
echo ""
sleep 3
echo "Installing webmin..."
skipwebmin="false"
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
then
echo "Warning: failed to download Webmin repo setup script."
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
read wmfailchoice
if [ "$wmfailchoice" = "C" -o "$wmfailchoice" = "c" ]
then
skipwebmin="true"
echo "Continuing without installing Webmin. You should investigate the failure"
echo "and install Webmin manually after the server is set up if you would like"
echo "to be able to manage the server from another computer with a GUI instead"
echo "of through ssh only."
echo -n "Press enter to continue."
read continueok
echo ""
fi
fi
if [ "$skipwebmin" = "false" ]
then
sh setup-repos.sh -f
apt-get install -y --install-recommends webmin
fi
echo "...done."
echo ""
echo "You can now access webmin using a web browser pointed to:"
echo "https://$HOSTNAME:10000"
echo "Unless you have obtained valid ssl certificates, your server is"
echo "using self-signed certs. This is not necessarily a problem, but"
echo "your browser will complain. You can tell the browser to accept the"
echo "self signed certificates and the traffic will still be encrypted,"
echo "however you may be vulnerable to man-in-the-middle attacks. You can"
echo "get free valid certificates through LetsEncrypt."
echo "See http://letsencrypt.org for more information."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
echo "Finished with webmin installation"
echo ""
sleep 3
fi
fi
echo ""
echo "Finished optional package installation."
fi
echo ""
sleep 3
# prompt for install location
echo "Where would you like to install this version of $APP_NAME? This should"
echo "be somewhere the webserver can find it. If you don't know, refer to the"
echo "webserver's documentation and check the server's configuration files."
echo "Note that this is where the directory containing $APP_NAME's files will be"
echo "created."
echo -n "Enter the webserver's install location [$DOC_ROOT]:"
read doc_root_in
echo ""
echo -n "Enter name of $APP_NAME installation directory [$INSTALL_LOC] :"
read install_loc_in
echo ""
if [ "$doc_root_in" = "" ]
then
doc_root_in=$DOC_ROOT
fi
if [ "$install_loc_in" = "" ]
then
install_loc_in=$INSTALL_LOC
fi
install_path="$doc_root_in/$install_loc_in"
if [ -d "$install_path" ]
then
# Install path exists.
if [ -e "$install_path/db.php" ]
then
# A db.php file was found in the install path
if grep -q -e "$APP_NAME" $install_path/db.php
then
# the db.php file is part of a previous installation
echo "The installation path you chose already exists."
echo "Would you like to upgrade an existing installation or cancel "
echo "and restart the install using a new installation location."
echo -n "[U]pgrade or [C]ancel? [C] :"
read upgrade_choice
if [ "$upgrade_choice" = "U" -o "$upgrade_choice" = "u" ] # Upgrade chosen
then
# proceed with upgrade
operation="upgraded"
# back up existing database
echo "Backing up the current database to the package directory."
curr_dbname=`grep dbname $install_path/db.php | head -1 | cut -d "\"" -f2`
curr_username=`grep username $install_path/db.php | head -1 | cut -d "\"" -f2`
curr_dbpass=`grep dbpass $install_path/db.php | head -1 | cut -d "\"" -f2`
export MYSQL_PWD="$curr_dbpass"
mysqldump --no-tablespaces -u"$curr_username" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql
# back up existing installation
echo "Backing up current installation to the package directory."
cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
# delete all existing installation files except db.php
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
# apply database updates
mysql -u"$curr_username" -f -D $curr_dbname < database-update.sql >/dev/null 2>&1
# apply updates to existing db.php
bash ./db.php_update $install_path
# copy distribution to install location
echo "Installing distribution . . ."
cp -R distfiles/* $install_path
# set symlink for jquery-ui
if [ ! -L "$install_path/jquery-ui" ]
then
ln -s $install_path/jquery-ui* $install_path/jquery-ui
fi
# set symlink for index.php
if [ ! -L "$install_path/index.php" ]
then
ln -s $install_path/$INDEX_FILE $install_path/index.php
fi
# set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the $APP_NAME installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo ""
echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path
else
echo "Cancelling installation"
abort_exit
fi
else
# This was a mistake. Exit now to avoid clobbering another app.
echo "The installation directory you chose exists, but no previous installation"
echo "of $APP_NAME was found. Please investigate the situation. Aborting now."
abort_exit
fi
else
# This was a mistake. Exit now to avoid clobbering another app.
echo "The installation directory you chose exists, but no previous installation"
echo "of $APP_NAME was found. Please investigate the situation. Aborting now."
abort_exit
fi
else
# This is a fresh install
operation="installed"
echo ""
echo "What would you like to call this installation of $APP_NAME? If you accept"
echo "the default, it will be called $APP_NAME. If you will be running multiple"
echo "instances of $APP_NAME on this server, you should choose a distinctive name."
echo "This can be changed later in the application itself."
echo -n "Installation name [$APP_NAME]: "
read new_inst_name
if [ "$new_inst_name" = "" ]
then
new_inst_name="$APP_NAME"
fi
echo ""
# Create initial database
db_create_fail=true
while $db_create_fail
do
echo "What would you like to call the database for this installation of $APP_NAME?"
echo "If you accept the default, it will be called $DEFAULT_DB_NAME. Again, this is fine"
echo "if you will only be running this one instance, but if you will be running"
echo "multiple instances of $APP_NAME on this server, you should choose a "
echo "distinctive name."
echo -n "database name [$DEFAULT_DB_NAME]: "
read new_db_name
if [ "$new_db_name" = "" ]
then
new_db_name=$DEFAULT_DB_NAME
fi
echo ""
if mysql -e "create database $new_db_name"
then
db_create_fail=false
else
echo "An error was encountered when trying to create the database."
echo "This probably means the database already exists."
echo -n "Try again with a different database name? [Y/N]: "
read dbcreatetry
if [ "$dbcreatetry" != "Y" -o "$dbcreatetry" != "y" ]
then
abort_exit
fi
fi
done
# Create user and give rights to database
db_user="$new_db_name`date +%Y%m%d%H%M%S`"
db_pass=`uuidgen`
mysql -e "create user if not exists '$db_user'@'localhost' identified by '$db_pass'"
mysql -e "grant all on $new_db_name.* to '$db_user'@'localhost'"
mysql -e "flush privileges"
# Populate initial database
mysql $new_db_name < database-initial.sql
# Set the installation name
export MYSQL_PWD="$db_pass"
mysql -u"$db_user" $new_db_name -e "update $CONFIG_TABLE set $CONFIG_VALUE_COLUMN=\"$new_inst_name\" where $CONFIG_NAME_COLUMN=\"log_name\""
if [ "$CONFIG_DEFAULT_COLUMN" != "" ]
then
mysql -u"$db_user" $new_db_name -e "update $CONFIG_TABLE set $CONFIG_DEFAULT_COLUMN=\"$new_inst_name\" where $CONFIG_NAME_COLUMN=\"log_name\""
fi
# Create install path
echo "Creating installation directory . . ."
mkdir $install_path
# Create db.php if it doesn't exist
if [ ! -f "$install_path/db.php" ]
then
cp db.php.template $install_path/db.php
sed -i "s/DBNAME/$new_db_name/g" $install_path/db.php
sed -i "s/DBUSER/$db_user/g" $install_path/db.php
sed -i "s/DBPASS/$db_pass/g" $install_path/db.php
sed -i "s/APPNAME/$APP_NAME/g" $install_path/db.php
fi
# copy distribution to install location
echo "Installing distribution . . ."
cp -R distfiles/* $install_path
if [ ! -L "$install_path/jquery-ui" ]
then
ln -s $install_path/jquery-ui* $install_path/jquery-ui
fi
if [ ! -L "$install_path/index.php" ]
then
ln -s $install_path/lognotes.php $install_path/index.php
fi
# set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the $APP_NAME installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo ""
echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path
fi
echo ""
# tell user to launch web browser to continue
echo ""
echo ""
echo ""
echo "$APP_NAME has been $operation."
base_url=$install_loc_in
if [ "$operation" = "installed" ]
then
echo "# $APP_NAME default Apache configuration" > $APACHE_CONF_DIR/$base_url.conf
echo "" >> $APACHE_CONF_DIR/$base_url.conf
echo "Alias /$base_url $doc_root_in/$base_url" >> $APACHE_CONF_DIR/$base_url.conf
echo "" >> $APACHE_CONF_DIR/$base_url.conf
echo "<Directory $doc_root_in/$base_url>" >> $APACHE_CONF_DIR/$base_url.conf
echo " Options FollowSymLinks" >> $APACHE_CONF_DIR/$base_url.conf
echo " DirectoryIndex index.php" >> $APACHE_CONF_DIR/$base_url.conf
echo "</Directory>" >> $APACHE_CONF_DIR/$base_url.conf
echo -n "The apache2 $base_url configuration must be enabled. Would you like to do that now? [Y/n] :"
read enconf
if [ "$enconf" = "" -o "$enconf" = "Y" -o "$enconf" = "y" ]
then
a2enconf $base_url.conf >/dev/null
service apache2 reload
echo "You can now point a web browser to $base_url on your web server "
echo "to set up and configure $APP_NAME."
echo ""
echo "IMPORTANT: The default login credentials for the initial admin user are:"
echo ""
echo "login: ${APP_NAME}Admin"
echo "password: $APP_NAME-1"
echo ""
echo "Remember these credentials. Otherwise, you will not be able to log in and"
echo "configure your new installation."
echo "It is highly recommended that you change the initial password to something"
echo "secure after logging in for the first time."
else
echo "You will need to manually enable the configuration by executing:"
echo " a2enconf $base_url.conf"
echo " systemctl reload apache2"
echo "as a superuser before it can be accessed."
fi
else
echo "You can now point a web browser to http://$HOSTNAME/$base_url "
echo "to use your upgraded $APP_NAME."
fi
clean_exit