Compare commits
63 Commits
5.2.5
...
v6.0.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 48d7964a90 | |||
| aefe3a4c55 | |||
| ed0195f123 | |||
| 96065c5b88 | |||
| 583400a0bb | |||
| 53d05c41b2 | |||
| 5e6c349df5 | |||
| c17c4d4608 | |||
| 5d3296c3bc | |||
| 09464aace5 | |||
| e3de786766 | |||
| b0aaf70e4d | |||
| b70996b4d9 | |||
| 8647c9b4d8 | |||
| b201ac6d24 | |||
| 1480feecf0 | |||
| f84395f79a | |||
| f3db1c1523 | |||
| 962bd7b504 | |||
| ec8efec61e | |||
| d23a19a3eb | |||
| 152bb30029 | |||
| 11c876886a | |||
| 9cce143cf9 | |||
| eb29a3799c | |||
| ba7db9279d | |||
| ce8e5d9ca7 | |||
| 0600ba18cd | |||
| ef0599342b | |||
| 5129d30992 | |||
| ed7a25cea3 | |||
| 968964e3fe | |||
| d41519ba91 | |||
| 513017d3cb | |||
| 3385954624 | |||
| 5a50400a56 | |||
| b138f462d9 | |||
| dd86d2e519 | |||
| 41c5b4560b | |||
| 01fd47814b | |||
| 9122040863 | |||
| 86f1512cc0 | |||
| 0145f5849f | |||
| c4d2d4334e | |||
| 5e1856f1dc | |||
| 262bd6dcdc | |||
| ff71083b49 | |||
| 1a4c9a9c2a | |||
| 5396f3367b | |||
| 557af4db04 | |||
| cc2b638a6a | |||
| 63bb7a3445 | |||
| 35173f6faa | |||
| f20b4cd8b6 | |||
| 71f60d353f | |||
| f74385d8f3 | |||
| 9e392faa4d | |||
| d2cb1851d0 | |||
| 07a6d352b0 | |||
| 0547e97479 | |||
| a79f73a8ca | |||
| 78ee18f03b | |||
| c11ef1ad8c |
3
BUGS
@@ -1,4 +1,5 @@
|
||||
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.)
|
||||
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.)
|
||||
|
||||
50
CHANGELOG
@@ -1,6 +1,6 @@
|
||||
CHANGELOG
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
@@ -244,3 +244,51 @@
|
||||
5.2.5 - 2026-02-10
|
||||
This is just a version number bump to get on a major-minor-patch
|
||||
scheme. There are no code changes for this release.
|
||||
|
||||
5.3.0 - 2026-02-20
|
||||
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
|
||||
its own page to make it less confusing and to fix some strange
|
||||
behavior.
|
||||
- Added global templates which can be used by anyone but can only be
|
||||
created, modified, or deleted by administrators. This makes it
|
||||
easier to employ standardized templates.
|
||||
- Changed the character encoding of the database to utf8mb4 to enable
|
||||
using emojis in text fields.
|
||||
- Changed the insert link functionality. There are now two fields, link
|
||||
text, and URL. The full URL string will now not be displayed in the
|
||||
note, since it frequently was too long and deformed the table,
|
||||
causing the user to have to scroll right to see the entire note. If
|
||||
a URL is entered in the URL field and no link text is entered in the
|
||||
link text field, the link will show up as just the last part of the
|
||||
URL. For example, "http://somewhere.com/myfile.pdf" will show as
|
||||
"myfile.pdf" in the note text. If text is entered in the link text
|
||||
field, that is what will show as the clickable link in the note text.
|
||||
NOTE: URLs in previously entered notes will not automatically be
|
||||
converted.
|
||||
- Changed the flag handling code to no longer dynamically create flag_
|
||||
tables in the database to track assignments. This is now done using
|
||||
a flagmap table.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- References will no longer be stored in the lognotes table with the note.
|
||||
There is now a reflinks table that stores the link information.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- Various code cleanups to prevent php warnings in the logs if logging
|
||||
is enabled.
|
||||
- Validate all date and time fields to prevent user entered invalid date
|
||||
formats from crashing php.
|
||||
- Fixed profile page to automatically refresh page to show the results
|
||||
when a user changes their color preferences.
|
||||
|
||||
5.3.1 - 2026-02-25
|
||||
- Fixed bug reported as Issue 1 where failure to select an action for a
|
||||
part entered in a lognote crashed php in logentry.php.
|
||||
- Fixed bug where the prompt to set flags on reference chain appeared
|
||||
even when no flags were available to select in logentry.php.
|
||||
|
||||
5.3.2 - 2026-03-02
|
||||
- Fixed bug reported as Issue 2 where printing search results resulted in
|
||||
the flags selection was being ignored.
|
||||
|
||||
34
INSTALL
@@ -1,35 +1,33 @@
|
||||
INSTALL
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
6. Start using OpenLog.
|
||||
|
||||
323
LICENSE
@@ -1,5 +1,5 @@
|
||||
The following license applies to all OpenLog code
|
||||
Copyright (C) 2016 by Rod Wright :
|
||||
Copyright (C) 2026 by Rod Wright :
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@@ -382,3 +382,324 @@ The following license applies to jquery code :
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
|
||||
The following license applies to the Fugue icon set :
|
||||
Creative Commons Legal Code
|
||||
|
||||
Attribution 3.0 Unported
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
|
||||
DAMAGES RESULTING FROM ITS USE.
|
||||
|
||||
License
|
||||
|
||||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
|
||||
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
|
||||
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
|
||||
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||
|
||||
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
|
||||
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
|
||||
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
|
||||
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
|
||||
CONDITIONS.
|
||||
|
||||
1. Definitions
|
||||
|
||||
a. "Adaptation" means a work based upon the Work, or upon the Work and
|
||||
other pre-existing works, such as a translation, adaptation,
|
||||
derivative work, arrangement of music or other alterations of a
|
||||
literary or artistic work, or phonogram or performance and includes
|
||||
cinematographic adaptations or any other form in which the Work may be
|
||||
recast, transformed, or adapted including in any form recognizably
|
||||
derived from the original, except that a work that constitutes a
|
||||
Collection will not be considered an Adaptation for the purpose of
|
||||
this License. For the avoidance of doubt, where the Work is a musical
|
||||
work, performance or phonogram, the synchronization of the Work in
|
||||
timed-relation with a moving image ("synching") will be considered an
|
||||
Adaptation for the purpose of this License.
|
||||
b. "Collection" means a collection of literary or artistic works, such as
|
||||
encyclopedias and anthologies, or performances, phonograms or
|
||||
broadcasts, or other works or subject matter other than works listed
|
||||
in Section 1(f) below, which, by reason of the selection and
|
||||
arrangement of their contents, constitute intellectual creations, in
|
||||
which the Work is included in its entirety in unmodified form along
|
||||
with one or more other contributions, each constituting separate and
|
||||
independent works in themselves, which together are assembled into a
|
||||
collective whole. A work that constitutes a Collection will not be
|
||||
considered an Adaptation (as defined above) for the purposes of this
|
||||
License.
|
||||
c. "Distribute" means to make available to the public the original and
|
||||
copies of the Work or Adaptation, as appropriate, through sale or
|
||||
other transfer of ownership.
|
||||
d. "Licensor" means the individual, individuals, entity or entities that
|
||||
offer(s) the Work under the terms of this License.
|
||||
e. "Original Author" means, in the case of a literary or artistic work,
|
||||
the individual, individuals, entity or entities who created the Work
|
||||
or if no individual or entity can be identified, the publisher; and in
|
||||
addition (i) in the case of a performance the actors, singers,
|
||||
musicians, dancers, and other persons who act, sing, deliver, declaim,
|
||||
play in, interpret or otherwise perform literary or artistic works or
|
||||
expressions of folklore; (ii) in the case of a phonogram the producer
|
||||
being the person or legal entity who first fixes the sounds of a
|
||||
performance or other sounds; and, (iii) in the case of broadcasts, the
|
||||
organization that transmits the broadcast.
|
||||
f. "Work" means the literary and/or artistic work offered under the terms
|
||||
of this License including without limitation any production in the
|
||||
literary, scientific and artistic domain, whatever may be the mode or
|
||||
form of its expression including digital form, such as a book,
|
||||
pamphlet and other writing; a lecture, address, sermon or other work
|
||||
of the same nature; a dramatic or dramatico-musical work; a
|
||||
choreographic work or entertainment in dumb show; a musical
|
||||
composition with or without words; a cinematographic work to which are
|
||||
assimilated works expressed by a process analogous to cinematography;
|
||||
a work of drawing, painting, architecture, sculpture, engraving or
|
||||
lithography; a photographic work to which are assimilated works
|
||||
expressed by a process analogous to photography; a work of applied
|
||||
art; an illustration, map, plan, sketch or three-dimensional work
|
||||
relative to geography, topography, architecture or science; a
|
||||
performance; a broadcast; a phonogram; a compilation of data to the
|
||||
extent it is protected as a copyrightable work; or a work performed by
|
||||
a variety or circus performer to the extent it is not otherwise
|
||||
considered a literary or artistic work.
|
||||
g. "You" means an individual or entity exercising rights under this
|
||||
License who has not previously violated the terms of this License with
|
||||
respect to the Work, or who has received express permission from the
|
||||
Licensor to exercise rights under this License despite a previous
|
||||
violation.
|
||||
h. "Publicly Perform" means to perform public recitations of the Work and
|
||||
to communicate to the public those public recitations, by any means or
|
||||
process, including by wire or wireless means or public digital
|
||||
performances; to make available to the public Works in such a way that
|
||||
members of the public may access these Works from a place and at a
|
||||
place individually chosen by them; to perform the Work to the public
|
||||
by any means or process and the communication to the public of the
|
||||
performances of the Work, including by public digital performance; to
|
||||
broadcast and rebroadcast the Work by any means including signs,
|
||||
sounds or images.
|
||||
i. "Reproduce" means to make copies of the Work by any means including
|
||||
without limitation by sound or visual recordings and the right of
|
||||
fixation and reproducing fixations of the Work, including storage of a
|
||||
protected performance or phonogram in digital form or other electronic
|
||||
medium.
|
||||
|
||||
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
|
||||
limit, or restrict any uses free from copyright or rights arising from
|
||||
limitations or exceptions that are provided for in connection with the
|
||||
copyright protection under copyright law or other applicable laws.
|
||||
|
||||
3. License Grant. Subject to the terms and conditions of this License,
|
||||
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
perpetual (for the duration of the applicable copyright) license to
|
||||
exercise the rights in the Work as stated below:
|
||||
|
||||
a. to Reproduce the Work, to incorporate the Work into one or more
|
||||
Collections, and to Reproduce the Work as incorporated in the
|
||||
Collections;
|
||||
b. to create and Reproduce Adaptations provided that any such Adaptation,
|
||||
including any translation in any medium, takes reasonable steps to
|
||||
clearly label, demarcate or otherwise identify that changes were made
|
||||
to the original Work. For example, a translation could be marked "The
|
||||
original work was translated from English to Spanish," or a
|
||||
modification could indicate "The original work has been modified.";
|
||||
c. to Distribute and Publicly Perform the Work including as incorporated
|
||||
in Collections; and,
|
||||
d. to Distribute and Publicly Perform Adaptations.
|
||||
e. For the avoidance of doubt:
|
||||
|
||||
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
|
||||
which the right to collect royalties through any statutory or
|
||||
compulsory licensing scheme cannot be waived, the Licensor
|
||||
reserves the exclusive right to collect such royalties for any
|
||||
exercise by You of the rights granted under this License;
|
||||
ii. Waivable Compulsory License Schemes. In those jurisdictions in
|
||||
which the right to collect royalties through any statutory or
|
||||
compulsory licensing scheme can be waived, the Licensor waives the
|
||||
exclusive right to collect such royalties for any exercise by You
|
||||
of the rights granted under this License; and,
|
||||
iii. Voluntary License Schemes. The Licensor waives the right to
|
||||
collect royalties, whether individually or, in the event that the
|
||||
Licensor is a member of a collecting society that administers
|
||||
voluntary licensing schemes, via that society, from any exercise
|
||||
by You of the rights granted under this License.
|
||||
|
||||
The above rights may be exercised in all media and formats whether now
|
||||
known or hereafter devised. The above rights include the right to make
|
||||
such modifications as are technically necessary to exercise the rights in
|
||||
other media and formats. Subject to Section 8(f), all rights not expressly
|
||||
granted by Licensor are hereby reserved.
|
||||
|
||||
4. Restrictions. The license granted in Section 3 above is expressly made
|
||||
subject to and limited by the following restrictions:
|
||||
|
||||
a. You may Distribute or Publicly Perform the Work only under the terms
|
||||
of this License. You must include a copy of, or the Uniform Resource
|
||||
Identifier (URI) for, this License with every copy of the Work You
|
||||
Distribute or Publicly Perform. You may not offer or impose any terms
|
||||
on the Work that restrict the terms of this License or the ability of
|
||||
the recipient of the Work to exercise the rights granted to that
|
||||
recipient under the terms of the License. You may not sublicense the
|
||||
Work. You must keep intact all notices that refer to this License and
|
||||
to the disclaimer of warranties with every copy of the Work You
|
||||
Distribute or Publicly Perform. When You Distribute or Publicly
|
||||
Perform the Work, You may not impose any effective technological
|
||||
measures on the Work that restrict the ability of a recipient of the
|
||||
Work from You to exercise the rights granted to that recipient under
|
||||
the terms of the License. This Section 4(a) applies to the Work as
|
||||
incorporated in a Collection, but this does not require the Collection
|
||||
apart from the Work itself to be made subject to the terms of this
|
||||
License. If You create a Collection, upon notice from any Licensor You
|
||||
must, to the extent practicable, remove from the Collection any credit
|
||||
as required by Section 4(b), as requested. If You create an
|
||||
Adaptation, upon notice from any Licensor You must, to the extent
|
||||
practicable, remove from the Adaptation any credit as required by
|
||||
Section 4(b), as requested.
|
||||
b. If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||
Collections, You must, unless a request has been made pursuant to
|
||||
Section 4(a), keep intact all copyright notices for the Work and
|
||||
provide, reasonable to the medium or means You are utilizing: (i) the
|
||||
name of the Original Author (or pseudonym, if applicable) if supplied,
|
||||
and/or if the Original Author and/or Licensor designate another party
|
||||
or parties (e.g., a sponsor institute, publishing entity, journal) for
|
||||
attribution ("Attribution Parties") in Licensor's copyright notice,
|
||||
terms of service or by other reasonable means, the name of such party
|
||||
or parties; (ii) the title of the Work if supplied; (iii) to the
|
||||
extent reasonably practicable, the URI, if any, that Licensor
|
||||
specifies to be associated with the Work, unless such URI does not
|
||||
refer to the copyright notice or licensing information for the Work;
|
||||
and (iv) , consistent with Section 3(b), in the case of an Adaptation,
|
||||
a credit identifying the use of the Work in the Adaptation (e.g.,
|
||||
"French translation of the Work by Original Author," or "Screenplay
|
||||
based on original Work by Original Author"). The credit required by
|
||||
this Section 4 (b) may be implemented in any reasonable manner;
|
||||
provided, however, that in the case of a Adaptation or Collection, at
|
||||
a minimum such credit will appear, if a credit for all contributing
|
||||
authors of the Adaptation or Collection appears, then as part of these
|
||||
credits and in a manner at least as prominent as the credits for the
|
||||
other contributing authors. For the avoidance of doubt, You may only
|
||||
use the credit required by this Section for the purpose of attribution
|
||||
in the manner set out above and, by exercising Your rights under this
|
||||
License, You may not implicitly or explicitly assert or imply any
|
||||
connection with, sponsorship or endorsement by the Original Author,
|
||||
Licensor and/or Attribution Parties, as appropriate, of You or Your
|
||||
use of the Work, without the separate, express prior written
|
||||
permission of the Original Author, Licensor and/or Attribution
|
||||
Parties.
|
||||
c. Except as otherwise agreed in writing by the Licensor or as may be
|
||||
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||
Publicly Perform the Work either by itself or as part of any
|
||||
Adaptations or Collections, You must not distort, mutilate, modify or
|
||||
take other derogatory action in relation to the Work which would be
|
||||
prejudicial to the Original Author's honor or reputation. Licensor
|
||||
agrees that in those jurisdictions (e.g. Japan), in which any exercise
|
||||
of the right granted in Section 3(b) of this License (the right to
|
||||
make Adaptations) would be deemed to be a distortion, mutilation,
|
||||
modification or other derogatory action prejudicial to the Original
|
||||
Author's honor and reputation, the Licensor will waive or not assert,
|
||||
as appropriate, this Section, to the fullest extent permitted by the
|
||||
applicable national law, to enable You to reasonably exercise Your
|
||||
right under Section 3(b) of this License (right to make Adaptations)
|
||||
but not otherwise.
|
||||
|
||||
5. Representations, Warranties and Disclaimer
|
||||
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
|
||||
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||
|
||||
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
|
||||
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
|
||||
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
||||
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. Termination
|
||||
|
||||
a. This License and the rights granted hereunder will terminate
|
||||
automatically upon any breach by You of the terms of this License.
|
||||
Individuals or entities who have received Adaptations or Collections
|
||||
from You under this License, however, will not have their licenses
|
||||
terminated provided such individuals or entities remain in full
|
||||
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
|
||||
survive any termination of this License.
|
||||
b. Subject to the above terms and conditions, the license granted here is
|
||||
perpetual (for the duration of the applicable copyright in the Work).
|
||||
Notwithstanding the above, Licensor reserves the right to release the
|
||||
Work under different license terms or to stop distributing the Work at
|
||||
any time; provided, however that any such election will not serve to
|
||||
withdraw this License (or any other license that has been, or is
|
||||
required to be, granted under the terms of this License), and this
|
||||
License will continue in full force and effect unless terminated as
|
||||
stated above.
|
||||
|
||||
8. Miscellaneous
|
||||
|
||||
a. Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||
the Licensor offers to the recipient a license to the Work on the same
|
||||
terms and conditions as the license granted to You under this License.
|
||||
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||
offers to the recipient a license to the original Work on the same
|
||||
terms and conditions as the license granted to You under this License.
|
||||
c. If any provision of this License is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this License, and without further action
|
||||
by the parties to this agreement, such provision shall be reformed to
|
||||
the minimum extent necessary to make such provision valid and
|
||||
enforceable.
|
||||
d. No term or provision of this License shall be deemed waived and no
|
||||
breach consented to unless such waiver or consent shall be in writing
|
||||
and signed by the party to be charged with such waiver or consent.
|
||||
e. This License constitutes the entire agreement between the parties with
|
||||
respect to the Work licensed here. There are no understandings,
|
||||
agreements or representations with respect to the Work not specified
|
||||
here. Licensor shall not be bound by any additional provisions that
|
||||
may appear in any communication from You. This License may not be
|
||||
modified without the mutual written agreement of the Licensor and You.
|
||||
f. The rights granted under, and the subject matter referenced, in this
|
||||
License were drafted utilizing the terminology of the Berne Convention
|
||||
for the Protection of Literary and Artistic Works (as amended on
|
||||
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
|
||||
and the Universal Copyright Convention (as revised on July 24, 1971).
|
||||
These rights and subject matter take effect in the relevant
|
||||
jurisdiction in which the License terms are sought to be enforced
|
||||
according to the corresponding provisions of the implementation of
|
||||
those treaty provisions in the applicable national law. If the
|
||||
standard suite of rights granted under applicable copyright law
|
||||
includes additional rights not granted under this License, such
|
||||
additional rights are deemed to be included in the License; this
|
||||
License is not intended to restrict the license of any rights under
|
||||
applicable law.
|
||||
|
||||
|
||||
Creative Commons Notice
|
||||
|
||||
Creative Commons is not a party to this License, and makes no warranty
|
||||
whatsoever in connection with the Work. Creative Commons will not be
|
||||
liable to You or any party on any legal theory for any damages
|
||||
whatsoever, including without limitation any general, special,
|
||||
incidental or consequential damages arising in connection to this
|
||||
license. Notwithstanding the foregoing two (2) sentences, if Creative
|
||||
Commons has expressly identified itself as the Licensor hereunder, it
|
||||
shall have all rights and obligations of Licensor.
|
||||
|
||||
Except for the limited purpose of indicating to the public that the
|
||||
Work is licensed under the CCPL, Creative Commons does not authorize
|
||||
the use by either party of the trademark "Creative Commons" or any
|
||||
related trademark or logo of Creative Commons without the prior
|
||||
written consent of Creative Commons. Any permitted use will be in
|
||||
compliance with Creative Commons' then-current trademark usage
|
||||
guidelines, as may be published on its website or otherwise made
|
||||
available upon request from time to time. For the avoidance of doubt,
|
||||
this trademark restriction does not form part of this License.
|
||||
|
||||
Creative Commons may be contacted at https://creativecommons.org/.
|
||||
|
||||
52
README.md
@@ -0,0 +1,52 @@
|
||||
# OpenLog #
|
||||
|
||||
OpenLog is an 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.
|
||||
|
||||
Version 5.0 adds parts tracking functionality. Notes can have parts change information associated with them and maintenance/repair forms can be generated for parts. Parts related functions can be disabled to reduce clutter if they are not needed.
|
||||
|
||||
Version 5.1 adds scheduled maintenance functionality, which can also be disabled if not needed. Notes, parts, and maintenance forms 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. Each user can personalize his or her own settings 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, Microsoft Internet Explorer, and Edge.
|
||||
|
||||
## Prerequisites ##
|
||||
|
||||
- Linux - The installer is written to automate installation on Debian based Linux servers, but OpenLog itself should run on any current Linux distribution, albeit installation will need to be accomplished manually.
|
||||
- Apache2 - Current development is using version 2.4.65
|
||||
- MySQL or MariaDB - Current development is using MariaDB version 11.8.3
|
||||
- php - Current development is using version 8.4.11
|
||||
|
||||
## Installation ##
|
||||
|
||||
> [!NOTE]
|
||||
> These instructions are used to either install a new instance of OpenLog or upgrade an existing one.
|
||||
|
||||
1. Unzip the OpenLog-x.x.x.tar.gz file you've downloaded into a convenient place.
|
||||
2. `cd OpenLog-x.x.x`
|
||||
3. `sudo ./install.sh`
|
||||
|
||||
* The installer will check for installation of the required packages and prompt for their installation if not found.
|
||||
* You'll then be prompted for the webserver's install location. The default should work for standard installations.
|
||||
* You'll then be prompted for the installation location of this instance of OpenLog. You should come up with a unique name.
|
||||
* If this directory already exists and contains an instance of OpenLog, you will be prompted to cancel the process or upgrade this instance.
|
||||
* If you choose to upgrade, your OpenLog instance will be upgraded and you're done.
|
||||
* If this directory does not exist, it will be created and a new instance will be installed. You can have multiple instances of OpenLog running under different names in different directories. For example, if you wanted to create an Operations Log, you could enter `opslog`.
|
||||
* In the Operations Log example referred to above, you could enter `OpsLog` or `Operations Log`.
|
||||
* You'll br prompted for the name of the database to be created. You should choose something appropriate, like `opslog` for the example given.
|
||||
* Next, you'll be prompted to enable the apache2 configuration for this instance.
|
||||
*The new instance will now be installed and accessible. You will be given some important information.
|
||||
> [!IMPORTANT]
|
||||
> The default login credentials for the initial admin user are:
|
||||
> login: `OpenLogAdmin`
|
||||
> password: `OpenLog-1`
|
||||
> Make note of these credentials, otherwise you will not be able to login and configure your new installation.
|
||||
>
|
||||
> It is highly recommended that you change the OpenLogAdmin user password and/or create your own admin user (with a secure password) and disable this default account after logging in for the first time.
|
||||
|
||||
|
||||
## History ##
|
||||
|
||||
OpenLog was written to replace a creaky old inefficient error prone Access database which had in turn replaced stacks of paper logbooks. Now, with some improvements and over 15 years and 44000 notes later in a production environment, it's still going strong.
|
||||
|
||||
8
TODO.txt
@@ -1,15 +1,15 @@
|
||||
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.
|
||||
2. Allow admins to create global templates. DONE
|
||||
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)
|
||||
8. Improve template management interface. It can be confusing. It needs its own page. DONE
|
||||
9. Remove refs from templates. (db change reqd) DONE
|
||||
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd) DONE
|
||||
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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.2.5
|
||||
5.3.2
|
||||
|
||||
@@ -6,6 +6,19 @@
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
function spinner() {
|
||||
local pid="$1"
|
||||
local delay="0.1"
|
||||
local spinstr='|/-\\'
|
||||
local i=0
|
||||
|
||||
while ps -p "$pid" > /dev/null; do
|
||||
i=$(( (i+1) % 4 ))
|
||||
printf "\r[%c]" "${spinstr:$i:1}"
|
||||
sleep "$delay"
|
||||
done
|
||||
printf "\r \r" # Clear the spinner line
|
||||
}
|
||||
|
||||
if [[ $1 == "" ]]
|
||||
then
|
||||
@@ -37,3 +50,105 @@ margs="--defaults-extra-file=$mysql_opt_file"
|
||||
# ---------- version 5.2.5 ------------
|
||||
# Nothing to do
|
||||
# -------------------------------------
|
||||
|
||||
# ---------- version 5.3.0 ------------
|
||||
#
|
||||
echo "Started database updates for OpenLog version 5.3.0..."
|
||||
|
||||
# Import old flag data from old scheme to new flagmap table
|
||||
if [[ $(mysql $margs -e "select count(*) from flagmap") == 0 ]]
|
||||
then
|
||||
echo "Importing flag data from old scheme to new flagmap table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for flagnumber in $(mysql $margs -e "select flagid from flags")
|
||||
do
|
||||
flag_x=$(mysql $margs -s -e "show tables like 'flag_$flagnumber'")
|
||||
if [[ -n "$flag_x" ]]
|
||||
then
|
||||
for tgtid in $(mysql $margs -e "select id from flag_$flagnumber")
|
||||
do
|
||||
target=$(mysql $margs -e "select target from flag_$flagnumber where id=$tgtid")
|
||||
if [[ $target == "lognotes" ]]
|
||||
then
|
||||
mysql $margs -e "insert into flagmap(flagid,lognoteid) values($flagnumber,$tgtid)"
|
||||
elif [[ $target == "maintforms" ]]
|
||||
then
|
||||
mysql $margs -e "insert into flagmap(flagid,maintformid) values($flagnumber,$tgtid)"
|
||||
elif [[ $target == "notetemplates" ]]
|
||||
then
|
||||
mysql $margs -e "insert into flagmap(flagid,notetemplateid) values($flagnumber,$tgtid)"
|
||||
fi
|
||||
|
||||
done
|
||||
mysql $margs -e "drop table flag_$flagnumber"
|
||||
fi
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
fi
|
||||
|
||||
# Import reference chain data into new reflinks table
|
||||
if [[ $(mysql $margs -e "select count(*) from reflinks") == 0 ]]
|
||||
then
|
||||
echo "Importing lognote reference chain data into new reflinks table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for note in $(mysql $margs -e "select lognoteid from lognotes where refs!=''")
|
||||
do
|
||||
refstring=$(mysql $margs -e "select refs from lognotes where lognoteid=$note")
|
||||
oldifs=$IFS
|
||||
IFS=', '
|
||||
for target in $refstring
|
||||
do
|
||||
target=$(echo "$target" | xargs)
|
||||
mysql $margs -e "insert into reflinks(noteid,target) values($note,$target)"
|
||||
done
|
||||
IFS=$oldifs
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
echo "Importing template reference chain data into new reflinks table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for template in $(mysql $margs -e "select templateid from notetemplates where refs!=''")
|
||||
do
|
||||
refstring=$(mysql $margs -e "select refs from notetemplates where templateid=$template")
|
||||
oldifs=$IFS
|
||||
IFS=', '
|
||||
for target in $refstring
|
||||
do
|
||||
target=$(echo "$target" | xargs)
|
||||
mysql $margs -e "insert into reflinks(templateid,target) values($template,$target)"
|
||||
done
|
||||
IFS=$oldifs
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
mysql $margs -e "alter table lognotes drop column refs" >/dev/null 2>&1
|
||||
mysql $margs -e "alter table notetemplates drop column refs" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Convert database to utf8mb4/utf8mb4_unicode_ci
|
||||
echo "Converting database to utf8mb4 encoding..."
|
||||
mysql $margs -e "ALTER DATABASE CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci"
|
||||
for table in $(mysql $margs -e "show tables")
|
||||
do
|
||||
mysql $margs -e "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
||||
done
|
||||
echo "...done."
|
||||
# -------------------------------------
|
||||
|
||||
# ---------- version 5.3.1 ------------
|
||||
# Nothing to do
|
||||
# -------------------------------------
|
||||
|
||||
# ---------- version 5.3.2 ------------
|
||||
# Nothing to do
|
||||
# -------------------------------------
|
||||
@@ -2,56 +2,95 @@
|
||||
|
||||
-- ---------- version 5.2.1 -------------
|
||||
-- Make confname a unique column
|
||||
ALTER TABLE configs ADD UNIQUE(confname);
|
||||
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";
|
||||
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')
|
||||
INSERT IGNORE INTO
|
||||
configs (confname, confvalue)
|
||||
values ('log_errors', '0')
|
||||
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.1" WHERE confname="ol_version";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
UPDATE configs SET confvalue = "5.2.4" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.2.4.1 -----------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.4.1" WHERE confname="ol_version";
|
||||
UPDATE configs SET confvalue = "5.2.4.1" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.2.4.2 -----------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.4.2" WHERE confname="ol_version";
|
||||
UPDATE configs SET confvalue = "5.2.4.2" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.2.4.3 -----------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.4.3" WHERE confname="ol_version";
|
||||
UPDATE configs SET confvalue = "5.2.4.3" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.2.4.4 -----------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.4.4" WHERE confname="ol_version";
|
||||
UPDATE configs SET confvalue = "5.2.4.4" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.2.5 -------------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue="5.2.5" WHERE confname="ol_version";
|
||||
UPDATE configs SET confvalue = "5.2.5" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.3.0 -------------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue = "5.3.0" WHERE confname = "ol_version";
|
||||
|
||||
-- Create the flagmap table
|
||||
CREATE TABLE IF NOT EXISTS `flagmap` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`flagid` int(11) NOT NULL,
|
||||
`lognoteid` int(11) DEFAULT NULL,
|
||||
`maintformid` int(11) DEFAULT NULL,
|
||||
`notetemplateid` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- Create the reflinks table
|
||||
CREATE TABLE IF NOT EXISTS `reflinks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`noteid` int(11) DEFAULT NULL,
|
||||
`templateid` int(11) DEFAULT NULL,
|
||||
`target` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.3.1 -------------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue = "5.3.1" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.3.2 -------------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue = "5.3.2" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
db.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -14,10 +14,10 @@
|
||||
** DO NOT EDIT **
|
||||
************************************************************************
|
||||
*/
|
||||
$appname="APPNAME";
|
||||
$dbname="DBNAME";
|
||||
$username="DBUSER";
|
||||
$dbpass="DBPASS";
|
||||
$appname = "APPNAME";
|
||||
$dbname = "DBNAME";
|
||||
$username = "DBUSER";
|
||||
$dbpass = "DBPASS";
|
||||
|
||||
function dberrmsg($dbname) {
|
||||
echo "
|
||||
@@ -34,7 +34,7 @@ function dberrmsg($dbname) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$db=@mysqli_connect("localhost",$username,$dbpass,$dbname);
|
||||
$db = @mysqli_connect("localhost",$username,$dbpass,$dbname);
|
||||
if (mysqli_errno($db)) {
|
||||
dberrmsg($dbname);
|
||||
}
|
||||
|
||||
13
default-apache.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# _APPNAME_ default Apache configuration
|
||||
|
||||
Alias /_BASEURL_ _DOCROOTIN_/_BASEURL_
|
||||
|
||||
<Directory _DOCROOTIN_/_BASEURL_>
|
||||
AllowOverride Options
|
||||
Options FollowSymLinks
|
||||
DirectoryIndex index.php
|
||||
|
||||
#RewriteEngine On
|
||||
#RewriteBase /_BASEURL_/
|
||||
#RewriteRule . maintenancemode.php [L]
|
||||
</Directory>
|
||||
294
distfiles-old/CHANGELOG
Normal file
@@ -0,0 +1,294 @@
|
||||
CHANGELOG
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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.
|
||||
|
||||
5.2.4.1 - 2025-12-10
|
||||
- Fixed bug in search.php where "Print search results" link on the
|
||||
search results page resulted in the printable page not showing
|
||||
any results. This was due to a php fatal error caused by passing
|
||||
a non-array as the second argument of the php in_array()
|
||||
function.
|
||||
|
||||
5.2.4.2 - 2025-12-11
|
||||
- Fixed other bugs caused by passing a non-array as the second
|
||||
argument of the php in_array() function in various files.
|
||||
|
||||
5.2.4.3 - 2025-12-16
|
||||
- Various problems were noted resulting from php's use of UTC as the
|
||||
default timezone. Now, on installation or upgrade, the installer
|
||||
gets the correct timezone from the system and sets it as a php
|
||||
option in a .htaccess file in the install location. This solves
|
||||
multiple problems and allows today's date and the current time
|
||||
to be determined from the php date() function as part of the
|
||||
settings.php once per page load instead of having to query the
|
||||
database multiple times per page load. Also added the option to
|
||||
allow apache to read the .htaccess file to the <Directory>
|
||||
section of the application's conf file in
|
||||
/etc/apache2/conf-available
|
||||
- Renamed the installer's db.php_update.sh script to files-update.sh
|
||||
to reflect that it now can do more than just modify the db.php
|
||||
file. For this version, it's used to modify the apache conf file
|
||||
mentioned earlier.
|
||||
- Completely removed the optional package prompting/installation
|
||||
code from install.sh. This is best done using separate
|
||||
installers.
|
||||
|
||||
5.2.4.4 - 2025-12-19
|
||||
- Fixed bugs that caused crashes on the Scheduled Maintenance page
|
||||
that were caused by more strict behavior of php regarding mysql
|
||||
queries.
|
||||
- Fixed bug where some functions defined in functions.php were not
|
||||
treating the $today variable as global.
|
||||
- In install.php, if a previous installation was found, make upgrade
|
||||
the default choice.
|
||||
|
||||
5.2.5 - 2026-02-10
|
||||
This is just a version number bump to get on a major-minor-patch
|
||||
scheme. There are no code changes for this release.
|
||||
|
||||
5.3.0 - 2026-02-20
|
||||
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
|
||||
its own page to make it less confusing and to fix some strange
|
||||
behavior.
|
||||
- Added global templates which can be used by anyone but can only be
|
||||
created, modified, or deleted by administrators. This makes it
|
||||
easier to employ standardized templates.
|
||||
- Changed the character encoding of the database to utf8mb4 to enable
|
||||
using emojis in text fields.
|
||||
- Changed the insert link functionality. There are now two fields, link
|
||||
text, and URL. The full URL string will now not be displayed in the
|
||||
note, since it frequently was too long and deformed the table,
|
||||
causing the user to have to scroll right to see the entire note. If
|
||||
a URL is entered in the URL field and no link text is entered in the
|
||||
link text field, the link will show up as just the last part of the
|
||||
URL. For example, "http://somewhere.com/myfile.pdf" will show as
|
||||
"myfile.pdf" in the note text. If text is entered in the link text
|
||||
field, that is what will show as the clickable link in the note text.
|
||||
NOTE: URLs in previously entered notes will not automatically be
|
||||
converted.
|
||||
- Changed the flag handling code to no longer dynamically create flag_
|
||||
tables in the database to track assignments. This is now done using
|
||||
a flagmap table.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- References will no longer be stored in the lognotes table with the note.
|
||||
There is now a reflinks table that stores the link information.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- Various code cleanups to prevent php warnings in the logs if logging
|
||||
is enabled.
|
||||
- Validate all date and time fields to prevent user entered invalid date
|
||||
formats from crashing php.
|
||||
- Fixed profile page to automatically refresh page to show the results
|
||||
when a user changes their color preferences.
|
||||
|
||||
5.3.1 - 2026-02-25
|
||||
- Fixed bug reported as Issue 1 where failure to select an action for a
|
||||
part entered in a lognote crashed php in logentry.php.
|
||||
- Fixed bug where the prompt to set flags on reference chain appeared
|
||||
even when no flags were available to select in logentry.php.
|
||||
|
||||
5.3.2 - 2026-03-02
|
||||
- Fixed bug reported as Issue 2 where printing search results resulted in
|
||||
the flags selection was being ignored.
|
||||
33
distfiles-old/INSTALL
Normal file
@@ -0,0 +1,33 @@
|
||||
INSTALL
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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.
|
||||
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
|
||||
Type ./install.sh at a command prompt. 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-old/LICENSE
Normal 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/
|
||||
|
||||
94
distfiles-old/about.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/*
|
||||
about.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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);
|
||||
856
distfiles-old/common.php
Normal file
@@ -0,0 +1,856 @@
|
||||
<?php
|
||||
/*
|
||||
common.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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");
|
||||
|
||||
// assign variables from constants
|
||||
|
||||
|
||||
// define some other constants
|
||||
define("ADMIN",2);
|
||||
define("USER",1);
|
||||
|
||||
// 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");
|
||||
|
||||
// Determine access mode, login status, and admin status
|
||||
if ($access_mode == "trusted") $trusted=true; else $trusted=false;
|
||||
$loggedin=$isadmin=false;
|
||||
if (isset($_SESSION['userid'])) {
|
||||
$uid=$_SESSION['userid'];
|
||||
$loggedin=true;
|
||||
if (mysqli_fetch_row(mysqli_query($db,"select role from users where id=\"$uid\""))[0] == ADMIN) {
|
||||
$isadmin=true;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 sidemenu/pagetable
|
||||
// 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>
|
||||
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
|
||||
<title>$htmltitle</title>
|
||||
<style type=\"text/css\">
|
||||
* {font-family: Arial, Helvetica, sans-serif;}
|
||||
table.writeup {table-layout:fixed;}
|
||||
td.forcewrap {word-wrap: break-word;}
|
||||
</style>
|
||||
<style type=\"text/css\">
|
||||
.fixed {
|
||||
position:fixed;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function goBack() {
|
||||
window.history.back()
|
||||
}
|
||||
</script>
|
||||
<link href=\"jquery-ui/jquery-ui.css\" rel=\"stylesheet\">
|
||||
<link href=\"jquery-ui/jquery.multiselect.css\" rel=\"stylesheet\">
|
||||
<style>div.ui-datepicker{font-size:12px;}</style>
|
||||
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"colorpicker/css/screen.css\">
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/ddcolorposter.js\"></script>
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/YAHOO.js\" ></script>
|
||||
<script type=\"text/javascript2\" src=\"colorpicker/js/log.js\" ></script>
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/color.js\" ></script>
|
||||
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/event.js\" ></script>
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/dom.js\" ></script>
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/animation.js\" ></script>
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/dragdrop.js\" ></script>
|
||||
|
||||
<script type=\"text/javascript\" src=\"colorpicker/js/slider.js\" ></script>
|
||||
<script type=\"text/javascript\">
|
||||
|
||||
var hue;
|
||||
var picker;
|
||||
//var gLogger;
|
||||
var dd1, dd2;
|
||||
var r, g, b;
|
||||
|
||||
function init() {
|
||||
if (typeof(ygLogger) != \"undefined\")
|
||||
ygLogger.init(document.getElementById(\"logDiv\"));
|
||||
pickerInit();
|
||||
ddcolorposter.fillcolorbox(\"bgcfield\", \"bgcbox\")
|
||||
ddcolorposter.fillcolorbox(\"mbgcfield\", \"mbgcbox\")
|
||||
ddcolorposter.fillcolorbox(\"tcfield\", \"tcbox\")
|
||||
ddcolorposter.fillcolorbox(\"lcfield\", \"lcbox\")
|
||||
ddcolorposter.fillcolorbox(\"vlcfield\", \"vlcbox\")
|
||||
ddcolorposter.fillcolorbox(\"hcfield\", \"hcbox\")
|
||||
}
|
||||
|
||||
// Picker ---------------------------------------------------------
|
||||
|
||||
function pickerInit() {
|
||||
hue = YAHOO.widget.Slider.getVertSlider(\"hueBg\", \"hueThumb\", 0, 180);
|
||||
hue.onChange = function(newVal) { hueUpdate(newVal); };
|
||||
|
||||
picker = YAHOO.widget.Slider.getSliderRegion(\"pickerDiv\", \"selector\",
|
||||
0, 180, 0, 180);
|
||||
picker.onChange = function(newX, newY) { pickerUpdate(newX, newY); };
|
||||
|
||||
hueUpdate();
|
||||
|
||||
dd1 = new YAHOO.util.DD(\"pickerPanel\");
|
||||
dd1.setHandleElId(\"pickerHandle\");
|
||||
dd1.endDrag = function(e) {
|
||||
// picker.thumb.resetConstraints();
|
||||
// hue.thumb.resetConstraints();
|
||||
};
|
||||
}
|
||||
|
||||
executeonload(init);
|
||||
|
||||
function pickerUpdate(newX, newY) {
|
||||
pickerSwatchUpdate();
|
||||
}
|
||||
|
||||
|
||||
function hueUpdate(newVal) {
|
||||
|
||||
var h = (180 - hue.getValue()) / 180;
|
||||
if (h == 1) { h = 0; }
|
||||
|
||||
var a = YAHOO.util.Color.hsv2rgb( h, 1, 1);
|
||||
|
||||
document.getElementById(\"pickerDiv\").style.backgroundColor =
|
||||
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
|
||||
|
||||
pickerSwatchUpdate();
|
||||
}
|
||||
|
||||
function pickerSwatchUpdate() {
|
||||
var h = (180 - hue.getValue());
|
||||
if (h == 180) { h = 0; }
|
||||
document.getElementById(\"pickerhval\").value = (h*2);
|
||||
|
||||
h = h / 180;
|
||||
|
||||
var s = picker.getXValue() / 180;
|
||||
document.getElementById(\"pickersval\").value = Math.round(s * 100);
|
||||
|
||||
var v = (180 - picker.getYValue()) / 180;
|
||||
document.getElementById(\"pickervval\").value = Math.round(v * 100);
|
||||
|
||||
var a = YAHOO.util.Color.hsv2rgb( h, s, v );
|
||||
|
||||
document.getElementById(\"pickerSwatch\").style.backgroundColor =
|
||||
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
|
||||
|
||||
document.getElementById(\"pickerrval\").value = a[0];
|
||||
document.getElementById(\"pickergval\").value = a[1];
|
||||
document.getElementById(\"pickerbval\").value = a[2];
|
||||
var hexvalue = document.getElementById(\"pickerhexval\").value =
|
||||
YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
|
||||
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</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>";
|
||||
if ($print) {
|
||||
echo "
|
||||
<input type=\"button\" onClick=\"window.print()\" value=\"Print\" id=\"printbutton\">
|
||||
<input type=\"button\" onClick=\"window.close()\" value=\"Close\" id=\"closebutton\">
|
||||
";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
} else if ($option=="end") {
|
||||
echo "
|
||||
<script src=\"jquery-ui/external/jquery/jquery.js\"></script>
|
||||
<script src=\"jquery-ui/jquery-ui.js\"></script>
|
||||
<script src=\"jquery-ui/jquery.multiselect.js\"></script>
|
||||
|
||||
<script>
|
||||
$( \".sidemenu\").addClass(\"fixed\");
|
||||
|
||||
$( \":button, :submit, :reset\" ).button();
|
||||
|
||||
$( \"#singledatepicker, #reportdatepicker, #actiondatepicker, [id|='onedp']\" ).datepicker({
|
||||
showOn: \"focus\",
|
||||
showButtonPanel: true,
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: \"yy-mm-dd\"
|
||||
});
|
||||
|
||||
$( \"#startdatepicker, [id|='sdp']\" ).datepicker({
|
||||
showOn: \"focus\",
|
||||
buttonImage: \"icons/calendar.gif\",
|
||||
buttonImageOnly: true,
|
||||
buttonText: \"Select start date\",
|
||||
inline: true,
|
||||
showButtonPanel: true,
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: \"yy-mm-dd\"
|
||||
});
|
||||
|
||||
$( \"#enddatepicker, [id|='edp']\" ).datepicker({
|
||||
showOn: \"focus\",
|
||||
buttonImage: \"icons/calendar.gif\",
|
||||
buttonImageOnly: true,
|
||||
buttonText: \"Select end date\",
|
||||
inline: true,
|
||||
showButtonPanel: true,
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: \"yy-mm-dd\"
|
||||
});
|
||||
|
||||
$( \"#logoutall\" ).checkboxradio({
|
||||
icon: false
|
||||
});
|
||||
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
|
||||
$( \"#status, #user, #reason\" ).selectmenu();
|
||||
$( \"#showdays\" ).selectmenu( { width : 130 } );
|
||||
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
|
||||
$( \"[id|='ms']\").multiselect();
|
||||
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
|
||||
</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) {
|
||||
if ($block=="left") {
|
||||
if ($option=="begin") {
|
||||
echo "
|
||||
<td width=\"210\" 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") {
|
||||
if (defined("FOOTER_MESSAGE")) {
|
||||
$footer_msg=FOOTER_MESSAGE;
|
||||
echo "
|
||||
<br><br>
|
||||
<center>$footer_msg</center><br>
|
||||
";
|
||||
}
|
||||
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($printable=true) {
|
||||
// Displays sidebar menu
|
||||
global $db,$mbgcolor,$trusted,$loggedin,$isadmin;
|
||||
|
||||
if ($trusted || $loggedin) {
|
||||
echo "
|
||||
<div class=\"sidemenu\">
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><a href=\"create.php\" title=\"Create new writeup\"><font size=\"+1\"><b>Create New Writeup</b></font></a></td></tr>
|
||||
</table>
|
||||
<br>";
|
||||
}
|
||||
echo "
|
||||
<center><button onclick=\"goBack()\">Go Back</button></center>
|
||||
";
|
||||
if ($trusted || $loggedin) {
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View writeups\">View Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
";
|
||||
if ($isadmin) {
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><b>Admin Functions</b></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"https://localhost:10000\" title=\"Webmin for managing a terminal. Webmin must be running on localhost.\">Manage Terminal</a></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
if (! $loggedin) {
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><b>My Account</b></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"login.php\"><b>Log In</b></a></td></tr>
|
||||
</table>
|
||||
<br>";
|
||||
} else {
|
||||
$menuuser=$_SESSION['userid'];
|
||||
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select firstname,lastname from users where id=\"$menuuser\""));
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><b>My Account</b></td></tr>
|
||||
<tr><td align=\"center\">Logged in as $loggedinas[0] $loggedinas[1]</td></tr><tr><td align=\"center\"><a href=\"login.php?cancel=1\"><b>Log Out</b></a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"profile.php\">My Profile</a></td></tr>
|
||||
</table>
|
||||
<br>";
|
||||
}
|
||||
if ($printable) {
|
||||
$currentparams=arrayCopy($_REQUEST);
|
||||
echo "
|
||||
<br>
|
||||
<center>
|
||||
<form method=\"post\" target=\"_blank\">
|
||||
<input type=\"hidden\" name=\"all_parameters\" value=\"". htmlentities(serialize($currentparams))."\">
|
||||
<input type=\"submit\" name=\"print\" value=\"Show Printable\" id=\"showprintable\"></form>
|
||||
</center>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><a href=\"about.php\">About</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
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($db,$table,$in_field,$out_field,$in_data) {
|
||||
// look up a single field in a database given a value for a single field
|
||||
$lookup_result=(mysqli_query($db,"select $out_field from $table where $in_field=\"$in_data\""));
|
||||
if (mysqli_num_rows($lookup_result) > 0) {
|
||||
$out_data=mysqli_fetch_row($lookup_result);
|
||||
return($out_data[0]);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
function arrayCopy( array $array ) {
|
||||
$result=[];
|
||||
foreach( $array as $key => $val ) {
|
||||
if( is_array( $val ) ) {
|
||||
$result[$key] = arrayCopy( $val );
|
||||
} elseif ( is_object( $val ) ) {
|
||||
$result[$key] = clone $val;
|
||||
} else {
|
||||
$result[$key] = $val;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function validateDate($date, $format = 'Y-m-d') {
|
||||
$d = DateTime::createFromFormat($format, $date);
|
||||
return $d && $d->format($format) == $date;
|
||||
}
|
||||
|
||||
function validateTime($time, $format = 'H:i:s') {
|
||||
$t = DateTime::createFromFormat($format, $time);
|
||||
return $t && $t->format($format) == $time;
|
||||
}
|
||||
|
||||
function validate_password($pass,$passconf) {
|
||||
// run some checks on supplied passwords
|
||||
// returns a two element array
|
||||
// first element is true if passwords match, false if not
|
||||
// second element is true if passwords meet complexity requirements, false if not
|
||||
|
||||
$results=[];
|
||||
|
||||
// check for match
|
||||
if ($pass==$passconf) {
|
||||
$results['match']=true;
|
||||
} else {
|
||||
$results['match']=false;
|
||||
}
|
||||
|
||||
// check for complexity
|
||||
// length
|
||||
if (strlen($pass) < 8) {
|
||||
$passlength=false;
|
||||
} else {
|
||||
$passlength=true;
|
||||
}
|
||||
// upper case
|
||||
if (preg_match('/[A-Z]/',$pass)) {
|
||||
$hasupper=true;
|
||||
} else {
|
||||
$hasupper=false;
|
||||
}
|
||||
// lower case
|
||||
if (preg_match('/[a-z]/',$pass)) {
|
||||
$haslower=true;
|
||||
} else {
|
||||
$haslower=false;
|
||||
}
|
||||
// number
|
||||
if (preg_match('/[0-9]/',$pass)) {
|
||||
$hasnumber=true;
|
||||
} else {
|
||||
$hasnumber=false;
|
||||
}
|
||||
// special character
|
||||
if (preg_match('/[[:punct:]]/',$pass)) {
|
||||
$hasspecial=true;
|
||||
} else {
|
||||
$hasspecial=false;
|
||||
}
|
||||
if ($passlength && $hasupper && $haslower && $hasnumber && $hasspecial) {
|
||||
$results['complex']=true;
|
||||
} else {
|
||||
$results['complex']=false;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
function displaywriteup($id) {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $db;
|
||||
|
||||
$writeupdata=mysqli_fetch_assoc(mysqli_query($db,"select * from writeups where id=\"$id\""));
|
||||
// determine status indicator
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine functional indicator
|
||||
if($writeupdata["functional"]==1) {
|
||||
$funcind="<font color=\"#00FF00\" title=\"$functional_yes\">$functional_yes_short</font>";
|
||||
} else {
|
||||
$funcind="<font color=\"#FF0000\" title=\"$functional_no\">$functional_no_short</font>";
|
||||
}
|
||||
// look up text data
|
||||
$devicename=dblookup($db,"devices","id","name",$writeupdata["device"]);
|
||||
$subsystemname=dblookup($db,"subsystems","id","name",$writeupdata["subsystem"]);
|
||||
$subsystemdesc=dblookup($db,"subsystems","id","description",$writeupdata["subsystem"]);
|
||||
$discrtxt=$writeupdata["discrepancy_text"];
|
||||
$rdate=$writeupdata["report_date"];
|
||||
$rtime=$writeupdata["report_time"];
|
||||
$repby=$writeupdata["reported_by"];
|
||||
$whendiscoveredname=dblookup($db,"discovered","id","whendiscoveredname",$writeupdata["discovered"]);
|
||||
$whendiscovereddesc=dblookup($db,"discovered","id","whendiscovereddesc",$writeupdata["discovered"]);
|
||||
$techfname=dblookup($db,"users","id","firstname",$writeupdata["action_by"]);
|
||||
$techlname=dblookup($db,"users","id","lastname",$writeupdata["action_by"]);
|
||||
$reasonname=dblookup($db,"reasons","id","text",$writeupdata["action_reason"]);
|
||||
$actxt=$writeupdata["action_text"];
|
||||
$adate=$writeupdata["action_date"];
|
||||
if ($adate=="0000-00-00") $adate="";
|
||||
$atime=$writeupdata["action_time"];
|
||||
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($db,"select linkgroup from links where writeupid=\"{$writeupdata['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
if ($is_member) {
|
||||
$group_count=$is_member;
|
||||
$member_group=mysqli_fetch_row($member_qry)[0];
|
||||
$member_group_name=dblookup($db,"groups","id","name",$member_group);
|
||||
if ($member_group_name) {
|
||||
$imgtitle="Member of group: $member_group_name";
|
||||
} else {
|
||||
$imgtitle="Member of group ID: $member_group";
|
||||
}
|
||||
if ($group_count == 1) {
|
||||
$group_ind="<a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$group_ind="<a href=\"writeupdetail.php?id={$writeupdata['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
} else {
|
||||
$group_ind=NULL;
|
||||
}
|
||||
echo "
|
||||
<table border=\"2\" width=\"100%\"><tr><td>
|
||||
<table border=\"0\">
|
||||
<tr><td><b>ID:</b> <a href=\"writeupdetail.php?id=$id\" title=\"View or change details of this writeup\">$id</a></td><td> </td>
|
||||
<td><b>$statusind</b></td><td> </td>
|
||||
<td><b>$device_term:</b> $devicename</td><td> </td>
|
||||
<td><b>Subsystem:</b> <font title=\"$subsystemdesc\">$subsystemname</font></td><td> </td>
|
||||
<td><b>$discovered_term:</b> <font title=\"$whendiscovereddesc\">$whendiscoveredname</font></td><td> </td>
|
||||
<td><b>$funcind</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td><b>Discrepancy:</b><br>$discrtxt</td><td> </td>
|
||||
<td align=\"right\" valign=\"bottom\">$group_ind</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td><b>Report date:</b> $rdate</td><td> </td>
|
||||
<td><b>Report time:</b> $rtime</td><td> </td>
|
||||
<td><b>Reported by:</b> $repby</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td><b>Action taken by:</b> $techfname $techlname</td><td> </td>
|
||||
<td><b>Status change reason:</b> $reasonname</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td><b>Action taken:</b><br>$actxt</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td><b>Action date:</b> $adate</td><td> </td>
|
||||
<td><b>Action time:</b> $atime</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
";
|
||||
}
|
||||
|
||||
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>
|
||||
";
|
||||
}
|
||||
|
||||
function getsetting($setting_name,$user_id) {
|
||||
// get the value of a setting for a user
|
||||
global $db;
|
||||
$confqry=mysqli_query($db,"select id,value from config where name=\"$setting_name\"");
|
||||
$confvalue=mysqli_fetch_assoc($confqry)['value'];
|
||||
$userqry=mysqli_query($db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
|
||||
if (mysqli_num_rows($userqry) > 0) {
|
||||
$uservalue=mysqli_fetch_assoc($userqry)['value'];
|
||||
if ($uservalue) {
|
||||
return $uservalue;
|
||||
} else {
|
||||
return $confvalue;
|
||||
}
|
||||
} else {
|
||||
return $confvalue;
|
||||
}
|
||||
}
|
||||
|
||||
function putsetting($setting_name,$setting_value,$user_id) {
|
||||
// set the value of a setting for a tech
|
||||
global $db;
|
||||
$confqry=mysqli_query($db,"select value from config where name=\"$setting_name\"");
|
||||
$confvalue=mysqli_fetch_assoc($confqry)['value'];
|
||||
$userqry=mysqli_query($db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
|
||||
if (mysqli_num_rows($userqry) > 0) {
|
||||
$uservalue=mysqli_fetch_assoc($userqry)['value'];
|
||||
if ($setting_value==$confvalue) {
|
||||
mysqli_query($db,"delete from profile where user=\"$user_id\" and name=\"$setting_name\"");
|
||||
} else {
|
||||
if ($uservalue) {
|
||||
if ($uservalue != $setting_value) mysqli_query($db,"update profile set value=\"$setting_value\" where name=\"$setting_name\" and user=\"$user_id\"");
|
||||
} else {
|
||||
mysqli_query($db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mysqli_query($db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
|
||||
}
|
||||
}
|
||||
|
||||
function group_detail($groupid,$role=false,$mode="view",$selection="none") {
|
||||
// display a table for a single group
|
||||
|
||||
// groupid is the group for which detail is to be shown
|
||||
// role is true if user is logged in, false if not.
|
||||
// mode is "select" if selection boxes are to be displayed, "view" if not.
|
||||
// selection is "all" or "none"
|
||||
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $db;
|
||||
|
||||
// print group id and name
|
||||
if ($selection == "all") {
|
||||
$sel_flag="checked";
|
||||
} elseif ($selection == "none") {
|
||||
$sel_flag="";
|
||||
}
|
||||
$groupname=dblookup($db,"groups","id","name",$groupid);
|
||||
if ($groupname == "") {
|
||||
echo "<b>Group ID: $groupid";
|
||||
} else {
|
||||
echo "<b>Group Name: $groupname";
|
||||
}
|
||||
echo "</b><br>";
|
||||
// print table headers
|
||||
if ($role && $mode=="select") {
|
||||
echo "
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">Select</th>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
$writeup_qry=mysqli_query($db,"select writeupid from links where linkgroup=$groupid order by writeupid asc");
|
||||
while ($writeup=mysqli_fetch_row($writeup_qry)) {
|
||||
// get writeup data
|
||||
$writeupdata=mysqli_fetch_assoc(mysqli_query($db,"select * from writeups where id={$writeup[0]}"));
|
||||
|
||||
// convert device number to name
|
||||
$tname=dblookup($db,"devices","id","name",$writeupdata["device"]);
|
||||
// convert subsystem number to name
|
||||
$ssname=dblookup($db,"subsystems","id","name",$writeupdata["subsystem"]);
|
||||
// determine status indicator
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine whendiscovered text for discovered id
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($db,"select whendiscoveredname from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($db,"select whendiscovereddesc from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
// determine functional icon
|
||||
if($writeupdata["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
// print table row
|
||||
if ($role && $mode=="select") {
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"targets[]\" value=\"%s\" $sel_flag></td>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</font></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\">%s</td>
|
||||
</tr>\n",
|
||||
$writeupdata["id"],
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$func_icon
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</font></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\">%s</td>
|
||||
</tr>\n",
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
}
|
||||
echo "</table><br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
382
distfiles-old/gpl.php
Normal file
@@ -0,0 +1,382 @@
|
||||
<?php
|
||||
/*
|
||||
gpl.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
|
||||
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);
|
||||
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 564 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
BIN
distfiles-old/icons/cross.png
Normal file
|
After Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 757 B |
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
BIN
distfiles-old/icons/question.png
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
distfiles-old/icons/tick.png
Normal file
|
After Width: | Height: | Size: 634 B |
BIN
distfiles-old/images/Kamiyamane.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
distfiles-old/images/apache_pb.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
distfiles-old/images/color-palette_1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
distfiles-old/images/linux.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
distfiles-old/images/php-small-trans-dark.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 276 B |
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
807
distfiles-old/logentry.php
Normal file
@@ -0,0 +1,807 @@
|
||||
<?php
|
||||
/*
|
||||
logentry.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (!array_key_exists("login", $_SESSION) && !array_key_exists("partview", $_REQUEST)) {
|
||||
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;
|
||||
$date = $_REQUEST['date'] ?? NULL;
|
||||
$time = $_REQUEST['time'] ?? NULL;
|
||||
$note = $_REQUEST['note'] ?? NULL;
|
||||
$shift = $_REQUEST['shift'] ?? NULL;
|
||||
$subject = $_REQUEST['subject'] ?? NULL;
|
||||
$refstring = $_REQUEST['refstring'] ?? NULL;
|
||||
$refto = $_REQUEST['refto'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
$add = $_REQUEST['add'] ?? NULL;
|
||||
$edit = $_REQUEST['edit'] ?? NULL;
|
||||
$delete = $_REQUEST['delete'] ?? NULL;
|
||||
$usertemplateid = $_REQUEST['usertemplateid'] ?? NULL;
|
||||
$globaltemplateid = $_REQUEST['globaltemplateid'] ?? NULL;
|
||||
$loadtemplate = $_REQUEST['loadtemplate'] ?? 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'] ?? ["off"];
|
||||
$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 ($isadmin) {
|
||||
$authorized = TRUE;
|
||||
} else {
|
||||
$authorized = FALSE;
|
||||
}
|
||||
|
||||
if ($add) {
|
||||
framework("begin", "$logname", "Note Entry", $print);
|
||||
$authorized = TRUE;
|
||||
}
|
||||
if ($edit || $delete) {
|
||||
framework("begin", "$logname", "Note Edit", $print);
|
||||
$owner = dblookup($db, "lognotes", "lognoteid", "tech", $noteid);
|
||||
if ($techid == $owner) $authorized = TRUE;
|
||||
}
|
||||
|
||||
// var_dump($_REQUEST);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
if ($usertemplateid) {
|
||||
$templateid = $usertemplateid;
|
||||
} else if ($globaltemplateid) {
|
||||
$templateid = $globaltemplateid;
|
||||
} else {
|
||||
$templateid = NULL;
|
||||
$loadtemplate = NULL;
|
||||
}
|
||||
|
||||
if ($add) {
|
||||
if ($submit) {
|
||||
// add the entry if submit is pressed
|
||||
if ($note) {
|
||||
// sanitize and fix blank date and time
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
// 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);
|
||||
|
||||
if (strlen($refstring)) {
|
||||
// remove everything except numbers and spaces from references and sanitize
|
||||
$refstring = preg_replace("#[^\d ]{1,}#", " ", $refstring);
|
||||
$refstring = mysqli_real_escape_string($db, $refstring);
|
||||
$refstring = trim($refstring);
|
||||
}
|
||||
|
||||
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) values (\"$date\", \"$time\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
||||
$newnoteid = mysqli_insert_id($db);
|
||||
|
||||
// add references to the reflinks table
|
||||
if (strlen($refstring)) {
|
||||
$refstring = trim($refstring);
|
||||
$refarray = explode(" ", $refstring);
|
||||
foreach ($refarray as $target) {
|
||||
mysqli_query($db, "insert into reflinks(noteid,target) values($newnoteid,$target)");
|
||||
}
|
||||
}
|
||||
$chainmembers = generate_chain($newnoteid);
|
||||
|
||||
// update the flagmap table
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this note
|
||||
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$newnoteid\")");
|
||||
if ($syncflags) {
|
||||
//set flag for reference chain notes
|
||||
foreach ($chainmembers as $refdnote) {
|
||||
if ($refdnote != $newnoteid) {
|
||||
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$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 (array_key_exists($plidx,$mfreqs) && $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 (array_key_exists($plidx,$mfreqs) && $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 (array_key_exists($plidx,$mfreqs) && $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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($loadtemplate) {
|
||||
$templatevalues = mysqli_fetch_assoc(mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\""));
|
||||
$defaultshift = $templatevalues["shift"];
|
||||
$defaultsubject = $templatevalues["subject"];
|
||||
$note = $templatevalues["lognote"];
|
||||
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||
while ($thistgt = mysqli_fetch_row($refstringqry)) {
|
||||
$refstring = $refstring . " " . $thistgt[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($edit) {
|
||||
if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
||||
if ($submit) {
|
||||
if ($note) {
|
||||
// sanitize and fix blank date and time
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
// remove cruft from note text
|
||||
$note = strip_tags($note, "<a>");
|
||||
$note = mysqli_real_escape_string($db, $note);
|
||||
|
||||
// remove cruft from references
|
||||
if (strlen($refstring)) {
|
||||
$refstring = trim($refstring);
|
||||
$refstring = preg_replace("#[a-zA-Z]{1,}#", "", $refstring);
|
||||
}
|
||||
|
||||
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\" where lognoteid=\"$noteid\"");
|
||||
|
||||
// update the reflinks table
|
||||
mysqli_query($db, "delete from reflinks where noteid=\"$noteid\"");
|
||||
if (strlen($refstring)) {
|
||||
$refstring = trim($refstring);
|
||||
$refarray = explode(" ", $refstring);
|
||||
foreach ($refarray as $thisref) {
|
||||
mysqli_query($db, "insert into reflinks(noteid,target) values(\"$noteid\",\"$thisref\")");
|
||||
}
|
||||
}
|
||||
$chainmembers = generate_chain($noteid);
|
||||
|
||||
// update the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where lognoteid=\"$noteid\"");
|
||||
if ($syncflags) {
|
||||
foreach ($chainmembers as $refdnote) {
|
||||
if ($refdnote != $noteid) {
|
||||
mysqli_query($db, "delete from flagmap where lognoteid=\"$refdnote\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this note
|
||||
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$noteid\")");
|
||||
if ($syncflags) {
|
||||
//set flag for reference chain notes
|
||||
foreach ($chainmembers as $refdnote) {
|
||||
if ($refdnote != $noteid) {
|
||||
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$refdnote\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 (array_key_exists($plidx,$mfreqs) && $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 (array_key_exists($plidx,$mfreqs) && $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 (array_key_exists($plidx,$mfreqs) && $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
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($loadtemplate) {
|
||||
// get the note in question from the selected template
|
||||
$getnote = mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\"");
|
||||
} else {
|
||||
// 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) {
|
||||
// find notes having this note as a target
|
||||
$drefnoteqry = mysqli_query($db, "select noteid from reflinks where target=\"$noteid\"");
|
||||
while ($drefnoterow = mysqli_fetch_assoc($drefnoteqry)) {
|
||||
$drefnotes[] = $drefnoterow["noteid"];
|
||||
}
|
||||
// find targets for this note
|
||||
$dreftgtqry = mysqli_query($db, "select target from reflinks where noteid=\"$noteid\"");
|
||||
while ($dreftgtrow = mysqli_fetch_assoc($dreftgtqry)) {
|
||||
$dreftgts[] = $dreftgtrow["target"];
|
||||
}
|
||||
// for every note having this one as a target, add this note's targets
|
||||
foreach ($drefnotes as $drefnote) {
|
||||
foreach ($dreftgts as $dreftgt) {
|
||||
mysqli_query($db, "insert into reflinks(noteid,target) values(\"$drefnote\",\"$dreftgt\")");
|
||||
}
|
||||
}
|
||||
// delete this note from reflinks
|
||||
mysqli_query($db, "delete from reflinks where noteid is not null and (noteid=\"$noteid\" or target=\"$noteid\")");
|
||||
|
||||
// delete from lognotes table
|
||||
mysqli_query($db, "delete from lognotes where lognoteid=\"$noteid\"");
|
||||
|
||||
// delete occurances from the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where lognoteid=\"$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"] ?? $today;
|
||||
$notetime = $notetoedit["time"] ?? $now;
|
||||
$defaultshift = $notetoedit["shift"];
|
||||
$defaultsubject = $notetoedit["subject"];
|
||||
|
||||
$note = $notetoedit["lognote"];
|
||||
// generate reference string for this note
|
||||
if ($submit) {
|
||||
$refstring = NULL;
|
||||
}
|
||||
$refstringqry = mysqli_query($db, "select target from reflinks where noteid=\"$noteid\"");
|
||||
while ($thistgt = mysqli_fetch_row($refstringqry)) {
|
||||
$refstring = $refstring . " " . $thistgt[0];
|
||||
}
|
||||
$techid = $notetoedit["tech"];
|
||||
}
|
||||
$techname = dblookup($db, "techs", "techid", "techname", $techid);
|
||||
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 (array_key_exists('login', $_SESSION)) {
|
||||
// show the template selection line
|
||||
templateselect($techid, NULL);
|
||||
}
|
||||
|
||||
// start note entry section
|
||||
echo "
|
||||
<form method=\"post\" action=\"logentry.php\">
|
||||
<table border=\"0\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<td align=\"center\" colspan=\"2\"><b>Date: </b>
|
||||
<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>
|
||||
<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>
|
||||
<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> $techname
|
||||
</td>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Shift: </b>
|
||||
<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>
|
||||
<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> <img src=\"icons/question.png\" title=\"Enter note text below. To insert a link to a web page, enter it's info in the link fields below the Note box and click Insert Link. You must provide the URL, but the link text is optional. \"><br>
|
||||
<textarea rows=\"10\" cols=\"60\" name=\"note\" id=\"notetextarea\" wrap=\"soft\">";
|
||||
if ($edit || $usertemplateid || $globaltemplateid || $schedmaintcomplete) echo "$note";
|
||||
echo "</textarea><br>
|
||||
<input type=\"text\" size=\"23\" id=\"linktextfield\" placeholder=\"Enter link text here\">
|
||||
<input type=\"text\" size=\"23\" id=\"linkurlfield\" placeholder=\"Enter URL here\">
|
||||
<a href=\"#\" onclick=\"insertUrlAtCaret('notetextarea','linktextfield','linkurlfield');return false;\">Insert Link</a><br>
|
||||
";
|
||||
|
||||
// create an array called theseflags of flagids set for this noteid
|
||||
$allflags = mysqli_query($db, "select flagid from flags");
|
||||
unset($theseflags);
|
||||
$theseflags = [];
|
||||
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||
if ($templateid) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
||||
$theseflags[] = $thisflag[0];
|
||||
}
|
||||
} else {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and lognoteid=\"$noteid\""))) {
|
||||
$theseflags[] = $thisflag[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if adding a note/template, only show active flags, otherwise, show all flags
|
||||
if ($add) {
|
||||
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||
} else {
|
||||
$flagslist = mysqli_query($db, "select * from flags");
|
||||
}
|
||||
$flagsperline = 8;
|
||||
$flagcount = 1;
|
||||
|
||||
// display checkboxes for all the flags, selecting the ones that are set for this note/template
|
||||
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 " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
if (mysqli_num_rows($flagslist)) {
|
||||
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>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"syncflags\" value=\"0\">
|
||||
";
|
||||
}
|
||||
|
||||
if ($add && $refto) $refstring = $refto;
|
||||
echo "
|
||||
<br><br><b>References: </b>
|
||||
<input type=\"text\" name=\"refstring\" size=\"20\" value=\"$refstring\" title=\"One or more Note ID numbers separated by spaces\">
|
||||
|
||||
";
|
||||
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=\"$defaultaction\" selected>Select Action</option>
|
||||
";
|
||||
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||
if ($actitem["status"] == 1) {
|
||||
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\"> <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¬eid=$noteid&removepart=$iconpartid\" title=\"Click to remove part from this note\"><img src=\"icons/minus-button.png\"></a> $epuid</td>
|
||||
<td align=\"center\">$eppn</td>
|
||||
<td align=\"center\">$epsn</td>
|
||||
<td align=\"center\">
|
||||
";
|
||||
if ($defaultaction) {
|
||||
// an action was selected previously, so just display it
|
||||
$actname = dblookup($db, "logpartactions", "lpactionid", "lpactionname", $defaultaction);
|
||||
echo "$actname";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
";
|
||||
// find maint form for this line and show link
|
||||
echo "
|
||||
<td align=\"center\">
|
||||
";
|
||||
$mflinkqry = mysqli_query($db, "select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\"");
|
||||
if (mysqli_num_rows($mflinkqry)) {
|
||||
$mflinkdata = mysqli_fetch_assoc($mflinkqry);
|
||||
$mflinknum = $mflinkdata["maintformid"];
|
||||
echo "
|
||||
<a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</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=\"$defaultaction\" selected>Select Action</option>
|
||||
";
|
||||
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||
if ($actitem["status"] == 1) {
|
||||
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);
|
||||
100
distfiles-old/login.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/*
|
||||
login.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$tech = $_REQUEST['tech'] ?? NULL;
|
||||
$pass = $_REQUEST['pass'] ?? NULL;
|
||||
$login = $_REQUEST['login'] ?? NULL;
|
||||
$cancel = $_REQUEST['cancel'] ?? NULL;
|
||||
|
||||
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>
|
||||
<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: <input type=\"password\" name=\"pass\" size=\"40\"><br><br>
|
||||
<input type=\"submit\" name=\"login\" value=\"Log In\">
|
||||
<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);
|
||||
259
distfiles-old/lognotes.php
Normal file
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
/*
|
||||
lognotes.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
//---include("functions.php");
|
||||
include("common.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
|
||||
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,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)) {
|
||||
$thisnote = $tablerow["lognoteid"];
|
||||
$refs = " <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
||||
if (islink($thisnote)) {
|
||||
$refs = $refs . " <a href=\"refchain.php?chainnote=$thisnote\"><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 = "";
|
||||
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
|
||||
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||
$flagcolor = $flagparams["flagcolor"];
|
||||
$flagsym = $flagparams["flagsym"];
|
||||
$flagname = $flagparams["flagname"];
|
||||
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||
}
|
||||
if ($flagstring) {
|
||||
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||
} 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=\"$thisnote\""))) {
|
||||
$fmtnote = $fmtnote . "<a href=\"logentry.php?partview=1¬eid=$thisnote\">PARTS</a>";
|
||||
}
|
||||
}
|
||||
// now print the line in the table
|
||||
if ($showtime) {
|
||||
printf(
|
||||
"<tr>
|
||||
<td valign=\"top\"><a href=\"logentry.php?edit=1¬eid=%s\" title=\"Edit this note\">%s</a> %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¬eid=%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,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)) {
|
||||
$thisnote = $tablerow["lognoteid"];
|
||||
$refs = " <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
||||
if (islink($tablerow["lognoteid"])) {
|
||||
$refs = $refs . " <a href=\"refchain.php?chainnote=$thisnote\"><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 = "";
|
||||
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
|
||||
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||
$flagcolor = $flagparams["flagcolor"];
|
||||
$flagsym = $flagparams["flagsym"];
|
||||
$flagname = $flagparams["flagname"];
|
||||
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||
}
|
||||
if ($flagstring) {
|
||||
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||
} 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=\"$thisnote\""))) {
|
||||
$fmtnote = $fmtnote . "<a href=\"logentry.php?edit=1¬eid=$thisnote\" 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¬eid=%s\" title=\"Note ID. Click to edit.\">%s</a>
|
||||
<b>%s
|
||||
%s
|
||||
%s
|
||||
%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¬eid=%s\">%s</a>
|
||||
<b>%s
|
||||
%s
|
||||
%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);
|
||||
237
distfiles-old/maintform.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/*
|
||||
maintform.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$histdays = $_REQUEST['histdays'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
|
||||
$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 = " ";
|
||||
$partno = dblookup($db, "parts", "partid", "partnum", $pendrow["mfpart"]);
|
||||
if ($partno == "") $partno = " ";
|
||||
$serno = dblookup($db, "parts", "partid", "sernum", $pendrow["mfpart"]);
|
||||
if ($serno == "") $serno = " ";
|
||||
$partname = dblookup($db, "parts", "partid", "partname", $pendrow["mfpart"]);
|
||||
if ($partname == "") $partname = " ";
|
||||
// look up tech name
|
||||
$tname = dblookup($db, "techs", "techid", "techname", $pendrow["mftech"]);
|
||||
if ($pendrow["lognoteid"] == 0) {
|
||||
$noteidval = " ";
|
||||
$notetag = "%s%s";
|
||||
} else {
|
||||
$noteidval = $pendrow["lognoteid"];
|
||||
$notetag = "<a href=\"logentry.php?edit=1¬eid=%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>
|
||||
<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 = " ";
|
||||
$serno = dblookup($db, "parts", "partid", "sernum", $histrow["mfpart"]);
|
||||
if ($serno == "") $serno = " ";
|
||||
$partname = dblookup($db, "parts", "partid", "partname", $histrow["mfpart"]);
|
||||
if ($partname == "") $partname = " ";
|
||||
// look up tech name
|
||||
$tname = dblookup($db, "techs", "techid", "techname", $histrow["mftech"]);
|
||||
if ($histrow["lognoteid"] == 0) {
|
||||
$noteidval = " ";
|
||||
$notetag = "%s%s";
|
||||
} else {
|
||||
$noteidval = $histrow["lognoteid"];
|
||||
$notetag = "<a href=\"logentry.php?edit=1¬eid=%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);
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
maintformentry.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -11,120 +11,123 @@ include("functions.php");
|
||||
|
||||
|
||||
if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
|
||||
header ("Location: login.php");
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
$loggedinas=$_SESSION['login'];
|
||||
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
|
||||
$loggedinas = $_SESSION['login'];
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||
|
||||
function getmfdata($maintformid) {
|
||||
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\""));
|
||||
$mfdata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintforms where maintformid=\"$maintformid\""));
|
||||
return $mfdata;
|
||||
}
|
||||
|
||||
function getactiondata($maintactionid) {
|
||||
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\""));
|
||||
$actiondata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintactions where maintactionid=\"$maintactionid\""));
|
||||
return $actiondata;
|
||||
}
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
|
||||
$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'];
|
||||
$maintformid = $_REQUEST['maintformid'] ?? NULL;
|
||||
$lognoteid = $_REQUEST['lognoteid'] ?? NULL;
|
||||
$mfdate = $_REQUEST['date'] ?? NULL;
|
||||
$mftime = $_REQUEST['time'] ?? NULL;
|
||||
$mfsubmit = $_REQUEST['mfsubmit'] ?? NULL;
|
||||
$mfadd = $_REQUEST['mfadd'] ?? NULL;
|
||||
$mfedit = $_REQUEST['mfedit'] ?? NULL;
|
||||
$mfdelete = $_REQUEST['mfdelete'] ?? NULL;
|
||||
$mfpartloc = $_REQUEST['mfpartloc'] ?? NULL;
|
||||
$mfmalfunction = $_REQUEST['mfmalfunction'] ?? NULL;
|
||||
$nha = $_REQUEST['nha'] ?? NULL;
|
||||
$repord = $_REQUEST['repord'] ?? NULL;
|
||||
$mfpart = $_REQUEST['mfpart'] ?? NULL;
|
||||
$uid = $_REQUEST['uid'] ?? NULL;
|
||||
$partnum = $_REQUEST['partnum'] ?? NULL;
|
||||
$sernum = $_REQUEST['sernum'] ?? NULL;
|
||||
$partname = $_REQUEST['partname'] ?? NULL;
|
||||
$actionadd = $_REQUEST['actionadd'] ?? NULL;
|
||||
$actionedit = $_REQUEST['actionedit'] ?? NULL;
|
||||
$actiondelete = $_REQUEST['actiondelete'] ?? NULL;
|
||||
$maintactionid = $_REQUEST['maintactionid'] ?? NULL;
|
||||
$actiondate = $_REQUEST['actiondate'] ?? NULL;
|
||||
$actiontime = $_REQUEST['actiontime'] ?? NULL;
|
||||
$actiontech = $_REQUEST['actiontech'] ?? NULL;
|
||||
$action = $_REQUEST['action'] ?? NULL;
|
||||
$actionaddsubmit = $_REQUEST['actionaddsubmit'] ?? NULL;
|
||||
$actioneditsubmit = $_REQUEST['actioneditsubmit'] ?? NULL;
|
||||
$printfmt = $_REQUEST['printfmt'] ?? NULL;
|
||||
if ($printfmt) $print = TRUE;
|
||||
$flags = $_POST['flags'] ?? [];
|
||||
|
||||
$logname=LOG_NAME;
|
||||
$uidtext=UID_TEXT;
|
||||
$logname = LOG_NAME;
|
||||
$uidtext = UID_TEXT;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
if ($printfmt) {
|
||||
framework("begin","","",$print);
|
||||
framework("begin", "", "", $print);
|
||||
} else if ($mfedit) {
|
||||
framework("begin","$logname","Maintenance Form Edit",$print);
|
||||
if ($loggedinas) $mfauthorized=1;
|
||||
framework("begin", "$logname", "Maintenance Form Edit", $print);
|
||||
if ($loggedinas) $mfauthorized = TRUE;
|
||||
} else if ($mfdelete) {
|
||||
framework("begin","$logname","Maintenance Form Edit",$print);
|
||||
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
|
||||
if (($loggedinas==$mfowner) || $isadmin) $mfauthorized=1;
|
||||
framework("begin", "$logname", "Maintenance Form Edit", $print);
|
||||
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||
if (($loggedinas == $mfowner) || $isadmin) $mfauthorized = TRUE;
|
||||
} else if ($actionadd) {
|
||||
framework("begin","$logname","Maintenance Action Entry",$print);
|
||||
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
|
||||
framework("begin", "$logname", "Maintenance Action Entry", $print);
|
||||
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||
if ($loggedinas) {
|
||||
$mfauthorized=1;
|
||||
$actionauthorized=1;
|
||||
$mfauthorized = TRUE;
|
||||
$actionauthorized = TRUE;
|
||||
}
|
||||
} 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;
|
||||
framework("begin", "$logname", "Maintenance Action Edit", $print);
|
||||
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||
if ($loggedinas) $mfauthorized = TRUE;
|
||||
$actionowner = dblookup($db, "maintactions", "maintactionid", "actiontech", $maintactionid);
|
||||
if (($loggedinas == $actionowner) || $isadmin) $actionauthorized = TRUE;
|
||||
} else {
|
||||
$mfadd=1;
|
||||
framework("begin","$logname","Maintenance Form Entry",$print);
|
||||
$mftech=$loggedinas;
|
||||
$mfauthorized=1;
|
||||
$mfadd = TRUE;
|
||||
framework("begin", "$logname", "Maintenance Form Entry", $print);
|
||||
$mftech = $loggedinas;
|
||||
$mfauthorized = TRUE;
|
||||
}
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
//var_dump($_REQUEST);
|
||||
|
||||
$pdatamismatch = NULL;
|
||||
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;
|
||||
$mftoedit = getmfdata($maintformid);
|
||||
$partdatainput = [];
|
||||
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 = TRUE;
|
||||
} 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'];
|
||||
$pdatamismatch = FALSE;
|
||||
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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,54 +135,59 @@ if ($mfadd) {
|
||||
if ($mfsubmit) {
|
||||
// add the entry if submit is pressed
|
||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||
// sanitize and fix blank date and time
|
||||
$mfdate = fix_date($mfdate);
|
||||
$mftime = fix_time($mftime);
|
||||
// determine whether supplied date is future or past
|
||||
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$mfdate\",CURRENT_DATE)"));
|
||||
$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 = "23:59:59:";
|
||||
}
|
||||
if ($datediff[0]>0) {
|
||||
$mftime="00:00:01:";
|
||||
if ($datediff[0] > 0) {
|
||||
$mftime = "00:00:01:";
|
||||
}
|
||||
// remove cruft from malfunction text
|
||||
$mfmalfunction=htmlentities($mfmalfunction);
|
||||
$mfmalfunction=addslashes($mfmalfunction);
|
||||
|
||||
$mfmalfunction = htmlentities($mfmalfunction);
|
||||
$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);
|
||||
$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 ($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;
|
||||
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 = TRUE;
|
||||
} else {
|
||||
// if it is in parts table, get partid for this record
|
||||
$mfpart=$partinfo['partid'];
|
||||
$pdatamismatch = FALSE;
|
||||
$mfpart = $partinfo['partid'];
|
||||
}
|
||||
if ($uid =="" || $partnum == "" || $sernum == "") {
|
||||
if ($uid == "" || $partnum == "" || $sernum == "") {
|
||||
// have the maintenance form stay pending due to incomplete part data
|
||||
$pending=1;
|
||||
$pending = 1;
|
||||
} else {
|
||||
$pending=0;
|
||||
$pending = 0;
|
||||
}
|
||||
|
||||
|
||||
// add the record to maintforms
|
||||
if (! $pdatamismatch) {
|
||||
mysqli_query($db,"insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
|
||||
$lognoteid = ($lognoteid == NULL) ? 0 : $lognoteid;
|
||||
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;
|
||||
$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\")");
|
||||
// update the flagmap table
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this maintenance form
|
||||
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$newmaintformid\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,78 +195,69 @@ if ($mfadd) {
|
||||
}
|
||||
}
|
||||
if ($mfedit) {
|
||||
$mfidtoprint=$maintformid;
|
||||
$mfidtoprint = $maintformid;
|
||||
if ($mfsubmit && $mfauthorized) {
|
||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||
// remove cruft from malfunction text
|
||||
$mfmalfunction=htmlentities($mfmalfunction);
|
||||
$mfmalfunction=addslashes($mfmalfunction);
|
||||
|
||||
$mfmalfunction = htmlentities($mfmalfunction);
|
||||
$mfmalfunction = addslashes($mfmalfunction);
|
||||
|
||||
// update parts table
|
||||
if ($uid =="" || $partnum == "" || $sernum == "") {
|
||||
if ($uid == "" || $partnum == "" || $sernum == "") {
|
||||
// have the maintenance form stay pending due to incomplete part data
|
||||
$pending=1;
|
||||
$pending = 1;
|
||||
} else {
|
||||
$pending=0;
|
||||
$pending = 0;
|
||||
}
|
||||
if (! $pdatamismatch) {
|
||||
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\"");
|
||||
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\",
|
||||
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 ($flags[0]=="") $flags=[];
|
||||
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\"");
|
||||
}
|
||||
}
|
||||
|
||||
// update the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where maintformid=\"$maintformid\"");
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this maintenance form
|
||||
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$maintformid\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// refresh the maintenance form in question from the database
|
||||
$mftoedit=getmfdata($maintformid);
|
||||
$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\"");
|
||||
}
|
||||
mysqli_query($db, "delete from maintforms where maintformid=\"$maintformid\"");
|
||||
// delete occurances from the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where maintformid=\"$maintformid\"");
|
||||
}
|
||||
|
||||
if ($actionadd) {
|
||||
if ($actionaddsubmit) {
|
||||
if ($action) {
|
||||
// sanitize and fix blank date and time
|
||||
$actiondate = fix_date($actiondate);
|
||||
$actiontime = fix_time($actiontime);
|
||||
// determine whether supplied date is future or past
|
||||
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$actiondate\",CURRENT_DATE)"));
|
||||
$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 = "23:59:59:";
|
||||
}
|
||||
if ($datediff[0]>0) {
|
||||
$actiontime="00:00:01:";
|
||||
if ($datediff[0] > 0) {
|
||||
$actiontime = "00:00:01:";
|
||||
}
|
||||
// remove cruft from action text
|
||||
$action=htmlentities($action);
|
||||
$action=addslashes($action);
|
||||
|
||||
$action = htmlentities($action);
|
||||
$action = addslashes($action);
|
||||
|
||||
// add to maintactions table
|
||||
mysqli_query($db,"insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
|
||||
mysqli_query($db, "insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
|
||||
values (\"$actiondate\",\"$actiontime\",\"$maintformid\",\"$loggedinas\",\"$action\")");
|
||||
echo mysqli_error($db);
|
||||
}
|
||||
@@ -268,20 +267,23 @@ if ($actionadd) {
|
||||
if ($actionedit) {
|
||||
if ($actioneditsubmit && $actionauthorized) {
|
||||
// update the action
|
||||
// sanitize and fix blank date and time
|
||||
$actiondate = fix_date($actiondate);
|
||||
$actiontime = fix_time($actiontime);
|
||||
// remove cruft from action text
|
||||
$action=htmlentities($action);
|
||||
$action=addslashes($action);
|
||||
|
||||
$action = htmlentities($action);
|
||||
$action = addslashes($action);
|
||||
|
||||
// update maintactions table
|
||||
mysqli_query($db,"update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\"");
|
||||
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);
|
||||
$actiontoedit = getactiondata($maintactionid);
|
||||
}
|
||||
|
||||
if ($actiondelete && $actionauthorized) {
|
||||
// delete the action
|
||||
mysqli_query($db,"delete from maintactions where maintactionid=\"$maintactionid\"");
|
||||
mysqli_query($db, "delete from maintactions where maintactionid=\"$maintactionid\"");
|
||||
}
|
||||
|
||||
|
||||
@@ -289,66 +291,67 @@ if ($actiondelete && $actionauthorized) {
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left","begin");
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
// display the form
|
||||
if ($mfadd || $actionadd) {
|
||||
$mfdate=$today;
|
||||
$mftime=$now;
|
||||
$actiondate=$today;
|
||||
$actiontime=$now;
|
||||
$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;
|
||||
$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);
|
||||
$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 = TRUE;
|
||||
else $pdatamismatch = FALSE;
|
||||
}
|
||||
|
||||
$techname=dblookup($db,"techs","techid","techname",$mftech);
|
||||
$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>");
|
||||
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>");
|
||||
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.");
|
||||
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.");
|
||||
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>");
|
||||
format_message(0, "Maintenance Form Deleted. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
|
||||
}
|
||||
if ($pdatamismatch) {
|
||||
$advtxt="
|
||||
$advtxt = "
|
||||
<img src=\"icons/exclamation-red.png\" border=\"0\">
|
||||
<b>Warning:</b> The $uidtext doesn't match the Part Number/Serial Number associated
|
||||
with it in our database. Please ensure the part information
|
||||
@@ -356,7 +359,7 @@ if ($pdatamismatch) {
|
||||
the <a href=\"parts.php\">Parts</a> page to correct the database.</b>
|
||||
";
|
||||
} else {
|
||||
$advtxt="
|
||||
$advtxt = "
|
||||
<font size=\"-1\">You can enter a $uidtext or Part Number/Serial Number or both.</font>
|
||||
";
|
||||
}
|
||||
@@ -384,32 +387,34 @@ if ($printfmt) {
|
||||
<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");
|
||||
|
||||
// create an array called theseflags 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];
|
||||
$theseflags = [];
|
||||
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
||||
$theseflags[] = $thisflag[0];
|
||||
}
|
||||
}
|
||||
$flagslist=mysqli_query($db,"select * from flags");
|
||||
while ($flagsymbol=mysqli_fetch_assoc($flagslist)) {
|
||||
if ($theseflags[0]=="") $theseflags=[];
|
||||
if (in_array($flagsymbol["flagid"],$theseflags)) {
|
||||
echo $flagsymbol['flagsym']." ";
|
||||
// display flag symbols for set flags
|
||||
$flagslist = mysqli_query($db, "select * from flags");
|
||||
while ($flagsymbol = mysqli_fetch_assoc($flagslist)) {
|
||||
if ($theseflags[0] == "") $theseflags = [];
|
||||
if (!empty($theseflags) && in_array($flagsymbol["flagid"], $theseflags)) {
|
||||
echo $flagsymbol['flagsym'] . " ";
|
||||
}
|
||||
}
|
||||
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"]);
|
||||
$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>
|
||||
@@ -470,41 +475,50 @@ if ($printfmt) {
|
||||
<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");
|
||||
// create an array called theseflags 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];
|
||||
$theseflags = [];
|
||||
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
||||
$theseflags[] = $thisflag[0];
|
||||
}
|
||||
}
|
||||
if ($mfadd) {
|
||||
$flagslist=mysqli_query($db,"select * from flags where status=1");
|
||||
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||
} else {
|
||||
$flagslist=mysqli_query($db,"select * from flags");
|
||||
$flagslist = mysqli_query($db, "select * from flags");
|
||||
}
|
||||
$flagsperline=8;
|
||||
$flagcount=1;
|
||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
||||
if ($theseflags[0]=="") $theseflags=[];
|
||||
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"]);
|
||||
$flagsperline = 8;
|
||||
$flagcount = 1;
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
//if ($theseflags[0]=="") $theseflags=[];
|
||||
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"]);
|
||||
$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) {
|
||||
if ($flagcount < $flagsperline) {
|
||||
echo " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount=1;
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -551,7 +565,7 @@ if ($printfmt) {
|
||||
</td></tr></table>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
echo "
|
||||
</form>
|
||||
<hr>
|
||||
@@ -559,16 +573,16 @@ if ($printfmt) {
|
||||
if ($actionadd || $actionedit) {
|
||||
// show the action form
|
||||
if ($actionadd) {
|
||||
$matime=$now;
|
||||
$actiontext="";
|
||||
$actiontech=$loggedinas;
|
||||
$matime = $now;
|
||||
$actiontext = "";
|
||||
$actiontech = $loggedinas;
|
||||
} else if ($actionedit) {
|
||||
$actiontext=$actiontoedit['action'];
|
||||
$actiontech=$actiontoedit['actiontech'];
|
||||
$actiondate=$actiontoedit['actiondate'];
|
||||
$actiontime=$actiontoedit['actiontime'];
|
||||
$actiontext = $actiontoedit['action'];
|
||||
$actiontech = $actiontoedit['actiontech'];
|
||||
$actiondate = $actiontoedit['actiondate'];
|
||||
$actiontime = $actiontoedit['actiontime'];
|
||||
}
|
||||
$tname=dblookup($db,"techs","techid","techname",$actiontech);
|
||||
$tname = dblookup($db, "techs", "techid", "techname", $actiontech);
|
||||
echo "<table width=\"70\" border=\"0\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<td>Tech: $tname
|
||||
@@ -606,25 +620,25 @@ if ($printfmt) {
|
||||
<br><br>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
echo "<b>Maintenance Actions</b> ";
|
||||
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"]);
|
||||
|
||||
|
||||
$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) {
|
||||
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>
|
||||
<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>
|
||||
@@ -647,16 +661,14 @@ if ($printfmt) {
|
||||
</table><br>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
echo "
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
framework("end", "", "", $print);
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
partentry.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -11,39 +11,39 @@ include("functions.php");
|
||||
|
||||
|
||||
if (!isset($_SESSION['login'])) {
|
||||
header ("Location: login.php");
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
$loggedinas=$_SESSION['login'];
|
||||
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
|
||||
$loggedinas = $_SESSION['login'];
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$add=$_REQUEST['add'];
|
||||
$edit=$_REQUEST['edit'];
|
||||
$delete=$_REQUEST['delete'];
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$add = $_REQUEST['add'] ?? NULL;
|
||||
$edit = $_REQUEST['edit'] ?? NULL;
|
||||
$delete = $_REQUEST['delete'] ?? NULL;
|
||||
|
||||
$partid=$_REQUEST['partid'];
|
||||
$uid=$_REQUEST['uid'];
|
||||
$partnum=$_REQUEST['partnum'];
|
||||
$sernum=$_REQUEST['sernum'];
|
||||
$partname=$_REQUEST['partname'];
|
||||
$submit=$_REQUEST['submit'];
|
||||
$partid = $_REQUEST['partid'] ?? NULL;
|
||||
$uid = $_REQUEST['uid'] ?? NULL;
|
||||
$partnum = $_REQUEST['partnum'] ?? NULL;
|
||||
$sernum = $_REQUEST['sernum'] ?? NULL;
|
||||
$partname = $_REQUEST['partname'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
|
||||
$logname=LOG_NAME;
|
||||
$uidtext=UID_TEXT;
|
||||
$logname = LOG_NAME;
|
||||
$uidtext = UID_TEXT;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
if ($edit || $delete) {
|
||||
framework("begin","$logname","Part Edit",$print);
|
||||
framework("begin", "$logname", "Part Edit", $print);
|
||||
} else {
|
||||
$add=1;
|
||||
framework("begin","$logname","Part Entry",$print);
|
||||
$add = 1;
|
||||
framework("begin", "$logname", "Part Entry", $print);
|
||||
}
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -53,11 +53,11 @@ 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\")"));
|
||||
$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);
|
||||
mysqli_query($db, "insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
||||
$partid = mysqli_insert_id($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,18 +66,18 @@ 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\"");
|
||||
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\""));
|
||||
$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\""));
|
||||
$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\"");
|
||||
if (!$inlogparts && !$inmaintforms) {
|
||||
mysqli_query($db, "delete from parts where partid=\"$partid\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,24 +85,24 @@ if ($delete) {
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left","begin");
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
// display the form
|
||||
$partdatainput=array();
|
||||
$partdatainput['partid']=$partid;
|
||||
$partinfo=get_part_data($partdatainput);
|
||||
if ($partinfo['result']==2) {
|
||||
$pdatamismatch=1;
|
||||
$partdatainput = array();
|
||||
$partdatainput['partid'] = $partid;
|
||||
$partinfo = get_part_data($partdatainput);
|
||||
if ($partinfo['result'] == 2) {
|
||||
$pdatamismatch = TRUE;
|
||||
} 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'];
|
||||
$pdatamismatch = FALSE;
|
||||
$uid = (array_key_exists('uid', $partinfo)) ? $partinfo['uid'] : NULL;
|
||||
$partnum = (array_key_exists('partnum', $partinfo)) ? $partinfo['partnum'] : NULL;
|
||||
$sernum = (array_key_exists('sernum', $partinfo)) ? $partinfo['sernum'] : NULL;
|
||||
$partname = (array_key_exists('partname', $partinfo)) ? $partinfo['partname'] : NULL;
|
||||
}
|
||||
if ($delete) {
|
||||
if ($inmaintforms) {
|
||||
@@ -168,9 +168,7 @@ echo "
|
||||
</form>
|
||||
";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
framework("end", "", "", $print);
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
parts.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -10,50 +10,50 @@
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin=1;
|
||||
$loggedin = TRUE;
|
||||
} else {
|
||||
unset($loggedin);
|
||||
$loggedin = FALSE;
|
||||
}
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$add=$_REQUEST['add'];
|
||||
$sort=$_REQUEST['sort'];
|
||||
$order=$_REQUEST['order'];
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$add = $_REQUEST['add'] ?? NULL;
|
||||
$sort = $_REQUEST['sort'] ?? NULL;
|
||||
$order = $_REQUEST['order'] ?? NULL;
|
||||
|
||||
$logname=LOG_NAME;
|
||||
$uidtext=UID_TEXT;
|
||||
$logname = LOG_NAME;
|
||||
$uidtext = UID_TEXT;
|
||||
|
||||
if ($add) {
|
||||
header ("Location: partentry.php?add=1");
|
||||
header("Location: partentry.php?add=1");
|
||||
}
|
||||
|
||||
if (! $sort) $sort="uid";
|
||||
if (! $sort) $sort = "uid";
|
||||
if ($order == "asc") {
|
||||
$order="desc";
|
||||
$order = "desc";
|
||||
} else if ($order == "desc") {
|
||||
$order="asc";
|
||||
$order = "asc";
|
||||
} else {
|
||||
$order="asc";
|
||||
$order = "asc";
|
||||
}
|
||||
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
|
||||
framework("begin","$logname","Parts",$print);
|
||||
framework("begin", "$logname", "Parts", $print);
|
||||
|
||||
pagetable("begin");
|
||||
if(!$print) {
|
||||
pageblock("left","begin");
|
||||
if (!$print) {
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
if ($loggedin) {
|
||||
echo "
|
||||
@@ -71,15 +71,16 @@ echo "
|
||||
<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)) {
|
||||
$partqry = mysqli_query($db, "select * from parts order by $sort $order");
|
||||
while ($partline = mysqli_fetch_assoc($partqry)) {
|
||||
if (!$partline['uid']) {
|
||||
$pluidtxt="none";
|
||||
$pluidtxt = "none";
|
||||
} else {
|
||||
$pluidtxt=$partline['uid'];
|
||||
$pluidtxt = $partline['uid'];
|
||||
}
|
||||
if ($loggedin) {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>
|
||||
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
|
||||
@@ -87,22 +88,24 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>",
|
||||
$partline['partid'],$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
$partline['partid'],
|
||||
$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
);
|
||||
} else {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>",
|
||||
$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
);
|
||||
}
|
||||
echo "
|
||||
@@ -115,9 +118,7 @@ echo "
|
||||
|
||||
echo "<br><br>";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
framework("end", "", "", $print);
|
||||
301
distfiles-old/profile.php
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
/*
|
||||
profile.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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 = TRUE;
|
||||
} else {
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> 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 = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
||||
} else {
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for matching passwords
|
||||
if ($pass != "password_is_unchanged") {
|
||||
if ($pass == $passconf) {
|
||||
$passmatch = TRUE;
|
||||
$passhash = password_hash($pass, PASSWORD_DEFAULT);
|
||||
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
|
||||
} else {
|
||||
$passmatch = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
||||
}
|
||||
} else {
|
||||
$passmatch = TRUE;
|
||||
$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 = TRUE;
|
||||
} else {
|
||||
$chunksuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> 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);
|
||||
$currentpage = $_SERVER['PHP_SELF'];
|
||||
header("Refresh: .1; url=$currentpage");
|
||||
}
|
||||
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): <input type=\"text\" name=\"name\" size=\"40\" value=\"$curname\"><br><br>
|
||||
Password: <input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass\"><br><br>
|
||||
Repeat Password: <input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
|
||||
<font size=\"-1\">Need a random password? </font>
|
||||
";
|
||||
$rpw = substr(str_shuffle(password_hash(microtime(), PASSWORD_DEFAULT)), 10, 12);
|
||||
echo "
|
||||
$rpw<br><br>
|
||||
<b>Shift: </b>
|
||||
<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\">
|
||||
<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): <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):
|
||||
<input type=\"text\" name=\"display_urlchunk\" size=\"3\" value=\"$curlchunk\"><br><br>
|
||||
Show timestamps in log notes:
|
||||
";
|
||||
if ($curts) {
|
||||
echo "<input type=\"checkbox\" name=\"display_showts\" checked>";
|
||||
} else {
|
||||
echo "<input type=\"checkbox\" name=\"display_showts\">";
|
||||
}
|
||||
echo "
|
||||
<br><br>
|
||||
Techs display order:
|
||||
";
|
||||
if ($curtdo) {
|
||||
echo "
|
||||
<input type=\"radio\" name=\"display_techalpha\" value=\"a\" checked>Alphabetical order
|
||||
|
||||
<input type=\"radio\" name=\"display_techalpha\" value=\"d\">Database order
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<input type=\"radio\" name=\"display_techalpha\" value=\"a\">Alphabetical order
|
||||
|
||||
<input type=\"radio\" name=\"display_techalpha\" value=\"d\" checked>Database order
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<br><br>
|
||||
Subjects display order:
|
||||
";
|
||||
if ($cursdo) {
|
||||
echo "
|
||||
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\" checked>Alphabetical order
|
||||
|
||||
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\">Database order
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\">Alphabetical order
|
||||
|
||||
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\" checked>Database order
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<br><br>
|
||||
<input type=\"submit\" name=\"updatedisplay\" value=\"Update My Display Preferences\">
|
||||
<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);
|
||||
105
distfiles-old/refchain.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
refchain.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$print = $_REQUEST['print'] ?? "";
|
||||
$chainnote = $_REQUEST['chainnote'] ?? NULL;
|
||||
|
||||
$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 / 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 = " <a href=\"logentry.php?add=1&refto=$noteid\"><img src=\"icons/plus.png\" border=\"0\" alt=\"Add referring note\" title=\"Add referring note\"></a> <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 = "";
|
||||
$flagmapqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$noteid");
|
||||
if (mysqli_num_rows($flagmapqry)) {
|
||||
while ($flagids = mysqli_fetch_row($flagmapqry)) {
|
||||
$flagid = $flagids[0];
|
||||
$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> ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($flagstring) $fmtnote = $fmtnote . "<br>" . $flagstring;
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
||||
<td>%s / %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);
|
||||
915
distfiles-old/schedmaint.php
Normal file
@@ -0,0 +1,915 @@
|
||||
<?php
|
||||
/*
|
||||
schedmaint.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin = true;
|
||||
} else {
|
||||
$loggedin = false;
|
||||
}
|
||||
$techid = $_SESSION['login'] ?? NULL;
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||
|
||||
$upcoming = $_REQUEST['upcoming'] ?? NULL;
|
||||
$schedule = $_REQUEST['schedule'] ?? NULL;
|
||||
$tasks = $_REQUEST['tasks'] ?? NULL;
|
||||
$devices = $_REQUEST['devices'] ?? NULL;
|
||||
$action = $_REQUEST['action'] ?? NULL;
|
||||
$complete = $_REQUEST['complete'] ?? NULL;
|
||||
$defer = $_REQUEST['defer'] ?? NULL;
|
||||
$add = $_REQUEST['add'] ?? NULL;
|
||||
$edit = $_REQUEST['edit'] ?? NULL;
|
||||
$update = $_REQUEST['update'] ?? NULL;
|
||||
$delete = $_REQUEST['delete'] ?? NULL;
|
||||
$id = $_REQUEST['id'] ?? NULL;
|
||||
$active_flag = $_REQUEST['active_flag'] ?? 0;
|
||||
|
||||
$devicename = $_REQUEST['devicename'] ?? NULL;
|
||||
$devicedesc = $_REQUEST['devicedesc'] ?? NULL;
|
||||
$group_flag = $_REQUEST['group_flag'] ?? 0;
|
||||
$members = $_REQUEST['members'] ?? [];
|
||||
|
||||
$weekdays_only = $_REQUEST['weekdays_only'] ?? NULL;
|
||||
$nextdue_relative = $_REQUEST['nextdue_relative'] ?? NULL;
|
||||
$taskname = $_REQUEST['taskname'] ?? NULL;
|
||||
$taskdesc = $_REQUEST['taskdesc'] ?? NULL;
|
||||
$frequency = $_REQUEST['frequency'] ?? NULL;
|
||||
$period = $_REQUEST['period'] ?? NULL;
|
||||
$refdoc_name = $_REQUEST['refdoc_name'] ?? NULL;
|
||||
$refdoc_url = $_REQUEST['refdoc_url'] ?? NULL;
|
||||
|
||||
$deferred_flag = $_REQUEST['deferred_flag'] ?? 0;
|
||||
$deferred_date = $_REQUEST['deferred_date'] ?? NULL;
|
||||
$start_date = $_REQUEST['start_date'] ?? NULL;
|
||||
$last_date = $_REQUEST['last_date'] ?? NULL;
|
||||
$task = $_REQUEST['task'] ?? NULL;
|
||||
$device = $_REQUEST['device'] ?? NULL;
|
||||
$deferuntil = $_REQUEST['deferuntil'] ?? NULL;
|
||||
$completedate = $_REQUEST['completedate'] ?? NULL;
|
||||
$addlognote = $_REQUEST['addlognote'] ?? NULL;
|
||||
|
||||
$logname = LOG_NAME;
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
// **** BEGIN DATABASE OPERATIONS ****
|
||||
$tomorrow = mysqli_fetch_row(mysqli_query($db, "select adddate((select current_date),1)"))[0];
|
||||
$errorstack = array();
|
||||
|
||||
if ($action) {
|
||||
if ($complete) {
|
||||
// sanitize user input
|
||||
$completedate = fix_date($completedate);
|
||||
// update events
|
||||
mysqli_query($db, "update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0001-01-01\" 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¬e=$lognotestrg");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
if ($defer) {
|
||||
$deferuntil = fix_date($deferuntil);
|
||||
// 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\"> 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\"> You didn't select a device.<br>";
|
||||
}
|
||||
// sanitize text data
|
||||
if ($start_date == NULL) $start_date = $today;
|
||||
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||
$start_date = fix_date($start_date);
|
||||
$last_date = fix_date($last_date);
|
||||
$deferred_date = fix_date($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\"> 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\"> 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\"> 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\"> 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
|
||||
if ($start_date == NULL) $start_date = $today;
|
||||
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||
$start_date = fix_date($start_date);
|
||||
$last_date = fix_date($last_date);
|
||||
$deferred_date = fix_date($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\"> 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\"> 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\"> 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\"> 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\"> 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\"> 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\">
|
||||
<input type=\"submit\" name=\"devices\" value=\"Manage Devices\">
|
||||
<input type=\"submit\" name=\"tasks\" value=\"Manage Tasks\">
|
||||
<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> $taskname </td><td><b> Device : </b> $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: <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: <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\">
|
||||
<input type=\"submit\" name=\"delete\" value=\"Delete Event\">
|
||||
<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 == "0001-01-01") $start_date = $today;
|
||||
//if ($last_date == "0001-01-01") $last_date = "";
|
||||
if ($deferred_date == "0001-01-01") $deferred_date = $tomorrow;
|
||||
$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: <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: <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: $startdatetag </td><td>Last Completed Date: $lastdatetag </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Defer this event: $deferredtag </td><td>Defer Until: $deferuntiltag </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Active: $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> <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 == "0001-01-01") $start_date = $today;
|
||||
if ($last_date == "0001-01-01") $last_date = "";
|
||||
if ($deferred_date == "0001-01-01") $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\">
|
||||
<input type=\"submit\" name=\"delete\" value=\"Delete Task\">
|
||||
<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 <input type=\"radio\" name=\"nextdue_relative\" value=\"1\" checked>Relative";
|
||||
} else {
|
||||
$nextduetag = "<input type=\"radio\" name=\"nextdue_relative\" value=\"0\" checked>Absolute <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 <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: <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: <input type=\"text\" name=\"frequency\" size=\"3\" value=\"$frequency\">
|
||||
<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>
|
||||
Weekdays Only: {$wdotag}<br><br>
|
||||
Due Date Calculation: <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.\"> $nextduetag<br><br><hr>
|
||||
Reference Documentation: <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: $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> <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\">
|
||||
<input type=\"submit\" name=\"delete\" value=\"Delete Device\">
|
||||
<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: <input type=\"text\" name=\"devicename\" size=\"40\" value=\"$devicename\"><br><br>
|
||||
Device Description: <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> $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: $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> <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 == "0001-01-01") {
|
||||
$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);
|
||||
891
distfiles-old/search.php
Normal file
@@ -0,0 +1,891 @@
|
||||
<?php
|
||||
/*
|
||||
search.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$noprint = TRUE;
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin = TRUE;
|
||||
} else {
|
||||
$loggedin = FALSE;
|
||||
}
|
||||
|
||||
$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'] ?? [];
|
||||
$target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
|
||||
|
||||
$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);
|
||||
|
||||
// echo "REQUEST variables: <br>";
|
||||
// var_dump($_REQUEST);
|
||||
// echo "<br>";
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
// define the arrays
|
||||
$logfromtables = [];
|
||||
$mffromtables = [];
|
||||
$pfromtables = [];
|
||||
$logconstraints = [];
|
||||
$mfconstraints = [];
|
||||
$pconstraints = [];
|
||||
|
||||
// get the date range of lognotes
|
||||
$logdateqry = mysqli_query($db, "select min(date), max(date) from lognotes");
|
||||
$logdateresults = mysqli_fetch_row($logdateqry);
|
||||
$logmindate = $logdateresults[0];
|
||||
if ($logmindate == "") $logmindate = $today;
|
||||
$logmaxdate = $logdateresults[1];
|
||||
if ($logmaxdate == "") $logmaxdate = $today;
|
||||
// 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 = $today;
|
||||
$mfmaxdate = $mfdateresults[1];
|
||||
if ($mfmaxdate == "") $mfmaxdate = $today;
|
||||
// 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%\"";
|
||||
}
|
||||
// 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}\"";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount = count($srchflags);
|
||||
$logfromtables[] = "lognotes";
|
||||
$logfromtables[] = "flagmap";
|
||||
$flagconstraints[] = "flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $flagid) {
|
||||
$flagconstraints[] = "\"$flagid\"";
|
||||
$flagconstraints[] = ",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[] = ") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$logconstraints[] = join('', $flagconstraints);
|
||||
}
|
||||
// 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)";
|
||||
}
|
||||
// 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}\"";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount = count($srchflags);
|
||||
$mffromtables[] = "maintforms";
|
||||
$mffromtables[] = "flagmap";
|
||||
$flagconstraints[] = "flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $thisflagid) {
|
||||
$flagconstraints[] = "\"$thisflagid\"";
|
||||
$flagconstraints[] = ",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[] = ") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$mfconstraints[] = join('', $flagconstraints);
|
||||
}
|
||||
// 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
|
||||
// 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}\"";
|
||||
}
|
||||
// flags doesn't apply to parts
|
||||
// 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> <input type=\"text\" name=\"srchnoteid\" size=\"7\" value=\"$noteidval\" title=\"Only show results with this Logbook Note ID number\">
|
||||
<b>Maintenance Form ID:</b> <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> <input type=\"text\" name=\"srchbdate\" size=\"10\" value=\"$bdateval\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\">
|
||||
<b>End Date:</b> <input type=\"text\" name=\"srchedate\" size=\"10\" value=\"$edateval\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">
|
||||
<br><br>
|
||||
<b>Shift:</b> <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>
|
||||
<b>Tech:</b> <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>
|
||||
<b>Subject:</b> <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>
|
||||
<br><br>
|
||||
";
|
||||
if ($doparts) {
|
||||
echo "
|
||||
<b>$uidtext:</b> <input type=\"text\" name=\"srchuid\" size=\"8\" value=\"$uidval\" title=\"Only show results associated with this $uidtext\">
|
||||
<b>Part Number:</b> <input type=\"text\" name=\"srchpn\" size=\"20\" value=\"$pnval\" title=\"Only show results associated with this part number\">
|
||||
<b>Serial Number:</b> <input type=\"text\" name=\"srchsn\" size=\"20\" value=\"$snval\" title=\"Only show results associated with this serial number\">
|
||||
<br><br>
|
||||
<b>Part Name:</b> <input type=\"text\" name=\"srchpname\" size=\"40\" value=\"$pnameval\" title=\"Only show results associated with this part name\">
|
||||
<b>Part Location:</b> <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> <input type=\"text\" name=\"srchnha\" size=\"20\" value=\"$nhaval\" title=\"Only show results associated with this next higher assembly\">
|
||||
<b>Repair Order:</b> <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 " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<br><br>
|
||||
";
|
||||
if ($doparts) {
|
||||
echo "
|
||||
<b>Search in:</b>
|
||||
";
|
||||
if ($target[0] == "") $target = [];
|
||||
if (in_array("log", $target)) {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\" checked>Logbook ";
|
||||
} else {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\">Logbook ";
|
||||
}
|
||||
if (in_array("maintform", $target)) {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\" checked>Maintenance Forms ";
|
||||
} else {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\">Maintenance Forms ";
|
||||
}
|
||||
if (in_array("part", $target)) {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\" checked>Parts ";
|
||||
} else {
|
||||
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\">Parts ";
|
||||
}
|
||||
echo "
|
||||
|
||||
";
|
||||
} 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 "
|
||||
<a href=\"search.php?print=1&$allvars\" target=\"_blank\">Print Search Results</a>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</form>
|
||||
<hr>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<b>Log Note ID:</b> $noteidval
|
||||
<b>Maintenance Form ID:</b> $mfidval
|
||||
<br><br>
|
||||
<b>Start Date:</b> $bdateval
|
||||
<b>End Date:</b> $edateval
|
||||
<br><br>
|
||||
<b>Shift:</b>
|
||||
";
|
||||
if ($shiftval == 0) {
|
||||
echo "any";
|
||||
} else {
|
||||
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $shiftval);
|
||||
echo "$shiftname";
|
||||
}
|
||||
echo "
|
||||
|
||||
<b>Tech:</b>
|
||||
";
|
||||
if ($techval == 0) {
|
||||
echo "any";
|
||||
} else {
|
||||
$techname = dblookup($db, "techs", "techid", "techname", $techval);
|
||||
echo "$techname";
|
||||
}
|
||||
echo "
|
||||
|
||||
<b>Subject:</b>
|
||||
";
|
||||
if ($subjval == 0) {
|
||||
echo "any";
|
||||
} else {
|
||||
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $subjval);
|
||||
echo "$subjname";
|
||||
}
|
||||
echo "
|
||||
|
||||
<br><br>
|
||||
";
|
||||
if ($doparts) {
|
||||
echo "
|
||||
<b>$uidtext:</b> $uidval
|
||||
<b>Part Number:</b> $pnval
|
||||
<b>Serial Number:</b> $snval
|
||||
<br><br>
|
||||
<b>Part Name:</b> $pnameval
|
||||
<b>Part Location:</b> $plocval
|
||||
<br><br>
|
||||
<b>Next Higher Assembly:</b> $nhaval
|
||||
<b>Repair Order:</b> $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 ($srchflags) {
|
||||
if ($srchflags[0] == "") $srchflags = [];
|
||||
if (in_array($flagcheckbox["flagid"], $srchflags)) {
|
||||
printf(
|
||||
"<font color=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount < $flagsperline) {
|
||||
echo " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<br><br>
|
||||
";
|
||||
if ($doparts) {
|
||||
if ($target[0] == "") $target = [];
|
||||
echo "
|
||||
<b>Search in:</b>
|
||||
";
|
||||
if (in_array("log", $target)) {
|
||||
echo "Logbook ";
|
||||
}
|
||||
if (in_array("maintform", $target)) {
|
||||
echo "Maintenance Forms ";
|
||||
}
|
||||
if (in_array("part", $target)) {
|
||||
echo "Parts ";
|
||||
}
|
||||
echo "
|
||||
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<hr>
|
||||
";
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
if ($target[0] == "") $target = [];
|
||||
if (in_array("log", $target)) {
|
||||
// run lognotes query and show results
|
||||
$log_num_results = mysqli_num_rows($logrowqry);
|
||||
if ($log_num_results) {
|
||||
echo "
|
||||
<b>Results from Logbook: $log_num_results</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 = " <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 . " <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 = "";
|
||||
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$logtablerow[lognoteid]");
|
||||
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||
$flagcolor = $flagparams["flagcolor"];
|
||||
$flagsym = $flagparams["flagsym"];
|
||||
$flagname = $flagparams["flagname"];
|
||||
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||
}
|
||||
if ($flagstring) {
|
||||
$logfmtnote = $logfmtnote . "<br>" . $flagstring . " ";
|
||||
} else {
|
||||
$logfmtnote = $logfmtnote . "<br>";
|
||||
}
|
||||
|
||||
printf(
|
||||
"<tr>
|
||||
<td valign=\"top\"><a href=logentry.php?edit=1¬eid=%s>%s</a></td>
|
||||
<td valign=\"top\">%s / %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 ($target[0] == "") $target = [];
|
||||
if (in_array("maintform", $target)) {
|
||||
// run maintforms query and show results
|
||||
$mf_num_results = mysqli_num_rows($mfrowqry);
|
||||
if ($mf_num_results) {
|
||||
echo "
|
||||
<b>Results from Maintenance Forms: $mf_num_results</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 = " ";
|
||||
$mfpartno = dblookup($db, "parts", "partid", "partnum", $mfrow["mfpart"]);
|
||||
if ($mfpartno == "") $mfpartno = " ";
|
||||
$mfserno = dblookup($db, "parts", "partid", "sernum", $mfrow["mfpart"]);
|
||||
if ($mfserno == "") $mfserno = " ";
|
||||
$mfpartname = dblookup($db, "parts", "partid", "partname", $mfrow["mfpart"]);
|
||||
if ($mfpartname == "") $mfpartname = " ";
|
||||
// look up tech name
|
||||
$mftname = dblookup($db, "techs", "techid", "techname", $mfrow["mftech"]);
|
||||
if ($mfrow["lognoteid"] == 0) {
|
||||
$mfnoteidval = " ";
|
||||
$mfnotetag = "%s%s";
|
||||
} else {
|
||||
$mfnoteidval = $mfrow["lognoteid"];
|
||||
$mfnotetag = "<a href=\"logentry.php?edit=1¬eid=%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 ($target[0] == "") $target = [];
|
||||
if (in_array("part", $target)) {
|
||||
// run parts query and show results
|
||||
$p_num_results = mysqli_num_rows($prowqry);
|
||||
if ($p_num_results) {
|
||||
echo "
|
||||
<b>Results from Parts: $p_num_results</b><br><br>
|
||||
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>$uidtext</th>
|
||||
<th>Part Number</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Part Name</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);
|
||||
63
distfiles-old/settings.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
settings.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
// determine today's date and time and assign them to variables
|
||||
$today = date("Y-m-d");
|
||||
$now = date("H:i:s");
|
||||
|
||||
$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);
|
||||
}
|
||||
571
distfiles-old/templates.php
Normal file
@@ -0,0 +1,571 @@
|
||||
<?php
|
||||
/*
|
||||
templates.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 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);
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$efftechid = $_REQUEST['efftechid'] ?? NULL;
|
||||
$shift = $_REQUEST['shift'] ?? NULL;
|
||||
$subject = $_REQUEST['subject'] ?? NULL;
|
||||
$note = $_REQUEST['note'] ?? NULL;
|
||||
$flags = $_POST['flags'] ?? [];
|
||||
$refstring = $_REQUEST['refstring'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
$operation = $_REQUEST['operation'] ?? NULL;
|
||||
$templateid = $_REQUEST['templateid'] ?? NULL;
|
||||
$templatename = $_REQUEST['templatename'] ?? NULL;
|
||||
$usertemplateid = $_REQUEST['usertemplateid'] ?? NULL;
|
||||
$globaltemplateid = $_REQUEST['globaltemplateid'] ?? NULL;
|
||||
$loadtemplate = $_REQUEST['loadtemplate'] ?? NULL;
|
||||
|
||||
|
||||
$logname = LOG_NAME;
|
||||
$techalpha = TECH_ALPHA;
|
||||
$subjalpha = SUBJ_ALPHA;
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
framework("begin", "$logname", "Note Templates", $print);
|
||||
|
||||
// make basic determination about authorization
|
||||
if ($isadmin) {
|
||||
$authorized = TRUE;
|
||||
} else if ($efftechid == $techid) {
|
||||
$authorized = TRUE;
|
||||
} else {
|
||||
$authorized = FALSE;
|
||||
}
|
||||
|
||||
// var_dump($_REQUEST);
|
||||
|
||||
function templatetable($db, $techid, $user)
|
||||
{
|
||||
// Show template table
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||
$templatequery = mysqli_query($db, "select * from notetemplates where tech=\"$user\" order by templatename asc");
|
||||
$tblusername = dblookup($db, "techs", "techid", "techname", $user);
|
||||
if (mysqli_num_rows($templatequery)) {
|
||||
$hastemplates = TRUE;
|
||||
} else {
|
||||
$hastemplates = FALSE;
|
||||
}
|
||||
|
||||
echo "<b><font size=\"+1\">";
|
||||
if ($hastemplates) {
|
||||
// print the user header
|
||||
if ($user == "0") {
|
||||
echo "Global Templates</font></b>";
|
||||
} else {
|
||||
if ($user == $techid) {
|
||||
echo "My templates</font></b>";
|
||||
} else {
|
||||
echo "Templates for $tblusername</font></b>";
|
||||
}
|
||||
}
|
||||
// print the table
|
||||
echo "<br><table border=\"1\" width=\"100%\">";
|
||||
echo "<tr><th width=\"70\">Template Name</th><th width=\"100\">Shift</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>";
|
||||
while ($tablerow = mysqli_fetch_assoc($templatequery)) {
|
||||
$templateid = $tablerow["templateid"];
|
||||
$templatename = $tablerow["templatename"];
|
||||
// convert shift number to name
|
||||
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
|
||||
// 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 = "";
|
||||
$flagqry = mysqli_query($db, "select flagid from flagmap where notetemplateid=$templateid");
|
||||
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||
$flagcolor = $flagparams["flagcolor"];
|
||||
$flagsym = $flagparams["flagsym"];
|
||||
$flagname = $flagparams["flagname"];
|
||||
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||
}
|
||||
if ($flagstring) {
|
||||
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||
} else {
|
||||
$fmtnote = $fmtnote . "<br>";
|
||||
}
|
||||
// generate a reference string
|
||||
$refstring = NULL;
|
||||
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||
while ($tgt = mysqli_fetch_row($refstringqry)) {
|
||||
$refstring = $refstring . " " . $tgt[0];
|
||||
}
|
||||
// now print the line in the table
|
||||
if (!$isadmin && $user == "0") {
|
||||
$nameblock = "$templatename</a>";
|
||||
} else {
|
||||
$nameblock = "<a href=\"templates.php?operation=edit&templateid=$templateid\">$templatename</a>";
|
||||
}
|
||||
printf(
|
||||
"<tr>
|
||||
<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>\n",
|
||||
$nameblock,
|
||||
$shiftname,
|
||||
$subjname,
|
||||
$fmtnote,
|
||||
$refstring
|
||||
);
|
||||
};
|
||||
echo "</table><br><hr><br>";
|
||||
} else {
|
||||
if ($user == "0") {
|
||||
echo "There are no global templates</font></b>";
|
||||
} else {
|
||||
if ($user == $techid) {
|
||||
echo "You have no templates</font></b>";
|
||||
} else {
|
||||
echo "$tblusername has no templates</font></b>";
|
||||
}
|
||||
}
|
||||
echo "<br><hr>";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
if ($usertemplateid) {
|
||||
$templateid = $usertemplateid;
|
||||
} else if ($globaltemplateid) {
|
||||
$templateid = $globaltemplateid;
|
||||
} else {
|
||||
$loadtemplate = NULL;
|
||||
}
|
||||
|
||||
// determine original owner of template
|
||||
$orig_owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
|
||||
if ($efftechid != NULL && $efftechid != $orig_owner) {
|
||||
$operation = "add";
|
||||
}
|
||||
|
||||
if ($operation == "add") {
|
||||
if ($submit) {
|
||||
if ($note) {
|
||||
// remove cruft from note text
|
||||
$note = strip_tags($note, "<a>");
|
||||
$note = mysqli_real_escape_string($db, $note);
|
||||
|
||||
if ($authorized) {
|
||||
// check if name supplied
|
||||
if ($templatename) {
|
||||
$namesupplied = TRUE;
|
||||
// check if supplied name already exists
|
||||
if (! mysqli_num_rows(mysqli_query($db, "select templateid from notetemplates where tech=\"$efftechid\" and templatename=\"$templatename\""))) {
|
||||
// add the record to notetemplates
|
||||
mysqli_query($db, "insert into notetemplates(templatename,shift,tech,subject,lognote) values (\"$templatename\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
||||
$newtemplateid = mysqli_insert_id($db);
|
||||
|
||||
// update the flagmap table
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this note
|
||||
mysqli_query($db, "insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$newtemplateid\")");
|
||||
}
|
||||
|
||||
// add references to the reflinks table
|
||||
if (strlen($refstring)) {
|
||||
$refstring = trim($refstring);
|
||||
$refarray = explode(" ", $refstring);
|
||||
foreach ($refarray as $target) {
|
||||
mysqli_query($db, "insert into reflinks(templateid,target) values($newtemplateid,$target)");
|
||||
}
|
||||
}
|
||||
$templateid = $newtemplateid;
|
||||
} else {
|
||||
$nameexists = TRUE;
|
||||
}
|
||||
} else {
|
||||
$namesupplied = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($operation == "edit" || $operation == "delete") {
|
||||
// test to see if this templateid is owned by techid to prevent hijacking
|
||||
$owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
|
||||
if (!$isadmin && ($owner != $techid)) $authorized = FALSE;
|
||||
|
||||
if ($submit) {
|
||||
if ($note) {
|
||||
// remove cruft from note text
|
||||
$note = strip_tags($note, "<a>");
|
||||
$note = mysqli_real_escape_string($db, $note);
|
||||
|
||||
if ($templatename) {
|
||||
$namesupplied = TRUE;
|
||||
} else {
|
||||
$namesupplied = FALSE;
|
||||
}
|
||||
|
||||
if ($authorized) {
|
||||
// check if name was supplied
|
||||
if ($templatename) {
|
||||
// update notetemplates
|
||||
mysqli_query($db, "update notetemplates set templatename=\"$templatename\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\" where templateid=\"$templateid\"");
|
||||
|
||||
// update the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where notetemplateid=\"$templateid\"");
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this note
|
||||
mysqli_query($db, "insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$templateid\")");
|
||||
}
|
||||
|
||||
// update the reflinks table
|
||||
mysqli_query($db, "delete from reflinks where templateid=\"$templateid\"");
|
||||
if (strlen($refstring)) {
|
||||
$refstring = trim($refstring);
|
||||
$refarray = explode(" ", $refstring);
|
||||
foreach ($refarray as $target) {
|
||||
mysqli_query($db, "insert into reflinks(templateid,target) values($templateid,$target)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($operation == "delete") {
|
||||
if ($authorized) {
|
||||
// update notetemplates
|
||||
mysqli_query($db, "delete from notetemplates where templateid=\"$templateid\"");
|
||||
// update the flagmap table
|
||||
mysqli_query($db, "delete from flagmap where notetemplateid=\"$templateid\"");
|
||||
// update the reflinks table
|
||||
mysqli_query($db, "delete from reflinks where templateid=\"$templateid\"");
|
||||
$templateid = NULL;
|
||||
$note = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ******** end database manipulation ********
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
|
||||
|
||||
if ($submit || $operation == "delete") {
|
||||
// show success/failure messages
|
||||
$nameexists = $nameexists ?? NULL;
|
||||
$namesupplied = $namesupplied ?? NULL;
|
||||
|
||||
if ($operation == "add") {
|
||||
$addfail = FALSE;
|
||||
if ($nameexists) {
|
||||
format_message(1, "Template creation failed because the name you supplied already exists. Please try again.");
|
||||
$addfail = TRUE;
|
||||
}
|
||||
if (!$namesupplied) {
|
||||
format_message(1, "Template creation failed because you didn't supply a name. Please try again.");
|
||||
$addfail = TRUE;
|
||||
}
|
||||
if (!$note) {
|
||||
format_message(1, "Template creation failed because you didn't enter any note text. Please try again.");
|
||||
$addfail = TRUE;
|
||||
}
|
||||
if (!$authorized) {
|
||||
format_message(1, "Template creation failed because you are not authorized to do so.");
|
||||
$addfail = TRUE;
|
||||
}
|
||||
if (!$addfail) format_message(0, "<strong>Template created.</strong>");
|
||||
}
|
||||
if ($operation == "edit") {
|
||||
$editfail = FALSE;
|
||||
if (!$namesupplied) {
|
||||
format_message(1, "Template save failed because you didn't supply a name. Please try again.");
|
||||
$editfail = TRUE;
|
||||
}
|
||||
if (!$note) {
|
||||
format_message(1, "Template save failed because you didn't enter any note text. Please try again.");
|
||||
$editfail = TRUE;
|
||||
}
|
||||
if (!$authorized) {
|
||||
format_message(1, "Template save failed because you are not authorized to do so.");
|
||||
$editfail = TRUE;
|
||||
}
|
||||
if (!$editfail) format_message(0, "<strong>Template modified.</strong>");
|
||||
}
|
||||
if ($operation == "delete") {
|
||||
$deletefail = FALSE;
|
||||
if (!$authorized) {
|
||||
format_message(1, "Template delete failed because you are not authorized to do so.");
|
||||
$deletefail = TRUE;
|
||||
}
|
||||
if (!$deletefail) format_message(0, "<strong>Template deleted.</strong>");
|
||||
}
|
||||
}
|
||||
|
||||
if ($operation == "delete") {
|
||||
// just show the link back to the templates page
|
||||
echo "
|
||||
<br><a href=\"templates.php\">Manage templates</a><br><br><br><br>
|
||||
";
|
||||
} else if ($operation == "add" || $operation == "edit") {
|
||||
// Display the input form
|
||||
if ($loadtemplate) {
|
||||
// make templateid the selected template
|
||||
if ($usertemplateid) {
|
||||
$templateid = $usertemplateid;
|
||||
} else if ($globaltemplateid) {
|
||||
$templateid = $globaltemplateid;
|
||||
} else {
|
||||
$templateid = NULL;
|
||||
}
|
||||
}
|
||||
if ($operation == "edit" || $loadtemplate) {
|
||||
// use values from the templateid supplied with a defined tech id
|
||||
$loadeddata = mysqli_fetch_assoc(mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\""));
|
||||
$filltemplatename = $loadeddata["templatename"];
|
||||
if ($efftechid) {
|
||||
$filltech = $efftechid;
|
||||
} else if ($isadmin && $loadeddata["tech"] == "0") {
|
||||
$filltech = "0";
|
||||
} else {
|
||||
$filltech = $techid;
|
||||
}
|
||||
$fillshift = $loadeddata["shift"];
|
||||
$fillsubject = $loadeddata["subject"];
|
||||
$fillnote = $loadeddata["lognote"];
|
||||
} else {
|
||||
// use empty values with a defined tech id
|
||||
$filltemplatename = NULL;
|
||||
if ($efftechid) {
|
||||
$filltech = $efftechid;
|
||||
} else {
|
||||
$filltech = $techid;
|
||||
}
|
||||
$fillshift = $defaultshift;
|
||||
$fillsubject = NULL;
|
||||
$fillnote = NULL;
|
||||
}
|
||||
|
||||
if ($operation == "add") $optext = "Creating new";
|
||||
if ($operation == "edit") $optext = "Editing";
|
||||
echo "
|
||||
<br><b>$optext template</b><br><hr>
|
||||
";
|
||||
|
||||
// show the template selection line
|
||||
templateselect($techid, $operation);
|
||||
|
||||
// start template entry section
|
||||
echo "
|
||||
<form method=\"post\" action=\"templates.php\">
|
||||
<table border=\"0\" cellpadding=\"5\">
|
||||
<tr><td colspan=\"2\"><b>Template Name: </b>
|
||||
<input type=\"text\" name=\"templatename\" size=\"30\" value=\"$filltemplatename\" title=\"What you'd like to name the template.\"></td></tr>
|
||||
";
|
||||
if ($isadmin) {
|
||||
echo "
|
||||
<tr><td colspan=\"2\"><b>Tech: </b>
|
||||
<select name=\"efftechid\">
|
||||
";
|
||||
if ($filltech == "0") {
|
||||
echo "<option value=\"0\" selected>--Global Template--</option>";
|
||||
} else {
|
||||
echo "<option value=\"0\">--Global Template--</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"] == $filltech) {
|
||||
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></tr>
|
||||
";
|
||||
} else {
|
||||
$authorized = TRUE;
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"efftechid\" value=\"$techid\">
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td><b>Shift: </b>
|
||||
<select name=\"shift\">
|
||||
";
|
||||
$shiftrow = mysqli_query($db, "select * from shifts");
|
||||
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
|
||||
if ($shiftitem["status"] == 1) {
|
||||
if ($shiftitem["shiftid"] == $fillshift) {
|
||||
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><b>Subject: </b>
|
||||
<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) {
|
||||
if ($subjitem["subjectid"] == $fillsubject) {
|
||||
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> <img src=\"icons/question.png\" title=\"Enter note text below. To insert a link to a web page, enter it's info in the link fields below the Note box and click Insert Link. You must provide the URL, but the link text is optional. \"><br>
|
||||
<textarea rows=\"10\" cols=\"60\" name=\"note\" id=\"notetextarea\" wrap=\"soft\">$fillnote";
|
||||
echo "</textarea><br>
|
||||
<input type=\"text\" size=\"23\" id=\"linktextfield\" placeholder=\"Enter link text here\">
|
||||
<input type=\"text\" size=\"23\" id=\"linkurlfield\" placeholder=\"Enter URL here\">
|
||||
<a href=\"#\" onclick=\"insertUrlAtCaret('notetextarea','linktextfield','linkurlfield');return false;\">Insert Link</a><br>
|
||||
";
|
||||
|
||||
// create an array called theseflags and optionally load it with flagids set for this template
|
||||
unset($theseflags);
|
||||
$theseflags = [];
|
||||
if ($templateid) {
|
||||
$allflags = mysqli_query($db, "select flagid from flags");
|
||||
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
||||
$theseflags[] = $thisflag[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||
$flagsperline = 8;
|
||||
$flagcount = 1;
|
||||
|
||||
// display checkboxes for all the flags, selecting the ones that are set for this template
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
if ($operation == "edit" && 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 " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($operation == "edit" || $loadtemplate) {
|
||||
// generate a reference string
|
||||
$refstring = NULL;
|
||||
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||
while ($tgt = mysqli_fetch_row($refstringqry)) {
|
||||
$refstring = $refstring . " " . $tgt[0];
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<br><br><b>References: </b>
|
||||
<input type=\"text\" name=\"refstring\" size=\"20\" value=\"$refstring\" title=\"One or more Note ID numbers separated by spaces\">
|
||||
|
||||
";
|
||||
|
||||
if ($operation == "add" && $authorized) {
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"operation\" value=\"add\">
|
||||
<input type=\"submit\" name=\"submit\" value=\"Save Template\">
|
||||
";
|
||||
}
|
||||
if ($operation == "edit" && $authorized) {
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"operation\" value=\"edit\">
|
||||
<input type=\"hidden\" name=\"templateid\" value=\"$templateid\">
|
||||
<input type=\"submit\" name=\"submit\" value=\"Save Template\">
|
||||
<br><br>
|
||||
<button type=\"submit\" name=\"operation\" value=\"delete\">Delete this template</button><font color=\"#FF0000\"><b>Deleted templates are irretrievable!</b></font>
|
||||
";
|
||||
}
|
||||
|
||||
echo "
|
||||
</form>
|
||||
<br>
|
||||
";
|
||||
} else {
|
||||
echo "<br><font size= \"+1\"><b><a href=\"templates.php?operation=add\">Create or copy a template</a></b></font><br><hr>";
|
||||
|
||||
// Show my user template table
|
||||
templatetable($db, $techid, $techid);
|
||||
|
||||
// Show global template table
|
||||
templatetable($db, $techid, "0");
|
||||
|
||||
if ($isadmin) {
|
||||
// Show template tables for other users
|
||||
$techqry = mysqli_query($db, "select techid from techs where techid != $techid and techid != 0");
|
||||
while ($techtblrow = (mysqli_fetch_row($techqry))) {
|
||||
templatetable($db, $techid, $techtblrow[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
banner($print);
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
@@ -1,6 +1,6 @@
|
||||
CHANGELOG
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
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
|
||||
other than today's date contained a trailing colon 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
|
||||
@@ -237,11 +237,58 @@
|
||||
that were caused by more strict behavior of php regarding mysql
|
||||
queries.
|
||||
- Fixed bug where some functions defined in functions.php were not
|
||||
treating the $today variable as global.
|
||||
treating the $today variable as global.
|
||||
- In install.php, if a previous installation was found, make upgrade
|
||||
the default choice.
|
||||
|
||||
5.2.5 - 2026-02-10
|
||||
This is just a version number bump to get on a major-minor-patch
|
||||
scheme. There are no code changes for this release.
|
||||
|
||||
|
||||
5.3.0 - 2026-02-20
|
||||
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
|
||||
its own page to make it less confusing and to fix some strange
|
||||
behavior.
|
||||
- Added global templates which can be used by anyone but can only be
|
||||
created, modified, or deleted by administrators. This makes it
|
||||
easier to employ standardized templates.
|
||||
- Changed the character encoding of the database to utf8mb4 to enable
|
||||
using emojis in text fields.
|
||||
- Changed the insert link functionality. There are now two fields, link
|
||||
text, and URL. The full URL string will now not be displayed in the
|
||||
note, since it frequently was too long and deformed the table,
|
||||
causing the user to have to scroll right to see the entire note. If
|
||||
a URL is entered in the URL field and no link text is entered in the
|
||||
link text field, the link will show up as just the last part of the
|
||||
URL. For example, "http://somewhere.com/myfile.pdf" will show as
|
||||
"myfile.pdf" in the note text. If text is entered in the link text
|
||||
field, that is what will show as the clickable link in the note text.
|
||||
NOTE: URLs in previously entered notes will not automatically be
|
||||
converted.
|
||||
- Changed the flag handling code to no longer dynamically create flag_
|
||||
tables in the database to track assignments. This is now done using
|
||||
a flagmap table.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- References will no longer be stored in the lognotes table with the note.
|
||||
There is now a reflinks table that stores the link information.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- Various code cleanups to prevent php warnings in the logs if logging
|
||||
is enabled.
|
||||
- Validate all date and time fields to prevent user entered invalid date
|
||||
formats from crashing php.
|
||||
- Fixed profile page to automatically refresh page to show the results
|
||||
when a user changes their color preferences.
|
||||
|
||||
5.3.1 - 2026-02-25
|
||||
- Fixed bug reported as Issue 1 where failure to select an action for a
|
||||
part entered in a lognote crashed php in logentry.php.
|
||||
- Fixed bug where the prompt to set flags on reference chain appeared
|
||||
even when no flags were available to select in logentry.php.
|
||||
|
||||
5.3.2 - 2026-03-02
|
||||
- Fixed bug reported as Issue 2 where printing search results resulted in
|
||||
the flags selection was being ignored.
|
||||
|
||||
@@ -1,35 +1,28 @@
|
||||
INSTALL
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
Installation or upgrade of OpenDRS is straightforward.
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
1. Unpack
|
||||
Unpack the distribution in a convenient place. A directory will
|
||||
created called OpenDRS-x.x.x/.
|
||||
|
||||
2. Review License
|
||||
Change to the OpenDRS-x.x.x/ directory and review the LICENSE file.
|
||||
|
||||
Installation of OpenLog is straightforward.
|
||||
3. Run the install script
|
||||
In the same directory, type ./install.sh at a command prompt and
|
||||
follow the prompts.
|
||||
|
||||
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.
|
||||
4. Log in
|
||||
Click on the Log In menu option on the main page. If this is a fresh
|
||||
installation The initial user is drsadmin and the initial password
|
||||
is OpenDRS-1. It is highly recommended that you change this password
|
||||
to a strong one by going to the Manage Database page under the
|
||||
Admin Functions menu. If this an upgrade, your current usernames and
|
||||
passwords are unchanged.
|
||||
|
||||
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.
|
||||
5. Configure
|
||||
The Admin Functions menu will be shown when logged in as an admin user.
|
||||
Click on Global Settings to set display options, page colors, banners, and
|
||||
miscellaneous options. Click on Manage Database to set users, devices,
|
||||
subsystems, action reasons and when discovereds.
|
||||
|
||||
6. Start making writeups
|
||||
|
||||
@@ -1,384 +1,341 @@
|
||||
The following license applies to all OpenLog code
|
||||
Copyright (C) 2016 by Rod Wright :
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
|
||||
The following license applies to jquery code :
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
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.
|
||||
|
||||
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/
|
||||
|
||||
|
||||
@@ -1,93 +1,140 @@
|
||||
<?php
|
||||
/*
|
||||
about.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
$version=OL_VERSION;
|
||||
include("common.php");
|
||||
if (array_key_exists('print',$_REQUEST)) {
|
||||
$print=true;
|
||||
} else {
|
||||
$print=false;
|
||||
}
|
||||
|
||||
$print=$_REQUEST['print'] ?? NULL;
|
||||
// redirect to index.php on cancel button press
|
||||
if (array_key_exists('cancel',$_REQUEST)) {
|
||||
header("Cache-Control:no-cache, must-revalidate");
|
||||
header("Pragma:no-cache");
|
||||
header("Location:index.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// import session variables
|
||||
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
|
||||
|
||||
// import incoming arrays
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
// if printer friendly was clicked, values will be passed in serialized
|
||||
// form as "all_parameters" so we need to load those into $incoming
|
||||
$incoming=unserialize($_REQUEST['all_parameters']);
|
||||
} else {
|
||||
// copy $_REQUEST to $incoming
|
||||
$incoming=arrayCopy($_REQUEST);
|
||||
}
|
||||
|
||||
// extract incoming array keys into variables
|
||||
|
||||
|
||||
// define local functions
|
||||
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
$drs_version=DRS_VERSION;
|
||||
|
||||
if ($print=="Printer Friendly") {
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
}
|
||||
|
||||
framework("begin","About OpenLog","About OpenLog",$print);
|
||||
|
||||
framework("begin","$appname","About OpenDRS",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
|
||||
// ******** end database manipulation ********
|
||||
|
||||
pagetable("begin");
|
||||
if(!$print){
|
||||
if (!$print) {
|
||||
pageblock("left","begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
banner($print);
|
||||
echo "<br>";
|
||||
|
||||
echo "
|
||||
<h3 align=\"center\">
|
||||
OpenLog $version
|
||||
OpenDRS $drs_version Discrepancy Reporting System
|
||||
</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.
|
||||
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2025 by Rod Wright.
|
||||
</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.
|
||||
OpenDRS is a simple online maintenance tracking/discrepancy reporting application. It allows anyone with a web browser to create,
|
||||
view, and search writeups. The look and feel of the OpenDRS pages are easily changed.
|
||||
Settings that affect all users can be changed in the Admin Functions menu. User specific settings can be changed in the
|
||||
My Profile menu. No browser specific HTML is used in OpenDRS, so it should be useable in any browser, and it has been
|
||||
tested using Google Chrome, Mozilla Firefox, Microsoft Internet Explorer, and Microsoft Edge.
|
||||
</p>
|
||||
<p>
|
||||
OpenDRS is highly flexible. Instructions are included in the distribution for creating a user terminal with a Raspberry Pi. OpenDRS can be hosted on a
|
||||
centralized server, accessed by networked PCs and/or Raspberry Pi terminals. It can also be hosted directly on a Raspberry Pi
|
||||
terminal as a non-networked standalone system or in a small network of Raspberry Pi terminals.
|
||||
</p>
|
||||
<p>
|
||||
To read about the <a href=\"changelog.php\" >changes</a> in this latest version of OpenDRS, click on the link or see the CHANGELOG file in the distribution.
|
||||
</p>
|
||||
|
||||
<p>Several pieces of Open Source software make OpenLog possible.
|
||||
<p>Several pieces of Open Source software make OpenDRS 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
|
||||
development and most of the testing of OpenDRS 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
|
||||
border=0></a></td><td><b>PHP</b></td><td>OpenDRS 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>
|
||||
<td><a href=\"https://mariadb.org\" target=\"_blank\"><img src=\"images/mariadb-badge-180x60.png\"
|
||||
border=0></a></td><td><b>MariaDB</b></td><td>OpenDRS stores its data in a <a href=\"https://mariadb.org\" target=\"_blank\">MariaDB</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
|
||||
border=0></a></td><td><b>Apache</b></td><td>OpenDRS 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
|
||||
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenDRS 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 is licensed under the
|
||||
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</p>
|
||||
";
|
||||
|
||||
|
||||
|
||||
echo "<br>";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
|
||||
92
distfiles/changelog.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*
|
||||
changelog.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("common.php");
|
||||
if (array_key_exists('print',$_REQUEST)) {
|
||||
$print=true;
|
||||
} else {
|
||||
$print=false;
|
||||
}
|
||||
|
||||
// redirect to index.php on cancel button press
|
||||
if (array_key_exists('cancel',$_REQUEST)) {
|
||||
header("Cache-Control:no-cache, must-revalidate");
|
||||
header("Pragma:no-cache");
|
||||
header("Location:index.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// import session variables
|
||||
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
|
||||
|
||||
// import incoming arrays
|
||||
if ($print) {
|
||||
// if printer friendly was clicked, values will be passed in serialized
|
||||
// form as "all_parameters" so we need to load those into $incoming
|
||||
$incoming=unserialize($_REQUEST['all_parameters']);
|
||||
} else {
|
||||
// copy $_REQUEST to $incoming
|
||||
$incoming=arrayCopy($_REQUEST);
|
||||
}
|
||||
|
||||
// extract incoming array keys into variables
|
||||
|
||||
|
||||
// define local functions
|
||||
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
|
||||
if ($print) {
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
} else {
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
}
|
||||
|
||||
$role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","OpenDRS Change Log",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
|
||||
// ******** end database manipulation ********
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left","begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
banner($print);
|
||||
echo "<br>";
|
||||
|
||||
echo "
|
||||
<pre>
|
||||
";
|
||||
echo file_get_contents("CHANGELOG");
|
||||
echo "
|
||||
</pre>
|
||||
";
|
||||
|
||||
echo "<br>";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
149
distfiles/colorpicker/css/screen.css
Normal file
@@ -0,0 +1,149 @@
|
||||
#pickerPanel { width: 360px; height: 240px; font: normal 11px verdana, sans-serif; color: #333; line-height: 19px; margin: 0; }
|
||||
|
||||
/* slider */
|
||||
|
||||
.dragPanel {
|
||||
position: relative;
|
||||
background-color: #eeeeee;
|
||||
margin: 4px;
|
||||
width: 260px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
.dragPanel h4 {
|
||||
background-color: #bbbbbb;
|
||||
height: 10px;
|
||||
margin: 0px;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
|
||||
input { font-size: .85em }
|
||||
.thumb {
|
||||
cursor:default;
|
||||
width:18px;
|
||||
height:18px;
|
||||
z-index: 9;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
.bg {
|
||||
position:absolute;
|
||||
left:10px;
|
||||
height:18px;
|
||||
width:146px;
|
||||
border: 0px solid #aaaaaa;
|
||||
}
|
||||
|
||||
.bg span, .bg p {
|
||||
cursor:default;
|
||||
position: relative;
|
||||
font-size: 2px;
|
||||
overflow: hidden;
|
||||
color: #aaaaaa;
|
||||
top: 4px;
|
||||
height: 10px;
|
||||
width: 4px;
|
||||
display: block;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.bg span {
|
||||
border-top:1px solid #cccccc;
|
||||
border-bottom:1px solid #cccccc;
|
||||
}
|
||||
|
||||
.bg .lb {
|
||||
border-left:1px solid #cccccc;
|
||||
}
|
||||
|
||||
.bg .rb {
|
||||
border-right:1px solid #cccccc;
|
||||
}
|
||||
#valdiv { position:absolute; top: 100px; left:10px; }
|
||||
|
||||
#rBG {top:30px}
|
||||
#gBG {top:50px}
|
||||
#bBG {top:70px}
|
||||
|
||||
#rgbSwatch {
|
||||
position:absolute;
|
||||
left:160px;
|
||||
top:34px;
|
||||
height:50px;
|
||||
width:50px;
|
||||
border:1px solid #aaaaaa;
|
||||
}
|
||||
|
||||
#rgbPanel {
|
||||
/*
|
||||
top: 400px;
|
||||
left: 20px;
|
||||
*/
|
||||
width: 360px;
|
||||
height: 240px;
|
||||
}
|
||||
|
||||
/* picker */
|
||||
|
||||
#hueThumb {
|
||||
cursor:default;
|
||||
width:18px;
|
||||
height:18px;
|
||||
z-index: 9;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
#hueBg {
|
||||
position:absolute;
|
||||
left:216px;
|
||||
height:198px;
|
||||
width:18px;
|
||||
background:url(../img/hue.png) no-repeat;
|
||||
top:18px;
|
||||
}
|
||||
|
||||
#pickerDiv {
|
||||
position:absolute;
|
||||
left:10px;
|
||||
height:187px;
|
||||
width:188px;
|
||||
/*
|
||||
background:url(../img/pickerbg.png) no-repeat;
|
||||
*/
|
||||
top:20px;
|
||||
}
|
||||
|
||||
#pickerbg {
|
||||
position:absolute;
|
||||
z-index: 1;
|
||||
top:0px;
|
||||
left:0px;
|
||||
}
|
||||
#selector {
|
||||
cursor:default;
|
||||
width:11px;
|
||||
height:11px;
|
||||
z-index: 9;
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
}
|
||||
|
||||
#pickerSwatch {
|
||||
position:absolute;
|
||||
left:260px;
|
||||
top:30px;
|
||||
height:60px;
|
||||
width:60px;
|
||||
border:2px solid #aaaaaa;
|
||||
}
|
||||
|
||||
#pickervaldiv { text-align:right; position:absolute; top: 86px; left:246px; }
|
||||
|
||||
.colorbox{
|
||||
width: 25px;
|
||||
height: 14px;
|
||||
border: 1px solid black;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
196
distfiles/colorpicker/demo.htm
Normal file
@@ -0,0 +1,196 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:x2="http://www.w3.org/TR/xhtml2"
|
||||
xmlns:role="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#"
|
||||
xmlns:state="http://www.w3.org/2005/07/aaa">
|
||||
<head>
|
||||
<title>YUI Color Picker</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/screen.css">
|
||||
<script type="text/javascript" src="js/ddcolorposter.js"></script>
|
||||
<script type="text/javascript" src="js/YAHOO.js" ></script>
|
||||
<script type="text/javascript2" src="js/log.js" ></script>
|
||||
<script type="text/javascript" src="js/color.js" ></script>
|
||||
|
||||
<script type="text/javascript" src="js/event.js" ></script>
|
||||
<script type="text/javascript" src="js/dom.js" ></script>
|
||||
<script type="text/javascript" src="js/animation.js" ></script>
|
||||
<script type="text/javascript" src="js/dragdrop.js" ></script>
|
||||
|
||||
<script type="text/javascript" src="js/slider.js" ></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var hue;
|
||||
var picker;
|
||||
//var gLogger;
|
||||
var dd1, dd2;
|
||||
var r, g, b;
|
||||
|
||||
function init() {
|
||||
if (typeof(ygLogger) != "undefined")
|
||||
ygLogger.init(document.getElementById("logDiv"));
|
||||
pickerInit();
|
||||
ddcolorposter.fillcolorbox("colorfield1", "colorbox1") //PREFILL "colorbox1" with hex value from "colorfield1"
|
||||
ddcolorposter.fillcolorbox("colorfield2", "colorbox2") //PREFILL "colorbox1" with hex value from "colorfield1"
|
||||
}
|
||||
|
||||
// Picker ---------------------------------------------------------
|
||||
|
||||
function pickerInit() {
|
||||
hue = YAHOO.widget.Slider.getVertSlider("hueBg", "hueThumb", 0, 180);
|
||||
hue.onChange = function(newVal) { hueUpdate(newVal); };
|
||||
|
||||
picker = YAHOO.widget.Slider.getSliderRegion("pickerDiv", "selector",
|
||||
0, 180, 0, 180);
|
||||
picker.onChange = function(newX, newY) { pickerUpdate(newX, newY); };
|
||||
|
||||
hueUpdate();
|
||||
|
||||
dd1 = new YAHOO.util.DD("pickerPanel");
|
||||
dd1.setHandleElId("pickerHandle");
|
||||
dd1.endDrag = function(e) {
|
||||
// picker.thumb.resetConstraints();
|
||||
// hue.thumb.resetConstraints();
|
||||
};
|
||||
}
|
||||
|
||||
executeonload(init);
|
||||
|
||||
function pickerUpdate(newX, newY) {
|
||||
pickerSwatchUpdate();
|
||||
}
|
||||
|
||||
|
||||
function hueUpdate(newVal) {
|
||||
|
||||
var h = (180 - hue.getValue()) / 180;
|
||||
if (h == 1) { h = 0; }
|
||||
|
||||
var a = YAHOO.util.Color.hsv2rgb( h, 1, 1);
|
||||
|
||||
document.getElementById("pickerDiv").style.backgroundColor =
|
||||
"rgb(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
|
||||
|
||||
pickerSwatchUpdate();
|
||||
}
|
||||
|
||||
function pickerSwatchUpdate() {
|
||||
var h = (180 - hue.getValue());
|
||||
if (h == 180) { h = 0; }
|
||||
document.getElementById("pickerhval").value = (h*2);
|
||||
|
||||
h = h / 180;
|
||||
|
||||
var s = picker.getXValue() / 180;
|
||||
document.getElementById("pickersval").value = Math.round(s * 100);
|
||||
|
||||
var v = (180 - picker.getYValue()) / 180;
|
||||
document.getElementById("pickervval").value = Math.round(v * 100);
|
||||
|
||||
var a = YAHOO.util.Color.hsv2rgb( h, s, v );
|
||||
|
||||
document.getElementById("pickerSwatch").style.backgroundColor =
|
||||
"rgb(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
|
||||
|
||||
document.getElementById("pickerrval").value = a[0];
|
||||
document.getElementById("pickergval").value = a[1];
|
||||
document.getElementById("pickerbval").value = a[2];
|
||||
var hexvalue = document.getElementById("pickerhexval").value =
|
||||
YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
|
||||
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--[if gte IE 5.5000]>
|
||||
<script type="text/javascript">
|
||||
|
||||
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
|
||||
{
|
||||
for(var i=0; i<document.images.length; i++)
|
||||
{
|
||||
var img = document.images[i]
|
||||
var imgName = img.src.toUpperCase()
|
||||
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
|
||||
{
|
||||
var imgID = (img.id) ? "id='" + img.id + "' " : ""
|
||||
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
|
||||
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
|
||||
var imgStyle = "display:inline-block;" + img.style.cssText
|
||||
if (img.align == "left") imgStyle = "float:left;" + imgStyle
|
||||
if (img.align == "right") imgStyle = "float:right;" + imgStyle
|
||||
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
|
||||
var strNewHTML = "<span " + imgID + imgClass + imgTitle
|
||||
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
|
||||
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
|
||||
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
|
||||
img.outerHTML = strNewHTML
|
||||
i = i-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YAHOO.util.Event.addListener(window, "load", correctPNG);
|
||||
|
||||
</script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3>Color Picker</h3>
|
||||
<p>
|
||||
Implements a slider region and a vertical slider to implement an HSV color
|
||||
picker.
|
||||
</p>
|
||||
|
||||
|
||||
<div id="pickerPanel" class="dragPanel">
|
||||
<h4 id="pickerHandle"> </h4>
|
||||
<div id="pickerDiv">
|
||||
<img id="pickerbg" src="img/pickerbg.png" alt="">
|
||||
<div id="selector"><img src="img/select.gif"></div>
|
||||
</div>
|
||||
|
||||
<div id="hueBg">
|
||||
<div id="hueThumb"><img src="img/hline.png"></div>
|
||||
</div>
|
||||
|
||||
<div id="pickervaldiv">
|
||||
<form name="pickerform" onsubmit="return pickerUpdate()">
|
||||
<br />
|
||||
R <input name="pickerrval" id="pickerrval" type="text" value="0" size="3" maxlength="3" />
|
||||
H <input name="pickerhval" id="pickerhval" type="text" value="0" size="3" maxlength="3" />
|
||||
<br />
|
||||
G <input name="pickergval" id="pickergval" type="text" value="0" size="3" maxlength="3" />
|
||||
S <input name="pickergsal" id="pickersval" type="text" value="0" size="3" maxlength="3" />
|
||||
<br />
|
||||
B <input name="pickerbval" id="pickerbval" type="text" value="0" size="3" maxlength="3" />
|
||||
V <input name="pickervval" id="pickervval" type="text" value="0" size="3" maxlength="3" />
|
||||
<br />
|
||||
<br />
|
||||
# <input name="pickerhexval" id="pickerhexval" type="text" value="0" size="6" maxlength="6" />
|
||||
<br />
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="pickerSwatch"> </div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<form>
|
||||
# <input type="text" id="colorfield1" onFocus="ddcolorposter.echocolor(this, 'colorbox1')"> <span id="colorbox1" class="colorbox">____</span> <br />
|
||||
# <input type="text" id="colorfield2" onFocus="ddcolorposter.echocolor(this, 'colorbox2')"> <span id="colorbox2" class="colorbox">____</span>
|
||||
</form>
|
||||
|
||||
More info: <a href="http://www.dynamicdrive.com/dynamicindex11/yuicolorpicker/">YUI Color Picker script</a>.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
distfiles/colorpicker/img/bullet.gif
Normal file
|
After Width: | Height: | Size: 172 B |
BIN
distfiles/colorpicker/img/greybg.png
Normal file
|
After Width: | Height: | Size: 197 B |
BIN
distfiles/colorpicker/img/header.gif
Normal file
|
After Width: | Height: | Size: 203 B |
BIN
distfiles/colorpicker/img/hline.png
Normal file
|
After Width: | Height: | Size: 416 B |
BIN
distfiles/colorpicker/img/hue.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
distfiles/colorpicker/img/navHover2.png
Normal file
|
After Width: | Height: | Size: 875 B |
BIN
distfiles/colorpicker/img/pickerbg.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
distfiles/colorpicker/img/qbottom.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
distfiles/colorpicker/img/qmiddle.png
Normal file
|
After Width: | Height: | Size: 385 B |
BIN
distfiles/colorpicker/img/qtop.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
distfiles/colorpicker/img/select.gif
Normal file
|
After Width: | Height: | Size: 78 B |
BIN
distfiles/colorpicker/img/select.png
Normal file
|
After Width: | Height: | Size: 192 B |
BIN
distfiles/colorpicker/img/vline.png
Normal file
|
After Width: | Height: | Size: 481 B |
60
distfiles/colorpicker/js/YAHOO.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class The Yahoo global namespace
|
||||
*/
|
||||
var YAHOO = function() {
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform utils namespace
|
||||
*/
|
||||
util: {},
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform widgets namespace
|
||||
*/
|
||||
widget: {},
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform examples namespace
|
||||
*/
|
||||
example: {},
|
||||
|
||||
/**
|
||||
* Returns the namespace specified and creates it if it doesn't exist
|
||||
*
|
||||
* YAHOO.namespace("property.package");
|
||||
* YAHOO.namespace("YAHOO.property.package");
|
||||
*
|
||||
* Either of the above would create YAHOO.property, then
|
||||
* YAHOO.property.package
|
||||
*
|
||||
* @param {String} sNameSpace String representation of the desired
|
||||
* namespace
|
||||
* @return {Object} A reference to the namespace object
|
||||
*/
|
||||
namespace: function( sNameSpace ) {
|
||||
|
||||
if (!sNameSpace || !sNameSpace.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var levels = sNameSpace.split(".");
|
||||
|
||||
var currentNS = YAHOO;
|
||||
|
||||
// YAHOO is implied, so it is ignored if it is included
|
||||
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
|
||||
currentNS[levels[i]] = currentNS[levels[i]] || {};
|
||||
currentNS = currentNS[levels[i]];
|
||||
}
|
||||
|
||||
return currentNS;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
} ();
|
||||
|
||||
39
distfiles/colorpicker/js/animation.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
YAHOO.util.Anim=function(el,attributes,duration,method)
|
||||
{if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={doMethod:function(attribute,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attribute,val,unit){YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);},getAttribute:function(attribute){return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));},defaultUnits:{opacity:' '},defaultUnit:'px',init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var endTime=null;var actualFrames=0;var defaultValues={};el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.setDefault=function(attribute,val){if(val=='auto'){switch(attribute){case'width':val=el.clientWidth||el.offsetWidth;break;case'height':val=el.clientHeight||el.offsetHeight;break;case'left':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetLeft;}else{val=0;}
|
||||
break;case'top':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetTop;}else{val=0;}
|
||||
break;default:val=0;}}
|
||||
defaultValues[attribute]=val;}
|
||||
this.getDefault=function(attribute){return defaultValues[attribute];};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.animate=function(){this.onStart.fire();this._onStart.fire();this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);var attributes=this.attributes;var el=this.getEl();var val;for(var attribute in attributes){val=this.getAttribute(attribute);this.setDefault(attribute,val);}
|
||||
isAnimated=true;actualFrames=0;startTime=new Date();};this.stop=function(){this.currentFrame=0;endTime=new Date();var data={time:endTime,duration:endTime-startTime,frames:actualFrames,fps:actualFrames/this.duration};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};var onTween=function(){var start;var end=null;var val;var unit;var attributes=this['attributes'];for(var attribute in attributes){unit=attributes[attribute]['unit']||this.defaultUnits[attribute]||this.defaultUnit;if(typeof attributes[attribute]['from']!='undefined'){start=attributes[attribute]['from'];}else{start=this.getDefault(attribute);}
|
||||
if(typeof attributes[attribute]['to']!='undefined'){end=attributes[attribute]['to'];}else if(typeof attributes[attribute]['by']!='undefined'){end=start+attributes[attribute]['by'];}
|
||||
if(end!==null&&typeof end!='undefined'){val=this.doMethod(attribute,start,end);if((attribute=='width'||attribute=='height'||attribute=='opacity')&&val<0){val=0;}
|
||||
this.setAttribute(attribute,val,unit);}}
|
||||
actualFrames+=1;};this._onStart=new YAHOO.util.CustomEvent('_onStart',this);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onTween.subscribe(onTween);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){if(tween.isAnimated()){return false;}
|
||||
queue[queue.length]=tween;tweenCount+=1;this.start();};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween)
|
||||
{clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){queue[i].stop();}}
|
||||
queue=[];thread=null;tweenCount=0;}
|
||||
else{tween.stop();tweenCount-=1;if(tweenCount<=0){this.stop();}}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
|
||||
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
|
||||
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
|
||||
tween.onTween.fire();tween._onTween.fire();}
|
||||
else{YAHOO.util.AnimMgr.stop(tween);}}};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
|
||||
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
|
||||
tween.currentFrame+=tweak;}};}
|
||||
YAHOO.util.Bezier=new function()
|
||||
{this.getPosition=function(points,t)
|
||||
{var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
|
||||
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
|
||||
return[tmp[0][0],tmp[0][1]];};};YAHOO.util.Easing=new function(){this.easeNone=function(t,b,c,d){return b+c*(t/=d);};this.easeIn=function(t,b,c,d){return b+c*((t/=d)*t*t);};this.easeOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(tc+-3*ts+3*t);};this.easeBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-2*tc+3*ts);};this.backIn=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-3.4005*tc*ts+10.2*ts*ts+-6.2*tc+0.4*ts);};this.backOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(8.292*tc*ts+-21.88*ts*ts+22.08*tc+-12.69*ts+5.1975*t);};this.backBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(0.402*tc*ts+-2.1525*ts*ts+-3.2*tc+8*ts+-2.05*t);};};YAHOO.util.Motion=function(el,attributes,duration,method){if(el){this.initMotion(el,attributes,duration,method);}};YAHOO.util.Motion.prototype=new YAHOO.util.Anim();YAHOO.util.Motion.prototype.defaultUnits.points='px';YAHOO.util.Motion.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='points'){var translatedPoints=this.getTranslatedPoints();var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;if(translatedPoints){val=YAHOO.util.Bezier.getPosition(translatedPoints,t);}}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
|
||||
return val;};YAHOO.util.Motion.prototype.getAttribute=function(attribute){var val=null;if(attribute=='points'){val=[this.getAttribute('left'),this.getAttribute('top')];if(isNaN(val[0])){val[0]=0;}
|
||||
if(isNaN(val[1])){val[1]=0;}}else{val=parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));}
|
||||
return val;};YAHOO.util.Motion.prototype.setAttribute=function(attribute,val,unit){if(attribute=='points'){YAHOO.util.Dom.setStyle(this.getEl(),'left',val[0]+unit);YAHOO.util.Dom.setStyle(this.getEl(),'top',val[1]+unit);}else{YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);}};YAHOO.util.Motion.prototype.initMotion=function(el,attributes,duration,method){YAHOO.util.Anim.call(this,el,attributes,duration,method);attributes=attributes||{};attributes.points=attributes.points||{};attributes.points.control=attributes.points.control||[];this.attributes=attributes;var start;var end=null;var translatedPoints=null;this.getTranslatedPoints=function(){return translatedPoints;};var translateValues=function(val,self){var pageXY=YAHOO.util.Dom.getXY(self.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var onStart=function(){start=this.getAttribute('points');var attributes=this.attributes;var control=attributes['points']['control']||[];if(control.length>0&&control[0].constructor!=Array){control=[control];}
|
||||
if(YAHOO.util.Dom.getStyle(this.getEl(),'position')=='static'){YAHOO.util.Dom.setStyle(this.getEl(),'position','relative');}
|
||||
if(typeof attributes['points']['from']!='undefined'){YAHOO.util.Dom.setXY(this.getEl(),attributes['points']['from']);start=this.getAttribute('points');}
|
||||
else if((start[0]===0||start[1]===0)){YAHOO.util.Dom.setXY(this.getEl(),YAHOO.util.Dom.getXY(this.getEl()));start=this.getAttribute('points');}
|
||||
var i,len;if(typeof attributes['points']['to']!='undefined'){end=translateValues(attributes['points']['to'],this);for(i=0,len=control.length;i<len;++i){control[i]=translateValues(control[i],this);}}else if(typeof attributes['points']['by']!='undefined'){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
|
||||
if(end){translatedPoints=[start];if(control.length>0){translatedPoints=translatedPoints.concat(control);}
|
||||
translatedPoints[translatedPoints.length]=end;}};this._onStart.subscribe(onStart);};YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Anim.call(this,el,attributes,duration,method);}};YAHOO.util.Scroll.prototype=new YAHOO.util.Anim();YAHOO.util.Scroll.prototype.defaultUnits.scroll=' ';YAHOO.util.Scroll.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
|
||||
return val;}
|
||||
YAHOO.util.Scroll.prototype.getAttribute=function(attribute){var val=null;var el=this.getEl();if(attribute=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=parseFloat(YAHOO.util.Dom.getStyle(el,attribute));}
|
||||
return val;};YAHOO.util.Scroll.prototype.setAttribute=function(attribute,val,unit){var el=this.getEl();if(attribute=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{YAHOO.util.Dom.setStyle(el,attribute,val+unit);}};
|
||||
101
distfiles/colorpicker/js/color.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
YAHOO.util.Color = new function() {
|
||||
|
||||
// Adapted from http://www.easyrgb.com/math.html
|
||||
// hsv values = 0 - 1
|
||||
// rgb values 0 - 255
|
||||
this.hsv2rgb = function (h, s, v) {
|
||||
var r, g, b;
|
||||
if ( s == 0 ) {
|
||||
r = v * 255;
|
||||
g = v * 255;
|
||||
b = v * 255;
|
||||
} else {
|
||||
|
||||
// h must be < 1
|
||||
var var_h = h * 6;
|
||||
if ( var_h == 6 ) {
|
||||
var_h = 0;
|
||||
}
|
||||
|
||||
//Or ... var_i = floor( var_h )
|
||||
var var_i = Math.floor( var_h );
|
||||
var var_1 = v * ( 1 - s );
|
||||
var var_2 = v * ( 1 - s * ( var_h - var_i ) );
|
||||
var var_3 = v * ( 1 - s * ( 1 - ( var_h - var_i ) ) );
|
||||
|
||||
if ( var_i == 0 ) {
|
||||
var_r = v;
|
||||
var_g = var_3;
|
||||
var_b = var_1;
|
||||
} else if ( var_i == 1 ) {
|
||||
var_r = var_2;
|
||||
var_g = v;
|
||||
var_b = var_1;
|
||||
} else if ( var_i == 2 ) {
|
||||
var_r = var_1;
|
||||
var_g = v;
|
||||
var_b = var_3
|
||||
} else if ( var_i == 3 ) {
|
||||
var_r = var_1;
|
||||
var_g = var_2;
|
||||
var_b = v;
|
||||
} else if ( var_i == 4 ) {
|
||||
var_r = var_3;
|
||||
var_g = var_1;
|
||||
var_b = v;
|
||||
} else {
|
||||
var_r = v;
|
||||
var_g = var_1;
|
||||
var_b = var_2
|
||||
}
|
||||
|
||||
r = var_r * 255 //rgb results = 0 ÷ 255
|
||||
g = var_g * 255
|
||||
b = var_b * 255
|
||||
|
||||
}
|
||||
return [Math.round(r), Math.round(g), Math.round(b)];
|
||||
};
|
||||
|
||||
this.rgb2hex = function (r,g,b) {
|
||||
return this.toHex(r) + this.toHex(g) + this.toHex(b);
|
||||
};
|
||||
|
||||
this.hexchars = "0123456789ABCDEF";
|
||||
|
||||
this.toHex = function(n) {
|
||||
n = n || 0;
|
||||
n = parseInt(n, 10);
|
||||
if (isNaN(n)) n = 0;
|
||||
n = Math.round(Math.min(Math.max(0, n), 255));
|
||||
|
||||
return this.hexchars.charAt((n - n % 16) / 16) + this.hexchars.charAt(n % 16);
|
||||
};
|
||||
|
||||
this.toDec = function(hexchar) {
|
||||
return this.hexchars.indexOf(hexchar.toUpperCase());
|
||||
};
|
||||
|
||||
this.hex2rgb = function(str) {
|
||||
var rgb = [];
|
||||
rgb[0] = (this.toDec(str.substr(0, 1)) * 16) +
|
||||
this.toDec(str.substr(1, 1));
|
||||
rgb[1] = (this.toDec(str.substr(2, 1)) * 16) +
|
||||
this.toDec(str.substr(3, 1));
|
||||
rgb[2] = (this.toDec(str.substr(4, 1)) * 16) +
|
||||
this.toDec(str.substr(5, 1));
|
||||
// gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
|
||||
return rgb;
|
||||
};
|
||||
|
||||
this.isValidRGB = function(a) {
|
||||
if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255) return false;
|
||||
if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255) return false;
|
||||
if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
43
distfiles/colorpicker/js/ddcolorposter.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
======================================================================
|
||||
ddcolorposter.js: By Dynamic Drive (http://www.dynamicdrive.com)
|
||||
Communicates between Yahoo Color Picker and form fields on your page
|
||||
Created: Feb 20th, 06'
|
||||
======================================================================
|
||||
*/
|
||||
|
||||
function executeonload(functionref){
|
||||
if (window.addEventListener)
|
||||
window.addEventListener("load", functionref, false)
|
||||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", functionref)
|
||||
else if (document.getElementById)
|
||||
window.onload=functionref
|
||||
}
|
||||
|
||||
var ddcolorposter={
|
||||
initialize:function(r,g,b, hexvalue){
|
||||
this.rvalue=r //store red value
|
||||
this.gvalue=g //store green value
|
||||
this.bvalue=b //store blue value
|
||||
this.hexvalue=hexvalue //store combined hex value
|
||||
if (typeof this.targetobj!="undefined"){
|
||||
this.targetobj.value=this.hexvalue //set field to selected hex color value
|
||||
if (typeof this.divobj!="undefined") //set adjacent div to selected hex color value
|
||||
this.divobj.style.backgroundColor="#"+this.hexvalue
|
||||
}
|
||||
},
|
||||
echocolor:function(inputobj, divID){
|
||||
this.targetobj=inputobj
|
||||
this.divobj=document.getElementById(divID)
|
||||
this.targetobj.onblur=function(){
|
||||
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
|
||||
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
|
||||
}
|
||||
},
|
||||
fillcolorbox:function(inputID, divID){
|
||||
var inputobj=document.getElementById(inputID)
|
||||
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
|
||||
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
|
||||
}
|
||||
}
|
||||