Revert "Import pwic as source, add overrides"

Trying to coerce a poorly-laid out application into a library was a bad
idea.
This commit is contained in:
evilchili 2025-09-21 15:28:16 -07:00
parent 7aa6f03d5d
commit 987ad1964e
88 changed files with 12 additions and 26426 deletions

View File

@ -1,2 +0,0 @@
[run]
omit = **/pwic/**

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/pwic"]
path = src/pwic
url = https://github.com/gitbra/pwic.git

View File

@ -1,7 +1,7 @@
[tool.poetry] [tool.poetry]
name = "ttfrog" name = "ttfrog"
version = "1.0" version = "1.0"
description = "TTFrog" description = "ttfrog: automatically generated by poetry-slam."
authors = ["greg"] authors = ["greg"]
readme = "README.md" readme = "README.md"
packages = [ packages = [
@ -10,23 +10,13 @@ packages = [
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.11" python = "^3.11"
python-dotenv = "*" python-dotenv = "^0.21.0"
rich = "*" rich = "^13.7.0"
typer = "*" typer = "^0.9.0"
aiohttp = ">=3.8"
aiohttp-cors = "^0.8.1"
aiohttp-session = ">=2.10"
imagesize = "^1.4.1"
jinja2 = "^3.1.6"
prettytable = ">=1.0"
pygments = "^2.19.2"
pyotp = "^2.9.0"
cryptography = "^46.0.1"
setuptools = "^80.9.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pytest = "*" pytest = "^8.4.2"
pytest-cov = "*" pytest-cov = "^7.0.0"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]
@ -59,6 +49,6 @@ remove-unused-variables = true # remove unused variables
[tool.pytest.ini_options] [tool.pytest.ini_options]
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
addopts = "--cov=src --cov-report=term-missing --cov-config=.coveragerc" addopts = "--cov=src --cov-report=term-missing"
### ENDSLAM ### ENDSLAM

1
src/pwic Submodule

@ -0,0 +1 @@
Subproject commit adf276747c65a3f256caa01fbe1a4dddb3252a60

View File

@ -11,10 +11,6 @@ CONFIG_DEFAULTS = """
# ttfrog Defaults # ttfrog Defaults
LOG_LEVEL=INFO LOG_LEVEL=INFO
SALT=fnord
DB_DEFAULT_PORT=8005
""" """
app = typer.Typer() app = typer.Typer()
@ -58,4 +54,4 @@ def run(context: typer.Context):
""" """
The default CLI entrypoint is ttfrog.cli.run(). The default CLI entrypoint is ttfrog.cli.run().
""" """
db.init() raise NotImplementedError("Please define ttfrog.cli.run().")

View File

@ -1,23 +0,0 @@
from typing import Dict
from ttfrog.pwic.pwic import PwicConst as Config
from . import path
def init(config: Dict):
Config.DB = path.CONFIG_ROOT
Config.DB_SQLITE = Config.DB / "db.sql"
Config.DB_SQLITE_BACKUP = Config.DB / "db_%s.sql"
Config.DB_SQLITE_AUDIT = Config.DB / "db_audit.sql"
Config.DOCUMENTS_PATH = Config.DB / "documents" / "%s"
for key, value in config.items():
if hasattr(Config, key):
setattr(Config, key, value)
continue
if key.startswith("DB_DEFAULT_"):
default_key = key.split("_", 2)[2]
Config.DEFAULTS[default_key.lower()] = value
return Config

View File

@ -1,3 +0,0 @@
from pathlib import Path
CONFIG_ROOT = Path("~/.dnd/ttfrog/").resolve()

View File

@ -1,661 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
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
them 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.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero 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 that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
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
state 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 Affero General Public License as published by
the Free Software Foundation, either version 3 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

View File

@ -1,171 +0,0 @@
# Pwic.wiki server written with Python and SQLite
## Presentation
**Pwic.wiki** (pronounce /puik/) is a flexible and compact wiki server to support the documentation of your projects through comprehensive features and 5 basic roles. Its purpose is to serve as a common repository where the essential documentation can be easily located, accessed, edited, compared, validated, shared, exported and eventually analyzed by your own scripts.
*Pwic.wiki* is an advanced concept that attempts to fix the methodological limitations that you can face by participating to an IT project. If you ever wasted your time on managing your files, templates, styles and validations, you are probably searching for a fresh solution to support your process!
The [official homepage](https://pwic.wiki) is running the latest version.
## Some supported features
### For the readers
- Access with a user account on both desktop and mobile devices
- Lightweight user interface illustrated with emojis
- Dark mode
- Homogeneous look and feel across the pages
- Encyclopedic mode to browse the latest validated revisions only
- Automatic summary of the page
- In-text search with inclusion, exclusion, hash tags and special keywords
- Search link for the browsers
- Highlight of the lines of code
- Export of a page to Markdown (.md), web page (.html) and OpenDocument (.odt)
- OData feed for BI reports
- RSS feed
- Progressive web application (PWA)
- Share by link
- Share by email
- Internationalization: English, French, German, extendable to your language from a template or [online](https://explore.transifex.com/pwicwiki/pwicwiki/)
- LTR/RTL
### For the validators
- Text comparison between two revisions
- No change or no deletion possible after a page is validated
- Visible control hash key
### For the editors
- Page layout supervised with Markdown and HTML
- Markdown editor with syntax highlighting
- Formatting
- Annotations
- Task lists
- Classification of the pages with hashtags and statuses
- Automatic numbering of the headers with no gap
- Mandatory, linear and partially undoable versioning
- Management of attached documents by name, mime, size and magic bytes
- Import of texts from OpenDocument Text (ODT), HTML, Markdown and remote web pages
- Dictation
### For the managers
- Dynamic tables to track the progress of the documentation by project and tag
- Copyable templates between projects
- Possible automatic KB identifier
- Detection of the orphaned pages
- Detection of the broken links
- Visual graph of the links between the pages
### For the administrators
**System**
- Low technical requirements and bandwidth
- Affordable solution based on open-source applications
- Fast setup with Python 3 in 15 minutes
- No data stored in proprietary formats
- Local storage of the uploaded files and SQLite database
- Possible deployment with command lines
- Critical administration not available online
- Support for HTTP, HTTPS and reverse proxy
- Unicode content and URL
- HTTP logging
- Basic filter of bots
- IP filtering
- Expirable sessions
**Pwic.wiki**
- Multi-projects with dedicated authorizations by user
- Global and project-dependent settings
- OAuth2-based federated authentication with control of the state (SSO)
- Two-factor authentication based on time (2FA TOTP)
- Cache system
- Private and public modes
- Custom CSS and templates
- Export of an entire project to Markdown and HTML
- Traceable activities
- API and command line to automate the operations
- Extensible code base for the following possibilities:
- Enhanced authorizations
- Password control
- Named emojis
- Content checks
- Content includes
- Automatic pages
- Redirections
- Related pages
- External cloud storage
- Automatic renaming of the files
- Bridged chat notifications
- ...
- No JavaScript needed to read the pages
## Install
### Mandatory technical setup
- Install Python >=3.7: `apt-get install python3 python3-pip gzip --no-install-recommends`
- Clone the repository `git clone https://github.com/gitbra/pwic.git` or uncompress the [latest modifications](https://github.com/gitbra/pwic/archive/refs/heads/master.zip) in the folder of your choice
- Install the dependencies: `python3 -m pip install --upgrade -r requirements.txt`
- If your packages are managed by the system, use instead `apt-get install python3-xxx` where `xxx` stands for the name of each package listed in the file `requirements.txt`
- Optionally modify some default values in the file `pwic_lib.py` with a text editor to increase the security:
- Change the default password in `PwicConst.DEFAULTS['password']`
- Write random characters in the secret salt `PwicConst.SALT` forever
- Initialize the database: `python3 pwic_admin.py init-db`
- A sub-folder `db/` is created for all your data
### Quick local setup
- Create a new project `demo` for the user `admin`: `python3 pwic_admin.py create-project demo "Demo project" admin`
- Run the server: `python3 pwic.py`
- Open your browser at `http://127.0.0.1:8080` by default
- Log in with your account and change your password by using the link in the footer
- In the special area of the project, grant yourself the role *Manager* to allow the creation of new pages
Once you have well tested Pwic.wiki and defined the global and project-dependent variables described in the embedded help file, you can use the bind address `0.0.0.0` and change the port in the main command line.
## Support
Please use the [issue tracker](https://github.com/gitbra/pwic/issues) on Github to ask questions, report bugs and request new features.
To enhance the existing translations, you may edit the selected languages by [joining the online workspace](https://explore.transifex.com/pwicwiki/pwicwiki/). Native speakers can achieve one translation precisely in few hours.
## Licenses
### Main
- Pwic.wiki server running on Python and SQLite
- Copyright (C) 2020-2025 Alexandre Bréard
- <https://pwic.wiki>
- <https://github.com/gitbra/pwic>
- Released under the terms of the GNU Affero General Public License v3+
### Third-party software
- [aiohttp](https://github.com/aio-libs/aiohttp) is released under Apache 2.0 License
- [aiohttp-cors](https://github.com/aio-libs/aiohttp-cors) is released under Apache 2.0 License
- [aiohttp-session](https://github.com/aio-libs/aiohttp-session) is released under Apache 2.0 License
- [cash.js](https://github.com/fabiospampinato/cash) is released under MIT License
- [CodeMirror](https://github.com/codemirror/codemirror5) is released under MIT License
- [ImageSize](https://github.com/shibukawa/imagesize_py) is released under MIT License
- [Jinja2](https://github.com/pallets/jinja) is released under BSD-3-Clause License
- [Markdown2](https://github.com/trentm/python-markdown2) is released under MIT License
- [MathJax](https://github.com/mathjax/MathJax-src) is released under Apache 2.0 License
- [Noto Sans](https://fonts.google.com/specimen/Noto+Sans) is released under Open Font License
- [PrettyTable](https://github.com/jazzband/prettytable) is released under BSD License
- [pygments](https://github.com/pygments/pygments) is released under BSD-2-Clause License
- [pyotp](https://github.com/pyauth/pyotp) is released under MIT License
- [Python](https://github.com/python/cpython/) is released under Python Software Foundation License
- [SQLite](https://www.sqlite.org) is released in the public domain
- [SVG pan & zoom](https://github.com/ariutta/svg-pan-zoom) is released under BSD-2-Clause License
- [Swagger UI](https://github.com/swagger-api/swagger-ui) is released under Apache 2.0 License
- [Viz.js](https://github.com/mdaines/viz.js) is released under MIT License

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,784 +0,0 @@
# Pwic.wiki server running on Python and SQLite
# Copyright (C) 2020-2025 Alexandre Bréard
#
# https://pwic.wiki
# https://github.com/gitbra/pwic
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import sqlite3
from datetime import tzinfo
from typing import Any, Dict, List, Optional, Tuple
from aiohttp import web
from multidict import MultiDict
from prettytable import PrettyTable
from .pwic_lib import PwicLib
class PwicExtension:
"""Extensions for Pwic.wiki
The behavior of Pwic.wiki is changeable in this file through a logic of events
positioned at critical positions in the code base. It is easier and safer to
implement some changes here but it remains technically sensitive.
Each method is always active and generally returns from 0 to 2 results.
The first one usually indicates if something happened. The second one provides
the new result. With no result, the parameters of the method are changeable
if they are passed as a reference, else raise an exception.
"""
# ============
# User exits
# ============
@staticmethod
def on_api_document_convert(
sql: sqlite3.Cursor, # Cursor to query the database
project: str, # Name of the project
user: str, # Name of the user
page: Optional[str], # Name of the page
doc_id: int, # Identifier of the document
url: Optional[str], # Remote web page
markdown: str, # Converted Markdown
) -> str:
"""Event when a file (doc_id>0) or remote web page (doc_id=0) is converted to Markdown.
The result is the new converted text.
"""
return markdown
@staticmethod
def on_api_document_create_end(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
document: Dict[str, Any], # Document as defined in the database and extra fields
) -> None:
"""Event after a file is loaded on the server. The database is committed already.
You can trigger an asynchronous task to do what you want with the new/updated file.
It is up to you to update safely the table of the documents and do the appropriate audit.
By using the field "documents.exturl", the file must not exist locally anymore.
"""
@staticmethod
def on_api_document_create_start(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
document: Dict[str, Any], # Submitted document (changeable)
) -> bool:
"""Event when a new document is submitted and before many internal checks are executed.
The result indicates if the creation of the document is possible.
"""
return True
@staticmethod
def on_api_document_delete(
sql: sqlite3.Cursor, # Cursor to query the database
request: Optional[web.Request], # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: Optional[str], # Name of the page
doc_id: Optional[int], # Identifier of the document
filename: str, # Name of the file
exturl: str, # External URL of the file
) -> bool:
"""Event when the file must be deleted.
For the local files, the result indicates if the deletion of the document is possible and Pwic.wiki will perform the deletion.
For the external files, you must delete the file with your custom logic, so the result indicates if the operation is successful.
The page and id may be None when a mandatory allowed technical maintenance occurs on the repository.
"""
# local_path = os.path.join(PwicConst.DOCUMENTS_PATH % project, filename)
return True
@staticmethod
def on_api_document_list(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
page: str, # Name of the page
documents: List[Dict[str, Any]], # List of the documents (changeable)
) -> None:
"""Event when the list of the documents of a page is requested.
Modify the parameter 'documents' without reallocating it.
"""
@staticmethod
def on_api_document_rename(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
doc_id: int, # Identifier of the document
old_filename: str, # Current file name
new_filename: str, # Target file name
) -> bool:
"""Event when a local file is renamed.
The result indicates if the renaming of the document is possible.
"""
# local_path = os.path.join(PwicConst.DOCUMENTS_PATH % project, filename)
return True
@staticmethod
def on_api_page_create(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
kb: bool, # Is knowledge base article
tags: str, # Tags
milestone: str, # Milestone
) -> bool:
"""Event when a new page is created.
The result indicates if the creation of the page is possible.
"""
return True
@staticmethod
def on_api_page_delete(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
revision: int, # Number of the revision
) -> bool:
"""Event when a given revision of a page is about to be deleted.
The result indicates if the deletion of the revision is possible.
"""
return True
@staticmethod
def on_api_page_edit(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
title: str, # Title of the page
markdown: str, # Content of the page
tags: str, # Tags
comment: str, # Reason for the commit
milestone: str, # Milestone
draft: bool, # Flag for draft
final: bool, # Flag for final
header: bool, # Flag for header
protection: bool, # Flag for protection
) -> bool:
"""Event when a new revision is submitted.
The result indicates if the update of the page is possible.
"""
return True
@staticmethod
def on_api_page_export(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
revision: int, # Number of the revision
extension: str, # Extension of the file format
name: str, # Target file name
) -> Tuple[bool, Any, Dict]:
"""Event when a single page is exported.
The first result indicates if the own implementation overrides the standard download.
The second result gives the new content to be downloaded. The value None denotes a forbidden download.
The third result configures the HTTP response to ease the download with a correct format.
An exception can be raised to cancel the download.
"""
return False, None, {}
@staticmethod
def on_api_page_move(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Source project
user: str, # Name of the user
page: str, # Source page
dst_project: str, # Destination project
dst_page: str, # Destination page
) -> bool:
"""Event when a given page is renamed and/or moved to another project.
The result indicates if both the rename and the move of the page is possible.
No other extension is called during the operation.
"""
return True
@staticmethod
def on_api_page_requested(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
action: str, # Performed action
project: str, # Name of the project
page: str, # Name of the page
revision: int, # Number of the revision
) -> None:
"""Event when a page is accessed.
An exception can be raised to guide the navigation.
"""
@staticmethod
def on_api_page_validate(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
revision: int, # Number of the revision
) -> bool:
"""Event when a given revision of a page is validated.
The result indicates if the validation of the page is possible.
"""
return True
@staticmethod
def on_api_project_env_set(
sql: sqlite3.Cursor, # Cursor to query the database
request: Optional[web.Request], # HTTP request when online
project: str, # Name of the project (empty = global scope)
user: str, # Name of the user
key: str, # Name of the option modified for the project
value: str, # New value of the option
) -> str:
"""Event when an option is about to be changed.
The non-null result gives the new value of the variable.
Setting the result to an empty string will delete the option.
"""
return value.replace("\r", "").strip()
@staticmethod
def on_api_project_info_get(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of a precise page
data: Dict[str, Dict[str, List[Dict[str, Any]]]], # Output data (changeable)
) -> None:
"""Event when the project information are queried through the API.
Modify the parameter 'data' to change the returned content.
"""
@staticmethod
def on_api_user_create(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
admin: str, # Name of the administrator
user: str, # Sanitized name of the new user account
) -> bool:
"""Event when an administrator requests the creation of a new user account (if needed) and also its assignment to the project.
The result indicates if the full operation is permitted.
This check is important because there is no native way to remove a misspelled user account.
"""
return True
@staticmethod
def on_api_user_password_change(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user whose password is modified
new_password: str, # New desired password
) -> bool:
"""Event when a user changes his password.
The result indicates if the modification of the password is allowed.
"""
return True
@staticmethod
def on_api_user_roles_set(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
admin: str, # Name of the administrator
user: str, # Name of the user whose rights are modified
role: str, # Affected role: admin, manager, editor, validator, reader, disabled, delete
state: Optional[bool], # New value of the role
) -> bool:
"""Event when an administrator deletes or modifies a role of a user account.
The result indicates if the modification of the role is allowed.
"""
return True
@staticmethod
def on_admin_split_project(
sql_src: sqlite3.Cursor, # Cursor for the source database
sql_dst: sqlite3.Cursor, # Cursor for the target database
projects: List[str], # List of the impacted projects
) -> None:
"""Event when a database is split.
You can execute additional operations for your custom tables.
"""
@staticmethod
def on_admin_stats(
sql: sqlite3.Cursor, # Cursor to query the database
tab: PrettyTable, # Result view
) -> None:
"""Event when an administrator runs the command "show-stats"."""
# tab.add_row(['Custom stat', 'demo-project', '2024-01', 123])
@staticmethod
def on_audit(
sql: sqlite3.Cursor, # Cursor to query the database
request: Optional[web.Request], # HTTP request, None if called from the console
event: Dict[str, Any], # Details of the event
) -> None:
"""Event after an auditable operation is just executed:
archive-audit change-password clear-cache create-backup create-document create-project create-revision
create-user delete-document delete-page delete-project delete-revision delete-user execute-sql
export-project fetch-url grant-admin grant-editor grant-manager grant-reader grant-validator
init-db login logout regenerate-cache rename-document repair-documents reset-password
reset-totp set-* shutdown-server split-project start-server ungrant-admin ungrant-editor
ungrant-manager ungrant-reader ungrant-validator unlock-db unset-* update-document update-revision
validate-revision
You cannot change the content of the event that is saved already.
You should not write yourself to the table 'audit'.
The database is not committed yet.
You cannot raise any exception.
"""
@staticmethod
def on_audit_skip(
sql: sqlite3.Cursor, # Cursor to query the database
request: Optional[web.Request], # HTTP request, None if called from the console
event: Dict[str, Any], # Details of the event (passed by value)
) -> bool:
"""Event to block some audit events. You have no possibility to recover the rejected events.
You can't edit the event in the parameter. The result indicates if the audit event is skipped.
"""
return False
@staticmethod
def on_cache(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
revision: int, # Revision of the page
) -> bool:
"""Event when a page is calling the cache.
The result indicates if the cache can be used, so if the page should not be regenerated.
"""
return True
@staticmethod
def on_document_get(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
filename: str, # Name of the file
mime: str, # Mime type of the file
filesize: int, # Size of the file
) -> bool:
"""Event when a document is requested.
The result indicates if the download of the document is allowed.
"""
return True
@staticmethod
def on_download_pre(
url: str, # Target URL
headers: Dict[str, str], # Changeable headers
) -> None:
"""Event when the server downloads a file on behalf of the user.
You can populate the session cookies to bypass an authentication wall for example.
"""
# headers['Cookie'] = '...'
@staticmethod
def on_html(
sql: sqlite3.Cursor, # Cursor to query the database
project: str, # Name of the project
page: Optional[str], # Name of the page
revision: int, # Revision of the page
html: str, # Current converted Markdown to HTML code
) -> str:
"""Event when a page is converted to HTML and cached, or previewed during its edition.
The result is the converted HTML code.
Warning: the conversion to HTML is used in the export to OpenDocument (odt). Changing
the HTML inappropriately may result in a technical failure of this feature.
"""
return html
@staticmethod
def on_html_description(
sql: sqlite3.Cursor, # Cursor to query the database
project: str, # Name of the project
user: Optional[str], # Name of the user
page: str, # Name of the page
revision: int, # Revision of the page
) -> str:
"""Event to determine the description of the page in the HTML field "meta description".
The impact on SEO is limited but this may be required by some search engines.
The result is the calculated description.
"""
# Read the first paragraph to provide the description of the page
sql.execute(
""" SELECT markdown
FROM pages
WHERE project = ?
AND page = ?
AND revision = ?""",
(project, page, revision),
)
lines = sql.fetchone()["markdown"][:500].split("\n")
for e in lines:
if (e[:1] not in ["", "#", "<", ">", "[", "!", "&"]) and (e[:3] != "```") and (len(e) > 64):
return PwicLib.no_md(e).replace(" ", " ").replace(" .", ".").strip()[:150]
return ""
@staticmethod
def on_html_keywords(
sql: sqlite3.Cursor, # Cursor to query the database
project: str, # Name of the project
user: Optional[str], # Name of the user
page: str, # Name of the page
revision: int, # Revision of the page
) -> str:
"""Event to determine the keywords of the page in the HTML field "meta keywords".
The impact on SEO is limited but this may be required by some search engines.
The result is the calculated keywords.
"""
# Read the existing tags
sql.execute(
""" SELECT tags --, markdown
FROM pages
WHERE project = ?
AND page = ?
AND revision = ?""",
(project, page, revision),
)
row = sql.fetchone()
if row["tags"] != "":
return row["tags"].replace(" ", ", ")
# Determine the most occurring words from the Mardown
# words = PwicLib.no_html(PwicLib.no_md(row['markdown'])).lower()
# for w in ['\n', '.', ',', ':', "'", '']:
# words = words.replace(w, ' ')
# words = [w for w in words.split(' ') if (len(w) > 6) and ('/' not in w)]
# words = [(w, words.count(w)) for w in set(words)]
# words = [w for w in words if w[1] > 1]
# if len(words) > 0:
# words.sort(key=lambda w: w[1], reverse=True)
# words = [w[0] for w in words[:10]]
# return ', '.join(words)
# Default result
return ""
@staticmethod
def on_html_robots(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
template: str, # Name of the template
data: Dict[str, Any], # Data elements of the page
robots: Dict[str, Optional[bool]], # Status of the robots (assign None to remove the value)
) -> bool:
"""Event to calculate the meta HTML header 'robots' when a page is rendered.
The result indicates if the parameter 'robots' (that contains the result) has been changed.
"""
# Offline mode for the special pages
offline = template in ["login", "logout", "page-404", "page-history", "page-special", "search", "user"]
if (template == "page") and not data["latest"]:
seo_hide_revs = PwicLib.option(sql, project, "seo_hide_revs") is not None
validated_only = PwicLib.option(sql, project, "validated_only") is not None
if seo_hide_revs and not validated_only:
offline = True
if offline:
robots["archive"] = False
robots["cache"] = False
if template in ["page-history"]:
robots["follow"] = False
robots["imageindex"] = False
robots["index"] = False
robots["snippet"] = False
return True
@staticmethod
def on_http_headers(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
headers: MultiDict, # Output HTTP headers
project: str, # Name of the project
template: Optional[str], # Layout of the page. None denotes a file download
) -> None:
"""Event when a page or a document is delivered, excluding the API and the static files.
To change the HTTP headers, modify the parameter 'headers' without reallocating it.
"""
if template == "login":
headers["X-Frame-Options"] = "deny"
@staticmethod
def on_ip_check(
ip: str, # Remote IP address
authorized: bool, # Current status of the authorization
) -> bool:
"""Event when the IP address of the user is checked.
The result indicates if the IP address is authorized.
"""
return authorized
@staticmethod
def on_ip_header(
request: Optional[web.Request], # HTTP request
) -> str:
"""Event when the remote IP address must be retrieved from the HTTP headers.
With internal proxies, you should not rely on the remote address of the TCP connection only.
The single result is the IP fetched according to your logic.
"""
if request is None:
return ""
# return str(request.headers.get('X-Forwarded-For', request.remote)) # Enable this line if you use a reverse proxy
return str(request.remote)
@staticmethod
def on_language_detected(
request: web.Request, # HTTP request
language: str, # Current language
available_langs: List[str], # All the available languages
sso: bool, # True from the federated authentication
) -> str:
"""Event when a default language is suggested.
The result gives the new default language that must belong to the authorized languages.
"""
return language
@staticmethod
def on_login(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
language: str, # Selected language
ip: str, # IP address
) -> bool:
"""Event when a user successfully connects with a password and 2FA TOTP.
The result indicates if the connection is possible.
Note: the custom check for OAuth is covered by "PwicExtension.on_oauth".
"""
return True
@staticmethod
def on_markdown_pre(
sql: sqlite3.Cursor, # Cursor to query the database
project: str, # Name of the project
page: Optional[str], # Name of the page
revision: int, # Revision of the page
markdown: str, # Current Markdown
) -> str:
"""Event when a Markdown text is selected prior to conversion.
The result is the new Markdown text to be processed.
The control hash key is not affected.
"""
return markdown
@staticmethod
def on_oauth(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
emails: List[str], # Array of candidate email addresses (changeable)
) -> None:
"""Event when email addresses are fetched from the remote OAuth server.
Modify the parameter 'emails' without reallocating it.
"""
@staticmethod
def on_odata_xml_definition(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
filename: str, # Name of the static XML configuration file
content: str, # Content of the file
):
"""Event to change the XML definition of the OData service.
The result is the content of the new file.
"""
return content
@staticmethod
def on_odata_content_pre(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
) -> bool:
"""Event when a user calls a content through the OData interface.
The result indicates if the operation is allowed.
"""
return True
@staticmethod
def on_odata_custom_content(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
table: str, # Name of the custom table
) -> bool:
"""Event to process the data selection of one custom table.
The result indicates if some data were retrieved within the SQL cursor.
"""
return False
@staticmethod
def on_odata_content(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
data: Dict[str, Any], # Content to be delivered
) -> None:
"""Event when an OData object is returned to the connected user.
Changing the structure of the OData object in parameter is not allowed by the OData design.
"""
@staticmethod
def on_project_export_documents(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
documents: List[Dict[str, Any]], # List of the documents to be exported (changeable)
) -> None:
"""Event when a list of documents is to be exported as an archive for a given project.
Modify the parameter 'documents' without reallocating it.
"""
@staticmethod
def on_related_pages(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
page: str, # Name of the page
relations: List[Tuple[str, str]], # Related pages
) -> None:
"""Event to determine the related pages of a page.
Modify the parameter 'relations' without reallocating it.
A related link is a tuple made of the URL and its description.
The URL should respect the formats "/project/page" or "http://your-site.tld/project/page".
"""
@staticmethod
def on_render_post(
app: web.Application, # Access to the application (do not change)
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
pwic: Dict[str, Any], # Rendered content (not changeable)
html: str, # Current output to HTML
) -> str:
"""Event after a page is rendered to HTML.
The result returns the new output.
Beware to be as efficient as possible in your custom logic.
Raise an exception web.HTTP* to cancel the rendering.
"""
return html
@staticmethod
def on_render_pre(
app: web.Application, # Access to the application (do not change)
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
pwic: Dict[str, Any], # Content to be rendered (changeable)
) -> None:
"""Event when a page is about to be rendered.
The variable 'pwic' contains all the calculated data and you can interact with it.
Raise an exception web.HTTP* to cancel the rendering.
"""
@staticmethod
def on_search_documents(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
pwic: Dict[str, Any], # Work area
query: Dict[str, List[str]], # Search terms
) -> bool:
"""Event to delegate the search of the documents.
Populate pwic['documents'] to return the found documents.
The result indicates if you implemented a custom logic.
"""
return False
@staticmethod
def on_search_pages(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
user: str, # Name of the user
pwic: Dict[str, Any], # Work area
query: Dict[str, List[str]], # Search terms
) -> bool:
"""Event to delegate the search of the pages.
Populate pwic['pages'] to return the found pages, without reallocating it.
The result indicates if you implemented a custom logic.
"""
return False
@staticmethod
def on_search_terms(
sql: sqlite3.Cursor, # Cursor to query the database
request: web.Request, # HTTP request
project: str, # Name of the project
user: str, # Name of the user
query: Optional[Dict[str, List[str]]], # Not-null parsed search terms (changeable)
with_rev: bool, # Search in the old revisions too?
) -> None:
"""Event when a search is launched by a user.
The variable 'query' is the changeable result.
"""
@staticmethod
def on_server_ready(
app: web.Application, # Full access to the application (changeable)
sql: sqlite3.Cursor, # Cursor to query the database
) -> bool:
"""Event when the server is ready to start.
The result indicates if the server can start.
"""
return True
@staticmethod
def on_timezone() -> Optional[tzinfo]:
"""Event when the current date is determined.
The result is the timezone to be used for the determination.
The local date is used by default.
"""
# from pytz import utc # UTC+0
# return utc
return None # Local time
# ===============
# Custom routes
# ===============
@staticmethod
def load_custom_routes(
server, # PwicServer
) -> List[web.RouteDef]:
# return [web.static('/.well-known/acme-challenge/', '/path/to/acme/challenge/'),
# web.get('/special/sample', PwicExtension.on_page_special_sample),
# web.get('/virtual-file.txt', PwicExtension.on_page_virtual_file)]
return []
# @staticmethod
# async def on_page_special_sample(request: web.Request) -> web.Response:
# return web.Response(text='Hello world!', content_type=PwicLib.mime('html'))
# @staticmethod
# async def on_page_virtual_file(request: web.Request) -> web.Response:
# return web.FileResponse('./static/virtual-file.txt') # sof/34121814

View File

@ -1,503 +0,0 @@
# Pwic.wiki server running on Python and SQLite
# Copyright (C) 2020-2025 Alexandre Bréard
#
# https://pwic.wiki
# https://github.com/gitbra/pwic
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import re
import sqlite3
from html import unescape
from html.parser import HTMLParser
from os.path import join
from typing import Dict, List, Optional, Tuple
from zipfile import BadZipFile, ZipFile
from .pwic_exporter import PwicCleanerHtml
from .pwic_extension import PwicExtension
from .pwic_lib import PwicBuffer, PwicConst, PwicHTMLParserTL, PwicLib
# =========
# file2md
# =========
class PwicImporter:
"""Import external documents into Pwic.wiki"""
def convert(self, sql: Optional[sqlite3.Cursor], user: str, identifier: int) -> Optional[str]:
# Read the document
if (sql is None) or (identifier == 0):
return None
sql.execute(
""" SELECT project, page, filename
FROM documents
WHERE id = ?
AND exturl = '' """,
(identifier,),
)
row = sql.fetchone()
if row is None:
return None
# Convert the document
options = {"base_url": str(PwicLib.option(sql, "", "base_url", ""))}
filename = join(PwicConst.DOCUMENTS_PATH % row["project"], row["filename"])
extension = PwicLib.file_ext(row["filename"])
try:
result = ""
for cls in handlers:
if extension in cls.get_extensions():
result = cls().get_md(filename, options)
if result != "":
break
except Exception:
return None
return PwicExtension.on_api_document_convert(sql, row["project"], user, row["page"], identifier, None, result)
@staticmethod
def get_allowed_extensions() -> List[str]:
return sum([cls.get_extensions() for cls in handlers], []) # sof/952914
# =======
# md2md
# =======
class PwicImporterMd:
@staticmethod
def get_extensions() -> List[str]:
return ["md", "txt"]
def get_md(self, filename: str, options: Dict[str, str]) -> str:
# Read the local file
try:
content = b""
with open(filename, "rb") as f:
content = f.read()
md = content.decode().replace("\r", "")
return PwicLib.recursive_replace(md, "\n\n\n", "\n\n").strip()
except Exception:
return ""
# =========
# html2md
# =========
class PwicImporterHtml(PwicHTMLParserTL):
def __init__(self):
self.md = PwicBuffer()
super().__init__()
self.map_open = {
"a": "[",
"b": "**",
"blockcode": "\n\n> ",
"br": "\n",
"code": "`",
"del": "~~",
"div": "\n",
"em": "*",
"h1": "\n\n# ",
"h2": "\n\n## ",
"h3": "\n\n### ",
"h4": "\n\n#### ",
"h5": "\n\n##### ",
"h6": "\n\n###### ",
"hr": "\n\n---\n\n",
"i": "*",
"img": "![IMAGE",
"input": "[",
"ins": "--",
"li": "\n- ",
"ol": "\n",
"p": "\n\n",
"pre": "```",
"s": "~~",
"strike": "~~",
"strong": "**",
"sub": "_",
"sup": "^",
"tr": "\n| ",
"u": "--",
"ul": "\n",
}
self.map_close = {
"a": "](#href)",
"b": "**",
"code": "`",
"del": "~~",
"em": "*",
"h1": "\n",
"h2": "\n",
"h3": "\n",
"h4": "\n",
"h5": "\n",
"h6": "\n",
"i": "*",
"ins": "--",
"ol": "\n",
"pre": "```",
"s": "~~",
"strike": "~~",
"strong": "**",
"sub": "_",
"sup": "^",
"td": " |",
"th": " |",
"u": "--",
"ul": "\n",
}
def reset(self) -> None:
super().reset()
self.md.reset()
self.pre = False
self.last_tag = ""
self.last_href = ""
self.last_colspan = 1
self.table_col_max = 0
self.table_col_cur = 0
self.table_lin_cur = 0
def feed(self, data: str):
cleaner = PwicCleanerHtml("aside header nav", False)
cleaner.feed(data.replace("\r", ""))
super().feed(cleaner.get_html())
def on_timeout(self) -> None:
self.md.reset()
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None:
self.check_timeout()
tagattr = {}
if not self.pre:
if tag == "pre":
self.pre = True
elif tag == "a":
self.last_href = PwicLib.read_attr(attrs, "href")
elif tag == "img":
tagattr["src"] = PwicLib.read_attr(attrs, "src", PwicLib.read_attr(attrs, "data-src"))
elif (tag == "li") and (self.last_tag not in ["ol", "ul"]):
self.md.rstrip()
elif tag == "table":
self.table_col_max = 0
self.table_col_cur = 0
self.table_lin_cur = 0
elif tag == "tr":
self.md.rstrip()
if self.last_tag == "table":
self.md.push("\n")
self.table_col_cur = 0
self.table_lin_cur += 1
if self.table_lin_cur == 2:
self.md.push("\n|" + ("---|" * self.table_col_max))
elif tag in ["th", "td"]:
self.md.rstrip()
self.md.push(" ")
self.last_colspan = max(1, PwicLib.intval(PwicLib.read_attr(attrs, "colspan", "1")))
self.table_col_cur += self.last_colspan
self.table_col_max = max(self.table_col_max, self.table_col_cur)
if tag in self.map_open:
self.md.push(self.map_open[tag])
# Void tags
if tag == "img":
self.md.push("](%s)" % tagattr.get("src", tagattr.get("data-src", "")))
elif tag == "input":
typ = PwicLib.read_attr(attrs, "type")
if typ == "checkbox":
self.md.push("X" if PwicLib.read_attr_key(attrs, "checked") else " ")
else:
self.md.push(typ)
self.md.push("]")
self.last_tag = tag
def handle_endtag(self, tag: str) -> None:
if tag in PwicConst.VOID_HTML:
return
if self.pre and (tag == "pre"):
self.pre = False
if tag in self.map_close:
value = self.map_close[tag]
if not self.pre:
if tag == "a":
value = value.replace("#href", self.last_href)
self.last_href = ""
if (tag in ["td", "th"]) and (self.last_tag == "tr"):
self.md.rstrip()
self.md.push(" ")
self.md.push(value)
if (tag in ["td", "th"]) and (self.last_colspan > 1):
self.md.push(value * (self.last_colspan - 1))
def handle_data(self, data: str) -> None:
if not self.pre:
data = PwicLib.recursive_replace(
data.replace("\t", " "), " ", " ", strip=(self.last_tag == "a") and (self.md.lastchar() == "[")
)
self.md.push(data)
@staticmethod
def get_extensions() -> List[str]:
return ["htm", "html"]
def get_md(self, filename: str, options: Dict[str, str]) -> str:
# Read the HTML content
try:
content = b""
with open(filename, "rb") as f:
content = f.read()
return self.get_md_memory(content.decode())
except Exception:
return ""
def get_md_memory(self, html: str) -> str:
# Extract the main content
for tag in ["body", "article"]:
p1 = html.find(f"<{tag}")
p2 = html.rfind(f"</{tag}>")
if (-1 not in [p1, p2]) and (p1 < p2):
p1 = html.find(">", p1)
html = html[p1 + 1 : p2].replace("\r", "").strip()
# Convert
self.feed(html)
lines = [e.rstrip() for e in self.md.pop().split("\n")]
return PwicLib.recursive_replace("\n".join(lines), "\n\n\n", "\n\n").strip()
# ========
# odt2md
# ========
class PwicStylerOdt(HTMLParser):
def reset(self) -> None:
super().reset()
self.styles: Dict[str, Dict[str, bool]] = {}
self.reset_marks()
def reset_marks(self) -> None:
self.name = ""
self.bold = False
self.italic = False
self.underline = False
self.strike = False
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None:
tag = tag.strip().lower()
# Block
if tag == "style:style":
self.reset_marks()
if PwicLib.read_attr(attrs, "style:family") == "text":
self.name = PwicLib.read_attr(attrs, "style:name")
else:
self.name = ""
# Attributes
elif tag == "style:text-properties":
value = PwicLib.read_attr(attrs, "fo:font-weight")
if value != "":
self.bold = value != "normal"
value = PwicLib.read_attr(attrs, "fo:font-style")
if value != "":
self.italic = value in ["italic", "oblique"]
value = PwicLib.read_attr(attrs, "style:text-underline-type")
if value != "":
self.underline = value != "none"
value = PwicLib.read_attr(attrs, "style:text-line-through-style")
if value != "":
self.strike = value != "none"
def handle_endtag(self, tag: str) -> None:
tag = tag.strip().lower()
if (tag == "style:style") and (self.name != "") and (self.name[:5] != "Code_"):
if self.bold or self.italic or self.underline or self.strike:
self.styles[self.name] = {
"bold": self.bold,
"italic": self.italic,
"underline": self.underline,
"strike": self.strike,
}
def get_decorator(self, name: str) -> str:
deco = ""
if name in self.styles:
if self.styles[name]["bold"]:
deco += "**"
if self.styles[name]["italic"]:
deco += "*"
if self.styles[name]["underline"]:
deco += "--"
if self.styles[name]["strike"]:
deco += "~~"
return deco
class PwicImporterOdt(PwicHTMLParserTL):
def __init__(self):
self.md = PwicBuffer()
super().__init__()
def reset(self) -> None:
super().reset()
# Content
self.content = ""
self.styler = PwicStylerOdt()
# Parser
self.md.reset()
self.link = ""
self.listlevel = 0
self.table = False
self.table_rows = 0
self.table_cols = 0
self.spanstack: List[str] = []
self.mute = ""
def on_timeout(self) -> None:
self.md.reset()
def load_odt(self, filename: str) -> bool:
# Read the contents
content = ""
styles = ""
try:
with ZipFile(filename) as odt:
with odt.open("content.xml") as f: # Mandatory
content = f.read().decode()
with odt.open("styles.xml") as f: # Optional
styles = f.read().decode()
except (BadZipFile, FileNotFoundError, KeyError):
pass
if content == "":
return False
# Extract the main block
p1 = content.find("<office:body>") # Has no attribute
p2 = content.rfind("</office:body>")
if (-1 in [p1, p2]) or (p1 > p2):
return False
self.content = content[p1 + 13 : p2].replace("\r", "").strip()
# Read the styles
self.styler.reset()
# ... from content
p1 = content.find("<office:automatic-styles>")
p2 = content.find("</office:automatic-styles>", p1)
if (-1 not in [p1, p2]) and (p1 < p2):
self.styler.feed(content[p1 + 25 : p2])
# ... from styles
self.styler.feed(styles)
return True
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None:
self.check_timeout()
# Mute
if self.mute != "":
return
tag = tag.strip().lower()
# Element
if tag == "text:span":
deco = self.styler.get_decorator(PwicLib.read_attr(attrs, "text:style-name"))
if self.link != "":
deco = deco.replace("--", "")
self.md.push(deco)
self.spanstack.append(deco[::-1])
elif tag == "text:a":
self.md.push("[")
self.link = PwicLib.read_attr(attrs, "xlink:href")
if (self.link[: len(self.base_url)] == self.base_url) and (len(self.link) > len(self.base_url)):
self.link = self.link[len(self.base_url) :]
elif tag == "draw:frame":
self.md.push("[IMAGE]")
self.mute = tag # Assumed to be not imbricated
# Block
elif tag == "text:p":
if (self.listlevel == 0) and not self.table:
self.md.push("\n\n")
elif tag == "text:h":
self.md.push("\n\n%s " % ("#" * PwicLib.intval(PwicLib.read_attr(attrs, "text:outline-level"))))
# List
elif tag == "text:list":
self.listlevel += 1
if self.listlevel == 1:
self.md.push("\n\n")
elif tag == "text:list-item":
self.md.push("\n%s- " % (" " * (self.listlevel - 1)))
# Table
elif tag == "table:table":
self.table = True
self.table_rows = 0
self.table_cols = 0
self.md.push("\n")
elif tag == "table:table-row":
self.table_rows += 1
if self.table_rows == 2:
self.md.push("\n|%s" % ("---|" * self.table_cols))
self.md.push("\n| ")
elif tag == "table:table-cell":
self.table_cols += 1
def handle_endtag(self, tag: str) -> None:
tag = tag.strip().lower()
if tag == self.mute:
self.mute = ""
if tag == "text:s":
self.md.push(" ")
elif tag == "text:tab":
self.md.push("\t")
elif tag == "text:line-break":
self.md.push("\n")
elif tag == "text:span":
try:
self.md.push(self.spanstack.pop())
except IndexError:
pass
elif tag == "text:a":
self.md.push(f"]({self.link})")
self.link = ""
elif tag == "text:list":
self.listlevel = max(0, self.listlevel - 1)
elif tag == "table:table":
self.table = False
elif tag == "table:table-cell":
self.md.push(" | ")
def handle_data(self, data: str) -> None:
if self.mute != "":
data = ""
elif (self.listlevel > 0) or self.table:
data = data.replace("\n", " ")
data = re.sub(r"^[\s\t]+", " ", data) # Soft strip for start
data = re.sub(r"[\s\t]+$", " ", data) # Soft strip for end
self.md.push(unescape(data))
@staticmethod
def get_extensions() -> List[str]:
return ["odt"]
def get_md(self, filename, options: Dict[str, str]) -> str:
self.base_url = options.get("base_url", "")
if not self.load_odt(filename):
return ""
self.feed(self.content)
lines = [e.rstrip() for e in self.md.pop().split("\n")]
return PwicLib.recursive_replace("\n".join(lines), "\n\n\n", "\n\n").strip()
handlers = [PwicImporterMd, PwicImporterHtml, PwicImporterOdt]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
aiohttp>=3.8
aiohttp-cors
aiohttp-session>=2.10
imagesize
jinja2
PrettyTable>=1.0
pygments
pyotp
cryptography
setuptools

View File

@ -1,62 +0,0 @@
# This demo program queries the API to fetch the work in progress left in the content of the pages.
# Programmers generally leave lines starting with "TODO" or "BUG", and followed by a comment.
# This technique highlights the remaining things to do before the documentation is complete.
# This script summarizes these actions in a table. Note that it is written to not handle the errors.
import json
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from prettytable import PrettyTable
# Changeable configuration
host = "http://127.0.0.1:8080"
user = "your@user.name"
password = "your.password"
project = "your_project"
# Authentication
headers = {"Origin": host}
response = urlopen(
Request(
host + "/api/login", urlencode({"user": user, "password": password}).encode(), headers=headers, method="POST"
)
)
headers["Cookie"] = response.headers.get("Set-Cookie", "")
# Get some information
tab = PrettyTable()
response = urlopen(
Request(host + "/api/project/get", urlencode({"project": project}).encode(), headers=headers, method="POST")
)
if response.status == 200:
data = response.read().decode("utf-8")
jsonData = json.loads(data)
for key in jsonData:
entry = jsonData[key]["revisions"][0]
if "markdown" not in entry:
print('Error: the option "api_expose_markdown" must be enabled for the project.')
break
# Parse the page
lines = entry["markdown"].split("\n")
for line in lines:
line = line.strip()
if line[:4] == "BUG ":
p = 4
elif line[:5] == "TODO ":
p = 5
else:
continue
tab.add_row([project, key, line[: p - 1], line[p:]])
# Display the results
if tab.rowcount == 0:
print("There is no work in progress.")
else:
tab.field_names = ["Project", "Page", "Type", "Action"]
for f in tab.field_names:
tab.align[f] = "l"
tab.header = True
tab.border = True
print(tab.get_string())

View File

@ -1,45 +0,0 @@
import json
from urllib.error import HTTPError, URLError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
# Changeable configuration
host = "http://127.0.0.1:8080"
user = "your@user.name"
password = "your.password"
project = "your_project"
# Authentication
headers = {"Origin": host}
try:
response = urlopen(
Request(
host + "/api/login",
urlencode({"user": user, "password": password}).encode(),
headers=headers,
method="POST",
)
)
except (URLError, HTTPError) as e:
if isinstance(e, HTTPError):
print("Error: %d %s" % (e.getcode(), e.reason))
else:
print(e.reason)
exit(1)
headers["Cookie"] = response.headers.get("Set-Cookie", "")
# Retrieve the data
try:
response = urlopen(
Request(host + "/api/project/get", urlencode({"project": project}).encode(), headers=headers, method="POST")
)
except HTTPError as e:
print("Error: %d %s" % (e.getcode(), e.reason))
exit(1)
# Read the output
print("Do what you want with the result in JSON format:")
data = response.read().decode("utf-8")
jsonData = json.loads(data)
for key in jsonData:
print("> %s: %s..." % (key, str(jsonData[key])[:96]))

View File

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema Namespace="wiki.pwic.odata.model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityType Name="Env">
<Key>
<PropertyRef Name="project"/>
<PropertyRef Name="key"/>
</Key>
<Property Name="project" Type="Edm.String" Nullable="false"/>
<Property Name="key" Type="Edm.String" Nullable="false"/>
<Property Name="value" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="env2project" Type="wiki.pwic.odata.model.Project">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Document">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int32" Nullable="false"/>
<Property Name="project" Type="Edm.String" Nullable="false"/>
<Property Name="page" Type="Edm.String" Nullable="false"/>
<Property Name="filename" Type="Edm.String" Nullable="false"/>
<Property Name="mime" Type="Edm.String" Nullable="false"/>
<Property Name="size" Type="Edm.Int32" Nullable="false"/>
<Property Name="width" Type="Edm.Int32" Nullable="false"/>
<Property Name="height" Type="Edm.Int32" Nullable="false"/>
<Property Name="hash" Type="Edm.String" Nullable="false"/>
<Property Name="author" Type="Edm.String" Nullable="false"/>
<Property Name="date" Type="Edm.Date" Nullable="false"/>
<Property Name="time" Type="Edm.TimeOfDay" Nullable="false"/>
<Property Name="exturl" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="document2page" Type="Collection(wiki.pwic.odata.model.Page)">
<!-- The relation is 1-n in the OData (latest=X), but N-N in the database -->
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
<ReferentialConstraint Property="page" ReferencedProperty="page"/>
</NavigationProperty>
<NavigationProperty Name="document2project" Type="wiki.pwic.odata.model.Project">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="document2user" Type="wiki.pwic.odata.model.User">
<ReferentialConstraint Property="author" ReferencedProperty="user"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Page">
<Key>
<PropertyRef Name="project"/>
<PropertyRef Name="page"/>
<PropertyRef Name="revision"/>
</Key>
<Property Name="project" Type="Edm.String" Nullable="false"/>
<Property Name="page" Type="Edm.String" Nullable="false"/>
<Property Name="revision" Type="Edm.Int32" Nullable="false"/>
<Property Name="draft" Type="Edm.Boolean" Nullable="false"/>
<Property Name="final" Type="Edm.Boolean" Nullable="false"/>
<Property Name="header" Type="Edm.Boolean" Nullable="false"/>
<Property Name="protection" Type="Edm.Boolean" Nullable="false"/>
<Property Name="author" Type="Edm.String" Nullable="false"/>
<Property Name="date" Type="Edm.Date" Nullable="false"/>
<Property Name="time" Type="Edm.TimeOfDay" Nullable="false"/>
<Property Name="title" Type="Edm.String" Nullable="false"/>
<Property Name="tags" Type="Edm.String" Nullable="false"/>
<Property Name="comment" Type="Edm.String" Nullable="false"/>
<Property Name="milestone" Type="Edm.String" Nullable="false"/>
<Property Name="valuser" Type="Edm.String" Nullable="false"/>
<Property Name="valdate" Type="Edm.Date" Nullable="false"/>
<Property Name="valtime" Type="Edm.TimeOfDay" Nullable="false"/>
<NavigationProperty Name="page2document" Type="Collection(wiki.pwic.odata.model.Document)">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
<ReferentialConstraint Property="page" ReferencedProperty="page"/>
</NavigationProperty>
<NavigationProperty Name="page2project" Type="wiki.pwic.odata.model.Project">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="page2user1" Type="wiki.pwic.odata.model.User">
<ReferentialConstraint Property="author" ReferencedProperty="user"/>
</NavigationProperty>
<NavigationProperty Name="page2user2" Type="wiki.pwic.odata.model.User">
<ReferentialConstraint Property="valuser" ReferencedProperty="user"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Project">
<Key>
<PropertyRef Name="project"/>
</Key>
<Property Name="project" Type="Edm.String" Nullable="false"/>
<Property Name="description" Type="Edm.String" Nullable="false"/>
<Property Name="date" Type="Edm.Date" Nullable="false"/>
<NavigationProperty Name="project2document" Type="Collection(wiki.pwic.odata.model.Document)">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="project2env" Type="Collection(wiki.pwic.odata.model.Env)">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="project2page" Type="Collection(wiki.pwic.odata.model.Page)">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="project2role" Type="Collection(wiki.pwic.odata.model.Role)">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
</EntityType>
<EntityType Name="User">
<Key>
<PropertyRef Name="user"/>
</Key>
<Property Name="user" Type="Edm.String" Nullable="false"/>
<Property Name="oauth" Type="Edm.Boolean" Nullable="false"/>
<Property Name="initial" Type="Edm.Boolean" Nullable="false"/>
<Property Name="totp" Type="Edm.Boolean" Nullable="false"/>
<Property Name="password_date" Type="Edm.Date" Nullable="false"/>
<Property Name="password_time" Type="Edm.TimeOfDay" Nullable="false"/>
<NavigationProperty Name="user2document" Type="Collection(wiki.pwic.odata.model.Document)">
<ReferentialConstraint Property="user" ReferencedProperty="author"/>
</NavigationProperty>
<NavigationProperty Name="user2page1" Type="Collection(wiki.pwic.odata.model.Page)">
<ReferentialConstraint Property="user" ReferencedProperty="author"/>
</NavigationProperty>
<NavigationProperty Name="user2page2" Type="Collection(wiki.pwic.odata.model.Page)">
<ReferentialConstraint Property="user" ReferencedProperty="valuser"/>
</NavigationProperty>
<NavigationProperty Name="user2role" Type="Collection(wiki.pwic.odata.model.Role)">
<ReferentialConstraint Property="user" ReferencedProperty="user"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Role">
<Key>
<PropertyRef Name="project"/>
<PropertyRef Name="user"/>
</Key>
<Property Name="project" Type="Edm.String" Nullable="false"/>
<Property Name="user" Type="Edm.String" Nullable="false"/>
<Property Name="admin" Type="Edm.Boolean" Nullable="false"/>
<Property Name="manager" Type="Edm.Boolean" Nullable="false"/>
<Property Name="editor" Type="Edm.Boolean" Nullable="false"/>
<Property Name="validator" Type="Edm.Boolean" Nullable="false"/>
<Property Name="reader" Type="Edm.Boolean" Nullable="false"/>
<NavigationProperty Name="role2project" Type="wiki.pwic.odata.model.Project">
<ReferentialConstraint Property="project" ReferencedProperty="project"/>
</NavigationProperty>
<NavigationProperty Name="role2user" Type="wiki.pwic.odata.model.User">
<ReferentialConstraint Property="user" ReferencedProperty="user"/>
</NavigationProperty>
</EntityType>
<!-- More EntityType ? -->
<EntityContainer Name="Container">
<EntitySet Name="documents" EntityType="wiki.pwic.odata.model.Document">
<NavigationPropertyBinding Path="document2page" Target="pages"/>
<NavigationPropertyBinding Path="document2project" Target="projects"/>
<NavigationPropertyBinding Path="document2user" Target="users"/>
</EntitySet>
<EntitySet Name="env" EntityType="wiki.pwic.odata.model.Env">
<NavigationPropertyBinding Path="env2project" Target="projects"/>
</EntitySet>
<EntitySet Name="pages" EntityType="wiki.pwic.odata.model.Page">
<NavigationPropertyBinding Path="page2document" Target="documents"/>
<NavigationPropertyBinding Path="page2project" Target="projects"/>
<NavigationPropertyBinding Path="page2user1" Target="users"/>
<NavigationPropertyBinding Path="page2user2" Target="users"/>
</EntitySet>
<EntitySet Name="projects" EntityType="wiki.pwic.odata.model.Project">
<NavigationPropertyBinding Path="project2document" Target="documents"/>
<NavigationPropertyBinding Path="project2env" Target="env"/>
<NavigationPropertyBinding Path="project2page" Target="pages"/>
<NavigationPropertyBinding Path="project2role" Target="roles"/>
</EntitySet>
<EntitySet Name="roles" EntityType="wiki.pwic.odata.model.Role">
<NavigationPropertyBinding Path="role2project" Target="projects"/>
<NavigationPropertyBinding Path="role2user" Target="users"/>
</EntitySet>
<EntitySet Name="users" EntityType="wiki.pwic.odata.model.User">
<NavigationPropertyBinding Path="user2document" Target="documents"/>
<NavigationPropertyBinding Path="user2page1" Target="pages"/>
<NavigationPropertyBinding Path="user2page2" Target="pages"/>
<NavigationPropertyBinding Path="user2role" Target="roles"/>
</EntitySet>
<!-- More EntitySet ? -->
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<service xml:base="{base_url}/api/odata" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" m:context="{base_url}/api/odata/$metadata">
<workspace>
<atom:title type="text">OData integration for Pwic.wiki</atom:title>
<collection href="env">
<atom:title type="text">env</atom:title>
</collection>
<collection href="projects">
<atom:title type="text">projects</atom:title>
</collection>
<collection href="pages">
<atom:title type="text">pages</atom:title>
</collection>
<collection href="documents">
<atom:title type="text">documents</atom:title>
</collection>
<collection href="users">
<atom:title type="text">users</atom:title>
</collection>
<collection href="roles">
<atom:title type="text">roles</atom:title>
</collection>
<!-- More collection ? -->
</workspace>
</service>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
/* MIT https://github.com/fabiospampinato/cash */
(function(){
'use strict';var e={"class":"className",contenteditable:"contentEditable","for":"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function aa(a,b){try{return a(b)}catch(c){return b}}
var k=document,m=window,ba=k.documentElement,n=k.createElement.bind(k),ca=n("div"),p=n("table"),da=n("tbody"),ea=n("tr"),q=Array.isArray,r=Array.prototype,fa=r.concat,t=r.filter,ha=r.indexOf,ia=r.map,ja=r.push,ka=r.slice,u=r.some,la=r.splice,ma=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,na=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,oa=/<.+>/,pa=/^\w+$/;function v(a,b){return a&&(w(b)||x(b))?na.test(a)?b.getElementsByClassName(a.slice(1)):pa.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a):[]}
var B=function(){function a(a,c){if(a){if(a instanceof B)return a;var b=a;if(C(a)){if(b=(c instanceof B?c[0]:c)||k,b=ma.test(a)?b.getElementById(a.slice(1)):oa.test(a)?qa(a):v(a,b),!b)return}else if(D(a))return this.ready(a);if(b.nodeType||b===m)b=[b];this.length=b.length;a=0;for(c=this.length;a<c;a++)this[a]=b[a]}}a.prototype.init=function(b,c){return new a(b,c)};return a}(),E=B.prototype,F=E.init;F.fn=F.prototype=E;E.length=0;E.splice=la;"function"===typeof Symbol&&(E[Symbol.iterator]=r[Symbol.iterator]);
E.map=function(a){return F(fa.apply([],ia.call(this,function(b,c){return a.call(b,c,b)})))};E.slice=function(a,b){return F(ka.call(this,a,b))};var ra=/-([a-z])/g;function G(a){return a.replace(ra,function(a,c){return c.toUpperCase()})}F.guid=1;function sa(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.msMatchesSelector);return!!c&&!!b&&c.call(a,b)}function H(a){return!!a&&a===a.window}function w(a){return!!a&&9===a.nodeType}function x(a){return!!a&&1===a.nodeType}
function D(a){return"function"===typeof a}function C(a){return"string"===typeof a}function ta(a){return!isNaN(parseFloat(a))&&isFinite(a)}function I(a){if("object"!==typeof a||null===a)return!1;a=Object.getPrototypeOf(a);return null===a||a===Object.prototype}F.isWindow=H;F.isFunction=D;F.isArray=q;F.isNumeric=ta;F.isPlainObject=I;E.get=function(a){if(void 0===a)return ka.call(this);a=Number(a);return this[0>a?a+this.length:a]};E.eq=function(a){return F(this.get(a))};E.first=function(){return this.eq(0)};
E.last=function(){return this.eq(-1)};function J(a,b,c){if(c)for(c=a.length;c--&&!1!==b.call(a[c],c,a[c]););else if(I(a)){var d=Object.keys(a);c=0;for(var h=d.length;c<h;c++){var f=d[c];if(!1===b.call(a[f],f,a[f]))break}}else for(c=0,h=a.length;c<h&&!1!==b.call(a[c],c,a[c]);c++);return a}F.each=J;E.each=function(a){return J(this,a)};E.prop=function(a,b){if(a){if(C(a))return a=e[a]||a,2>arguments.length?this[0]&&this[0][a]:this.each(function(c,h){h[a]=b});for(var c in a)this.prop(c,a[c]);return this}};
E.removeProp=function(a){return this.each(function(b,c){delete c[e[a]||a]})};function K(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];b="boolean"===typeof a[0]?a.shift():!1;var c=a.shift(),d=a.length;if(!c)return{};if(!d)return K(b,F,c);for(var h=0;h<d;h++){var f=a[h],g;for(g in f)b&&(q(f[g])||I(f[g]))?(c[g]&&c[g].constructor===f[g].constructor||(c[g]=new f[g].constructor),K(b,c[g],f[g])):c[g]=f[g]}return c}F.extend=K;E.extend=function(a){return K(E,a)};
function L(a){return C(a)?function(b,c){return sa(c,a)}:D(a)?a:a instanceof B?function(b,c){return a.is(c)}:a?function(b,c){return c===a}:function(){return!1}}E.filter=function(a){var b=L(a);return F(t.call(this,function(a,d){return b.call(a,d,a)}))};function M(a,b){return b?a.filter(b):a}var ua=/\S+/g;function N(a){return C(a)?a.match(ua)||[]:[]}E.hasClass=function(a){return!!a&&u.call(this,function(b){return x(b)&&b.classList.contains(a)})};
E.removeAttr=function(a){var b=N(a);return this.each(function(a,d){x(d)&&J(b,function(a,b){d.removeAttribute(b)})})};E.attr=function(a,b){if(a){if(C(a)){if(2>arguments.length){if(!this[0]||!x(this[0]))return;var c=this[0].getAttribute(a);return null===c?void 0:c}return void 0===b?this:null===b?this.removeAttr(a):this.each(function(c,h){x(h)&&h.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}};
E.toggleClass=function(a,b){var c=N(a),d=void 0!==b;return this.each(function(a,f){x(f)&&J(c,function(a,c){d?b?f.classList.add(c):f.classList.remove(c):f.classList.toggle(c)})})};E.addClass=function(a){return this.toggleClass(a,!0)};E.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")};
function O(a,b,c,d){for(var h=[],f=D(b),g=d&&L(d),y=0,z=a.length;y<z;y++)if(f){var l=b(a[y]);l.length&&ja.apply(h,l)}else for(l=a[y][b];!(null==l||d&&g(-1,l));)h.push(l),l=c?l[b]:null;return h}function P(a){return 1<a.length?t.call(a,function(a,c,d){return ha.call(d,a)===c}):a}F.unique=P;E.add=function(a,b){return F(P(this.get().concat(F(a,b).get())))};function Q(a,b,c){if(x(a)){var d=m.getComputedStyle(a,null);return c?d.getPropertyValue(b)||void 0:d[b]||a.style[b]}}
function R(a,b){return parseInt(Q(a,b),10)||0}var S=/^--/,T={},va=ca.style,wa=["webkit","moz","ms"];function xa(a,b){void 0===b&&(b=S.test(a));if(b)return a;if(!T[a]){b=G(a);var c=""+b[0].toUpperCase()+b.slice(1);b=(b+" "+wa.join(c+" ")+c).split(" ");J(b,function(b,c){if(c in va)return T[a]=c,!1})}return T[a]}
var ya={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function za(a,b,c){void 0===c&&(c=S.test(a));return c||ya[a]||!ta(b)?b:b+"px"}
E.css=function(a,b){if(C(a)){var c=S.test(a);a=xa(a,c);if(2>arguments.length)return this[0]&&Q(this[0],a,c);if(!a)return this;b=za(a,b,c);return this.each(function(d,f){x(f)&&(c?f.style.setProperty(a,b):f.style[a]=b)})}for(var d in a)this.css(d,a[d]);return this};var Aa=/^\s+|\s+$/;function Ba(a,b){a=a.dataset[b]||a.dataset[G(b)];return Aa.test(a)?a:aa(JSON.parse,a)}
E.data=function(a,b){if(!a){if(!this[0])return;var c={},d;for(d in this[0].dataset)c[d]=Ba(this[0],d);return c}if(C(a))return 2>arguments.length?this[0]&&Ba(this[0],a):void 0===b?this:this.each(function(c,d){c=b;c=aa(JSON.stringify,c);d.dataset[G(a)]=c});for(d in a)this.data(d,a[d]);return this};function Ca(a,b){var c=a.documentElement;return Math.max(a.body["scroll"+b],c["scroll"+b],a.body["offset"+b],c["offset"+b],c["client"+b])}
function Da(a,b){return R(a,"border"+(b?"Left":"Top")+"Width")+R(a,"padding"+(b?"Left":"Top"))+R(a,"padding"+(b?"Right":"Bottom"))+R(a,"border"+(b?"Right":"Bottom")+"Width")}
J([!0,!1],function(a,b){J(["Width","Height"],function(a,d){E[(b?"outer":"inner")+d]=function(c){if(this[0])return H(this[0])?b?this[0]["inner"+d]:this[0].document.documentElement["client"+d]:w(this[0])?Ca(this[0],d):this[0][(b?"offset":"client")+d]+(c&&b?R(this[0],"margin"+(a?"Top":"Left"))+R(this[0],"margin"+(a?"Bottom":"Right")):0)}})});
J(["Width","Height"],function(a,b){var c=b.toLowerCase();E[c]=function(d){if(!this[0])return void 0===d?void 0:this;if(!arguments.length)return H(this[0])?this[0].document.documentElement["client"+b]:w(this[0])?Ca(this[0],b):this[0].getBoundingClientRect()[c]-Da(this[0],!a);var h=parseInt(d,10);return this.each(function(b,d){x(d)&&(b=Q(d,"boxSizing"),d.style[c]=za(c,h+("border-box"===b?Da(d,!a):0)))})}});var U={};
E.toggle=function(a){return this.each(function(b,c){if(x(c))if(void 0===a?"none"===Q(c,"display"):a){if(c.style.display=c.___cd||"","none"===Q(c,"display")){b=c.style;c=c.tagName;if(U[c])c=U[c];else{var d=n(c);k.body.insertBefore(d,null);var h=Q(d,"display");k.body.removeChild(d);c=U[c]="none"!==h?h:"block"}b.display=c}}else c.___cd=Q(c,"display"),c.style.display="none"})};E.hide=function(){return this.toggle(!1)};E.show=function(){return this.toggle(!0)};
function Ea(a,b){return!b||!u.call(b,function(b){return 0>a.indexOf(b)})}var V={focus:"focusin",blur:"focusout"},W={mouseenter:"mouseover",mouseleave:"mouseout"},Fa=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Ga(a,b,c,d,h){var f=a.___ce=a.___ce||{};f[b]=f[b]||[];f[b].push([c,d,h]);a.addEventListener(b,h)}function X(a){a=a.split(".");return[a[0],a.slice(1).sort()]}
function Y(a,b,c,d,h){var f=a.___ce=a.___ce||{};if(b)f[b]&&(f[b]=f[b].filter(function(f){var g=f[0],z=f[1];f=f[2];if(h&&f.guid!==h.guid||!Ea(g,c)||d&&d!==z)return!0;a.removeEventListener(b,f)}));else for(b in f)Y(a,b,c,d,h)}
E.off=function(a,b,c){var d=this;if(void 0===a)this.each(function(a,b){(x(b)||w(b)||H(b))&&Y(b)});else if(C(a))D(b)&&(c=b,b=""),J(N(a),function(a,h){a=X(h);h=a[0];var f=a[1],g=W[h]||V[h]||h;d.each(function(a,d){(x(d)||w(d)||H(d))&&Y(d,g,f,b,c)})});else for(var h in a)this.off(h,a[h]);return this};
E.on=function(a,b,c,d,h){var f=this;if(!C(a)){for(var g in a)this.on(g,b,c,a[g],h);return this}C(b)||(void 0!==b&&null!==b&&(void 0!==c&&(d=c),c=b),b="");D(d)||(d=c,c=void 0);if(!d)return this;J(N(a),function(a,g){a=X(g);g=a[0];var l=a[1],z=W[g]||V[g]||g,y=g in W,Ka=g in V;z&&f.each(function(a,f){if(x(f)||w(f)||H(f))a=function La(a){if(a.target["___i"+a.type])return a.stopImmediatePropagation();if(!a.namespace||Ea(l,a.namespace.split(".")))if(b||!(Ka&&(a.target!==f||a.___ot===z)||y&&a.relatedTarget&&
f.contains(a.relatedTarget))){var g=f;if(b){for(var A=a.target;!sa(A,b);){if(A===f)return;A=A.parentNode;if(!A)return}g=A;a.___cd=!0}a.___cd&&Object.defineProperty(a,"currentTarget",{configurable:!0,get:function(){return g}});Object.defineProperty(a,"data",{configurable:!0,get:function(){return c}});A=d.call(g,a,a.___td);h&&Y(f,z,l,b,La);!1===A&&(a.preventDefault(),a.stopPropagation())}},a.guid=d.guid=d.guid||F.guid++,Ga(f,z,l,b,a)})});return this};E.one=function(a,b,c,d){return this.on(a,b,c,d,!0)};
E.ready=function(a){function b(){return setTimeout(a,0,F)}"loading"!==k.readyState?b():k.addEventListener("DOMContentLoaded",b);return this};E.trigger=function(a,b){if(C(a)){var c=X(a),d=c[0];c=c[1];var h=W[d]||V[d]||d;if(!h)return this;var f=Fa.test(h)?"MouseEvents":"HTMLEvents";a=k.createEvent(f);a.initEvent(h,!0,!0);a.namespace=c.join(".");a.___ot=d}a.___td=b;var g=a.___ot in V;return this.each(function(b,c){g&&D(c[a.___ot])&&(c["___i"+a.type]=!0,c[a.___ot](),c["___i"+a.type]=!1);c.dispatchEvent(a)})};
function Ha(a){return a.multiple&&a.options?O(t.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""}var Ia=/%20/g,Ja=/\r?\n/g,Ma=/file|reset|submit|button|image/i,Na=/radio|checkbox/i;
E.serialize=function(){var a="";this.each(function(b,c){J(c.elements||[c],function(b,c){c.disabled||!c.name||"FIELDSET"===c.tagName||Ma.test(c.type)||Na.test(c.type)&&!c.checked||(b=Ha(c),void 0!==b&&(b=q(b)?b:[b],J(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d.replace(Ja,"\r\n")).replace(Ia,"+");a=b+d})))})});return a.slice(1)};
E.val=function(a){return arguments.length?this.each(function(b,c){if((b=c.multiple&&c.options)||Na.test(c.type)){var d=q(a)?ia.call(a,String):null===a?[]:[String(a)];b?J(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)},!0):c.checked=0<=d.indexOf(c.value)}else c.value=void 0===a||null===a?"":a}):this[0]&&Ha(this[0])};E.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};E.detach=function(a){M(this,a).each(function(a,c){c.parentNode&&c.parentNode.removeChild(c)});return this};
var Oa=/^\s*<(\w+)[^>]*>/,Pa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Qa={"*":ca,tr:da,td:ea,th:ea,thead:p,tbody:p,tfoot:p};function qa(a){if(!C(a))return[];if(Pa.test(a))return[n(RegExp.$1)];var b=Oa.test(a)&&RegExp.$1;b=Qa[b]||Qa["*"];b.innerHTML=a;return F(b.childNodes).detach().get()}F.parseHTML=qa;E.empty=function(){return this.each(function(a,b){for(;b.firstChild;)b.removeChild(b.firstChild)})};
E.html=function(a){return arguments.length?void 0===a?this:this.each(function(b,c){x(c)&&(c.innerHTML=a)}):this[0]&&this[0].innerHTML};E.remove=function(a){M(this,a).detach().off();return this};E.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){x(c)&&(c.textContent=a)})};E.unwrap=function(){this.parent().each(function(a,b){"BODY"!==b.tagName&&(a=F(b),a.replaceWith(a.children()))});return this};
E.offset=function(){var a=this[0];if(a)return a=a.getBoundingClientRect(),{top:a.top+m.pageYOffset,left:a.left+m.pageXOffset}};E.offsetParent=function(){return this.map(function(a,b){for(a=b.offsetParent;a&&"static"===Q(a,"position");)a=a.offsetParent;return a||ba})};
E.position=function(){var a=this[0];if(a){var b="fixed"===Q(a,"position"),c=b?a.getBoundingClientRect():this.offset();if(!b){var d=a.ownerDocument;for(b=a.offsetParent||d.documentElement;(b===d.body||b===d.documentElement)&&"static"===Q(b,"position");)b=b.parentNode;b!==a&&x(b)&&(d=F(b).offset(),c.top-=d.top+R(b,"borderTopWidth"),c.left-=d.left+R(b,"borderLeftWidth"))}return{top:c.top-R(a,"marginTop"),left:c.left-R(a,"marginLeft")}}};
E.children=function(a){return M(F(P(O(this,function(a){return a.children}))),a)};E.contents=function(){return F(P(O(this,function(a){return"IFRAME"===a.tagName?[a.contentDocument]:"TEMPLATE"===a.tagName?a.content.childNodes:a.childNodes})))};E.find=function(a){return F(P(O(this,function(b){return v(a,b)})))};var Ra=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Sa=/^$|^module$|\/(java|ecma)script/i,Ta=["type","src","nonce","noModule"];
function Ua(a,b){a=F(a);a.filter("script").add(a.find("script")).each(function(a,d){if(Sa.test(d.type)&&ba.contains(d)){var c=n("script");c.text=d.textContent.replace(Ra,"");J(Ta,function(a,b){d[b]&&(c[b]=d[b])});b.head.insertBefore(c,null);b.head.removeChild(c)}})}
function Z(a,b,c,d,h,f,g,y){J(a,function(a,f){J(F(f),function(a,f){J(F(b),function(b,g){var l=c?g:f;b=c?a:b;g=c?f:g;l=b?l.cloneNode(!0):l;b=!b;h?g.insertBefore(l,d?g.firstChild:null):g.parentNode.insertBefore(l,d?g:g.nextSibling);b&&Ua(l,g.ownerDocument)},y)},g)},f);return b}E.after=function(){return Z(arguments,this,!1,!1,!1,!0,!0)};E.append=function(){return Z(arguments,this,!1,!1,!0)};E.appendTo=function(a){return Z(arguments,this,!0,!1,!0)};E.before=function(){return Z(arguments,this,!1,!0)};
E.insertAfter=function(a){return Z(arguments,this,!0,!1,!1,!1,!1,!0)};E.insertBefore=function(a){return Z(arguments,this,!0,!0)};E.prepend=function(){return Z(arguments,this,!1,!0,!0,!0,!0)};E.prependTo=function(a){return Z(arguments,this,!0,!0,!0,!1,!1,!0)};E.replaceWith=function(a){return this.before(a).remove()};E.replaceAll=function(a){F(a).replaceWith(this);return this};E.wrapAll=function(a){a=F(a);for(var b=a[0];b.children.length;)b=b.firstElementChild;this.first().before(a);return this.appendTo(b)};
E.wrap=function(a){return this.each(function(b,c){var d=F(a)[0];F(c).wrapAll(b?d.cloneNode(!0):d)})};E.wrapInner=function(a){return this.each(function(b,c){b=F(c);c=b.contents();c.length?c.wrapAll(a):b.append(a)})};E.has=function(a){var b=C(a)?function(b,d){return v(a,d).length}:function(b,d){return d.contains(a)};return this.filter(b)};E.is=function(a){var b=L(a);return u.call(this,function(a,d){return b.call(a,d,a)})};E.next=function(a,b,c){return M(F(P(O(this,"nextElementSibling",b,c))),a)};
E.nextAll=function(a){return this.next(a,!0)};E.nextUntil=function(a,b){return this.next(b,!0,a)};E.not=function(a){var b=L(a);return this.filter(function(c,d){return(!C(a)||x(d))&&!b.call(d,c,d)})};E.parent=function(a){return M(F(P(O(this,"parentNode"))),a)};E.index=function(a){var b=a?F(a)[0]:this[0];a=a?this:F(b).parent().children();return ha.call(a,b)};E.closest=function(a){var b=this.filter(a);if(b.length)return b;var c=this.parent();return c.length?c.closest(a):b};
E.parents=function(a,b){return M(F(P(O(this,"parentElement",!0,b))),a)};E.parentsUntil=function(a,b){return this.parents(b,a)};E.prev=function(a,b,c){return M(F(P(O(this,"previousElementSibling",b,c))),a)};E.prevAll=function(a){return this.prev(a,!0)};E.prevUntil=function(a,b){return this.prev(b,!0,a)};E.siblings=function(a){return M(F(P(O(this,function(a){return F(a).parent().children().not(a)}))),a)};"undefined"!==typeof exports?module.exports=F:m.cash=m.$=F;
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

File diff suppressed because one or more lines are too long

View File

@ -1,140 +0,0 @@
User-agent: 008
Disallow: /
User-agent: AI2Bot
Disallow: /
User-agent: Amazonbot
Disallow: /
User-agent: anthropic-ai
Disallow: /
User-agent: Applebot
Disallow: /
User-agent: Applebot-Extended
Disallow: /
User-agent: archive.org_bot
Disallow: /
User-agent: Arquivo-web-crawler
Disallow: /
User-agent: Bytespider
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: ChatGPT-User
Disallow: /
User-agent: Claude-Web
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: cohere-ai
Disallow: /
User-agent: cohere-training-data-crawler
Disallow: /
User-agent: Dataprovider.com
Disallow: /
User-agent: dcrawl
Disallow: /
User-agent: Diffbot
Disallow: /
User-agent: DuckAssistBot
Disallow: /
User-agent: FacebookBot
Disallow: /
User-agent: GeedoProductSearch
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: GPTBot
Disallow: /
User-agent: heritrix
Disallow: /
User-agent: HTTrack
Disallow: /
User-agent: ia_archiver
Disallow: /
User-agent: ia_archiver-web.archive.org
Disallow: /
User-agent: ImagesiftBot
Disallow: /
User-agent: Kangaroo Bot
Disallow: /
User-agent: Meta-ExternalAgent
Disallow: /
User-agent: Meta-ExternalFetcher
Disallow: /
User-agent: MetaInspector
Disallow: /
User-agent: newspaper
Disallow: /
User-agent: Nicecrawler
Disallow: /
User-agent: Nutch
Disallow: /
User-agent: OAI-SearchBot
Disallow: /
User-agent: Offline Explorer
Disallow: /
User-agent: omgili
Disallow: /
User-agent: omgilibot
Disallow: /
User-agent: OpenindexSpider
Disallow: /
User-agent: Operator
Disallow: /
User-agent: PanguBot
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: Scrapy
Disallow: /
User-agent: Timpibot
Disallow: /
User-agent: Webzio-Extended
Disallow: /
User-agent: YouBot
Disallow: /

View File

@ -1,9 +0,0 @@
HEADER, .pwic_action_bar, A.pwic_external_link::after, #pwic_browser_access, #pwic_browser, #page_topofpage, FOOTER {
display: none;
}
ARTICLE {
border: none;
margin: none;
width: 95%;
}

File diff suppressed because one or more lines are too long

View File

@ -1,876 +0,0 @@
// --------------------------------
// Fonts
// https://fonts.google.com/specimen/Noto+Sans
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_latin.woff2) format('woff2')
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_latin-ext.woff2) format('woff2')
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_cyrillic.woff2) format('woff2')
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_cyrillic-ext.woff2) format('woff2')
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_greek.woff2) format('woff2')
unicode-range: U+0370-03FF
@font-face
font-family: 'Noto Sans'
src: url(/static/noto_greek-ext.woff2) format('woff2')
unicode-range: U+1F00-1FFF
// --------------------------------
// Main HTML tags
HTML
height: 100%
scroll-behavior: smooth
BODY
height: 100%
width: 100%
margin: 0
padding: 0
background-color: white
font-family: 'Noto Sans', sans-serif
A
text-decoration: none
color: black
ABBR
cursor: help
BLOCKQUOTE
margin-left: 0
margin-right: 0
padding: 10px
background-color: #F2F2F2
border-left: 4px solid gray
border-radius: 10px
P
margin-right: 0
&:first-child
margin-top: 0
&:last-child
margin-bottom: 0
&.spoiler
cursor: help
border-left-style: dotted
border-radius: 0
*
visibility: hidden
&:hover *
visibility: visible
CODE
display: inline-block
white-space: pre-wrap
padding: 3px
max-width: 100%
border: 1px solid gray
font-family: monospace
.pwic_copy_code
float: right
margin: 5px
background-color: white
border: 1px solid black
border-radius: 15px
line-height: 30px
width: 30px
text-align: center
cursor: pointer
.pwic_copy_code:hover
background-color: lightgray
.pwic_copy_code_tiny
float: right
margin-left: 5px
background-color: lightgray
text-align: center
cursor: pointer
// --------------------------------
// Template - Header
HEADER
padding: 10px 50px 10px 50px
background-color: #F0F0F0
border-bottom: 1px solid black
box-shadow: 0 0 5px gray
font-weight: bold
.pwic_ph1
font-size: 24pt
.pwic_ph2
font-size: 18pt
.pwic_tagbox
margin-top: 10px
overflow: hidden
A,DIV
float: left
margin: 0 10px 5px 0
padding: 5px 10px
line-height: 20px
border: 1px solid black
A:hover
background-color: white
DIV
background-color: white
INPUT
width: 50px
border: none
INPUT:focus
width: 80vw
transition: width 0.5s
INPUT:not(:focus)
transition: width 0.5s
// --------------------------------
// Template - Content
ARTICLE
display: block
margin: auto
width: 90%
padding: 20px 20px 0 20px
// -------------------------------- Standard tags
H1
background-color: #F4F4F4
border-bottom: 1px solid black
border-radius: 10px
margin: 30px 10px 20px 0
padding: 3px 10px
font-size: 24pt
font-weight: bold
H2
margin: 20px 10px 20px 1cm
font-size: 22pt
font-weight: bold
border-bottom: 1px solid lightgray
H3
margin: 20px 10px 20px 2cm
font-size: 20pt
H4
margin: 20px 10px 20px 3cm
font-size: 18pt
H5
margin: 20px 10px 20px 4cm
font-size: 16pt
H6
margin: 20px 10px 20px 5cm
font-size: 14pt
TABLE
width: 95%
margin: auto
border-spacing: 0
border-collapse: collapse
border: 1px solid gray
TR:nth-child(n+1):not(:last-child)
border-bottom: 1px solid lightgray
TR:hover
background-color: lightblue !important
CAPTION
caption-side: bottom
display: inline-block
padding: 3px 10px
border-top: 1px solid gray
border-right: 1px solid gray
background-color: lightyellow
font-style: italic
font-size: 8pt
cursor: pointer
TABLE.pwic_zebra
TR:nth-child(even)
background-color: #F0F0F0
TH
text-align: left
background-color: lightgray
border-bottom: 1px solid gray
TH,TD
padding: 2px 5px
INPUT[type=button], INPUT[type=submit]
padding: 5px 15px 5px 15px
cursor: pointer
A
color: red
text-decoration: underline
IMG
vertical-align: middle
max-width: 100%
// max-height: 90vh
border: 1px solid lightgray
margin: 5px
// -------------------------------- Action bar
.pwic_action_bar
text-align: right
margin-bottom: 25px
A
display: inline-block
margin: 0 0 5px 5px
padding: 5px 10px
border: 1px solid lightgray
border-radius: 10px
background-color: #ECF6F9
text-decoration: none !important
&:hover
border: 1px solid black
border-radius: 0
// -------------------------------- Tag box
.pwic_tagbox
margin: 10px 0 10px 0
overflow: hidden
A
float: left
margin: 0 5px 5px 0
padding: 3px 5px
line-height: 20px
border: 1px solid gray
border-radius: 10px
font-family: monospace
color: black
text-decoration: none
&:hover
background-color: lightgray
border: 1px solid black
border-radius: 0
&.pwic_selected
background-color: lightgray
// -------------------------------- File gallery
.pwic_file_gallery
display: block
overflow: hidden
padding: 10px
A
float: left
padding: 5px 10px
margin: 5px
// width: 200px
border: 1px solid lightgray
text-align: center
color: black
text-decoration: none
SPAN
color: red
text-decoration: underline
&:hover
border: 1px solid black
// -------------------------------- Progress
#pwic_progress
position: fixed
top: 0
left: 0
height: 5px
width: 0
background-color: gray
// -------------------------------- Document browser
#pwic_browser_access
position: fixed
bottom: 65px
right: 75px
z-index: 999
width: 50px
height: 50px
line-height: 50px
border-radius: 25px
border: 2px solid green
background-color: rgb(149, 236, 168)
box-shadow: 0 0 0 10px white
font-size: 22pt
text-align: center
#pwic_browser_access:hover
cursor: pointer
background-color: green
color: white
box-shadow: 0 0 10px 5px lime
#pwic_browser
position: fixed
left: 10px
right: 10px
top: 10px
bottom: 10px
z-index: 998
overflow-x: hidden
overflow-y: scroll
padding: 10px
border: 1px solid black
box-shadow: 0 0 0 10px white
background-color: #F7F7F7
A
display: block
padding: 5px
margin: 5px
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
color: black // Invalidates the general A
text-decoration: none // Invalidates the general A
&:hover
background-color: lightyellow
font-weight: bold
&.pwic_browser_item_h1
padding-left: 10px
border-bottom: 1px solid gray
font-size: 16pt
font-weight: bold
&.pwic_browser_item_h2
padding-left: 20px
font-size: 14pt
&.pwic_browser_item_h3
padding-left: 30px
&.pwic_browser_item_h4
padding-left: 40px
&.pwic_browser_item_h5
padding-left: 50px
&.pwic_browser_item_h6
padding-left: 60px
// --------------------------------
// Template - Footer
FOOTER
display: block
padding: 25px 10px 10px 10px
margin-bottom: 10px
> DIV
width: 90%
margin: auto
padding: 5px 10px
border: 2px solid black
border-radius: 10px
background-color: #F8F8F8
font-size: smaller
text-align: center
A
text-decoration: underline
// --------------------------------
// Popup widget
.pwic_blurcontainer
position: absolute
left: 0
right: 0
top: 0
bottom: 0
background-color: rgb(255, 255, 255, 75%)
backdrop-filter: blur(3px) // Only Chrome
.pwic_popup
position: absolute
left: 15%
right: 15%
top: 30%
bottom: auto
background-color: #FFFFF0
padding: 15px
box-shadow: 0 0 15px gray
border: 1px solid black
border-radius: 15px
P
text-align: center
// --------------------------------
// Messages types
.pwic_error, .pwic_information, .pwic_warning
margin-bottom: 20px
padding: 5px
border-radius: 10px
.pwic_error
background-color: #FFE0E0
border: 1px solid red
.pwic_information
background-color: #E0FFE0
border: 1px solid green
.pwic_warning
background-color: lightyellow
border: 1px solid orange
// --------------------------------
// Progress bar
SPAN.pwic_progressbar
display: inline-block
width: 50%
height: 12px
margin-left: 10px
margin-right: 10px
padding: 0
border: 1px solid black
box-shadow: inset -1px -1px gray
text-align: left
> SPAN
display: inline-block
height: 100%
background-color: teal
// --------------------------------
// Individual reusable styles
.pwic_bold
font-weight: bold
.pwic_break
word-break: break-all
.pwic_center
text-align: center
.pwic_cursor
cursor: pointer
.pwic_disabled_bg
background-color: lightgray
A.pwic_external_link
margin-right: 15px
&::after
content: "\238B"
color: purple
position: absolute
margin-left: 3px
.pwic_fill
width: 100%
.pwic_hidden
display: none
.pwic_italic
font-style: oblique
.pwic_js
display: none !important
.pwic_limebg
background-color: lime
.pwic_mobile
display: none
.pwic_monospace
font-family: monospace
.pwic_noborder
border: none
.pwic_nooverflow
overflow: hidden
.pwic_nowrap
white-space: pre
.pwic_red
color: red
.pwic_right
text-align: right
.pwic_spacer
margin-right: 15px !important
// --------------------------------
// Individual elements
#page_lastmod
margin-top: 25px
text-align: right
font-size: smaller
#page_legal_notice
padding: 10px
border-top: 1px dashed gray
font-size: smaller
#page_topofpage
text-align: center
font-weight: bold
#edit_toolbar
DIV
display: inline-block
margin-right: 10px
INPUT[type=button]
padding: 5px 10px
margin-top: 5px
height: 32px
vertical-align: top
#edit_emojis
width: 100%
margin-top: 5px
padding: 3px
border: 1px dashed gray
SPAN
display: inline-block
width: 25px
text-align: center
cursor: pointer
#edit_markdown
width: 100%
height: 75vh
margin-top: 5px
#create_tags, #edit_tags
font-family: monospace
#edit_files_drop
border: 2px dashed lightgray
margin-top: 10px
margin-bottom: 20px
padding: 10px
line-height: 40px
font-weight: bold
text-align: center
background-color: #F7F7F7
#edit_files_drop.pwic_dragover
border: 2px solid gray
background-color: lightyellow
#edit_files_list INPUT[type="button"]
padding: 5px
#graph_viz
width: 100%
height: 80vh
border: 1px solid black
svg
width: 100%
height: 100%
#roles_table INPUT[type="button"]
padding: 5px
// --------------------------------
// Mobile corrections
@media screen and (max-width: 640px)
.pwic_desktop
display: none !important
.pwic_mobile
display: inline !important
HEADER
padding: 5px 10px
.pwic_ph1
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
font-size: 18pt
.pwic_ph2
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
font-size: 12pt
.pwic_tagbox
A,DIV
margin: 0 5px 5px 0
padding: 3px 10px
font-size: smaller
ARTICLE
H1
font-size: 18pt
margin-left: 0
H2
font-size: 18pt
margin-left: 0.25cm
H3
font-size: 16pt
margin-left: 0.5cm
H4
font-size: 16pt
margin-left: 0.75cm
H5
font-size: 14pt
margin-left: 1cm
H6
font-size: 14pt
margin-left: 1.25cm
TABLE
width: 100%
font-size: smaller
#pwic_browser_access
right: 25px
.pwic_action_bar
font-size: smaller
A
padding: 3px 5px 3px 5px !important
#edit_toolbar
DIV
display: inline
INPUT[type=button]
padding: 0px 5px
// --------------------------------
// Code differences
TABLE.diff
width: 100%
font-family: monospace
word-wrap: anywhere
TD
padding: 0 5px
&:nth-child(3)
width: 45%
&:nth-child(6)
width: 45%
.diff_header
background-color: #F0F0F0
text-align: right
.diff_add
padding: 1px 5px
display: inline-block
background-color: #E0FFE0
border: 1px solid green
.diff_chg
padding: 1px 5px
display: inline-block
background-color: #FFF0CC
border: 1px solid #FF8000
.diff_sub
padding: 1px 5px
display: inline-block
background-color: #FFE0E0
border: 1px solid red
// --------------------------------
// Syntax highlight
ARTICLE
CODE
background-color: #FFFFFF
.hll
background-color: #FFFFCC
.err
color: #FF0000
border: 1px solid #FF0000
.k
color: #800080
font-weight: bold
.kc
color: #800080
font-weight: bold
.kd
color: #800080
font-weight: bold
.kn
color: #800080
font-weight: bold
.kp
color: #800080
.kr
color: #800080
font-weight: bold
.kt
color: #B00040
.na
color: #008080
.nb
font-weight: bold
.nc
font-weight: bold
.ne
font-weight: bold
.nl
color: #BC7A00
.nt
color: #2080C0
font-weight: bold
.nv
color: #2F4F4F
.l
color: #0000FF
.ld
color: #0000FF
.s
color: #FF0000
.sa
color: #FF0000
.sb
color: #FF0000
.sc
color: #FF0000
.dl
color: #FF0000
.sd
color: #FF8000
.s2
color: #FF0000
.se
color: #FF8000
font-weight: bold
.sh
color: #FF0000
.si
color: #FF0000
.sx
color: #FF0000
.sr
color: #800000
.s1
color: #FF0000
.ss
color: #FF0000
.m
color: #0000FF
.mb
color: #0000FF
.mf
color: #0000FF
.mh
color: #0000FF
.mi
color: #0000FF
.il
color: #0000FF
.mo
color: #0000FF
.ow
color: #800080
font-weight: bold
.c
color: #008000
font-style: oblique
.ch
color: #808080
font-style: oblique
.cm
color: #008000
font-style: oblique
.cp
color: #BC7A00
font-weight: bold
.cpf
color: #408080
.c1
color: #008000
font-style: oblique
.cs
color: #008000
font-style: oblique
.gd
color: #FF0000
.ge
font-style: oblique
.gr
color: #FF0000
border: 1px solid #FF0000
.gh
color: #4040FF
font-weight: bold
.gi
color: #008000
.gp
color: #4040FF
font-weight: bold
.gs
font-weight: bold
.gu
background-color: #D3D3D3
font-weight: bold
font-style: oblique

View File

@ -1 +0,0 @@
BODY{background-color:#000;color:#d3d3d3}BLOCKQUOTE{color:#000}CODE{border-color:#fff;color:#000}INPUT,SELECT{background-color:gray;color:#fff}::placeholder{color:maroon;opacity:1}::-ms-input-placeholder{color:maroon}HEADER{background-color:gray}HEADER .pwic_ph1,HEADER .pwic_ph2{color:#000}HEADER .pwic_tagbox A{background-color:#d3d3d3}HEADER .pwic_tagbox A:hover{border-color:#fff;background-color:#000;color:#fff}HEADER .pwic_tagbox DIV{background-color:#d3d3d3}HEADER .pwic_tagbox DIV>INPUT{background-color:#d3d3d3;color:#000}ARTICLE{background-color:#303030}ARTICLE H1{border-color:#fff;background-color:gray;color:#000}ARTICLE TABLE TR:hover{background-color:#add8e6 !important;color:#000 !important}ARTICLE TABLE.pwic_zebra TR:nth-child(even){background-color:#505050}ARTICLE TH{color:#000}ARTICLE A{color:#ff0}ARTICLE .pwic_action_bar A{background-color:gray}ARTICLE .pwic_action_bar A:hover{border-color:#fff;background-color:#000;color:#fff}ARTICLE .pwic_tagbox A{background-color:#d3d3d3}ARTICLE .pwic_tagbox A:hover{border-color:#fff;background-color:#000;color:#fff}ARTICLE .pwic_tagbox A.pwic_selected{border-color:#fff;background-color:#000;color:#fff}ARTICLE .pwic_file_gallery A{background-color:#d3d3d3;color:#000}ARTICLE .pwic_file_gallery A:hover{border-color:#ff0}ARTICLE #pwic_progress{background-color:#fff}ARTICLE #pwic_browser_access{background-color:#95eca8;box-shadow:0 0 0 10px gray}ARTICLE #pwic_browser_access:hover{background-color:green;color:#fff}ARTICLE #pwic_browser{background-color:#303030}ARTICLE #pwic_browser A{color:#fff}ARTICLE #pwic_browser A:hover{background-color:#d3d3d3;color:#000}FOOTER{background-color:#303030;color:#000}FOOTER A{color:#000}.pwic_blurcontainer{background-color:hsla(0,0%,100%,.75)}.pwic_popup{background-color:#303030}.pwic_error,.pwic_information,.pwic_warning{color:#000}SPAN.pwic_progressbar>SPAN{background-color:teal}.pwic_disabled_bg{background-color:gray}#page_legal_notice{color:#fff}#page_topofpage A{color:#fff}#edit_emojis{background-color:#fff;color:#000}#edit_files_drop{background-color:gray;color:#fff}#edit_files_drop.pwic_dragover{background-color:#fff;color:#000}.diff_header{background-color:gray;color:#fff}.diff_add{background-color:#e0ffe0;color:#000}.diff_chg{background-color:#ffffe0;color:#000}.diff_sub{background-color:#ffe0e0;color:#000}ARTICLE CODE{background:#d3d3d3}

View File

@ -1,232 +0,0 @@
// --------------------------------
// Main HTML tags
BODY
background-color: black
color: lightgray
BLOCKQUOTE
color: black
CODE
border-color: white
color: black
INPUT, SELECT
background-color: gray
color: white
::placeholder
color: maroon
opacity: 1
::-ms-input-placeholder
color: maroon
// --------------------------------
// Template - Header
HEADER
background-color: gray
.pwic_ph1, .pwic_ph2
color: black
.pwic_tagbox
A
background-color: lightgray
A:hover
border-color: white
background-color: black
color: white
DIV
background-color: lightgray
> INPUT
background-color: lightgray
color: black
// --------------------------------
// Template - Content
ARTICLE
background-color: #303030
// -------------------------------- Standard tags
H1
border-color: white
background-color: gray
color: black
TABLE
TR:hover
background-color: lightblue !important
color: black !important
TABLE.pwic_zebra
TR:nth-child(even)
background-color: #505050
TH
color: black
A
color: yellow
// -------------------------------- Action bar
.pwic_action_bar
A
background-color: gray
A:hover
border-color: white
background-color: black
color: white
// -------------------------------- Tag box
.pwic_tagbox
A
background-color: lightgray
A:hover
border-color: white
background-color: black
color: white
A.pwic_selected
border-color: white
background-color: black
color: white
// -------------------------------- File gallery
.pwic_file_gallery
A
background-color: lightgray
color: black
A:hover
border-color: yellow
// -------------------------------- Progress
#pwic_progress
background-color: white
// -------------------------------- Document browser
#pwic_browser_access
background-color: rgb(149, 236, 168)
box-shadow: 0 0 0 10px gray
#pwic_browser_access:hover
background-color: green
color: white
#pwic_browser
background-color: #303030
A
color: white
A:hover
background-color: lightgray
color: black
// --------------------------------
// Template - Footer
FOOTER
background-color: #303030
color: black
A
color: black
// --------------------------------
// Popup widget
.pwic_blurcontainer
background-color: rgb(255, 255, 255, 75%)
.pwic_popup
background-color: #303030
// --------------------------------
// Messages types
.pwic_error, .pwic_information, .pwic_warning
color: black
// --------------------------------
// Progress bar
SPAN.pwic_progressbar
> SPAN
background-color: teal
// --------------------------------
// Individual reusable styles
.pwic_disabled_bg
background-color: gray
// --------------------------------
// Individual elements
#page_legal_notice
color: white
#page_topofpage
A
color: white
#edit_emojis
background-color: white
color: black
#edit_files_drop
background-color: gray
color: white
#edit_files_drop.pwic_dragover
background-color: white
color: black
// --------------------------------
// Code differences
.diff_header
background-color: gray
color: white
.diff_add
background-color: #E0FFE0
color: black
.diff_chg
background-color: #FFFFE0
color: black
.diff_sub
background-color: #FFE0E0
color: black
// --------------------------------
// Syntax highlight
ARTICLE
CODE
background: lightgray

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,14 +0,0 @@
<ul>
{% if pwic.env.support_email %}
<li>{% trans %}By email:{% endtrans %} <a href="mailto:{{pwic.env.support_email.value|urlencode}}">{{pwic.env.support_email.value|escape}}</a></li>
{% endif %}
{% if pwic.env.support_phone %}
<li>{% trans %}By phone:{% endtrans %} <a href="tel:{{pwic.env.support_phone.value|replace(' ','')|urlencode}}">{{pwic.env.support_phone.value|escape}}</a></li>
{% endif %}
{% if pwic.env.support_url %}
<li>{% trans %}On a portal:{% endtrans %} <a href="{{pwic.env.support_url.value|escape}}">{{pwic.env.support_url.value|escape}}</a></li>
{% endif %}
{% if pwic.env.support_text %}
<li>{{pwic.env.support_text.value|escape|replace('\\n','<br>')}}</li>
{% endif %}
</ul>

View File

@ -1,24 +0,0 @@
<p id="page_topofpage" class="pwic_hidden">
<a href="#top">{{pwic.emojis.top}} {% trans %}Top of the page{% endtrans %} {{pwic.emojis.top}}</a>
</p>
<footer>
<div>
{% trans %}Powered by{% endtrans %} <a href="https://pwic.wiki">Pwic.wiki</a> v{{pwic.constants.version|escape}} &copy; {% if pwic.env.copyright_years %}{{pwic.env.copyright_years.value|escape}}{% else %}2020-2025{% endif %}
{% if not pwic.env.no_help %}
&mdash; {{pwic.emojis.help}}&nbsp;<a href="/special/help">{% trans %}Help{% endtrans %}</a>
{% endif %}
&mdash;
{% if not pwic.user|reserved_user_name %}
{{pwic.emojis.laptop}}&nbsp;<a href="/special/user/{{pwic.user|urlencode}}" title="{% trans %}Your profile{% endtrans %}" rel="nofollow">{{pwic.user|escape}}</a> (<a class="pwic_bold" href="/special/logout" onclick="return confirm({% trans %}'Are you sure to disconnect from Pwic.wiki?'{% endtrans %})">{% trans %}Log out{% endtrans %}</a>)
{% else %}
<a class="pwic_bold" href="/special/login">{% trans %}Log in{% endtrans %}</a>
{% endif %}
</div>
</footer>
<script>
$('H1,H2,H3,H4,H5,H6,TH,TD,P,DIV,SPAN,A,LI').removeClass('pwic_js');
pwic_url_status({% trans %}'The operation is a success.'{% endtrans %}, {% trans %}'The operation failed.'{% endtrans %});
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Connect to Pwic.wiki{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{{pwic.emojis.finger_up}} {% trans %}Connect to Pwic.wiki{% endtrans %}</a></div>
</header>
<article>
{% if pwic.env.no_login %}
<p class="pwic_warning">{{pwic.emojis.pin}} {% trans %}This instance is accessible anonymously.{% endtrans %}</p>
{% endif %}
<p class="pwic_error" id="login_js">{{pwic.emojis.red_check}} {% trans %}Your browser is incompatible or enable JavaScript.{% endtrans %}</p>
<form id="login_form" action="/api/login?redirect" method="post">
<p><strong>{% trans %}User:{% endtrans %}</strong> <input class="pwic_fill" type="text" id="login_user" name="user" autofocus autocomplete="username" required="true" spellcheck="false"></p>
<p><strong>{% trans %}Password:{% endtrans %}</strong> <input class="pwic_fill" type="password" id="login_password" name="password" autocomplete="current-password"></p>
{% if pwic.env.totp %}
<p><strong>{% trans %}Optional PIN code for 2FA:{% endtrans %}</strong>
<br><input type="number" id="login_pin" name="pin" min="0" max="999999"></p>
{% endif %}
<p {% if pwic.constants.languages|count == 1 %} class="pwic_hidden" {% endif %}>
<strong>{% trans %}Language:{% endtrans %}</strong>
<br><select id="login_language" name="language">
{% for lang in pwic.constants.languages %}
<option value="{{lang|escape}}"
{% if lang == pwic.language %}
selected="selected"
{% endif %}
>{{lang|escape}}</option>
{% endfor %}
</select>
</p>
<p>
<input type="submit" value="{{pwic.emojis.plug}} {% trans %}Log in{% endtrans %}">
<input type="button" value="{{pwic.emojis.alien}} {% trans %}Anonymous login{% endtrans %}" onclick="login_anonymous()">
{% if pwic.env.oauth_provider %}
<input type="button" value="{{pwic.emojis.id}} {% trans %}Federated login{% endtrans %}" onclick="login_oauth()">
{% endif %}
{% if pwic.env.registration_link %}
<input type="button" value="{{pwic.emojis.users}} {% trans %}Register{% endtrans %}" onclick="login_register()">
{% endif %}
</p>
</form>
</article>
{% include 'js/login.js' %}
<script>
login_translate_langs({ 'de': 'Deutsch',
'en': 'English',
'fr': 'Français'
});
</script>
{% endblock %}

View File

@ -1,21 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Disconnected from Pwic.wiki{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{% trans %}You are disconnected{% endtrans %}</a></div>
</header>
<article>
<p class="pwic_information">{{pwic.emojis.globe}} {% trans %}You successfully logged out.{% endtrans %}</p>
<p>{% trans %}You can go back to:{% endtrans %}</p>
<ol>
<li><a href="/">{% trans %}the selection of a new project{% endtrans %}</a></li>
<li><a href="/special/login">{% trans %}the login page{% endtrans %}</a></li>
</ol>
</article>
{% endblock %}

View File

@ -1,190 +0,0 @@
<!DOCTYPE html>
<html lang="{% if pwic.env.language %}{{pwic.env.language.value|escape}}{% else %}{{pwic.language|escape}}{% endif %}"
dir="{% if pwic.env.language and (pwic.env.language.value in pwic.constants.rtl) %}rtl{% else %}ltr{% endif %}">
<head>
<!-- General headers -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Pwic.wiki version {{pwic.constants.version|escape}}">
{% if pwic.env.robots %}
<meta name="robots" content="{{pwic.env.robots.value|replace(' ',', ')|escape}}">
{% endif %}
<meta charset="utf-8">
<meta name="description" content="{{(pwic.description or gettext('No description'))|escape}}">
{% if pwic.keywords %}
<meta name="keywords" content="{{pwic.keywords|escape}}">
{% endif %}
<title>{% block title %}{{pwic.title|escape}}{% endblock %}{% if pwic.env.title %} - {{pwic.env.title.value|escape}}{% endif %}</title>
{% if pwic.canonical %}
<link rel="canonical" href="{{pwic.canonical|escape}}">
{% endif %}
<link rel="icon" type="image/png" href="/static/favicon.png">
{% if pwic.project and (pwic.project not in pwic.constants.not_project) %}
{% if not pwic.env.no_sitemap %}
<link rel="sitemap" type="application/xml" href="/{{pwic.project|urlencode}}/special/sitemap">
{% endif %}
{% if not pwic.env.no_search %}
<link rel="search" type="application/opensearchdescription+xml" href="/{{pwic.project|urlencode}}/special/searchlink" title="{{ gettext('Search in project %(project)s')|format(project=pwic.project|escape) }}">
{% endif %}
{% if pwic.env.manifest %}
<link rel="manifest" href="/{{pwic.project|urlencode}}/special/manifest">
{% endif %}
{% if not pwic.env.no_feed and (not pwic.pure_reader or not pwic.env.no_history) %}
<link rel="alternate" type="application/atom+xml" href="/{{pwic.project|urlencode}}/special/feed/atom" title="{{ gettext('Recent changes for %(project)s (%(format)s)')|format(project=pwic.project|escape, format='ATOM') }}">
<link rel="alternate" type="application/rss+xml" href="/{{pwic.project|urlencode}}/special/feed/rss" title="{{ gettext('Recent changes for %(project)s (%(format)s)')|format(project=pwic.project|escape, format='RSS') }}">
{% endif %}
{% endif %}
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="/static/styles.css" media="all">
{% if pwic.env.css %}
{% set list = pwic.env.css.value.split(';') %}
{% for css in list %}
<link rel="stylesheet" type="text/css" href="{{css|trim|urlencode}}" media="all">
{% endfor %}
{% endif %}
{% if pwic.env.dark_theme %}
<link rel="stylesheet" type="text/css" href="/static/styles_dark.css" media="screen">
{% if pwic.env.css_dark %}
{% set list = pwic.env.css_dark.value.split(';') %}
{% for css in list %}
<link rel="stylesheet" type="text/css" href="{{css|trim|urlencode}}" media="screen">
{% endfor %}
{% endif %}
{% endif %}
<link rel="stylesheet" type="text/css" href="/static/styles-print.css" media="print">
{% if pwic.env.css_printing %}
{% set list = pwic.env.css_printing.value.split(';') %}
{% for css in list %}
<link rel="stylesheet" type="text/css" href="{{css|trim|urlencode}}" media="print">
{% endfor %}
{% endif %}
{% if pwic.env.no_printing %}
<style media="print">
BODY { display: none }
</style>
{% endif %}
<!-- Scripts -->
<script src="/static/cash.min.js"></script>
{% block header_scripts %}{% endblock %}
<script>
'use strict';
function pwic_entities(value) {
return value.replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;');
}
function pwic_is_safe(name) {
if (name == '')
return false;
var chars = '{{pwic.constants.unsafe_chars|replace("\\", "\\\\")|replace("'", "\\'")}}';
for (var i=0 ; i<chars.length ; i++)
if (name.indexOf(chars[i]) !== -1)
return false;
return true;
}
function pwic_kick(value, chars) {
while (true) {
var curlen = value.length;
for (var i=0 ; i<chars.length ; i++)
value = value.replaceAll(chars[i], '');
if (value.length == curlen)
break;
}
return value;
}
function pwic_slash(value) {
{# sof/18251399 #}
return value.split("'").join("\\'").split('"').join('\\"');
}
function pwic_unimoji(value) {
return value.replace(/&#x([0-9a-f]+);/gi, (match, v) => {
return String.fromCodePoint(parseInt(v, 16));
});
}
function pwic_url_status(success, failed) {
var url = window.location.toString();
if ((url.indexOf('?success') !== -1) || (url.indexOf('&success') !== -1))
alert(success);
else
if ((url.indexOf('?failed') !== -1) || (url.indexOf('&failed') !== -1))
alert(failed);
}
</script>
</head>
<body id="top">
{% block content %}{% endblock %}
{% include 'html/footer.html' %}
<script>
'use strict';
{% if not pwic.env.no_sort_table %}
function pwic_table_sort(that, column) {
function _get_sort_key(obj) {
var v, list = $(obj).find('INPUT[type=checkbox]');
if (list.length > 0)
return (!list.prop('checked')).toString();
v = (obj.dataset.sort || obj.innerText).trim();
if (v == '')
return '';
if (/^-?\d+( *%)?$/.test(v))
return parseInt(v.replace('%', '').trim());
v = v.replaceAll(',', '.');
if ((/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)) || (/^-?\.\d+(e-?\d+)?$/.test(v)))
return parseFloat(v);
return v.trim().toLowerCase();
}
var e = $(that),
table = e.parents('TABLE')[0],
i, j, op, data, src;
// Sort order
op = parseInt(e.data('sort') || '1');
e.data('sort', -op);
// Cache and sort the data
data = [];
for (i=1 ; i<table.rows.length ; i++)
data.push([i, _get_sort_key($(table.rows[i]).find('TD')[column])]);
data.sort(function(a, b) {
if (a[1] == b[1])
return 0;
return (a[1] < b[1] ? -1 : 1) * op;
});
// Update DOM
for (i=0 ; i<data.length ; i++) {
src = data[i][0];
if (src != i + 1) {
table.rows[src].parentNode.insertBefore(table.rows[src], table.rows[i+1]);
for (j=0; j<data.length; j++)
if (data[j][0] < src)
data[j][0]++;
}
}
}
$('TABLE').each(function(i, e) {
$(e).find('TR TH').each(function(i, e) {
e.innerHTML = '<span class="pwic_cursor" title="{% trans %}Sort{% endtrans %}" onclick="pwic_table_sort(this, '+i+')">' + (e.innerHTML||'...') + '<\/span>';
});
});
{% endif %}
{% if pwic.env.link_new_tab %}
$('A[href^="http"]').attr('target','_blank');
{% endif %}
</script>
</body>
</html>

View File

@ -1,32 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Page not found{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}">{{pwic.project_description|escape}}</a></div>
{% if pwic.links|count > 0 %}
<div class="pwic_tagbox">
{% for link in pwic.links %}
<a href="/{{pwic.project|urlencode}}/{{link.page|urlencode}}">{{link.title|escape}}</a>
{% endfor %}
</div>
{% endif %}
</header>
<article>
<p class="pwic_error">{{pwic.emojis.padlock}} {% trans %}The page does not exist.{% endtrans %}</p>
<p>{% trans %}Please verify your authorizations, the spelling of the link and the revision level of the page.{% endtrans %}</p>
<p>{% trans %}You can go back to:{% endtrans %}</p>
<ol>
<li class="pwic_js"><a href="#" onclick="history.back()">{% trans %}your last browsed page{% endtrans %}</a></li>
<li><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}">{% trans %}the latest revision of the page{% endtrans %}</a></li>
<li><a href="/{{pwic.project|urlencode}}">{% trans %}the home page of the project{% endtrans %}</a></li>
<li class="pwic_js"><a href="/{{pwic.project|urlencode}}/special/page?page={{pwic.page|urlencode}}">{% trans %}the creation of the missing page{% endtrans %}</a></li>
<li><a href="/{{pwic.project|urlencode}}/special">{% trans %}the special page of the project{% endtrans %}</a></li>
<li><a href="/">{% trans %}the selection of a new project{% endtrans %}</a></li>
</ol>
</article>
{% endblock %}

View File

@ -1,93 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Audit{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Audit of the activities{% endtrans %}</a></div>
<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
</header>
<article>
<div class="pwic_action_bar">
<a href="/{{pwic.project|urlencode}}/special/env">{{pwic.emojis.pill}} {% trans %}Settings{% endtrans %}</a>
{% if not pwic.env.no_help %}
<a href="/special/help#help_setup">{{pwic.emojis.help}} {% trans %}Help{% endtrans %}</a>
{% endif %}
</div>
<h1>{% trans %}Server information{% endtrans %}</h1>
<p>{{ gettext('The server has started on %(date)s at %(time)s.')|format(date=pwic.up.date|escape, time=pwic.up.time|escape) }}</p>
<p>{{ gettext('The current time on the server is %(date)s at %(time)s.')|format(date=pwic.systime.date|escape, time=pwic.systime.time|escape) }}</p>
<p>{{ gettext('You are connected in %(protocol)s.')|format(protocol=pwic.protocol|escape) }}</p>
<h1>{% trans %}Environment variables{% endtrans %}</h1>
<table id="audit_envs">
<tr>
<th>{% trans %}Key{% endtrans %}</th>
<th>{% trans %}Scope{% endtrans %}</th>
<th>{% trans %}Value{% endtrans %}</th>
</tr>
</table>
{% if pwic.audits|count > 0 %}
<h1>{{ gettext('Audit of the last %(n)d days')|format(n=pwic.range) }}</h1>
<table>
<tr>
<th>{% trans %}Date{% endtrans %}</th>
<th>{% trans %}Time{% endtrans %}</th>
<th>{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Event{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Project{% endtrans %}</th>
<th>{% trans %}Page{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Reference{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}String{% endtrans %}</th>
</tr>
{% for audit in pwic.audits %}
<tr>
<td class="pwic_nowrap">{{audit.date|escape}}</td>
<td>{{audit.time|escape}}</td>
<td><a class="pwic_break" href="/special/user/{{audit.author|urlencode}}" rel="nofollow">{{audit.author|escape}}</a></td>
<td>{{audit.event|escape}}</td>
<td class="pwic_desktop">
{% if audit.project != '' %}
<a href="/{{audit.project|urlencode}}">{{audit.project|escape}}</a>
{% endif %}
</td>
<td>
{% if audit.page != '' %}
<a href="/{{audit.project|urlencode}}/{{audit.page|urlencode}}">{{audit.page|escape}}</a>
{% endif %}
</td>
<td class="pwic_desktop">
{% if audit.reference > 0 %}
{% if audit.event[-9:] == '-revision' %}
<a href="/{{audit.project|urlencode}}/{{audit.page|urlencode}}/rev{{audit.reference|urlencode}}">{{audit.reference|escape}}</a>
{% elif audit.event[-9:] == '-document' %}
<a href="/special/document/{{audit.reference|urlencode}}?attachment" target="_blank">{{audit.reference|escape}}</a>
{% else %}
?
{% endif %}
{% endif %}
</td>
<td class="pwic_desktop">
{% if audit.string != '' %}
{{audit.string|escape}}
{% elif audit.user != '' %}
<a class="pwic_break" href="/special/user/{{audit.user|urlencode}}" rel="nofollow">{{audit.user|escape}}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% include 'js/page-audit.js' %}
</article>
{% endblock %}

View File

@ -1,17 +0,0 @@
{% extends 'html/main.html' %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}">{{pwic.project_description|escape}}</a></div>
<div class="pwic_ph2"><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/history">{{pwic.emojis.finger_left}} [{{pwic.page|escape}}] {{pwic.title|escape}}</a></div>
</header>
<article>
<h2>Comparison of <a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/rev{{pwic.old_revision|escape}}">revision {{pwic.old_revision|escape}}</a> and <a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/rev{{pwic.new_revision|escape}}">revision {{pwic.new_revision|escape}}</a></h2>
<hr>
{{pwic.diff}}
</article>
{% endblock %}

View File

@ -1,53 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Create a new page{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{{pwic.emojis.finger_left}} {% trans %}Create a new page{% endtrans %}</a></div>
</header>
<article>
{% if pwic.projects|count == 0 %}
<p class="pwic_error">{{pwic.emojis.padlock}} {% trans %}You have no authorization to create a new page. Please contact your manager.{% endtrans %}</p>
{% else %}
<h1>{% trans %}New page{% endtrans %}</h1>
<p><strong>{% trans %}Project:{% endtrans %}</strong><br>
<select id="create_project">
{% for proj in pwic.projects %}
<option value="{{proj.project|escape}}"
{% if proj.project == pwic.default_project %} selected="selected" {% endif %}
>{{proj.description|escape}} [{{proj.project|escape}}]</option>
{% endfor %}
</select>
</p>
<p><strong>{% trans %}Page identifier:{% endtrans %}</strong>
<br><input id="create_kb" type="checkbox"> <label for="create_kb">{% trans %}Generate a knowledge base article{% endtrans %}</label>
<br><input id="create_page" class="pwic_fill" type="text" value="{{pwic.default_page|escape}}" spellcheck="false"></p>
<p><strong>{% trans %}Tags:{% endtrans %}</strong> <input id="create_tags" class="pwic_fill" type="text" title="{% trans %}No hash and separated by a space{% endtrans %}" spellcheck="false"></p>
<p><strong>{% trans %}Milestone:{% endtrans %}</strong> <input id="create_milestone" class="pwic_fill" type="text"></p>
<h1>{% trans %}Copy in reference to another page{% endtrans %}</h1>
<p><strong>{% trans %}Project:{% endtrans %}</strong><br>
<select id="create_ref_project">
<option value=""></option>
{% for p in pwic.projects %}
<option value="{{p.project|escape}}">{{p.description|escape}} [{{p.project|escape}}]</option>
{% endfor %}
</select>
</p>
<p><strong>{% trans %}Page identifier:{% endtrans %}</strong> <input id="create_ref_page" class="pwic_fill" type="text" spellcheck="false"></p>
<p><input id="create_ref_tags" type="checkbox" checked="checked"> <label for="create_ref_tags">{% trans %}Copy and merge the tags{% endtrans %}</label></p>
<p><input type="button" value="{{pwic.emojis.sparkles}} {% trans %}Create the page{% endtrans %}" onclick="create_submit()"></p>
{% include 'js/page-create.js' %}
{% endif %}
</article>
{% endblock %}

View File

@ -1,149 +0,0 @@
{% extends 'html/main.html' %}
{% block header_scripts %}
<link rel="stylesheet" type="text/css" href="/static/codemirror.min.css">
<style>
.CodeMirror { height: 75vh; margin-top: 5px; border: 1px solid black }
</style>
<script src="/static/codemirror_md.min.js"></script>
{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}">{{pwic.emojis.finger_left}} {% trans %}Edit the page{% endtrans %}</a></div>
</header>
<article>
<h1>[{{pwic.page|escape}}] {{pwic.title|escape}}</h1>
{% if not pwic.manager and (pwic.protection or not pwic.editor) %}
<p class="pwic_error">{{pwic.emojis.padlock}} {% trans %}You are not authorized to edit the page.{% endtrans %}</p>
{% else %}
<form id="edit_form" action="/api/page/edit" method="post">
<p><strong><span class="pwic_red">*</span> {% trans %}Title:{% endtrans %}</strong> <input id="edit_title" class="pwic_fill" type="text" value="{{pwic.title|escape}}"></p>
<p><strong>{% trans %}Tags:{% endtrans %}</strong> <input id="edit_tags" class="pwic_fill" type="text" value="{{pwic.tags|escape}}" title="{% trans %}No hash and separated by a space{% endtrans %}" spellcheck="false"></p>
<div id="edit_toolbar">
<div>
<input type="button" value="{{pwic.emojis.glasses}}" title="{% trans %}Preview{% endtrans %}" onclick="edit_preview_md('{{pwic.page|urlencode}}')" data-shortcut="Ctrl-E">
<input type="button" value="{{pwic.emojis.round_arrow_left}}" title="{% trans %}Undo{% endtrans %}" onclick="edit_undo(true)" data-shortcut="Ctrl-Z">
<input type="button" value="{{pwic.emojis.round_arrow_right}}" title="{% trans %}Redo{% endtrans %}" onclick="edit_undo(false)" data-shortcut="Ctrl-Y">
</div>
<div>
<input type="button" value="B" title="** {% trans %}Bold{% endtrans %} **" style="font-weight: bold" onclick="edit_decorate('**', '**')" data-shortcut="Ctrl-B">
<input type="button" value="I" title="* {% trans %}Italic{% endtrans %} *" style="font-style: italic" onclick="edit_decorate('*', '*')" data-shortcut="Ctrl-I">
<input type="button" value="U" title="-- {% trans %}Underline{% endtrans %} --" style="text-decoration: underline" onclick="edit_decorate('--', '--')" data-shortcut="Ctrl-U">
<input type="button" value="S" title="~~ {% trans %}Strikethrough{% endtrans %} ~~" style="text-decoration: line-through" onclick="edit_decorate('~~', '~~')">
<input type="button" value="^2" title="<sup> {% trans %}Superscript{% endtrans %} </sup>" onclick="edit_decorate('<sup>', '</sup>')">
<input type="button" value="_2" title="<sub> {% trans %}Subscript{% endtrans %} </sub>" onclick="edit_decorate('<sub>', '</sub>')">
<input type="button" value="{{pwic.emojis.chains}}" title="[{% trans %}Link{% endtrans %}](url)" onclick="edit_link()" data-shortcut="Ctrl-K">
</div>
<div>
<input type="button" value="abCD" title="{% trans %}Upper/Lower case{% endtrans %}" onclick="edit_switch_case()" data-shortcut="Shift-F3">
<input type="button" value="{{pwic.emojis.double}}" title="{% trans %}No double spaces{% endtrans %}" onclick="edit_double_spaces()">
<input type="button" value="{{pwic.emojis.right}}" title="{% trans %}Shift to the right{% endtrans %}" onclick="edit_prepend(' ')">
<input type="button" value="{{pwic.emojis.left}}" title="{% trans %}Shift to the left{% endtrans %}" onclick="edit_left_line()">
<input type="button" value="{{pwic.emojis.noblank}}" title="{% trans %}No blank line{% endtrans %}" onclick="edit_no_blank_line()">
<input type="button" value="{{pwic.emojis.oneline}}" title="{% trans %}As single line{% endtrans %}" onclick="edit_single_line()">
</div>
<div>
<input type="button" value="H1" title="# {% trans %}Title{% endtrans %} 1" onclick="edit_prepend('# ')" data-shortcut="Shift-Ctrl-F1">
<input type="button" value="H2" title="## {% trans %}Title{% endtrans %} 2" onclick="edit_prepend('## ')" data-shortcut="Shift-Ctrl-F2">
<input type="button" value="H3" title="### {% trans %}Title{% endtrans %} 3" onclick="edit_prepend('### ')" data-shortcut="Shift-Ctrl-F3">
<input type="button" value="H4" title="#### {% trans %}Title{% endtrans %} 4" onclick="edit_prepend('#### ')" data-shortcut="Shift-Ctrl-F4">
<input type="button" value="H5" title="##### {% trans %}Title{% endtrans %} 5" onclick="edit_prepend('##### ')" data-shortcut="Shift-Ctrl-F5">
<input type="button" value="H6" title="###### {% trans %}Title{% endtrans %} 6" onclick="edit_prepend('###### ')" data-shortcut="Shift-Ctrl-F6">
<input type="button" value="{% trans %}Footnote{% endtrans %}" title="[^1] {% trans %}Footnote{% endtrans %}" onclick="edit_footnote()">
<input type="button" value="[{% trans %}Annotation{% endtrans %}]" title="&lt;!-- {% trans %}Annotation{% endtrans %} --&gt;" onclick="edit_decorate('&lt;!-- ', ' --&gt;')">
</div>
<div>
<input type="button" value="{% trans %}Line{% endtrans %}" title="{% trans %}Horizontal line{% endtrans %}" onclick="edit_decorate('\n---\n\n', '')">
<input id="edit_toolbar_table" type="button" value="Table" title="{% trans %}Table{% endtrans %} | {% trans %}Table{% endtrans %}" onclick="edit_table()">
<input type="button" value="{% trans %}AutoTable{% endtrans %}" title="{% trans %}Paste as target table{% endtrans %}" onclick="edit_table_import()">
<input type="button" value="- {% trans %}List{% endtrans %}" title="- {% trans %}Bulleted list{% endtrans %}" onclick="edit_prepend('- ')" data-shortcut="Ctrl-L">
<input type="button" value="1. {% trans %}List{% endtrans %}" title="1. {% trans %}Numbered list{% endtrans %}" onclick="edit_prepend_nlist()">
<input type="button" value="- [X] {% trans %}Tasks{% endtrans %}" onclick="edit_prepend('- [ ] ')">
<input type="button" value="> {% trans %}Quote{% endtrans %}" onclick="edit_prepend('> ')">
<input type="button" value=">! {% trans %}Spoiler{% endtrans %}" onclick="edit_prepend('>! ')">
<input type="button" value="`{% trans %}Keyword{% endtrans %}`" title="`{% trans %}Monospaced keyword{% endtrans %}`" onclick="edit_decorate('`', '`')" data-shortcut="Ctrl-'">
<input type="button" value="{% trans %}Code{% endtrans %}" title="```{% trans %}Code{% endtrans %}```" onclick="edit_decorate('```\n', '\n```')">
{% if pwic.env.emojis %}
<input type="button" value="{{pwic.emojis.bang}}" title="{% trans %}Emojis{% endtrans %}" onclick="$('#edit_emojis').toggleClass('pwic_hidden');md_editor.focus()">
{% endif %}
{% if pwic.env.remote_url %}
<input type="button" value="{{pwic.emojis.recycle}}" title="{% trans %}Fetch a remote web page{% endtrans %}" onclick="edit_convert_remote_document()">
{% endif %}
{% if not pwic.env.no_dictation %}
<input id="edit_toolbar_dictate" type="button" value="{{pwic.emojis.microphone}}" title="{% trans %}Dictate{% endtrans %}">
{% endif %}
</div>
</div>
{% if pwic.env.emojis %}
<div id="edit_emojis" class="pwic_hidden">
{% set list = pwic.emojis_toolbar.split(' ') %}
{% for e in list %}
{% if e|is_hex %}
{% if e[-4:] == 'fe0f' %}
{% set e = '&#x' + e[:-4]|upper + ';&#xFE0F;' %}
{% else %}
{% set e = '&#x' + e|upper + ';' %}
{% endif %}
<span title="{% trans %}Insert{% endtrans %}" onclick="edit_decorate_end('{{e|escape}} ')">{{e}}</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
<textarea id="edit_markdown">{{pwic.markdown|escape}}</textarea>
{% if (not pwic.env.document_size_max) or (pwic.env.document_size_max.value|int > 0) %}
<h2>{% trans %}Documents{% endtrans %}</h2>
<div id="edit_files_drop" ondrop="edit_drop(event)" ondragover="edit_dragover(event)" ondragleave="edit_dragleave(event)">
<input type="button" value="{{pwic.emojis.refresh}}" title="{% trans %}Refresh{% endtrans %}" onclick="edit_refresh_documents()">
<input class="pwic_mobile" type="button" value="{{pwic.emojis.inbox}}" title="{% trans %}Upload a new document{% endtrans %}" onclick="edit_upload_document()" style="margin-left: 15px">
<br>
{% trans %}Drop the files here{% endtrans %}
{% if pwic.env.document_size_max %}
({% trans %}max:{% endtrans %} {{pwic.env.document_size_max.value|size2str|escape}})
{% endif %}
{% trans %}and save immediately{% endtrans %}
</div>
<table id="edit_files_list" class="pwic_break">
<tr>
<th>{% trans %}Action{% endtrans %}</th>
<th>{% trans %}File name{% endtrans %}</th>
<th class="pwic_desktop" title="{% trans %}For the latest saved revision only{% endtrans %}">{% trans %}Used{% endtrans %}</th>
<th>{% trans %}Size{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Format{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th>{% trans %}File{% endtrans %}</th>
</tr>
</table>
{% endif %}
<h2>{% trans %}Attributes{% endtrans %}</h2>
<p><strong><span class="pwic_red">*</span> {% trans %}Reason for the modification:{% endtrans %}</strong> <input id="edit_comment" class="pwic_fill" type="text" placeholder="{{pwic.comment|escape}}"></p>
<p><strong>{% trans %}Milestone:{% endtrans %}</strong> <input id="edit_milestone" class="pwic_fill" type="text" value="{{pwic.milestone|escape}}" title="{% trans %}Free text to report the expected readiness of the page{% endtrans %}"></p>
<p>
<input id="edit_draft" type="checkbox" {% if pwic.draft %}checked="checked"{% endif %} onclick="$('#edit_final').prop('checked', false)"> <label for="edit_draft">{% trans %}Draft{% endtrans %}</label>
<br><input id="edit_final" type="checkbox" onclick="$('#edit_draft').prop('checked', false)"> <label for="edit_final">{% trans %}Final version{% endtrans %}</label>
<br><input id="edit_header" type="checkbox" {% if pwic.header %}checked="checked"{% endif %} {% if not pwic.manager %}disabled="disabled"{% endif %}> <label for="edit_header">{% trans %}Header line *{% endtrans %}</label>
<br><input id="edit_protection" type="checkbox" {% if pwic.protection %}checked="checked"{% endif %} {% if not pwic.manager %}disabled="disabled"{% endif %}> <label for="edit_protection">{% trans %}Protected page *{% endtrans %}</label>
</p>
<p>
<input id="edit_submit" type="button" value="{{pwic.emojis.save}} {% trans %}Save the modifications{% endtrans %}" onclick="edit_submit_form()">
<input id="edit_preview" type="button" value="{{pwic.emojis.glasses}} {% trans %}Preview{% endtrans %}" onclick="edit_preview_md('{{pwic.page|urlencode}}')">
</p>
</form>
{% include 'js/page-edit.js' %}
{% endif %}
</article>
{% endblock %}

View File

@ -1,37 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Project-dependent environment variables{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Project-dependent settings{% endtrans %}</a></div>
<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
</header>
<article>
<p>{% trans %}The following settings are changeable online and they are applicable to the current project only.{% endtrans %}</p>
<p>{{ gettext('Refer to your administrator to configure the <a href="/%(project)s/special/audit">other environment variables</a> (whose details are available in the <a href="/special/help#help_setup">help page</a>), or if you want a setting to apply once for all the projects hosted on the server.')|format(project=pwic.project|urlencode) }}</p>
<table>
<tr>
<th style="width:33%">{% trans %}Variable{% endtrans %}</th>
<th style="width:67%">{% trans %}Value{% endtrans %}</th>
</tr>
{% for key in pwic.changeable_vars %}
<tr>
<td><code>{{key|escape}}</code></td>
<td style="padding-right: 10px">
<input class="pwic_fill" type="text" data-key="{{key|escape}}">
<input type="button" data-key="{{key|escape}}" value="{{pwic.emojis.save}} {% trans %}Save{% endtrans %}">
</td>
</tr>
{% endfor %}
</table>
<p class="pwic_center"><a href="env" onclick="return confirm({% trans %}'Are you sure to reset the current changes?'{% endtrans %})">{% trans %}Cancel the current modifications{% endtrans %}</a></p>
</article>
{% include 'js/page-env.js' %}
{% endblock %}

View File

@ -1,19 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Graph of the project{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Visual representation of the pages{% endtrans %}</a></div>
<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
</header>
<article>
<p><input type="button" value="{{pwic.emojis.inbox}} {% trans %}Download as a file{% endtrans %}" onclick="graph_get_data('download')"></p>
<div id="graph_viz"></div>
{% include 'js/page-graph.js' %}
</article>
{% endblock %}

View File

@ -1,50 +0,0 @@
{% extends 'html/main.html' %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}">{{pwic.emojis.finger_left}} {% trans %}History of the modifications{% endtrans %}</a></div>
<div class="pwic_ph2"><a href="/{{pwic.project|urlencode}}">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</a></div>
</header>
{% include 'js/page-history.js' %}
<article>
<h1>[{{pwic.page|escape}}] {{pwic.title|escape}}</h1>
<table>
<tr>
<th class="pwic_js"><span class="pwic_desktop">{% trans %}Compare{% endtrans %}</span></th>
<th>{% trans %}Rev<span class="pwic_desktop">ision</span>{% endtrans %}</th>
<th>{% trans %}Flags{% endtrans %}</th>
<th>{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Milestone{% endtrans %}</th>
</tr>
{% for rev in pwic.revisions %}
<tr>
<td class="pwic_js"><input type="checkbox" data-revision="{{rev.revision|escape}}" onclick="return history_compare()"></td>
<td><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/rev{{rev.revision|urlencode}}">{{rev.revision|escape}}</a></td>
<td>
{% if rev.draft %}
<span title="{% trans %}Draft{% endtrans %}">{{pwic.emojis.hourglass}}</span>
{% endif %}
{% if rev.final %}
<span title="{% trans %}Marked as final{% endtrans %}">{{pwic.emojis.notes}}</span>
{% endif %}
{% if rev.valuser != '' %}
<span title="{{ gettext('Validated by %(valuser)s on %(valdate)s at %(valtime)s.')|format(valuser=rev.valuser|escape, valdate=rev.valdate|escape, valtime=rev.valtime|escape) }}">{{pwic.emojis.flag}}</span>
{% endif %}
</td>
<td><a class="pwic_break" href="/special/user/{{rev.author|urlencode}}" rel="nofollow">{{rev.author|escape}}</a></td>
<td>{{rev.date|escape}}</td>
<td class="pwic_desktop">{{rev.time|escape}}</td>
<td>{{rev.comment|escape}}</td>
<td class="pwic_desktop">{{rev.milestone|escape}}</td>
</tr>
{% endfor %}
</table>
</article>
{% endblock %}

View File

@ -1,68 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Report of the links{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Verification of the links{% endtrans %}</a></div>
<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
</header>
<article>
<h1>{% trans %}Orphaned pages{% endtrans %}</h1>
{% if pwic.orphans|count == 0 %}
<p>{% trans %}You have no orphaned page.{% endtrans %}</p>
{% else %}
<p>{% trans %}These pages cannot be reached by simple clicks but are still referenced by the search engine.{% endtrans %}</p>
<ul>
{% for page in pwic.orphans %}
<li><a href="/{{pwic.project|urlencode}}/{{page|urlencode}}">{{page|escape}}</a></li>
{% endfor %}
</ul>
{% endif %}
<h1>{% trans %}Broken links to a page{% endtrans %}</h1>
{% if pwic.broken|count == 0 %}
<p>{% trans %}You have no broken link to a page.{% endtrans %}</p>
{% else %}
<p>{% trans %}A broken link displays the error 404 because the targeted page does not exist.{% endtrans %}</p>
<table class="pwic_fit">
<tr>
<th>{% trans %}Page{% endtrans %}</th>
<th>{% trans %}Non-existent page{% endtrans %}</th>
</tr>
{% for page in pwic.broken %}
<tr>
<td><a href="/{{pwic.project|urlencode}}/{{page[0]|urlencode}}">{{page[0]|escape}}</a></td>
<td>{{pwic.emojis.sheet}} <a href="/{{pwic.project|urlencode}}/special/page?page={{page[1]|urlencode}}" title="{% trans %}Create the page{% endtrans %}">{{page[1]|escape}}</a></td>
</tr>
{% endfor %}
</table>
<p class="pwic_italic">{% trans %}Note: the table does not check the links to the other projects.{% endtrans %}</p>
{% endif %}
<h1>{% trans %}Broken links to a document{% endtrans %}</h1>
{% if pwic.broken_docs|count == 0 %}
<p>{% trans %}You have no broken link to a document.{% endtrans %}</p>
{% else %}
<p>{% trans %}Managing the files without updating the pages may result in invalid links.{% endtrans %}</p>
<table class="pwic_fit">
<tr>
<th>{% trans %}Page{% endtrans %}</th>
<th>{% trans %}Non-existent document{% endtrans %}</th>
</tr>
{% for page in pwic.broken_docs %}
<tr>
<td><a href="/{{pwic.project|urlencode}}/{{page|urlencode}}/edit">{{page|escape}}</a></td>
<td>{{pwic.broken_docs[page]|sort|join(', ')|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</article>
{% endblock %}

View File

@ -1,58 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Move a page{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}">{{pwic.emojis.finger_left}} {% trans %}Move the page and its attachments{% endtrans %}</a></div>
</header>
<article>
<h1>[{{pwic.project|escape}}/{{pwic.page|escape}}] {{pwic.title|escape}}</h1>
<input id="move_src_project" type="hidden" value="{{pwic.project|escape}}">
<input id="move_src_page" type="hidden" value="{{pwic.page|escape}}">
<p><strong>{% trans %}Target project:{% endtrans %}</strong><br>
<select id="move_dst_project">
{% for proj in pwic.projects %}
<option value="{{proj.project|escape}}"
{% if proj.project == pwic.project %} selected="selected" {% endif %}
>{{proj.description|escape}} [{{proj.project|escape}}]</option>
{% endfor %}
</select>
</p>
<p><strong>{% trans %}Target page identifier:{% endtrans %}</strong> <input id="move_dst_page" class="pwic_fill" type="text" placeholder="{{pwic.page|escape}}" spellcheck="false"></p>
<p><input type="button" value="{{pwic.emojis.truck}} {% trans %}Move the page{% endtrans %}" onclick="move_submit()"></p>
<p class="pwic_italic">
{% trans %}This form can be used to rename an existing page.{% endtrans %}
{% if pwic.relations|count > 0 %}
{% trans %}No link will be updated within the following pages:{% endtrans %}
{% endif %}
</p>
{% if pwic.relations|count > 0 %}
<table>
<tr>
<th>{% trans %}Link{% endtrans %}</th>
<th>{% trans %}Title{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
</tr>
{% for row in pwic.relations %}
<tr>
<td><a href="/{{row.project|urlencode}}/{{row.page|urlencode}}">/{{row.project|escape}}/{{row.page|escape}}</a></td>
<td>{{row.title|escape}}</td>
<td>{{row.date|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% include 'js/page-move.js' %}
</article>
{% endblock %}

View File

@ -1,261 +0,0 @@
{% extends 'html/main.html' %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}">{{pwic.emojis.finger_up}} {{pwic.project_description|escape}}</a></div>
{% if (not pwic.env.no_search) or (pwic.links|count > 0) %}
<div class="pwic_tagbox">
{% for link in pwic.links %}
<a href="/{{pwic.project|urlencode}}/{{link.page|urlencode}}">{{link.title|escape}}</a>
{% endfor %}
{% if not pwic.env.no_search %}
<div class="pwic_searchbox pwic_js">
{{pwic.emojis.search}}
<input type="text" id="page_search" onkeypress="page_search()">
</div>
{% endif %}
</div>
{% endif %}
</header>
{% if not pwic.env.no_search %}
{% include 'js/search.js' %}
{% endif %}
<article>
{% if pwic.env.maintenance %}
<div class="pwic_error">{{pwic.emojis.calendar}} {{pwic.env.maintenance.value|escape}}</div>
{% endif %}
{% if pwic.env.message %}
<div class="pwic_information">{{pwic.emojis.pin}} {{pwic.env.message.value|escape}}</div>
{% endif %}
<div class="pwic_action_bar">
{% if pwic.admin %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/user">{{pwic.emojis.users}} {% trans %}New user{% endtrans %}</a>
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/roles">{{pwic.emojis.key}} {% trans %}Roles{% endtrans %}</a>
<a href="/{{pwic.project|urlencode}}/special/audit">{{pwic.emojis.glasses}} {% trans %}Audit{% endtrans %}</a>
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/env">{{pwic.emojis.pill}} {% trans %}Settings{% endtrans %}</a>
{% endif %}
{% if pwic.manager %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/page">{{pwic.emojis.sparkles}} {% trans %}New page{% endtrans %}</a>
{% endif %}
{% if not pwic.env.no_feed and (not pwic.pure_reader or not pwic.env.no_history) %}
<a href="/{{pwic.project|urlencode}}/special/feed/atom">{{pwic.emojis.atom}} {% trans %}ATOM{% endtrans %}</a>
<a href="/{{pwic.project|urlencode}}/special/feed/rss">{{pwic.emojis.rss}} {% trans %}RSS{% endtrans %}</a>
{% endif %}
{% if pwic.manager %}
{% if not pwic.env.no_link_review %}
<a href="/{{pwic.project|urlencode}}/special/links">{{pwic.emojis.chains}} {% trans %}Links{% endtrans %}</a>
{% endif %}
{% if not pwic.env.no_graph %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/graph">{{pwic.emojis.globe}} {% trans %}Graph{% endtrans %}</a>
{% endif %}
{% endif %}
{% if pwic.admin and not pwic.env.no_export_project %}
<a class="pwic_desktop" href="/{{pwic.project|urlencode}}/special/export/zip" title="{{ gettext('Export to format %(format)s')|format(format='ZIP') }}">{{pwic.emojis.clamp}} ZIP</a>
{% endif %}
<a class="pwic_js" href="/api">{{pwic.emojis.brick}} {% trans %}API{% endtrans %}</a>
<a href="/{{pwic.project|urlencode}}/special/random">{{pwic.emojis.dice}} {% trans %}Random page{% endtrans %}</a>
</div>
{% if pwic.env.support_email or pwic.env.support_phone or pwic.env.support_url or pwic.env.support_text %}
<h1>{% trans %}Internal support{% endtrans %}</h1>
{% include 'html/block-support.html' %}
{% endif %}
{% if pwic.recents|count > 0 %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#page_updates_list').toggleClass('pwic_hidden')">{% trans %}Recent updates{% endtrans %}</h1>
<table id="page_updates_list">
<tr>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th>{% trans %}Page{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Milestone{% endtrans %}</th>
</tr>
{% for recent in pwic.recents %}
<tr>
<td class="pwic_nowrap">{{recent.date|escape}}</td>
<td class="pwic_desktop">{{recent.time|escape}}</td>
<td><a href="/{{pwic.project|urlencode}}/{{recent.page|urlencode}}">{{recent.title|escape}}</a></td>
<td class="pwic_desktop"><a class="pwic_break" href="/special/user/{{recent.author|urlencode}}" rel="nofollow">{{recent.author|escape}}</a></td>
<td>{{recent.comment|escape}}</td>
<td class="pwic_desktop">{{recent.milestone|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if pwic.admins|count + pwic.managers|count + pwic.editors|count + pwic.validators|count + pwic.readers|count > 0 %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#page_members_list').toggleClass('pwic_hidden')">{% trans %}Team members{% endtrans %}</h1>
<ul id="page_members_list">
{% if pwic.admins|count > 0 %}
<li><strong>{% trans %}Administrators:{% endtrans %}</strong>
{% for admin in pwic.admins %}
<a href="/special/user/{{admin|urlencode}}" rel="nofollow">{{admin|escape}}</a>
{% endfor %}
</li>
{% endif %}
{% if pwic.managers|count > 0 %}
<li><strong>{% trans %}Managers:{% endtrans %}</strong>
{% for manager in pwic.managers %}
<a href="/special/user/{{manager|urlencode}}" rel="nofollow">{{manager|escape}}</a>
{% endfor %}
</li>
{% endif %}
{% if pwic.editors|count > 0 %}
<li><strong>{% trans %}Editors:{% endtrans %}</strong>
{% for editor in pwic.editors %}
<a href="/special/user/{{editor|urlencode}}" rel="nofollow">{{editor|escape}}</a>
{% endfor %}
</li>
{% endif %}
{% if pwic.validators|count > 0 %}
<li><strong>{% trans %}Validators:{% endtrans %}</strong>
{% for validator in pwic.validators %}
<a href="/special/user/{{validator|urlencode}}" rel="nofollow">{{validator|escape}}</a>
{% endfor %}
</li>
{% endif %}
{% if pwic.readers|count > 0 %}
<li><strong>{% trans %}Readers:{% endtrans %}</strong>
{% if pwic.readers|count > 100 %}
too many users.
{% else %}
{% for reader in pwic.readers %}
<a href="/special/user/{{reader|urlencode}}" rel="nofollow">{{reader|escape}}</a>
{% endfor %}
{% endif %}
</li>
{% endif %}
</ul>
{% endif %}
{% if (pwic.pages|count > 0) and (not pwic.user|reserved_user_name) %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#page_pages_list').toggleClass('pwic_hidden')">{% trans %}All the pages of the project{% endtrans %}</h1>
<table id="page_pages_list">
<tr>
<th>{% trans %}Page{% endtrans %}</th>
<th>{% trans %}Title{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Revision{% endtrans %}</th>
<th>{% trans %}Flags{% endtrans %}</th>
<th>{% trans %}Author{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Milestone{% endtrans %}</th>
</tr>
{% for page in pwic.pages %}
<tr>
<td>{{page.page|escape}}</td>
<td><a href="/{{pwic.project|urlencode}}/{{page.page|urlencode}}">{{page.title|escape}}</a></td>
<td class="pwic_desktop">{{page.revision|escape}}</td>
<td>
{% if page.draft %}
<span title="{% trans %}Draft{% endtrans %}">{{pwic.emojis.hourglass}}</span>
{% endif %}
{% if page.final %}
<span title="{% trans %}Marked as final{% endtrans %}">{{pwic.emojis.notes}}</span>
{% endif %}
{% if page.valuser != '' %}
<span title="{{ gettext('Validated by %(valuser)s on %(valdate)s at %(valtime)s.')|format(valuser=page.valuser|escape, valdate=page.valdate|escape, valtime=page.valtime|escape) }}">{{pwic.emojis.flag}}</span>
{% endif %}
</td>
<td><a class="pwic_break" href="/special/user/{{page.author|urlencode}}" rel="nofollow">{{page.author|escape}}</a></td>
<td class="pwic_desktop pwic_nowrap">{{page.date|escape}}</td>
<td class="pwic_desktop">{{page.time|escape}}</td>
<td class="pwic_desktop">{{page.milestone|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if (pwic.tags|count > 0) and (not pwic.user|reserved_user_name) %}
<h1 class="pwic_js">{% trans %}Progress by tag{% endtrans %}</h1>
<div id="page_progress_tags" class="pwic_tagbox pwic_js">
<a href="#" title="{% trans %}Select all{% endtrans %}">{{pwic.emojis.check}}</a>
<a href="#" title="{% trans %}Deselect all{% endtrans %}">{{pwic.emojis.red_check}}</a>
<a class="pwic_spacer" href="#" title="{% trans %}Combined selection{% endtrans %}">{{pwic.emojis.paperclip}}</a>
{% for tag in pwic.tags %}
<a href="#" title="{% trans %}De/Select this tag{% endtrans %}">#{{tag|escape}}</a>
{% endfor %}
</div>
<table id="page_progress_list" class="pwic_hidden">
<tr>
<th>{% trans %}Tag{% endtrans %}</th>
<th>{% trans %}Draft{% endtrans %}</th>
<th class="pwic_desktop">{{pwic.emojis.updown}}</th>
<th>{% trans %}Step{% endtrans %}</th>
<th class="pwic_desktop">{{pwic.emojis.updown}}</th>
<th>{% trans %}Final{% endtrans %}</th>
<th class="pwic_desktop">{{pwic.emojis.updown}}</th>
<th>{% trans %}Validated{% endtrans %}</th>
<th class="pwic_desktop">{{pwic.emojis.updown}}</th>
</tr>
</table>
{% include 'js/page-special-progress.js' %}
{% endif %}
{% if (pwic.documents|count > 0) and (not pwic.user|reserved_user_name) %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#page_documents_space, #page_documents_list').toggleClass('pwic_hidden')">{% trans %}All the documents of the project{% endtrans %}</h1>
<p id="page_documents_space" class="pwic_center"><strong>{% trans %}Disk space usage:{% endtrans %}</strong>
{% if pwic.disk_space.project_max > 0 %}
<span class="pwic_progressbar">
<span style="width:{{pwic.disk_space.percentage|escape}}%">&nbsp;</span>
</span>
<span class="pwic_nowrap">{{pwic.disk_space.used|size2str|escape}} / {{pwic.disk_space.project_max|size2str|escape}} ({{pwic.disk_space.percentage|escape}} %)</span>
{% else %}
{{pwic.disk_space.used|size2str|escape}}
{% endif %}
</p>
<table id="page_documents_list">
<tr>
<th class="pwic_desktop">{% trans %}Page{% endtrans %}</th>
<th>{% trans %}File name{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Format{% endtrans %}</th>
<th>{% trans %}Size{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Hash{% endtrans %}</th>
<th>{% trans %}Author{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th><span class="pwic_desktop">{% trans %}Download{% endtrans %}</span></th>
</tr>
{% for doc in pwic.documents %}
<tr>
<td class="pwic_desktop"><a href="/{{doc.project|urlencode}}/{{doc.page|urlencode}}">{{doc.page|escape}}</a></td>
<td>
<a class="pwic_break" href="/special/document/{{doc.id|urlencode}}/{{doc.filename|urlencode}}">{{doc.filename|escape}}</a>
{% if doc.exturl != ''%}
<span title="{% trans %}External storage{% endtrans %}">{{pwic.emojis.cloud}}</span>
{% endif%}
</td>
<td class="pwic_desktop" title="{{doc.mime|escape}}">{{doc.mime_icon}} {{doc.extension|upper}}</td>
<td data-sort="{{doc.size|escape}}">{{doc.size|size2str|escape}}</td>
<td class="pwic_desktop">
<span title="{{doc.hash|escape}}">{{doc.hash[:8]|escape}}</span>
{% if doc.occurrence > 1 %}
<span title="{% trans %}Duplicate file{% endtrans %}">{{pwic.emojis.gemini}}</span>
{% endif %}
</td>
<td><a class="pwic_break" href="/special/user/{{doc.author|urlencode}}" rel="nofollow">{{doc.author|escape}}</a></td>
<td class="pwic_desktop pwic_nowrap">{{doc.date|escape}}</td>
<td class="pwic_desktop">{{doc.time|escape}}</td>
<td><a href="/special/document/{{doc.id|urlencode}}?attachment">{{pwic.emojis.inbox}}</a></td>
</tr>
{% endfor %}
</table>
{% endif %}
</article>
{% endblock %}

View File

@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>API specification for Pwic.wiki</title>
<link rel="stylesheet" type="text/css" href="/static/api/swagger-ui.css" >
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="/static/api/swagger-ui-bundle.js"></script>
<script src="/static/api/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: '/static/api/swagger.txt',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: 'StandaloneLayout'
});
window.ui = ui;
};
</script>
</body>
</html>

View File

@ -1,192 +0,0 @@
{% extends 'html/main.html' %}
{% block header_scripts %}
{% if pwic.env.mathjax %}
<script>
window.MathJax = {
tex: { inlineMath: [['$', '$'], ['\\(', '\\)']] },
svg: { fontCache: 'global' }
};
</script>
<script src="/static/mathjax.min.js" async></script>
{% endif %}
{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{% if pwic.page != pwic.constants['default_home'] %}{{pwic.project|urlencode}}{% endif %}">{{pwic.project_description|escape}}</a></div>
{% if (not pwic.env.no_search) or (pwic.links|count > 0) %}
<div class="pwic_tagbox">
{% for link in pwic.links %}
<a href="/{{pwic.project|urlencode}}/{{link.page|urlencode}}">{{link.title|escape}}</a>
{% endfor %}
{% if not pwic.env.no_search %}
<div class="pwic_searchbox pwic_js">
{{pwic.emojis.search}}
<input type="text" id="page_search" onkeypress="page_search()">
</div>
{% endif %}
</div>
{% endif %}
</header>
<article>
<div id="pwic_progress"></div>
{% if pwic.env.maintenance %}
<div class="pwic_error">{{pwic.emojis.calendar}} {{pwic.env.maintenance.value|escape|replace('\\n','<br>')}}</div>
{% endif %}
{% if pwic.env.message %}
<div class="pwic_information">{{pwic.emojis.pin}} {{pwic.env.message.value|escape|replace('\\n','<br>')}}</div>
{% endif %}
<div class="pwic_action_bar">
{% if pwic.protection %}
<span title="{% trans %}The page is protected{% endtrans %}">{{pwic.emojis.padlock}}</span>
{% endif %}
<a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.star}} {% trans %}Special{% endtrans %}</a>
{% if pwic.manager %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/special/page">{{pwic.emojis.sparkles}} {% trans %}New page{% endtrans %}</a>
{% endif %}
{% if pwic.latest and (pwic.manager or (pwic.editor and not pwic.protection)) %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/edit">{{pwic.emojis.set_square}} {% trans %}Edit{% endtrans %}</a>
{% endif %}
{% if not pwic.pure_reader or not pwic.env.no_history %}
<a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/history">{{pwic.emojis.clock}} {% trans %}History{% endtrans %}</a>
{% endif %}
{% if pwic.manager %}
<a class="pwic_js" href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/move">{{pwic.emojis.truck}} {% trans %}Move{% endtrans %}</a>
{% endif %}
<a class="pwic_js" href="#" onclick="return page_email()">{{pwic.emojis.outbox}} {% trans %}Email{% endtrans %}</a>
{% if not pwic.env.no_printing %}
<a class="pwic_desktop pwic_js" href="#" onclick="return page_print()">{{pwic.emojis.printer}} {% trans %}Print{% endtrans %}</a>
{% endif %}
{% set no_formats = pwic.env.get('file_formats_disabled', {'value': ''}).value.split(' ') %}
{% if '*' not in no_formats %}
{% for f in pwic.file_formats %}
{% if f not in no_formats %}
<a class="pwic_js" href="#" title="{% trans %}Export to{% endtrans %} {{f|escape|upper}}" onclick="return page_export('{{f|escape}}')">{{pwic.emojis.save}} {{f|escape|upper}}</a>
{% endif %}
{% endfor %}
{% endif %}
{% if pwic.validator and (pwic.valuser == '') and pwic.final %}
<a class="pwic_js" href="#" onclick="return page_post_action('validate', {% trans %}'The validation cannot be undone.\n\nDo you want to continue?'{% endtrans %})">{{pwic.emojis.validate}} {% trans %}Validate{% endtrans %}</a>
{% endif %}
{% if pwic.removable %}
<a class="pwic_js" href="#" onclick="return page_post_action('delete', {% trans %}'Warning: deleting the revision cannot be undone.\n\nDo you want to continue?'{% endtrans %})">{{pwic.emojis.trashcan}} {% trans %}Delete{% endtrans %}</a>
{% endif %}
</div>
{% if not pwic.latest %}
<p class="pwic_warning">{{pwic.emojis.eye}}
{% if pwic.env.validated_only %}
{{ gettext('You are viewing the <span class="pwic_bold">revision %(revision)d</span> and <a href="/%(project)s/%(page)s/history">other revisions</a> are pending.')|format(revision=pwic.revision, project=pwic.project|urlencode, page=pwic.page|urlencode) }}
{% else %}
{{ gettext('You are viewing the <span class="pwic_bold">revision %(revision)d</span>, but the <a href="/%(project)s/%(page)s">latest version</a> is available.')|format(revision=pwic.revision, project=pwic.project|urlencode, page=pwic.page|urlencode) }}
{% endif %}
</p>
{% endif %}
{% if pwic.valuser != '' %}
<p class="pwic_information">{{pwic.emojis.flag}} {{ gettext('This page has been validated by <a href="/special/user/%(user1)s" rel="nofollow">%(user2)s</a> on %(sdate)s at %(stime)s.')|format(user1=pwic.valuser|urlencode, user2=pwic.valuser|escape, sdate=pwic.valdate|escape, stime=pwic.valtime|escape) }}</p>
{% endif %}
{% if pwic.tmap|count + pwic.documents|count > 1 %}
<div id="pwic_browser_access" class="pwic_js" title="{% trans %}Show/Hide the map of the page{% endtrans %}" onclick="page_tmap()">
{{pwic.emojis.pin}}
</div>
<div id="pwic_browser" class="pwic_hidden">
{% for tmap in pwic.tmap %}
<a class="pwic_browser_item pwic_browser_item_h{{tmap.level}}" href="#{{tmap.tag|urlencode}}" onclick="page_tmap()">{% if not pwic.env.no_heading %}<span class="pwic_bold">{{tmap.header|escape}}</span> {% endif %}{{tmap.title|no_html|escape}}</a>
{% endfor %}
{% if not pwic.env.no_document_list and (pwic.documents|count + pwic.images|count > 0) %}
<a class="pwic_browser_item pwic_browser_item_h1" href="#page_documents" onclick="page_tmap()">{{pwic.emojis.scroll}} {% trans %}Attached documents{% endtrans %}</a>
{% endif %}
</div>
{% endif %}
{% if pwic.relations|count > 0 %}
<p id="pwic_relations">
<span class="pwic_bold">{% trans %}Related pages:{% endtrans %}</span>
{% for p in pwic.relations %}
{% if loop.index > 1 %} &ndash; {% endif %}
<a href="{{p[0]|escape}}">{{p[1]|escape}}</a>
{% endfor %}
</p>
{% endif %}
{% if pwic.tags|count > 0 %}
<div class="pwic_tagbox">
{% for tag in pwic.tags %}
{% if pwic.env.no_search %}
<a href="#" onclick="return false">#{{tag|escape}}</a>
{% else %}
<a href="/{{pwic.project|urlencode}}/special/search?q=%23{{tag|urlencode}}" title="{% trans %}Search for related classified pages{% endtrans %}">#{{tag|escape}}</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
{{pwic.html}}
{% if not pwic.env.no_document_list and (pwic.documents|count + pwic.images|count > 0) %}
<h1 id="page_documents" class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#page_section_files').toggleClass('pwic_hidden')">{% trans %}Attached documents{% endtrans %}</h1>
<div id="page_section_files">
{% if pwic.documents|count > 0 %}
<div class="pwic_file_gallery">
{% if pwic.documents|count + pwic.images|count > 1 %}
<a href="/{{pwic.project|urlencode}}/special/documents/{{pwic.page|urlencode}}" rel="nofollow">
<span>{% trans %}Download all{% endtrans %}</span>
<br>{{pwic.emojis.inbox}}
</a>
{% endif %}
{% for doc in pwic.documents %}
<a href="/special/document/{{doc.id|urlencode}}/{{doc.filename|urlencode}}" title="{{ gettext('Uploaded by %(author)s on %(date)s at %(time)s.')|format(author=doc.author|escape, date=doc.date|escape, time=doc.time|escape) }}">
<span>{{doc.filename|escape}}</span>
<br><small>{{doc.mime|escape}}</small> ({{doc.size|size2str|escape}})
</a>
{% endfor %}
</div>
{% endif %}
{% if pwic.images|count > 0 %}
<div class="pwic_file_gallery">
{% if (pwic.documents|count == 0) and (pwic.images|count > 1) %}
<a href="/{{pwic.project|urlencode}}/special/documents/{{pwic.page|urlencode}}" rel="nofollow">
<span>{% trans %}Download all{% endtrans %}</span>
<br>{{pwic.emojis.inbox}}
</a>
{% endif %}
{% for doc in pwic.images %}
<a href="/special/document/{{doc.id|urlencode}}/{{doc.filename|urlencode}}" title="{{ gettext('Uploaded by %(author)s on %(date)s at %(time)s.')|format(author=doc.author|escape, date=doc.date|escape, time=doc.time|escape) }}">
<span>{{doc.filename|escape}}</span>
<br><small>{{doc.mime|escape}}</small> ({{doc.size|size2str|escape}})
</a>
{% endfor %}
</div>
{% endif %}
</div>
{% endif %}
<p id="page_lastmod">
{{ gettext('Revision <span class="pwic_bold">#%(revision)d</span> was last modified by <a href="/special/user/%(author1)s" rel="nofollow">%(author2)s</a><br>on %(date)s at %(time)s &mdash; <span title="Hash: %(hash)s">%(shash)s</span>')|format(revision=pwic.revision, author1=pwic.author|urlencode, author2=pwic.author|escape, date=pwic.date|escape, time=pwic.time|escape, hash=pwic.hash|escape, shash=pwic.hash[:16]|escape) }}
</p>
{% if pwic.env.legal_notice %}
<div id="page_legal_notice">{{pwic.env.legal_notice.value|escape|replace('\n','<br>')}}</div>
{% endif %}
</article>
<!-- Scripts -->
{% include 'js/page.js' %}
{% if not pwic.env.no_search %}
{% include 'js/search.js' %}
{% endif %}
{% endblock %}

View File

@ -1,22 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}No access{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{{pwic.emojis.finger_up}} [{{pwic.project|escape}}] {% trans %}Access denied{% endtrans %}</a></div>
</header>
<article>
<p class="pwic_error">{{pwic.emojis.red_check}} {% trans %}You don't have the authorizations to access this project.{% endtrans %}</p>
{% if pwic.env.support_email or pwic.env.support_phone or pwic.env.support_url or pwic.env.support_text %}
<p>{% trans %}To request your access, get in touch with the support team:{% endtrans %}</p>
{% include 'html/block-support.html' %}
{% else %}
<p>{% trans %}Unfortunately, there is no defined support information to request your access.{% endtrans %}</p>
{% endif %}
</article>
{% endblock %}

View File

@ -1,62 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Select your project{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1">{{pwic.emojis.home}} {% trans %}Select your project{% endtrans %}</div>
</header>
<article>
<div class="pwic_action_bar">
<a class="pwic_js" href="/api">{{pwic.emojis.brick}} {% trans %}API{% endtrans %}</a>
{% if not pwic.env.no_help %}
<a href="/special/help">{{pwic.emojis.help}} {% trans %}Help{% endtrans %}</a>
{% endif %}
</div>
{% if (pwic.projects|count + pwic.joinable_projects|count) == 0 %}
<p>{% trans %}Unfortunately, you have access to no project at all.{% endtrans %}</p>
{% endif %}
{% if pwic.projects|count > 0 %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#projects_1').toggleClass('pwic_hidden')">{% trans %}Joined projects{% endtrans %}</h1>
<table id="projects_1">
<tr>
<th>{% trans %}Project{% endtrans %}</th>
<th>{% trans %}Description{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Last activity{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Creation date{% endtrans %}</th>
</tr>
{% for p in pwic.projects %}
<tr>
<td>{{p.project|escape}}</td>
<td><a href="/{{p.project|urlencode}}">{{p.description|escape}}</a></td>
<td class="pwic_desktop">{{(p.last_activity or '-')|escape}}</td>
<td class="pwic_desktop">{{p.date|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if pwic.joinable_projects|count > 0 %}
<h1 class="pwic_cursor" title="{% trans %}Expand/Collapse{% endtrans %}" onclick="$('#projects_2').toggleClass('pwic_hidden')">{% trans %}Available public projects{% endtrans %}</h1>
<table id="projects_2">
<tr>
<th>{% trans %}Project{% endtrans %}</th>
<th>{% trans %}Description{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Date{% endtrans %}</th>
</tr>
{% for p in pwic.joinable_projects %}
<tr>
<td>{{p.project|escape}}</td>
<td><a href="/{{p.project|urlencode}}">{{p.description|escape}}</a></td>
<td class="pwic_desktop">{{p.date|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</article>
{% endblock %}

View File

@ -1,100 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Search{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}">{{pwic.emojis.finger_left}} {{pwic.project_description|escape}}</a></div>
</header>
{% include 'js/search.js' %}
<article>
<h1>{{pwic.pages|count + pwic.documents|count}} {% trans %}results{% endtrans %}</h1>
<p>{% trans %}Search terms:{% endtrans %}
<input id="page_search" class="pwic_fill" type="text" value="{{pwic.terms|escape}}" onkeypress="page_search()">
{% if not pwic.pure_reader or not pwic.env.no_history %}
<span class="pwic_js">
<input id="page_search_withrev" type="checkbox" {% if 'rev' in pwic.args %}checked="checked"{% endif %} onclick="page_start_search()">
<label for="page_search_withrev">{% trans %}Include the old revisions{% endtrans %}</label>,
</div>
{% endif %}
<span class="pwic_js">
<input id="page_search_casesensitive" type="checkbox" {% if 'cs' in pwic.args %}checked="checked"{% endif %} onclick="page_start_search()">
<label for="page_search_casesensitive">{% trans %}Case-sensitive{% endtrans %}</label>
</div>
</p>
{% if pwic.pages|count > 0 %}
<h2>{% trans %}Pages{% endtrans %}</h2>
<table>
<tr>
<th>{% trans %}Page{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Revision{% endtrans %}</th>
<th>{% trans %}Title{% endtrans %}</th>
<th>{% trans %}Flags{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Score{% endtrans %}</th>
</tr>
{% for page in pwic.pages %}
<tr>
<td>{{page.page|escape}}</td>
<td class="pwic_desktop">{{page.revision|escape}}</td>
<td><a href="/{{page.project|urlencode}}/{{page.page|urlencode}}{% if not page.latest %}/rev{{page.revision|urlencode}}{% endif %}">{{page.title|escape}}</a></td>
<td>
{% if pwic.with_rev and page.latest %}
<span title="{% trans %}Latest{% endtrans %}">{{pwic.emojis.watch}}</span>
{% endif %}
{% if page.draft %}
<span title="{% trans %}Draft{% endtrans %}">{{pwic.emojis.hourglass}}</span>
{% endif %}
{% if page.final %}
<span title="{% trans %}Marked as final{% endtrans %}">{{pwic.emojis.notes}}</span>
{% endif %}
{% if page.valuser != '' %}
<span title="{{ gettext('Validated by %(valuser)s on %(valdate)s at %(valtime)s.')|format(valuser=page.valuser|escape, valdate=page.valdate|escape, valtime=page.valtime|escape) }}">{{pwic.emojis.flag}}</span>
{% endif %}
</td>
<td class="pwic_desktop"><a class="pwic_break" href="/special/user/{{page.author|urlencode}}" rel="nofollow">{{page.author|escape}}</a></td>
<td>{{page.date|escape}}</td>
<td class="pwic_desktop">{{page.time|escape}}</td>
<td class="pwic_desktop">{{page.score|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if pwic.documents|count > 0 %}
<h2>{% trans %}Documents{% endtrans %}</h2>
<table>
<tr>
<th>{% trans %}Page{% endtrans %}</th>
<th>{% trans %}File name{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Format{% endtrans %}</th>
<th>{% trans %}Size{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Author{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<!-- <th class="pwic_desktop">{% trans %}Time{% endtrans %}</th> -->
</tr>
{% for doc in pwic.documents %}
<tr>
<td><a href="/{{pwic.project|urlencode}}/{{doc.page|urlencode}}">{{doc.page|escape}}</a></td>
<td><a href="/special/document/{{doc.id|urlencode}}/{{doc.filename|escape}}">{{doc.filename|escape}}</a></td>
<td class="pwic_desktop" title="{{doc.mime|escape}}">{{doc.mime_icon}} {{doc.extension|upper}}</td>
<td>{{doc.size|size2str|escape}}</td>
<td class="pwic_desktop"><a class="pwic_break" href="/special/user/{{doc.author|urlencode}}" rel="nofollow">{{doc.author|escape}}</a></td>
<td>{{doc.date|escape}}</td>
<!-- <td class="pwic_desktop">{{doc.time|escape}}</td> -->
</tr>
{% endfor %}
</table>
{% endif %}
</article>
{% endblock %}

View File

@ -1,36 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Create a new user{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{{pwic.emojis.finger_left}} {% if pwic.env.no_new_user %}{% trans %}Assign a new user{% endtrans %}{% else %}{% trans %}Create a new user{% endtrans %}{% endif %}</a></div>
</header>
{% include 'js/user-create.js' %}
<article>
{% if pwic.projects|count == 0 %}
<p class="pwic_error">{{pwic.emojis.padlock}} {% trans %}You have no authorization to create a new user. Please contact your administrator.{% endtrans %}</p>
{% else %}
<p class="pwic_italic">{% trans %}Reminder: your password must be changed before you can add a new user to the selected project.{% endtrans %}</p>
<p><strong>{% trans %}Project:{% endtrans %}</strong><br>
<select id="create_project" name="project">
{% for proj in pwic.projects %}
<option value="{{proj.project|escape}}"
{% if proj.project == pwic.default_project %} selected="selected" {% endif %}
>{{proj.description|escape}} [{{proj.project|escape}}]</option>
{% endfor %}
</select>
</p>
<p><strong>{% trans %}User name:{% endtrans %}</strong> <input id="create_user" class="pwic_fill" type="text" name="user" autofocus required="true" spellcheck="false"></p>
<p><input type="button" value="{{pwic.emojis.users}} {% trans %}Create the user{% endtrans %}" onclick="create_submit()"></p>
{% endif %}
</article>
{% endblock %}

View File

@ -1,140 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}Roles of the users{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Roles of the users{% endtrans %}</a></div>
<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
</header>
<article>
<div class="pwic_action_bar">
<a href="/{{pwic.project|urlencode}}/special/audit">{{pwic.emojis.glasses}} {% trans %}Audit{% endtrans %}</a>
<a href="/{{pwic.project|urlencode}}/special/user">{{pwic.emojis.users}} {% trans %}Create a user{% endtrans %}</a>
</div>
<p class="pwic_italic">{% trans %}Reminder: the password of a user must be changed before his roles can be changed.{% endtrans %}</p>
<table id="roles_table" class="pwic_zebra">
<tr>
<th>{% trans %}User{% endtrans %}</th>
<th class="pwic_desktop" title="{% trans %}Password{% endtrans %}">{% trans %}Pwd{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Activity{% endtrans %}</th>
<th>{% trans %}A<span class="pwic_desktop">dmin</span>{% endtrans %}</th>
<th>{% trans %}M<span class="pwic_desktop">anager</span>{% endtrans %}</th>
<th>{% trans %}E<span class="pwic_desktop">ditor</span>{% endtrans %}</th>
<th>{% trans %}V<span class="pwic_desktop">alidator</span>{% endtrans %}</th>
<th>{% trans %}R<span class="pwic_desktop">eader</span>{% endtrans %}</th>
<th>{% trans %}Dis<span class="pwic_desktop">abled</span>{% endtrans %}</th>
<th>{% trans %}Del<span class="pwic_desktop">ete</span>{% endtrans %}</th>
</tr>
{% set u = namespace(value=0) %}
{% for role in pwic.roles %}
<tr id="roles_tag_{{u.value+7}}">
<td><a class="pwic_break" href="/special/user/{{role.user|urlencode}}" rel="nofollow">{{role.user|escape}}</a></td>
<td class="pwic_desktop">
{% if role.user|reserved_user_name %}
<span title="{% trans %}Special account{% endtrans %}">{{pwic.emojis.star}}</span>
{% elif role.oauth %}
<span title="{% trans %}Federated authentication{% endtrans %}">{{pwic.emojis.id}}</span>
{% elif role.initial %}
<span title="{% trans %}The user must change his password{% endtrans %}">{{pwic.emojis.unlocked}}</span>
{% else %}
{{pwic.emojis.green_check}}
{% endif %}
</td>
<td class="pwic_desktop">{{role.activity|escape}}</td>
<td>
<input id="roles_tag_{{u.value+1}}"
type="checkbox"
{% if (role.user == pwic.user) or role.user|reserved_user_name or role.initial %}
disabled="disabled"
{% else %}
onclick="return roles_toggle({{u.value+1}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'admin')"
{% endif %}
{% if role.admin %}
checked="checked"
{% endif %}
>
</td>
<td>
<input id="roles_tag_{{u.value+2}}"
type="checkbox"
onclick="return roles_toggle({{u.value+2}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'manager')"
{% if role.initial %}
disabled="disabled"
{% endif %}
{% if role.manager %}
checked="checked"
{% endif %}
>
</td>
<td>
<input id="roles_tag_{{u.value+3}}"
type="checkbox"
onclick="return roles_toggle({{u.value+3}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'editor')"
{% if role.initial %}
disabled="disabled"
{% endif %}
{% if role.editor %}
checked="checked"
{% endif %}
>
</td>
<td>
<input id="roles_tag_{{u.value+4}}"
type="checkbox"
onclick="return roles_toggle({{u.value+4}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'validator')"
{% if role.initial %}
disabled="disabled"
{% endif %}
{% if role.validator %}
checked="checked"
{% endif %}
>
</td>
<td>
<input id="roles_tag_{{u.value+5}}"
type="checkbox"
onclick="return roles_toggle({{u.value+5}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'reader')"
{% if role.initial %}
disabled="disabled"
{% endif %}
{% if role.reader %}
checked="checked"
{% endif %}
>
</td>
<td>
<input id="roles_tag_{{u.value+6}}" type="checkbox"
{% if (role.user == pwic.user) or role.initial %}
disabled="disabled"
{% else %}
onclick="return roles_toggle({{u.value+6}}, '{{pwic.project|escape}}', '{{role.user|escape}}', 'disabled')"
{% endif %}
{% if role.disabled %}
checked="checked"
{% endif %}
>
</td>
<td>
{% if (role.user != pwic.user) and (not role.user|reserved_user_name) %}
<input type="button"
onclick="return roles_delete('Are you sure to delete the rights of the user \'{{role.user|escape}}\' for the project?', {{u.value+7}}, '{{pwic.project|escape}}', '{{role.user|escape}}')"
value="{{pwic.emojis.red_check}}"
title="{% trans %}Delete{% endtrans %} {{role.user|escape}}"
>
{% endif %}
</td>
</tr>
{% set u.value = u.value + 7 %}
{% endfor %}
</table>
</article>
{% include 'js/user-roles.js' %}
{% endblock %}

View File

@ -1,150 +0,0 @@
{% extends 'html/main.html' %}
{% block title %}{% trans %}User profile{% endtrans %}{% endblock %}
{% block content %}
<header>
<div class="pwic_ph1"><a href="/">{{pwic.emojis.finger_up}} {% trans %}User profile{% endtrans %}</a></div>
</header>
{% include 'js/user.js' %}
<article>
<h1>{{pwic.userpage|escape}}</h1>
<h2>{% trans %}Profile{% endtrans %}</h2>
<ul>
<li>{% trans %}Own password:{% endtrans %}
<span id="user_password_status">{{pwic.emojis.red_check if pwic.password_initial else pwic.emojis.green_check}}</span>
{% if pwic.password_totp %}
<span title="{% trans %}Enabled two-factor authentication (2FA){% endtrans %}">{{pwic.emojis.slot}}</span>
{% endif %}
{% if pwic.password_oauth %}
<span title="{% trans %}Federated authentication only{% endtrans %}">{{pwic.emojis.id}}</span>
{% elif (pwic.user == pwic.userpage) and (not pwic.userpage|reserved_user_name) %}
<span class="pwic_js">(<a href="#" onclick="return user_password_popup()">{% trans %}change it{% endtrans %}</a>)</span>
{% endif %}
</li>
{% if pwic.user == pwic.userpage %}
<li>{% trans %}Language:{% endtrans %}
<select id="user_language" onchange="user_language_set()">
{% for lang in pwic.constants.languages %}
<option value="{{lang|escape}}" {% if lang == pwic.language %} selected="selected" {% endif %}>{{lang|escape}}</option>
{% endfor %}
</select>
</li>
{% endif %}
{% if pwic.projects|count > 0 %}
<li>{% trans %}Projects:{% endtrans %}
<ul>
{% for project in pwic.projects %}
<li><a href="/{{project.project|urlencode}}">{{project.description|escape}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
{% if (not pwic.password_oauth) and (pwic.user == pwic.userpage) and (not pwic.userpage|reserved_user_name) %}
<div id="user_password_popup" class="pwic_blurcontainer pwic_hidden">
<div class="pwic_popup">
<form autocomplete="new-password">
<p class="pwic_bold">{% trans %}Change your password{% endtrans %}</p>
<p id="user_password_notice" class="pwic_italic">{{pwic.emojis.warning}} {% trans %}Warning: the site does not use a secure protocol. Please choose a dedicated password that you use nowhere else.{% endtrans %}</p>
<table class="pwic_noborder">
<tr><td>{% trans %}Current password:{% endtrans %}</td> <td><input class="pwic_fill" type="password" id="user_password_current" autocomplete="current-password" required="true"></td></tr>
<tr><td>{% trans %}New password:{% endtrans %}</td> <td><input class="pwic_fill" type="password" id="user_password_new1" autocomplete="new-password" required="true"></td></tr>
<tr><td>{% trans %}Repeat password:{% endtrans %}</td> <td><input class="pwic_fill" type="password" id="user_password_new2" autocomplete="off" required="true" onpaste="return false"></td></tr>
</table>
<p>
<input type="button" value="{{pwic.emojis.locked}} {% trans %}Change{% endtrans %}" onclick="user_password_submit()">
<input type="button" value="{% trans %}Cancel{% endtrans %}" onclick="user_password_popup()">
</p>
</form>
</div>
</div>
{% endif %}
<h2>{% trans %}Contributions in the last 90 days{% endtrans %}</h2>
{% if pwic.pages|count == 0 %}
<p class="pwic_center pwic_italic">{% trans %}The user has no recent contribution.{% endtrans %}</p>
{% else%}
<table>
<tr>
<th class="pwic_desktop">{% trans %}Project{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Page{% endtrans %}</th>
<th>{% trans %}Title{% endtrans %}</th>
<th>{% trans %}Flags{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Milestone{% endtrans %}</th>
</tr>
{% for page in pwic.pages %}
<tr>
<td class="pwic_desktop pwic_break">{{page.project|escape}}</td>
<td class="pwic_desktop pwic_break">{{page.page|escape}}</td>
<td><a href="/{{page.project|urlencode}}/{{page.page|urlencode}}">{{page.title|escape}}</a></td>
<td>
{% if page.draft %}
<span title="{% trans %}Draft{% endtrans %}">{{pwic.emojis.hourglass}}</span>
{% endif %}
{% if page.final %}
<span title="{% trans %}Marked as final{% endtrans %}">{{pwic.emojis.notes}}</span>
{% endif %}
{% if page.valuser != '' %}
<span title="{{ gettext('Validated by %(valuser)s on %(valdate)s at %(valtime)s.')|format(valuser=page.valuser|escape, valdate=page.valdate|escape, valtime=page.valtime|escape) }}">{{pwic.emojis.flag}}</span>
{% endif %}
</td>
<td>{{page.date|escape}}</td>
<td class="pwic_desktop">{{page.time|escape}}</td>
<td class="pwic_desktop">{{page.milestone|escape}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if (pwic.documents|count > 0) and (not pwic.user|reserved_user_name) %}
<h2>{% trans %}Uploaded documents{% endtrans %}</h2>
<table>
<tr>
<th class="pwic_desktop">{% trans %}Project{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Page{% endtrans %}</th>
<th>{% trans %}File name{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Format{% endtrans %}</th>
<th>{% trans %}Size{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Hash{% endtrans %}</th>
<th>{% trans %}Date{% endtrans %}</th>
<th class="pwic_desktop">{% trans %}Time{% endtrans %}</th>
<th><span class="pwic_desktop">{% trans %}Download{% endtrans %}</span></th>
</tr>
{% for doc in pwic.documents %}
<tr>
<td class="pwic_desktop pwic_break">{{doc.project|escape}}</td>
<td class="pwic_desktop pwic_break"><a href="/{{doc.project|urlencode}}/{{doc.page|urlencode}}">{{doc.page|escape}}</a></td>
<td>
<a class="pwic_break" href="/special/document/{{doc.id|urlencode}}/{{doc.filename|urlencode}}">{{doc.filename|escape}}</a>
{% if doc.exturl != ''%}
<span title="{% trans %}External storage{% endtrans %}">{{pwic.emojis.cloud}}</span>
{% endif%}
</td>
<td class="pwic_desktop" title="{{doc.mime|escape}}">{{doc.mime_icon}} {{doc.extension|upper}}</td>
<td data-sort="{{doc.size|escape}}">{{doc.size|size2str|escape}}</td>
<td class="pwic_desktop">
<span title="{{doc.hash|escape}}">{{doc.hash[:8]|escape}}</span>
{% if doc.occurrence > 1 %} <span title="{% trans %}Duplicate file{% endtrans %}">{{pwic.emojis.gemini}}</span> {% endif %}
</td>
<td>{{doc.date|escape}}</td>
<td class="pwic_desktop">{{doc.time|escape}}</td>
<td><a href="/special/document/{{doc.id|urlencode}}?attachment">{{pwic.emojis.inbox}}</a></td>
</tr>
{% endfor %}
</table>
{% endif %}
</article>
{% endblock %}

View File

@ -1,71 +0,0 @@
<script>
'use strict';
function login_translate_langs(mapping) {
$('#login_language OPTION').each((i, e) => {
var lang = $(e).attr('value');
if (mapping.hasOwnProperty(lang))
$(e).html(lang + ' - ' + mapping[lang]);
});
}
function login_anonymous() {
$('#login_user').val('{{pwic.constants.anonymous_user|escape}}');
$('#login_password').val('');
$('#login_pin').val('');
$('#login_form')[0].submit();
return true;
}
{% if pwic.env.base_url and pwic.env.oauth_provider %}
function login_oauth() {
{% if pwic.env.oauth_provider.value == 'github' %}
var args = {client_id: '{{pwic.env.oauth_identifier.value|escape}}',
redirect_uri: '{{pwic.env.base_url.value|escape}}/api/oauth',
login: $('#login_user').val(),
scope: 'user:email',
state: '{{pwic.oauth_user_secret|escape}}',
allow_signup: false};
window.location = 'https://github.com/login/oauth/authorize?' + (new URLSearchParams(args).toString());
{% elif pwic.env.oauth_provider.value == 'google' %}
var args = {client_id: '{{pwic.env.oauth_identifier.value|escape}}',
redirect_uri: '{{pwic.env.base_url.value|escape}}/api/oauth',
scope: 'https://www.googleapis.com/auth/userinfo.email',
access_type: 'online',
state: '{{pwic.oauth_user_secret|escape}}',
login_hint: $('#login_user').val(),
response_type: 'code'};
window.location = 'https://accounts.google.com/o/oauth2/v2/auth?' + (new URLSearchParams(args).toString());
{% elif pwic.env.oauth_provider.value == 'microsoft' %}
var args = {client_id: '{{pwic.env.oauth_identifier.value|escape}}',
response_type: 'code',
redirect_uri: '{{pwic.env.base_url.value|escape}}/api/oauth',
scope: 'https://graph.microsoft.com/user.read',
response_mode: 'query',
state: '{{pwic.oauth_user_secret|escape}}',
login_hint: $('#login_user').val()};
{% if pwic.env.oauth_domains %}
var main = '{{pwic.env.oauth_domains.value|escape}}'.trim().split(' ')[0];
if (main.length > 0)
args['domain_hint'] = main;
{% endif %}
window.location = 'https://login.microsoftonline.com/{{pwic.env.oauth_tenant.value|urlencode}}/oauth2/v2.0/authorize?' + (new URLSearchParams(args).toString());
{% else %}
throw 'Internal error - Invalid OAuth provider';
{% endif %}
}
{% endif %}
{% if pwic.env.registration_link %}
function login_register() {
window.location = '{{pwic.env.registration_link.value|escape}}';
return true;
}
{% endif %}
if (window.fetch)
$('#login_js').addClass('pwic_hidden');
</script>

View File

@ -1,30 +0,0 @@
<script>
'use strict';
fetch('/api/server/env/get',
{ method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({'project': '{{pwic.project|slash}}'}),
credentials: 'same-origin'})
.then(response => {
if (response.ok)
response.json().then(data => {
var key, buffer, tr;
for (key in data) {
tr = $(document.createElement('TR')).appendTo($('#audit_envs'));
$(document.createElement('TD'))
.html('<code>' + pwic_entities(key) + '</code>')
.appendTo(tr);
$(document.createElement('TD'))
.html(data[key].global
? '<span title="{% trans %}Global{% endtrans %}">{{pwic.emojis.globe}}</span>'
: '<span title="{% trans %}Project-dependent{% endtrans %}">{{pwic.emojis.hammer}}</span>')
.appendTo(tr);
$(document.createElement('TD'))
.addClass('pwic_monospace')
.html(pwic_entities(data[key].value))
.appendTo(tr);
}
});
});
</script>

View File

@ -1,49 +0,0 @@
<script>
'use strict';
$('#create_kb').on('change', event => {
if ($(event.target).prop('checked')) {
var e = $('#create_page');
if (e.val() == '')
e.val('kb');
e[0].select();
}
});
function create_submit() {
var project = $('#create_project').val().trim().toLowerCase(),
kbmode = $('#create_kb').prop('checked'),
page = $('#create_page').val().trim().toLowerCase();
// Check the parameters
if (!pwic_is_safe(project) || !pwic_is_safe(page)) {
alert({% trans %}'The parameters are not acceptable.'{% endtrans %});
return false;
}
// Submit the form
$('INPUT[type=button]').attr('disabled', '');
var args = {project: project,
kb: kbmode,
page: page,
tags: $('#create_tags').val(),
milestone: $('#create_milestone').val(),
ref_project: $('#create_ref_project').val(),
ref_page: $('#create_ref_page').val(),
ref_tags: $('#create_ref_tags').val()};
fetch('/api/page/create', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams(args),
credentials: 'same-origin'})
.then(response => {
$('INPUT[type=button]').removeAttr('disabled');
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.json().then(data => window.location = data['url'] + '?success');
})
.catch(error => {
alert(error);
$('INPUT[type=button]').removeAttr('disabled');
});
}
</script>

View File

@ -1,695 +0,0 @@
<script>
'use strict';
// -------------------------------- Toolbar
function edit_decorate(tagStart, tagEnd) {
var nosel = !md_editor.somethingSelected();
md_editor.replaceSelection(tagStart + md_editor.getSelection() + tagEnd);
if (nosel) {
var cur = md_editor.getCursor();
md_editor.setCursor(cur.line, cur.ch - tagEnd.length);
}
md_editor.focus();
}
function edit_decorate_end(text) {
md_editor.replaceSelection(md_editor.getSelection() + text);
md_editor.focus();
}
function edit_link() {
if (md_editor.somethingSelected()) {
// Check the current selection for an autolink
var txt = md_editor.getSelection();
if (txt.match('^[a-z]{3,7}:\/\/')) {
md_editor.replaceSelection('<' + md_editor.getSelection().replaceAll(' ', '%20') + '>');
md_editor.focus();
return;
}
// Ask for the link
var url = prompt({% trans %}'Paste the link:'{% endtrans %}, '');
if ((url != null) && (url != '')) {
url = url.trim();
if ((url.length > 0)
&& (url.indexOf(':') === -1)
&& (url.indexOf('/') === -1)
&& (url == url.toLowerCase()))
url = '/{{pwic.project}}/' + url;
// Replace the text by another one
md_editor.replaceSelection('[' + txt + '](' + url + ')');
}
}
md_editor.focus();
}
function _edit_prepend_generic(ftag) {
// Fit the selection
var lft = md_editor.getCursor('start'),
rgt = md_editor.getCursor('end');
md_editor.setCursor(lft.line, 0);
md_editor.setSelection(md_editor.getCursor('start'), rgt);
// Adapt the content to the new format
var txt = ftag() + md_editor.getSelection();
md_editor.replaceSelection(txt.split('').map(c => c == '\n' ? '\n' + ftag() : c).join(''));
md_editor.focus();
}
function edit_prepend(tag) {
return _edit_prepend_generic(() => tag);
}
function edit_prepend_nlist() {
var id = 0;
return _edit_prepend_generic(() => ++id + '. ');
}
function _edit_block_transform(f) {
if (md_editor.somethingSelected())
md_editor.replaceSelection(f(md_editor.getSelection()), 'around');
md_editor.focus();
}
function edit_switch_case() {
_edit_block_transform(s => (s == s.toUpperCase()
? s.toLowerCase()
: (s == s.toLowerCase()
? s.substring(0,1).toUpperCase() + s.substring(1).toLowerCase()
: s.toUpperCase())));
}
function edit_double_spaces() {
_edit_block_transform(s => s.replace(/ +/g, ' '));
}
function edit_left_line() {
_edit_block_transform(s => s.replaceAll('\r', '').replace(/\n\s+/g, '\n'));
}
function edit_no_blank_line() {
_edit_block_transform(s => s.replaceAll('\r', '').replaceAll(/\n\s*\n/g, '\n'));
}
function edit_single_line() {
_edit_block_transform(s => s.replaceAll('\r', '').replace(/[\s\t]*\n[\s\t]*/, '\n').replaceAll('\n', ' '));
}
function edit_table() {
// Get the dimensions of the table
var ncol = parseInt(prompt({% trans %}'Number of columns:'{% endtrans %}, 0));
if (isNaN(ncol) || (ncol < 1))
return false;
var nrow = parseInt(prompt({% trans %}'Number of rows:'{% endtrans %}, 0)) + 1;
if (isNaN(nrow) || (nrow < 1))
return false;
// Prepare the associated markdown
var i, j, buffer = '';
for (i=0 ; i<nrow ; i++) {
buffer += '|';
for (j=0 ; j<ncol ; j++)
buffer += ' |';
buffer += '\n';
if (i == 0) {
buffer += '|';
for (j=0 ; j<ncol ; j++)
buffer += ' -------- |';
buffer += '\n';
}
}
// Apply the text
md_editor.replaceSelection(buffer);
md_editor.focus();
}
function edit_table_import() {
try {
navigator.clipboard.readText()
.then(input_text => {
var i, j, lines, cols,
ncols = 0,
nlens = [],
txt, buffer, nice;
// Check
input_text = input_text.replaceAll('\r', '').trim();
if (input_text.length == 0) {
$('#edit_toolbar_table').trigger('click');
return;
}
// Scan the dimensions of the table
lines = input_text.split('\n');
for (i=0 ; i<lines.length ; i++) {
cols = lines[i].split('\t');
ncols = Math.max(ncols, cols.length);
for (j=0 ; j<cols.length ; j++) {
if (nlens.length <= j)
nlens.push(0);
nlens[j] = Math.max(nlens[j], cols[j].trim().length);
}
}
nice = (nlens.reduce((a, b) => a + b, 0) <= 128); // To shorten large tables
// Build the final text
buffer = '';
for (i=0 ; i<lines.length ; i++) {
buffer += '\n';
cols = lines[i].split('\t');
for (j=0 ; j<ncols ; j++) {
txt = (j < cols.length ? cols[j] : '').trim();
buffer += '| ' + txt + ' '.repeat((nice ? nlens[j] - txt.length : 0) + 1);
}
buffer += '|';
// Header line
if (i == 0) {
buffer += '\n';
for (j=0 ; j<ncols ; j++)
buffer += '|' + '-'.repeat((nice ? nlens[j] : 1) + 2);
buffer += '|';
}
}
// Paste the table
edit_decorate_end('\n' + buffer + '\n\n');
});
} catch (e) {
// See dom.events.testing.asyncClipboard in Firefox
alert({% trans %}'You cannot use this feature.'{% endtrans %});
}
}
function edit_footnote() {
// Search for the highest current footnote
var id = 0,
list = [...md_editor.getValue().matchAll(/\[\^([0-9]+)\]/g)];
list.forEach(match => {
var value = parseInt(match[1]);
if (value > id)
id = value;
});
// Apply the footnote
md_editor.replaceSelection(md_editor.getSelection() + ' [^'+(id+1)+']');
md_editor.setValue(md_editor.getValue() + '\n\n' + '[^'+(id+1)+']: ');
md_editor.focus();
md_editor.setCursor(md_editor.lineCount(), 0);
}
function edit_join_document(id, filename, mime) {
var buffer = '';
// Include an image
if (mime.substring(0, 6) == 'image/') {
var tip = prompt({% trans %}'Tooltip of the image:'{% endtrans %}, ''),
alt = prompt({% trans %}'Alternate text for the image:'{% endtrans %}, '');
buffer = '![';
if (alt != '')
buffer += pwic_kick(alt, '["]');
buffer += '](/special/document/' + id;
if (tip != '')
buffer += ' "'+pwic_kick(tip, '"')+'"';
buffer += ')';
}
// Any other file
else
buffer = '['+filename+'](/special/document/'+id+'?attachment)'
// Set the value
md_editor.replaceSelection(buffer);
md_editor.focus();
}
function _edit_convert(endpoint, payload) {
fetch(endpoint, { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams(payload),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.text().then(text => {
if ((text != '') && confirm({% trans %}'Do you want to replace the current content by the one of the selected document?'{% endtrans %})) {
md_editor.setValue(text);
md_editor.focus();
}
});
})
.catch(error => alert(error));
}
function edit_convert_document(id) {
_edit_convert('/api/document/convert', {id: id});
}
{% if pwic.env.remote_url %}
function edit_convert_remote_document() {
var url = prompt({% trans %}'Remote URL to fetch:'{% endtrans %}, '');
if ((url != null) && (url != ''))
_edit_convert( '/api/document/remote/convert',
{project: '{{pwic.project|slash}}', url: url});
}
{% endif %}
// -------------------------------- Dictation
{% if not pwic.env.no_dictation %}
class PwicSpeech {
constructor() {
this._timeout = null;
// Load the speech recognition
if ((location.protocol != 'https:') || (window.webkitSpeechRecognition === undefined)) {
$('#edit_toolbar_dictate').prop('disabled', 'disabled');
return false;
}
this._handler = new webkitSpeechRecognition();
this._handler.continuous = true;
this._handler.interimResults = true;
this._handler.lang = $('HTML').prop('lang');
// Event when started
this._handler.onstart = () => {
this._timeout = setTimeout(() => this._handler.stop(), 5000);
$('#edit_toolbar_dictate').addClass('pwic_limebg');
};
// Event on word received
// https://developer.chrome.com/blog/voice-driven-web-apps-introduction-to-the-web-speech-api
this._handler.onresult = (event) => {
// Fetch the words
var buffer, i, result, lft, rgt;
buffer = '';
for (i=event.resultIndex; i<event.results.length; ++i) {
result = event.results[i];
buffer += result[0].transcript;
}
// Update the Markdown editor
md_editor.replaceSelection(buffer);
if (!result.isFinal) {
rgt = md_editor.getCursor();
lft = {...rgt};
lft.ch -= buffer.length;
md_editor.setSelection(lft, rgt);
}
// Delay
clearTimeout(this._timeout);
this._timeout = setTimeout(() => this._handler.stop(), 5000);
};
// Event when ended
this._handler.onend = () => {
clearTimeout(this._timeout);
this._timeout = null;
$('#edit_toolbar_dictate').removeClass('pwic_limebg');
};
// Install
$('#edit_toolbar_dictate').on('click', (event) => {
if ($(event.target).hasClass('pwic_limebg'))
this._handler.stop();
else
if (this._timeout == null) {
this._handler.start();
md_editor.focus();
}
});
return true;
}
};
new PwicSpeech();
{% endif %}
// -------------------------------- File drop
function edit_refresh_documents() {
fetch('/api/document/list', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
page: '{{pwic.page|slash}}' }),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.json().then(data => {
$('#edit_files_list TR:nth-child(n+2)').remove();
var i, doc, tr, td;
for (i=0 ; i<data.length ; i++) {
doc = data[i];
tr = $(document.createElement('TR')).appendTo($('#edit_files_list'));
td = $(document.createElement('TD')).appendTo(tr);
$(document.createElement('INPUT'))
.attr('type', 'button')
.val(pwic_unimoji('{{pwic.emojis.plus}}'))
.attr('title', "{% trans %}Add a link{% endtrans %}")
.data('id', doc.id)
.data('filename', doc.filename)
.data('mime', doc.mime)
.on('click', (e) => edit_join_document($(e.target).data('id'), $(e.target).data('filename'), $(e.target).data('mime')))
.appendTo(td);
if (doc.convertible)
$(document.createElement('INPUT'))
.addClass('pwic_desktop')
.attr('type', 'button')
.val(pwic_unimoji('{{pwic.emojis.hammer}}'))
.attr('title', "{% trans %}Import the content of the document{% endtrans %}")
.data('id', doc.id)
.on('click', (e) => edit_convert_document($(e.target).data('id')))
.appendTo(td);
td = $(document.createElement('TD')).appendTo(tr);
$(document.createElement('A'))
.attr('href', '/special/document/' + encodeURIComponent(doc.id) + '/' + encodeURIComponent(doc.filename))
.attr('target', '_blank')
.html(pwic_entities(doc.filename) + (doc.exturl != '' ? ' {{pwic.emojis.cloud}}' : ''))
.appendTo(td);
$(document.createElement('TD'))
.addClass('pwic_desktop')
.html(doc.used ? '{{pwic.emojis.green_check}}' : '')
.appendTo(tr);
$(document.createElement('TD'))
.attr('title', "{% trans %}Hash:{% endtrans %} " + pwic_entities(doc.hash.substring(0, 8)))
.html(doc.size_str)
.appendTo(tr);
$(document.createElement('TD'))
.addClass('pwic_desktop')
.attr('title', pwic_entities(doc.mime))
.html(doc.mime_icon + ' ' + pwic_entities(doc.extension).toUpperCase())
.appendTo(tr);
td = $(document.createElement('TD'))
.addClass('pwic_desktop')
.appendTo(tr);
$(document.createElement('A'))
.attr('href', '/special/user/' + encodeURIComponent(doc.author))
.attr('target', '_blank')
.attr('rel', 'nofollow')
.html(pwic_entities(doc.author))
.appendTo(td);
$(document.createElement('TD'))
.html(pwic_entities(doc.date))
.appendTo(tr);
$(document.createElement('TD'))
.addClass('pwic_desktop')
.html(pwic_entities(doc.time))
.appendTo(tr);
td = $(document.createElement('TD')).appendTo(tr);
$(document.createElement('INPUT'))
.attr('type', 'button')
.val(pwic_unimoji('{{pwic.emojis.curved_left_arrow}}'))
.attr('title', "{% trans %}Rename the document{% endtrans %}")
.data('id', doc.id)
.data('filename', doc.filename)
.on('click', (e) => edit_rename_document($(e.target).data('id'), $(e.target).data('filename')))
.appendTo(td);
$(document.createElement('INPUT'))
.attr('type', 'button')
.val(pwic_unimoji('{{pwic.emojis.red_check}}'))
.attr('title', "{% trans %}Delete the document{% endtrans %}")
.data('id', doc.id)
.data('filename', doc.filename)
.on('click', (e) => edit_delete_document($(e.target).data('id'), $(e.target).data('filename')))
.appendTo(td);
}
$('#edit_files_list').toggleClass('pwic_hidden', data.length == 0);
});
})
.catch(error => alert(error));
}
edit_refresh_documents(); // For the initialization
function _edit_transfer_files(files) {
// Create an XHR for each file
var notification = null;
for (var i=0 ; i<files.length ; i++) {
// Fields
var form = new FormData();
form.append('project', '{{pwic.project|slash}}');
form.append('page', '{{pwic.page|slash}}');
form.append('content', files[i]);
// Request
fetch('/api/document/create', { method: 'POST',
body: form,
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
if (notification != null)
clearTimeout(notification);
notification = setTimeout(() => {
edit_refresh_documents();
alert({% trans %}'The file is uploaded and usable in the list below.'{% endtrans %});
}, 2000);
})
.catch(error => alert(error));
}
}
function edit_upload_document() {
var obj = $(document.createElement('INPUT'))
.attr('type', 'file')
.addClass('pwic_hidden')
.appendTo('body')
.on('change', e => { _edit_transfer_files(e.target.files), obj.remove() })
.on('cancel', () => obj.remove())
.trigger('click');
}
function edit_drop(event) {
$('#edit_files_drop').removeClass('pwic_dragover');
if (event.dataTransfer.items) {
event.preventDefault();
event.stopPropagation();
_edit_transfer_files(event.dataTransfer.files);
} else
alert({% trans %}'Unsupported feature.'{% endtrans %});
}
function edit_dragover(event) {
$('#edit_files_drop').addClass('pwic_dragover');
event.preventDefault();
event.stopPropagation();
}
function edit_dragleave(event) {
$('#edit_files_drop').removeClass('pwic_dragover');
event.preventDefault();
event.stopPropagation();
}
function edit_rename_document(id, filename) {
var newfn = prompt('Type the new file name:', filename);
if ((newfn != null) && (newfn != filename)) {
fetch('/api/document/rename', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ id: id,
project: '{{pwic.project|slash}}',
filename: newfn}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
setTimeout(edit_refresh_documents, 1000);
})
.catch(error => alert(error));
}
return false;
}
function edit_delete_document(id, filename) {
if (confirm({% trans %}'Are sure to delete "%s"?'{% endtrans %}.replace('%s', filename))) {
fetch('/api/document/delete', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ id: id,
project: '{{pwic.project|slash}}'}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
setTimeout(edit_refresh_documents, 1000);
})
.catch(error => alert(error));
}
return false;
}
// -------------------------------- Submit a page
$('#edit_comment').on('dblclick', event => {
if ($(event.target).val() == '')
$(event.target).val($(event.target).prop('placeholder'));
});
var edit_submittable = false,
edit_preview_hwnd = null;
function edit_submit_form() {
// Check the current values
edit_submittable = ($('#edit_title').val() != '')
&& ($('#edit_comment').val() != '');
if (!edit_submittable) {
alert({% trans %}'Some fields are mandatory.'{% endtrans %});
return false;
}
// Disable the button temporarily
$('#edit_submit').prop('disabled', true);
setTimeout(() => $('#edit_submit').prop('disabled', false), 5000);
// First ping-pong the server to make sure that the session is still valid
fetch('/api/server/ping', { method: 'POST',
credentials: 'same-origin'})
.then(response => {
var errorPing = {% trans %}'Your session is not valid anymore. Please reconnect from another tab and retry.'{% endtrans %};
if (!response.ok)
alert('['+response.status+'] '+errorPing);
else
response.text().then(text => {
if (text != 'OK') {
alert(errorPing);
return;
}
// Close the preview
if (edit_preview_hwnd != null) {
edit_preview_hwnd.close();
edit_preview_hwnd = null;
}
// Query the current revision of the modified page
fetch('/api/project/get', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
page: '{{pwic.page|slash}}'}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error('['+response.status+'] '+response.statusText);
response.json().then(data => {
// Check the conflict
if (data['{{pwic.page|slash}}']['revisions'][0]['revision'] > {{pwic.revision}}) {
if (!confirm({% trans %}'Warning: the page has been modified in parallel of your current modifications.\n\nConsequently, your changes will be posted as a removable draft. You must merge the changes manually later.'{% endtrans %}))
return false;
$('#edit_draft').prop('checked', true);
$('#edit_final').prop('checked', false);
}
// Submit the modifications
{# sof/7542586 #}
var form = {project: '{{pwic.project|slash}}',
page: '{{pwic.page|slash}}',
title: $('#edit_title').val(),
tags: $('#edit_tags').val(),
markdown: md_editor.getValue(),
comment: $('#edit_comment').val(),
milestone: $('#edit_milestone').val(),
draft: $('#edit_draft').prop('checked'),
final: $('#edit_final').prop('checked'),
header: $('#edit_header').prop('checked'),
protection: $('#edit_protection').prop('checked')};
fetch('/api/page/edit', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams(form),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
window.location = '/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}?success';
})
.catch(error => alert(error));
});
})
.catch(error => alert(error));
});
})
.catch(error => alert({% trans %}'The server or your Internet connection is down.'{% endtrans %}));
}
function edit_preview_md(pageName) {
fetch('/api/markdown/convert', {method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
markdown: md_editor.somethingSelected() ? md_editor.getSelection() : md_editor.getValue()}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.text().then(text => {
if (edit_preview_hwnd != null)
edit_preview_hwnd.close();
edit_preview_hwnd = window.open('');
edit_preview_hwnd.document.head.innerHTML = '<link rel="stylesheet" type="text/css" href="'+window.location.protocol+'//'+window.location.host+'/static/styles.css" />';
edit_preview_hwnd.document.title = {% trans %}'Preview of the page'{% endtrans %} + ' "'+pageName+'"';
edit_preview_hwnd.document.body.innerHTML = '\
<article>\
<p style="position:fixed; top:0px; right:0px; padding:15px">\
<input type="button" onclick="window.close()" value="{{pwic.emojis.door}} '+{% trans %}'Close the preview'{% endtrans %}+'" />\
<\/p>\
'+text+'\
<\/article>';
edit_preview_hwnd.window.onkeydown = function(event) {
if (event.key == 'Escape') {
edit_preview_hwnd.close();
edit_preview_hwnd = null;
}
};
});
})
.catch(error => alert(error));
}
// -------------------------------- Leave without saving
window.onbeforeunload = function(e) {
var e = e || window.event;
if (!edit_submittable)
if (e)
e.returnValue = {% trans %}'The current changes may be lost.'{% endtrans %};
};
// -------------------------------- Markdown editor
function edit_undo(mode) {
if (mode)
md_editor.undo();
else
md_editor.redo();
md_editor.focus();
return false;
}
function _edit_get_shortcuts() { // Callable once
var sc = {};
$("INPUT[type='button'][data-shortcut]").each((i, e) => {
e.title = (e.title || '') + ' (' + e.dataset['shortcut'] + ')';
sc[e.dataset.shortcut] = cm => e.click();
});
return sc;
}
var md_editor = CodeMirror.fromTextArea(document.getElementById('edit_markdown'), {
mode: 'markdown',
lineNumbers: true,
lineWrapping: true,
extraKeys: _edit_get_shortcuts()
});
</script>

View File

@ -1,76 +0,0 @@
<script>
'use strict';
// Easy copy of the global value
$('INPUT[type=text]').on('dblclick', event => {
if ($(event.target).val() == '') {
$(event.target).val($(event.target).prop('placeholder'));
$(event.target).trigger('keyup');
}
});
// Manage the visibility of the save button
$('INPUT[type=button]').addClass('pwic_hidden');
$('INPUT[type=text]').on('keyup', event => {
// Inbound values
var value = $(event.target).val(),
saved = ($(event.target).data('saved') || ''),
global = ($(event.target).data('global') == 'X');
// Conditions to show it
var b1 = !global && (value != saved),
b2 = global && (value != '');
$('INPUT[type=button][data-key='+$(event.target).data('key')+']').toggleClass('pwic_hidden', !b1 && !b2);
});
// Manage the save button
$('INPUT[type=button]').on('click', event => {
var key = $(event.target).data('key'),
value = $('INPUT[type=text][data-key='+key+']').val();
env_set(key, value);
});
// Load the default values of the configuration
$('INPUT[type=text]').attr('readonly', '').addClass('pwic_disabled_bg');
fetch('/api/server/env/get', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({project: '{{pwic.project|slash}}'}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.json().then(data => {
var key, item, element;
for (key in data) {
item = data[key];
element = $('INPUT[type=text][data-key='+key+']');
if (element.length == 1) {
element.data('saved', item['value'])
.data('global', (item['global'] ? 'X' : ''));
if (item['global'])
element.attr('placeholder', item['value']);
else
element.val(item['value']);
}
}
$('INPUT[type=text]').removeAttr('readonly').removeClass('pwic_disabled_bg');
});
})
.catch(error => alert(error));
// Action when the save button is pressed
function env_set(key, value) {
fetch('/api/project/env/set', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
key: key,
value: value}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
$('INPUT[type=text][data-key='+key+']').data('saved', value);
$('INPUT[type=button][data-key='+key+']').addClass('pwic_hidden');
})
.catch(error => alert(error));
}
</script>

View File

@ -1,70 +0,0 @@
<script src="/static/svg-pan-zoom.min.js"></script>
<script>
'use strict';
// Get the graph from the API
var graph_cache = null;
function graph_get_data(action) {
// Download from cache
if ((action == 'download') && (graph_cache != null))
return graph_download();
// Else first download
fetch('/api/project/graph/get', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({project: '{{pwic.project|slash}}'}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.text().then(text => {
graph_cache = text;
if (action == 'render')
graph_generate_svg();
else
if (action == 'download')
graph_download();
});
})
.catch(error => alert(error));
}
graph_get_data('render');
// Download the graph as a raw file
function graph_download() {
if (graph_cache == null)
return false;
var blob = window.URL.createObjectURL(new Blob([graph_cache], {type: 'text/vnd.graphviz'}));
$(document.createElement('A'))
.addClass('pwic_hidden')
.attr('href', blob)
.attr('download', '{{pwic.project|slash}}.gv')
.appendTo('BODY')
.trigger('click')
.remove();
window.URL.revokeObjectURL(blob);
return true;
}
// Generate the graph
function graph_generate_svg() {
var worker = new Worker('/static/viz.js');
worker.onmessage = function(e) {
// Render SVG
var graph = $('#graph_viz')[0];
var svg = (new DOMParser()).parseFromString(e.data, 'image/svg+xml').documentElement;
graph.appendChild(svg);
// Zooming area for SVG
var panZoom = svgPanZoom(svg, {zoomEnabled: true, controlIconsEnabled: true, center: true, minZoom: 0.1});
svg.addEventListener('paneresize', e => panZoom.resize(), false);
window.addEventListener('resize', e => panZoom.resize());
worker.terminate();
};
worker.onerror = function(e) {
alert(e.message === undefined ? 'The graph cannot be rendered.' : e.message);
};
worker.postMessage({src: graph_cache, options: {engine: 'dot', format: 'svg'}});
}
</script>

View File

@ -1,19 +0,0 @@
<script>
'use strict';
function history_compare() {
var rev = [];
$('input').each((i, e) => {
e = $(e);
if ((e.attr('type') == 'checkbox') && e.prop('checked'))
rev.push(e.data('revision'));
});
if (rev.length > 2)
return false;
if (rev.length == 2) {
rev.sort();
window.location = '/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}/rev'+rev[1]+'/compare/rev'+rev[0];
}
return true;
}
</script>

View File

@ -1,52 +0,0 @@
<script>
'use strict';
$('#move_dst_page').on('dblclick', event => {
if ($(event.target).val() == '')
$(event.target).val($(event.target).prop('placeholder'));
});
function move_submit() {
// Fetch the parameters
var srcproj = $('#move_src_project').val(),
srcpage = $('#move_src_page').val(),
dstproj = $('#move_dst_project').val(),
dstpage = $('#move_dst_page').val().trim().toLowerCase();
// Check the parameters
if (dstpage == '')
dstpage = srcpage;
if ( !pwic_is_safe(srcproj)
|| !pwic_is_safe(srcpage)
|| !pwic_is_safe(dstproj)
|| !pwic_is_safe(dstpage)
|| ((srcproj == dstproj) && (dstpage == srcpage))
|| ((srcproj != dstproj) && (dstpage == ''))
) {
alert({% trans %}'The parameters are not acceptable.'{% endtrans %});
return false;
}
// Submit the form
$('INPUT[type=button]').attr('disabled', '');
var args = {project: dstproj,
page: dstpage,
ref_project: srcproj,
ref_page: srcpage,
ignore_file_errors: 'X'};
fetch('/api/page/move', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams(args),
credentials: 'same-origin'})
.then(response => {
$('INPUT[type=button]').removeAttr('disabled');
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
window.location = response.url;
})
.catch(error => {
alert(error);
$('INPUT[type=button]').removeAttr('disabled');
});
}
</script>

View File

@ -1,86 +0,0 @@
<script>
(function() {
var list_initial = null,
timeout = null;
$('#page_progress_tags > A:nth-child(1)').on('click', event => {
$('#page_progress_tags > A:nth-child(n+4)').addClass('pwic_selected');
clearTimeout(timeout);
page_progress_refresh();
return false;
});
$('#page_progress_tags > A:nth-child(2)').on('click', event => {
$('#page_progress_tags > A:nth-child(n+4)').removeClass('pwic_selected');
clearTimeout(timeout);
page_progress_refresh();
return false;
});
$('#page_progress_tags > A:nth-child(n+3)').on('click', event => {
$(event.target).toggleClass('pwic_selected');
clearTimeout(timeout);
timeout = setTimeout(page_progress_refresh, 2000);
return false;
});
async function page_progress_refresh() {
function _pc(a, b) {
return (b == 0 ? '' : Math.floor(100 * a / b) + ' %');
}
function _sl(terms, text, entries) {
if ({% if pwic.env.no_search %} true {% else %} false {% endif %} || (entries == 0))
return encodeURIComponent(text);
return '<a href="/{{pwic.project|urlencode}}/special/search?q=%23'+encodeURIComponent(terms)+'" target="_blank">'+encodeURIComponent(text)+'<\/a>';
}
// Get the selected tags
var tags = '';
$('#page_progress_tags > A:nth-child(n+4)').each((i, e) => {
if ($(e).hasClass('pwic_selected'))
tags += ' ' + $(e).text().substring(1);
});
tags = tags.trim();
// Calculate the progress
var buffer = '';
if (tags.length > 0) {
var args = {project: '{{pwic.project|slash}}',
tags: tags,
combined: $('#page_progress_tags > A:nth-child(3)').hasClass('pwic_selected') ? 'on' : ''},
options = { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams(args),
credentials: 'same-origin'};
try {
var request = await fetch('/api/project/progress/get', options);
if (request.ok) {
var data = await request.json();
for (var tag in data) {
var item = data[tag];
if (item['total'] > 0)
buffer += '<tr>'
+ '<td>' + _sl(tag, tag, 1) + '<\/td>'
+ '<td>' + _sl(tag + ' :draft', item['draft'], item['draft']) + '<\/td>'
+ '<td class="pwic_desktop">' + _pc(item['draft'], item['total']) + '<\/td>'
+ '<td>' + _sl(tag + ' -:draft -:final -:validated', item['step'], item['step']) + '<\/td>'
+ '<td class="pwic_desktop">' + _pc(item['step'], item['total']) + '<\/td>'
+ '<td>' + _sl(tag + ' :final', item['final'], item['final']) + '<\/td>'
+ '<td class="pwic_desktop">' + _pc(item['final'], item['total']) + '<\/td>'
+ '<td>' + _sl(tag + ' :validated', item['validated'], item['validated']) + '<\/td>'
+ '<td class="pwic_desktop">' + _pc(item['validated'], item['total']) + '<\/td>'
+ '<\/tr>';
}
}
}
catch (error) {
console.log(error);
}
}
// Display the result
var e = $('#page_progress_list');
e.html((list_initial = list_initial || e.html()) + buffer).toggleClass('pwic_hidden', buffer.length == 0);
}
}());
</script>

View File

@ -1,156 +0,0 @@
<script>
'use strict';
{% if pwic.env.no_text_selection %}
$(document).on('keydown', e => !((e.key == 'F12') || (e.ctrlKey && e.shiftKey && (e.key == 'I')) || (e.ctrlKey && (e.key == 'u'))));
$(document).on('selectstart', () => false);
$(document).on('contextmenu', () => false);
$('ARTICLE *').css(atob('dXNlci1zZWxlY3Q='), 'none');
{% endif %}
window.onscroll = () => {
var scroll = document.body.scrollTop || document.documentElement.scrollTop,
height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
$('#pwic_progress')[0].style.width = ((scroll / height) * 100).toString() + 'vw';
$('#page_topofpage').toggleClass('pwic_hidden', scroll == 0);
};
$(document).on('keyup', event => {
if (!$('#pwic_browser').hasClass('pwic_hidden'))
if ((event || window.event).key == 'Escape')
$('#pwic_browser_access').trigger('click');
});
function page_email() {
{% if pwic.draft %}
if (confirm({% trans %}'Warning: the current page is a draft, so its content may disappear in the future without notice.'{% endtrans %}))
{% endif %}
{
var url = window.location.toString();
if (url.endsWith('#'))
url = url.substring(0, url.length - 1);
window.location = "mailto:?subject={{pwic.title|urlencode}}&body="+encodeURIComponent('\n\n'+url);
}
return false;
}
function page_print() {
window.print();
return false;
}
function page_tmap() {
var element = $('#pwic_browser');
element.toggleClass('pwic_hidden');
if (!element.hasClass('pwic_hidden'))
element[0].focus();
}
function page_post_action(action, confirmText) {
if (confirm(confirmText)) {
fetch('/api/page/'+action, {method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
page: '{{pwic.page|slash}}',
revision: {{pwic.revision}}}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
window.location = '/{{pwic.project|urlencode}}' +
'/{{pwic.page|urlencode}}' +
(action != 'delete' ? '/rev{{pwic.revision|urlencode}}' : '') +
(action == 'delete' ? '?success' : '');
})
.catch(error => alert(error));
}
return false;
}
function page_export(format) {
fetch('/api/page/export', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: '{{pwic.project|slash}}',
page: '{{pwic.page|slash}}',
revision: {{pwic.revision}},
format: format}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
var filename = response.headers.get('Content-Disposition').split('"')[1];
filename = filename.substring(10,filename.length-2);
filename = decodeURIComponent(escape(atob(filename)))
response.blob().then(blob => {
var dl = $(document.createElement('A'))
.addClass('pwic_hidden')
.attr('href', window.URL.createObjectURL(new Blob([blob], {type: blob.type})))
.attr('download', filename)
.appendTo('body')
.trigger('click')
.remove();
window.URL.revokeObjectURL(dl.href);
return true;
});
})
.catch(error => alert(error));
return false;
}
{% if not pwic.env.no_copy_code %}
function page_copy_code() {
var code = $(this).parent().text().substring($(this).text().length);
navigator.clipboard.writeText(code).then(
() => alert({% trans %}'The code has been copied successfully to the clipboard.'{% endtrans %}),
() => alert({% trans %}'The code cannot be copied to the clipboard.'{% endtrans %})
);
}
$('CODE').each((i, e) => {
if ((e.clientHeight >= 100) || (e.clientWidth >= 300))
$(e).prepend($(document.createElement('SPAN'))
.addClass('pwic_copy_code' + (e.clientHeight <= 50 ? '_tiny' : ''))
.attr('title', 'Copy')
.html('{{pwic.emojis.notes}}')
.on('click', page_copy_code));
});
{% endif %}
{% if not pwic.env.no_table_csv %}
function page_export_table() {
var csv, row, x, y, val,
table = this.parentElement;
// Prepare the table
csv = [];
for (y=0; y<table.rows.length; y++) {
row = [];
for (x=0; x<table.rows[y].cells.length; x++) {
val = table.rows[y].cells[x].textContent;
if ((val.indexOf('"') != -1) || (val.indexOf(';') != -1))
val = '"' + val.replaceAll('"', '""') + '"';
row.push(val);
}
csv.push(row.join(';'));
}
// Download the file
var blob = window.URL.createObjectURL(new Blob([csv], {type: 'text/csv'}));
$(document.createElement('A'))
.addClass('pwic_hidden')
.attr('href', blob)
.attr('download', 'table.csv')
.appendTo('BODY')
.trigger('click')
.remove();
window.URL.revokeObjectURL(blob);
}
$('ARTICLE > TABLE').each((i, e) => {
if (e.rows.length >= 10)
$(e).append($(document.createElement('CAPTION'))
.html('<span class="pwic_desktop">' + {% trans %}'Download this table as CSV file'{% endtrans %} + '<\/span><span class="pwic_mobile">&#x1F4BE;&nbsp;CSV<\/span>')
.on('click', page_export_table));
});
{% endif %}
</script>

View File

@ -1,20 +0,0 @@
<script>
'use strict';
function page_start_search() {
var args = {q: $('#page_search').val()};
if (args['q'].length > 0) {
if ($('#page_search_withrev').prop('checked'))
args['rev'] = 'on';
if ($('#page_search_casesensitive').prop('checked'))
args['cs'] = 'on';
window.location = '/{{pwic.project|urlencode}}/special/search?' + (new URLSearchParams(args).toString());
}
}
function page_search(event) {
event = event || window.event;
if (event.key == 'Enter')
page_start_search();
}
</script>

View File

@ -1,28 +0,0 @@
<script>
'use strict';
function create_submit() {
var project = $('#create_project').val(),
user = $('#create_user').val().trim().toLowerCase();
if ((project == '') || (user.substring(0, 4) == 'pwic'))
alert({% trans %}'The parameters are not acceptable.'{% endtrans %});
else {
$('INPUT[type=button]').attr('disabled', '');
fetch('/api/user/create', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ project: project,
user: user}),
credentials: 'same-origin'})
.then(response => {
$('INPUT[type=button]').removeAttr('disabled');
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
window.location = '/' + project + '/special/roles';
})
.catch(error => {
alert(error);
$('INPUT[type=button]').removeAttr('disabled');
});
}
}
</script>

View File

@ -1,33 +0,0 @@
<script>
'use strict';
function roles_toggle(id, project, user, role) {
var element = $('#roles_tag_' + id);
if (element.length > 0) {
element.toggleClass('pwic_hidden'); // Hide until the request is completed
fetch('/api/user/roles/set', { method: 'POST',
body: new URLSearchParams({ project: project,
name: user,
role: role}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok)
throw Error(response.status + ' ' + response.statusText);
response.text().then(text => {
setTimeout(() => {
if (element.attr('type') == 'checkbox')
element.prop('checked', text == 'X');
if (text != 'OK')
element.toggleClass('pwic_hidden');
}, 2000);
});
})
.catch(error => setTimeout(() => element.toggleClass('pwic_hidden'), 2000));
}
return false; // The element is updated async later
}
function roles_delete(text, id, project, user) {
return confirm(text) && roles_toggle(id, project, user, 'delete');
}
</script>

View File

@ -1,55 +0,0 @@
<script>
'use strict';
function user_password_popup() {
$('#user_password_popup').toggleClass('pwic_hidden');
$('BODY').toggleClass('pwic_nooverflow');
if ($('#user_password_popup').hasClass('pwic_hidden'))
$('#user_password_current, #user_password_new1, #user_password_new2').val('');
else {
window.scrollTo(0, 0);
$('#user_password_notice').toggleClass('pwic_hidden', window.location.toString().startsWith('https'));
document.getElementById('user_password_current').focus();
}
return false;
}
$('body').on('keydown', event => {
if ((event.key == 'Escape') && (!$('#user_password_popup').hasClass('pwic_hidden')))
user_password_popup();
});
function user_password_submit() {
var cur = $('#user_password_current').val(),
new1 = $('#user_password_new1').val(),
new2 = $('#user_password_new2').val();
if (([cur, new1, new2].indexOf('') !== -1) || (new1 != new2) || (new1 == cur))
alert({% trans %}'The form is inconsistent.'{% endtrans %});
else {
fetch('/api/user/password/change', {method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({ password_current: cur,
password_new1: new1,
password_new2: new2}),
credentials: 'same-origin'})
.then(response => {
if (!response.ok) {
document.getElementById('user_password_new1').focus();
throw Error({% trans %}'Failure to save your new password. Verify that it matches with the security rules.'{% endtrans %} + ' ['+response.status+']');
}
user_password_popup();
$('#user_password_status').html('{{pwic.emojis.green_check}}');
alert({% trans %}'Your password has been changed successfully.'{% endtrans %});
})
.catch(error => alert(error));
}
}
function user_language_set() {
fetch('/api/user/language/set', { method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({language: $('#user_language').val()}),
credentials: 'same-origin'})
.then(response => { if (response.ok) location.reload() });
}
</script>

View File

@ -1,9 +0,0 @@
from ttfrog import db
from ttfrog.pwic.pwic_admin import PwicConst
def test_db_init():
config = db.init({"SALT": "salt", "DB_DEFAULT_PORT": "012345"})
assert config.SALT == "salt"
assert config.DEFAULTS["port"] == "012345"
assert config.DEFAULTS["page"] == PwicConst.DEFAULTS["page"]