mirror of
https://github.com/documize/community.git
synced 2025-08-07 14:35:28 +02:00
cleaned repo
This commit is contained in:
parent
1154c5bac6
commit
4a5ffe97ba
1557 changed files with 770956 additions and 0 deletions
661
LICENSE
Normal file
661
LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
|
||||
<http://www.gnu.org/licenses/>.
|
46
README.md
Normal file
46
README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# To Document / Instructions
|
||||
|
||||
the build process around go get github.com/elazarl/go-bindata-assetfs
|
||||
|
||||
## GO
|
||||
|
||||
gobin / go env
|
||||
|
||||
## go-bindata-assetsfs
|
||||
|
||||
make sure you do install cmd from inside go-* folder where main.go lives
|
||||
|
||||
## SSL
|
||||
|
||||
selfcert generation and avoiding red lock
|
||||
|
||||
https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/
|
||||
|
||||
chrome://restart
|
||||
|
||||
go run generate_cert.go -host demo1.dev
|
||||
|
||||
port number not required
|
||||
but browser restart is!
|
||||
|
||||
## after clone
|
||||
|
||||
- cd app
|
||||
- npm install
|
||||
- bower install
|
||||
- cd ..
|
||||
- ./build.sh
|
||||
|
||||
# XSS
|
||||
https://www.google.com/about/appsecurity/learning/xss/#HowToTest
|
||||
|
||||
https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet_
|
||||
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape
|
||||
|
||||
# Running the Go tests
|
||||
|
||||
WARNING: DO NOT RUN THE AUTOMATED TESTS AGAINST A LIVE DATABASE.
|
||||
|
||||
Before running the Go tests, please note that they will alter the database that they are run on.
|
||||
For detailed instructions see the SDK README.md and directory "exttest".
|
53
app/README.md
Normal file
53
app/README.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Documize
|
||||
|
||||
This README outlines the details of collaborating on this Ember application.
|
||||
A short introduction of this app could easily go here.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need the following things properly installed on your computer.
|
||||
|
||||
* [Git](http://git-scm.com/)
|
||||
* [Node.js](http://nodejs.org/) (with NPM)
|
||||
* [Bower](http://bower.io/)
|
||||
* [Ember CLI](http://ember-cli.com/)
|
||||
* [PhantomJS](http://phantomjs.org/)
|
||||
|
||||
## Installation
|
||||
|
||||
* `git clone <repository-url>` this repository
|
||||
* change into the new directory
|
||||
* `npm install`
|
||||
* `bower install`
|
||||
|
||||
## Running / Development
|
||||
|
||||
* `ember server`
|
||||
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
||||
|
||||
### Code Generators
|
||||
|
||||
Make use of the many generators for code, try `ember help generate` for more details
|
||||
|
||||
### Running Tests
|
||||
|
||||
* `ember test`
|
||||
* `ember test --server`
|
||||
|
||||
### Building
|
||||
|
||||
* `ember build` (development)
|
||||
* `ember build --environment production` (production)
|
||||
|
||||
### Deploying
|
||||
|
||||
Specify what it takes to deploy your app.
|
||||
|
||||
## Further Reading / Useful Links
|
||||
|
||||
* [ember.js](http://emberjs.com/)
|
||||
* [ember-cli](http://ember-cli.com/)
|
||||
* Development Browser Extensions
|
||||
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
||||
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
|
||||
|
0
app/app/adapters/.gitkeep
Normal file
0
app/app/adapters/.gitkeep
Normal file
23
app/app/app.js
Normal file
23
app/app/app.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Ember from 'ember';
|
||||
import Resolver from './resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
let App;
|
||||
|
||||
Ember.MODEL_FACTORY_INJECTIONS = true;
|
||||
|
||||
Ember.RSVP.on('error', function(error) {
|
||||
console.log("App:");
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
App = Ember.Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
export default App;
|
17
app/app/components/document/document-editor.js
Normal file
17
app/app/components/document/document-editor.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
didReceiveAttrs() {
|
||||
this.set('editorType', 'section/' + this.get('page.contentType') + '/type-editor');
|
||||
},
|
||||
|
||||
actions: {
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(page, meta) {
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
53
app/app/components/document/document-sidebar-edits.js
Normal file
53
app/app/components/document/document-sidebar-edits.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
document: {},
|
||||
meta: [],
|
||||
pages: [],
|
||||
|
||||
didReceiveAttrs() {
|
||||
let editors = this.get('meta.editors');
|
||||
let toc = this.get('pages');
|
||||
|
||||
if (is.null(editors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
editors.forEach(function(item) {
|
||||
Ember.set(item, "added", item.action === "add-page");
|
||||
Ember.set(item, "changed", item.action === "update-page");
|
||||
Ember.set(item, "deleted", item.action === "remove-page");
|
||||
|
||||
let page = _.findWhere(toc, {
|
||||
id: item.pageId
|
||||
});
|
||||
let title = "";
|
||||
|
||||
if (is.not.undefined(page)) {
|
||||
title = page.title;
|
||||
|
||||
if (item.added) {
|
||||
Ember.set(item, 'changeLabel', "added " + title);
|
||||
}
|
||||
|
||||
if (item.changed) {
|
||||
Ember.set(item, 'changeLabel', "changed " + title);
|
||||
}
|
||||
} else {
|
||||
Ember.set(item, "deleted", true);
|
||||
|
||||
if (item.added) {
|
||||
Ember.set(item, 'changeLabel', "added section (since removed)");
|
||||
}
|
||||
|
||||
if (item.changed) {
|
||||
Ember.set(item, 'changeLabel', "changed section (since removed)");
|
||||
}
|
||||
|
||||
if (item.deleted) {
|
||||
Ember.set(item, 'changeLabel', "removed section");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
383
app/app/components/document/document-sidebar-toc.js
Normal file
383
app/app/components/document/document-sidebar-toc.js
Normal file
|
@ -0,0 +1,383 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
document: {},
|
||||
folder: {},
|
||||
pages: [],
|
||||
page: "",
|
||||
showToc: false,
|
||||
tocTools: { UpTarget: "", DownTarget: "", AllowIndent: false, AllowOutdent: false },
|
||||
actionablePage: false,
|
||||
upDisabled: true,
|
||||
downDisabled: true,
|
||||
indentDisabled: true,
|
||||
outdentDisabled: true,
|
||||
|
||||
didReceiveAttrs: function() {
|
||||
this.set('showToc', is.not.undefined(this.get('pages')) && this.get('pages').get('length') > 2);
|
||||
if (is.not.null(this.get('page'))) {
|
||||
this.send('clickGotoPage', this.get('page'));
|
||||
}
|
||||
},
|
||||
|
||||
didRender: function() {
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("toc-up-button"));
|
||||
this.addTooltip(document.getElementById("toc-down-button"));
|
||||
this.addTooltip(document.getElementById("toc-outdent-button"));
|
||||
this.addTooltip(document.getElementById("toc-indent-button"));
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this.eventBus.subscribe('documentPageAdded', this, 'onDocumentPageAdded');
|
||||
|
||||
var s = $(".document-structure");
|
||||
var pos = s.position();
|
||||
$(window).scroll(function() {
|
||||
var windowpos = $(window).scrollTop();
|
||||
if (windowpos - 200 >= pos.top) {
|
||||
s.addClass("stick");
|
||||
s.css('width', s.parent().width());
|
||||
} else {
|
||||
s.removeClass("stick");
|
||||
s.css('width', 'auto');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.eventBus.unsubscribe('documentPageAdded');
|
||||
},
|
||||
|
||||
onDocumentPageAdded(pageId) {
|
||||
this.send('clickGotoPage', pageId);
|
||||
},
|
||||
|
||||
// Controls what user can do with the toc (left sidebar).
|
||||
// Identifies the target pages.
|
||||
setState(pageId) {
|
||||
// defaults
|
||||
this.set('tocTools.UpTarget', "");
|
||||
this.set('tocTools.DownTarget', "");
|
||||
this.set('tocTools.AllowIndent', false);
|
||||
this.set('tocTools.AllowOutdent', false);
|
||||
this.set('actionablePage', false);
|
||||
this.set('upDisabled', true);
|
||||
this.set('downDisabled', true);
|
||||
this.set('indentDisabled', true);
|
||||
this.set('outdentDisabled', true);
|
||||
|
||||
if (!this.get('isEditor') || is.empty(pageId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('page', pageId);
|
||||
|
||||
var toc = this.get('pages');
|
||||
var page = _.findWhere(toc, {id: pageId});
|
||||
|
||||
// handle root node
|
||||
if (is.undefined(page) || page.level === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = _.indexOf(toc, page, false);
|
||||
|
||||
if (index === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var upPage = toc[index-1];
|
||||
var downPage = toc[index+1];
|
||||
|
||||
if (_.isUndefined(upPage)) {
|
||||
this.set('tocTools.UpTarget', "");
|
||||
}
|
||||
|
||||
if (_.isUndefined(downPage)) {
|
||||
this.set('tocTools.DownTarget', "");
|
||||
}
|
||||
|
||||
// can we go up?
|
||||
// can we indent?
|
||||
if (!_.isUndefined(upPage))
|
||||
{
|
||||
// can only go up if someone is same or higher level?
|
||||
var index2 = _.indexOf(toc, upPage, false);
|
||||
|
||||
if (index2 !== -1)
|
||||
{
|
||||
// up
|
||||
for (var i = index2; i > 0; i--)
|
||||
{
|
||||
if (page.level > toc[i].level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (page.level === toc[i].level)
|
||||
{
|
||||
this.set('tocTools.UpTarget', toc[i].id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// indent?
|
||||
for (var i2 = index2; i2 > 0; i2--)
|
||||
{
|
||||
if (toc[i2].level < page.level)
|
||||
{
|
||||
this.set('tocTools.AllowIndent', false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (page.level === toc[i2].level)
|
||||
{
|
||||
this.set('tocTools.AllowIndent', true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if page above is root node then some things you can't do
|
||||
if (upPage.level === 1)
|
||||
{
|
||||
this.set('tocTools.AllowIndent', false);
|
||||
this.set('tocTools.UpTarget', "");
|
||||
}
|
||||
}
|
||||
|
||||
// can we go down?
|
||||
if (!_.isUndefined(downPage))
|
||||
{
|
||||
// can only go down if someone below is at our level or higher
|
||||
var index3 = _.indexOf(toc, downPage, false);
|
||||
|
||||
if (index3 !== -1)
|
||||
{
|
||||
for (var i3 = index3; i3 < toc.length; i3++)
|
||||
{
|
||||
if (toc[i3].level < page.level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (page.level === toc[i3].level)
|
||||
{
|
||||
this.set('tocTools.DownTarget', toc[i3].id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (page.level > downPage.level) {
|
||||
this.set('tocTools.DownTarget', "");
|
||||
}
|
||||
}
|
||||
|
||||
// can we outdent?
|
||||
this.set('tocTools.AllowOutdent', page.level > 2);
|
||||
|
||||
this.set('upDisabled', this.get('tocTools.UpTarget') === "");
|
||||
this.set('downDisabled', this.get('tocTools.DownTarget') === "");
|
||||
this.set('indentDisabled', !this.get('tocTools.AllowIndent'));
|
||||
this.set('outdentDisabled', !this.get('tocTools.AllowOutdent'));
|
||||
|
||||
this.set('actionablePage',
|
||||
is.not.empty(this.get('tocTools.UpTarget')) ||
|
||||
is.not.empty(this.get('tocTools.DownTarget')) ||
|
||||
this.get('tocTools.AllowIndent') ||
|
||||
this.get('tocTools.AllowOutdent'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
// Page up - above pages shunt down.
|
||||
pageUp() {
|
||||
if (this.upDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = this.get('pages');
|
||||
var current = _.findWhere(pages, {id: this.get('page')});
|
||||
var page1 = _.findWhere(pages, {id: this.tocTools.UpTarget});
|
||||
var page2 = null;
|
||||
var pendingChanges = [];
|
||||
|
||||
if (is.undefined(current) || is.undefined(page1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index1 = _.indexOf(pages, page1, false);
|
||||
|
||||
if (index1 !== -1 && index1 > 1) {
|
||||
page2 = pages[index1 - 1];
|
||||
}
|
||||
|
||||
var sequence1 = page1.sequence;
|
||||
var sequence2 = is.not.null(page2) ? page2.sequence : 1024;
|
||||
|
||||
var index = _.indexOf(pages, current, false);
|
||||
|
||||
if (index !== -1)
|
||||
{
|
||||
var sequence = (sequence1 + sequence2) / 2;
|
||||
|
||||
pendingChanges.push({ pageId: current.id, sequence: sequence });
|
||||
|
||||
for (var i = index + 1; i < pages.length; i++)
|
||||
{
|
||||
if (pages[i].level <= current.level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sequence = (sequence + page1.sequence) / 2;
|
||||
|
||||
pendingChanges.push({ pageId: pages[i].id, sequence: sequence });
|
||||
}
|
||||
}
|
||||
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
|
||||
this.send('clickGotoPage', this.get('page'));
|
||||
this.audit.record("moved-page-up");
|
||||
this.showNotification("Moved up");
|
||||
},
|
||||
|
||||
// Move down -- pages below shift up.
|
||||
pageDown() {
|
||||
if (this.downDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = this.get('pages');
|
||||
var current = _.findWhere(pages, {id: this.get('page')});
|
||||
var pageIndex = _.indexOf(pages, current, false);
|
||||
var downTarget = _.findWhere(pages, {id: this.tocTools.DownTarget});
|
||||
var downTargetIndex = _.indexOf(pages, downTarget, false);
|
||||
var pendingChanges = [];
|
||||
|
||||
if (pageIndex === -1 || downTargetIndex === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var startingSequence = 0;
|
||||
var upperSequence = 0;
|
||||
var cutOff = _.rest(pages, downTargetIndex);
|
||||
var siblings = _.reject(cutOff, function(p){ return p.level !== current.level || p.id === current.id || p.id === downTarget.id; });
|
||||
|
||||
if (siblings.length > 0)
|
||||
{
|
||||
var aboveThisGuy = siblings[0];
|
||||
var belowThisGuy = pages[_.indexOf(pages, aboveThisGuy, false) - 1];
|
||||
|
||||
if (is.not.null(belowThisGuy) && belowThisGuy.level > current.level)
|
||||
{
|
||||
startingSequence = (aboveThisGuy.sequence + belowThisGuy.sequence) / 2;
|
||||
upperSequence = aboveThisGuy.sequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
var otherGuy = pages[downTargetIndex + 1];
|
||||
|
||||
startingSequence = (otherGuy.sequence + downTarget.sequence) / 2;
|
||||
upperSequence = otherGuy.sequence;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startingSequence = downTarget.sequence * 2;
|
||||
upperSequence = startingSequence * 2;
|
||||
}
|
||||
|
||||
pendingChanges.push({ pageId: current.id, sequence: startingSequence });
|
||||
|
||||
var sequence = (startingSequence + upperSequence) / 2;
|
||||
|
||||
for (var i = pageIndex + 1; i < pages.length; i++)
|
||||
{
|
||||
if (pages[i].level <= current.level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var sequence2 = (sequence + upperSequence) / 2;
|
||||
|
||||
pendingChanges.push({ pageId: pages[i].id, sequence: sequence2 });
|
||||
}
|
||||
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
|
||||
this.send('clickGotoPage', this.get('page'));
|
||||
this.audit.record("moved-page-down");
|
||||
this.showNotification("Moved down");
|
||||
},
|
||||
|
||||
// Indent - changes a page from H2 to H3, etc.
|
||||
pageIndent() {
|
||||
if (this.indentDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = this.get('pages');
|
||||
var current = _.findWhere(pages, {id: this.get('page')});
|
||||
var pageIndex = _.indexOf(pages, current, false);
|
||||
var pendingChanges = [];
|
||||
|
||||
pendingChanges.push({ pageId: current.id, level: current.level + 1 });
|
||||
|
||||
for (var i = pageIndex + 1; i < pages.length; i++)
|
||||
{
|
||||
if (pages[i].level <= current.level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pendingChanges.push({ pageId: pages[i].id, level: pages[i].level + 1 });
|
||||
}
|
||||
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
|
||||
this.send('clickGotoPage', this.get('page'));
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.showNotification("Indent");
|
||||
},
|
||||
|
||||
// Outdent - changes a page from H3 to H2, etc.
|
||||
pageOutdent() {
|
||||
if (this.outdentDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = this.get('pages');
|
||||
var current = _.findWhere(pages, {id: this.get('page')});
|
||||
var pageIndex = _.indexOf(pages, current, false);
|
||||
var pendingChanges = [];
|
||||
|
||||
pendingChanges.push({ pageId: current.id, level: current.level - 1 });
|
||||
|
||||
for (var i = pageIndex + 1; i < pages.length; i++)
|
||||
{
|
||||
if (pages[i].level <= current.level)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pendingChanges.push({ pageId: pages[i].id, level: pages[i].level - 1 });
|
||||
}
|
||||
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.showNotification("Outdent");
|
||||
this.send('clickGotoPage', this.get('page'));
|
||||
},
|
||||
|
||||
clickGotoPage(id) {
|
||||
this.setState(id);
|
||||
this.attrs.gotoPage(id);
|
||||
},
|
||||
},
|
||||
});
|
6
app/app/components/document/document-sidebar-viewers.js
Normal file
6
app/app/components/document/document-sidebar-viewers.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
document: {},
|
||||
meta: [],
|
||||
});
|
22
app/app/components/document/document-sidebar.js
Normal file
22
app/app/components/document/document-sidebar.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
document: {},
|
||||
folder: {},
|
||||
|
||||
actions: {
|
||||
// Page up - above pages shunt down.
|
||||
onPageSequenceChange(pendingChanges) {
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
},
|
||||
|
||||
// Move down -- pages below shift up.
|
||||
onPageLevelChange(pendingChanges) {
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
},
|
||||
|
||||
gotoPage(id) {
|
||||
return this.attrs.gotoPage(id);
|
||||
},
|
||||
}
|
||||
});
|
130
app/app/components/document/document-toolbar.js
Normal file
130
app/app/components/document/document-toolbar.js
Normal file
|
@ -0,0 +1,130 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
drop: null,
|
||||
users: [],
|
||||
saveTemplate: {
|
||||
name: "",
|
||||
description: ""
|
||||
},
|
||||
|
||||
didRender() {
|
||||
if (this.get('isEditor')) {
|
||||
this.addTooltip(document.getElementById("add-section-button"));
|
||||
this.addTooltip(document.getElementById("attachment-button"));
|
||||
this.addTooltip(document.getElementById("save-template-button"));
|
||||
this.addTooltip(document.getElementById("set-meta-button"));
|
||||
}
|
||||
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("owner-avatar"));
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
if (this.get('isEditor')) {
|
||||
let self = this;
|
||||
let documentId = this.get('document.id');
|
||||
let uploadUrl = this.session.appMeta.getUrl(`documents/${documentId}/attachments`);
|
||||
|
||||
let dzone = new Dropzone("#attachment-button > i", {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + self.session.getSessionItem('token')
|
||||
},
|
||||
url: uploadUrl,
|
||||
method: "post",
|
||||
paramName: 'attachment',
|
||||
clickable: true,
|
||||
maxFilesize: 10,
|
||||
parallelUploads: 3,
|
||||
uploadMultiple: false,
|
||||
addRemoveLinks: false,
|
||||
autoProcessQueue: true,
|
||||
|
||||
init: function() {
|
||||
this.on("success", function(file /*, response*/ ) {
|
||||
self.showNotification(`Attached ${file.name}`);
|
||||
});
|
||||
|
||||
this.on("queuecomplete", function() {
|
||||
self.attrs.onAttachmentUpload();
|
||||
});
|
||||
|
||||
this.on("addedfile", function( /*file*/ ) {
|
||||
self.audit.record('attached-file');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
dzone.on("complete", function(file) {
|
||||
dzone.removeFile(file);
|
||||
});
|
||||
|
||||
this.set('drop', dzone);
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
if (is.not.null(this.get('drop'))) {
|
||||
this.get('drop').destroy();
|
||||
this.set('drop', null);
|
||||
}
|
||||
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
actions: {
|
||||
saveTemplate() {
|
||||
var templateName = this.get('saveTemplate.name');
|
||||
var templateDescription = this.get('saveTemplate.description');
|
||||
|
||||
if (is.empty(templateName)) {
|
||||
$("#new-template-name").addClass("error").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is.empty(templateDescription)) {
|
||||
$("#new-template-desc").addClass("error").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
let doc = this.get('document');
|
||||
doc.set('template', true);
|
||||
doc.set('name', templateName);
|
||||
doc.set('excerpt', templateDescription);
|
||||
|
||||
this.set('saveTemplate.name', "");
|
||||
this.set('saveTemplate.description', "");
|
||||
|
||||
this.showNotification('Templated');
|
||||
this.attrs.onSaveTemplate(doc);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
saveMeta() {
|
||||
let doc = this.get('document');
|
||||
|
||||
if (is.empty(doc.get('excerpt'))) {
|
||||
$("meta-excerpt").addClass("error").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
doc.set('excerpt', doc.get('excerpt').substring(0, 250));
|
||||
doc.set('userId', this.get('owner.id'));
|
||||
this.showNotification("Saved");
|
||||
|
||||
this.attrs.onDocumentChange(doc);
|
||||
return true;
|
||||
},
|
||||
|
||||
// close dialog
|
||||
close() {
|
||||
return true;
|
||||
},
|
||||
}
|
||||
});
|
147
app/app/components/document/document-view.js
Normal file
147
app/app/components/document/document-view.js
Normal file
|
@ -0,0 +1,147 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
sectionService: Ember.inject.service('section'),
|
||||
/* Parameters */
|
||||
document: null,
|
||||
// pages: [],
|
||||
attachments: [],
|
||||
folder: null,
|
||||
folders: [],
|
||||
isEditor: false,
|
||||
/* Internal */
|
||||
drop: null,
|
||||
deleteAttachment: {
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
deletePage: {
|
||||
id: "",
|
||||
title: "",
|
||||
children: false
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
let self = this;
|
||||
|
||||
this.get('sectionService').refresh(this.get('document.id')).then(function(changes) {
|
||||
changes.forEach(function(newPage) {
|
||||
let oldPage = self.get('pages').findBy('id', newPage.get('id'));
|
||||
if (is.not.undefined(oldPage)) {
|
||||
oldPage.set('body', newPage.body);
|
||||
oldPage.set('revised', newPage.revised);
|
||||
self.showNotification(`Refreshed ${oldPage.title}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
|
||||
let drop = this.get('drop');
|
||||
|
||||
if (is.not.null(drop)) {
|
||||
drop.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
confirmDeleteAttachment(id, name) {
|
||||
this.set('deleteAttachment', {
|
||||
id: id,
|
||||
name: name
|
||||
});
|
||||
|
||||
$(".delete-attachment-dialog").css("display", "block");
|
||||
|
||||
let drop = new Drop({
|
||||
target: $(".delete-attachment-" + id)[0],
|
||||
content: $(".delete-attachment-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: "bottom right",
|
||||
openOn: "always",
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
},
|
||||
remove: false
|
||||
});
|
||||
|
||||
this.set('drop', drop);
|
||||
},
|
||||
|
||||
cancel() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
|
||||
this.set('deleteAttachment', {
|
||||
id: "",
|
||||
name: ""
|
||||
});
|
||||
},
|
||||
|
||||
deleteAttachment() {
|
||||
let attachment = this.get('deleteAttachment');
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
|
||||
this.showNotification(`Deleted ${attachment.name}`);
|
||||
this.attrs.onAttachmentDeleted(this.get('deleteAttachment').id);
|
||||
this.set('deleteAttachment', {
|
||||
id: "",
|
||||
name: ""
|
||||
});
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onDeletePage(id) {
|
||||
let page = this.get('pages').findBy("id", id);
|
||||
|
||||
if (is.undefined(page)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('deletePage', {
|
||||
id: id,
|
||||
title: page.get('title'),
|
||||
children: false
|
||||
});
|
||||
|
||||
$(".delete-page-dialog").css("display", "block");
|
||||
|
||||
let drop = new Drop({
|
||||
target: $("#page-toolbar-" + id)[0],
|
||||
content: $(".delete-page-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: "bottom right",
|
||||
openOn: "always",
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
},
|
||||
remove: false
|
||||
});
|
||||
|
||||
this.set('drop', drop);
|
||||
},
|
||||
|
||||
deletePage() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
|
||||
this.attrs.onDeletePage(this.deletePage);
|
||||
},
|
||||
|
||||
// onTagChange event emitted from document/tag-editor component
|
||||
onTagChange(tags) {
|
||||
let doc = this.get('document');
|
||||
doc.set('tags', tags);
|
||||
this.get('documentService').save(doc);
|
||||
}
|
||||
}
|
||||
});
|
70
app/app/components/document/editor-history.js
Normal file
70
app/app/components/document/editor-history.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
documentService: Ember.inject.service('document'),
|
||||
|
||||
revisions: [],
|
||||
diffReport: "",
|
||||
busy: false,
|
||||
currentRevisionId: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (is.undefined(this.get('model'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
let self = this;
|
||||
|
||||
this.get('documentService').getPageRevisions(this.get('model.documentId'), this.get('model.pageId')).then(function(response) {
|
||||
if (is.array(response)) {
|
||||
self.set('revisions', response);
|
||||
if (response.length > 0) {
|
||||
self.send('produceReport', response[0].id);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
didRender() {
|
||||
let self = this;
|
||||
Ember.run.schedule('afterRender', function(){
|
||||
Mousetrap.bind('esc', function() { self.send('cancelAction'); return false;});
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
produceReport(revisionId) {
|
||||
this.set('busy', true);
|
||||
this.set('diffReport', "");
|
||||
this.set('currentRevisionId', revisionId);
|
||||
|
||||
// visually mark active revision
|
||||
let revisions = this.get('revisions');
|
||||
|
||||
revisions.forEach(function(revision) {
|
||||
Ember.set(revision, 'selected', false);
|
||||
});
|
||||
|
||||
let revision = _.findWhere(revisions, { id: revisionId});
|
||||
Ember.set(revision, 'selected', true);
|
||||
|
||||
let self = this;
|
||||
|
||||
this.get('documentService').getPageRevisionDiff(this.get('model.documentId'),
|
||||
this.get('model.pageId'), revisionId).then(function(response) {
|
||||
self.set('busy', false);
|
||||
self.set('diffReport', Ember.String.htmlSafe(response));
|
||||
});
|
||||
},
|
||||
|
||||
cancelAction() {
|
||||
this.attrs.editorClose();
|
||||
},
|
||||
|
||||
primaryAction() {
|
||||
if (this.session.isEditor) {
|
||||
this.attrs.editorAction(this.get('model.pageId'), this.get('currentRevisionId'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
23
app/app/components/document/page-heading.js
Normal file
23
app/app/components/document/page-heading.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Ember from 'ember';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(TooltipMixin, {
|
||||
didRender() {
|
||||
if (this.get('isEditor')) {
|
||||
let self = this;
|
||||
$(".page-edit-button, .page-delete-button").each(function(i, el) {
|
||||
self.addTooltip(el);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
editPage(id) {
|
||||
this.attrs.onEditPage(id);
|
||||
},
|
||||
|
||||
deletePage(id) {
|
||||
this.attrs.onDeletePage(id);
|
||||
},
|
||||
}
|
||||
});
|
43
app/app/components/document/page-wizard.js
Normal file
43
app/app/components/document/page-wizard.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
title: "",
|
||||
contentType: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
let section = this.get("sections").get('firstObject');
|
||||
section.set("selected", true);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
$("#page-title").removeClass("error").focus();
|
||||
},
|
||||
|
||||
actions: {
|
||||
setOption(id) {
|
||||
let sections = this.get("sections");
|
||||
|
||||
sections.forEach(function(option) {
|
||||
Ember.set(option, 'selected', option.id === id);
|
||||
});
|
||||
|
||||
this.set("sections", sections);
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction() {
|
||||
let title = this.get("title");
|
||||
let contentType = this.get("sections").findBy("selected", true).contentType;
|
||||
|
||||
if (is.empty(title)) {
|
||||
$("#page-title").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.attrs.onAction(title, contentType);
|
||||
}
|
||||
}
|
||||
});
|
100
app/app/components/document/tag-editor.js
Normal file
100
app/app/components/document/tag-editor.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
documentTags: [],
|
||||
tagz: [],
|
||||
isEditor: false,
|
||||
newTag: "",
|
||||
maxTags: 3,
|
||||
canAdd: false,
|
||||
|
||||
didInitAttrs() {
|
||||
let tagz = [];
|
||||
|
||||
if (this.get('documentTags').length > 1) {
|
||||
let tags = this.get('documentTags').split('#');
|
||||
_.each(tags, function(tag) {
|
||||
if (tag.length > 0) {
|
||||
tagz.pushObject(tag);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.set('tagz', tagz);
|
||||
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
|
||||
},
|
||||
|
||||
didUpdateAttrs() {
|
||||
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
$("#add-tag-field").off("keydown");
|
||||
},
|
||||
|
||||
actions: {
|
||||
onTagEditor() {
|
||||
$("#add-tag-field").off("keydown").on("keydown", function(e) {
|
||||
if (e.shiftKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.which === 13 || e.which === 45 || e.which === 189 || e.which === 8 || e.which === 127 || (e.which >= 65 && e.which <= 90) || (e.which >= 97 && e.which <= 122) || (e.which >= 48 && e.which <= 57)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
addTag() {
|
||||
let tags = this.get("tagz");
|
||||
let tag = this.get('newTag');
|
||||
tag = tag.toLowerCase().trim();
|
||||
|
||||
// empty or dupe?
|
||||
if (tag.length === 0 || _.contains(tags, tag) || tags.length >= this.get('maxTags') || tag.startsWith('-')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tags.pushObject(tag);
|
||||
this.set('tagz', tags);
|
||||
this.set('newTag', '');
|
||||
|
||||
let save = "#";
|
||||
_.each(tags, function(tag) {
|
||||
save = save + tag + "#";
|
||||
});
|
||||
|
||||
this.get('onChange')(save);
|
||||
|
||||
this.audit.record('added-tag');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// removeTag removes specified tag from the list of tags associated with this document.
|
||||
removeTag(tagToRemove) {
|
||||
let tags = this.get("tagz");
|
||||
let save = "";
|
||||
|
||||
tags = _.without(tags, tagToRemove);
|
||||
|
||||
_.each(tags, function(tag) {
|
||||
save = save + tag + "#";
|
||||
});
|
||||
|
||||
if (save.length) {
|
||||
save = "#" + save;
|
||||
}
|
||||
|
||||
this.set('tagz', tags);
|
||||
this.get('onChange')(save);
|
||||
this.audit.record('removed tag');
|
||||
},
|
||||
}
|
||||
});
|
99
app/app/components/dropdown-dialog.js
Normal file
99
app/app/components/dropdown-dialog.js
Normal file
|
@ -0,0 +1,99 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
import stringUtil from '../utils/string';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
drop: null,
|
||||
target: null,
|
||||
button: "Delete",
|
||||
color: "flat-red",
|
||||
button2: "",
|
||||
color2: "2",
|
||||
open: "click",
|
||||
position: 'bottom right',
|
||||
showCancel: true,
|
||||
contentId: "",
|
||||
focusOn: null, // is there an input field we need to focus?
|
||||
selectOn: null, // is there an input field we need to select?
|
||||
onOpenCallback: null, // callback when opened
|
||||
onAction: null,
|
||||
onAction2: null,
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0",
|
||||
|
||||
hasSecondButton: Ember.computed('button2', 'color2', function() {
|
||||
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set("contentId", 'dropdown-dialog-' + stringUtil.makeId(10));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
let self = this;
|
||||
|
||||
let drop = new Drop({
|
||||
target: document.getElementById(self.get('target')),
|
||||
content: self.$(".dropdown-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: self.get('position'),
|
||||
openOn: self.get('open'),
|
||||
tetherOptions: {
|
||||
offset: self.offset,
|
||||
targetOffset: self.targetOffset
|
||||
},
|
||||
remove: true
|
||||
});
|
||||
|
||||
self.set('drop', drop);
|
||||
|
||||
drop.on('open', function() {
|
||||
if (is.not.null(self.get("focusOn"))) {
|
||||
document.getElementById(self.get("focusOn")).focus();
|
||||
}
|
||||
|
||||
if (is.not.null(self.get("selectOn"))) {
|
||||
document.getElementById(self.get("selectOn")).select();
|
||||
}
|
||||
|
||||
if (is.not.null(self.get("onOpenCallback"))) {
|
||||
self.attrs.onOpenCallback(drop);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.get('drop').destroy();
|
||||
},
|
||||
|
||||
actions: {
|
||||
onCancel() {
|
||||
this.get('drop').close();
|
||||
},
|
||||
|
||||
onAction() {
|
||||
if (this.get('onAction') === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let close = this.attrs.onAction();
|
||||
|
||||
if (close) {
|
||||
this.get('drop').close();
|
||||
}
|
||||
},
|
||||
|
||||
onAction2() {
|
||||
if (this.get('onAction2') === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let close = this.attrs.onAction2();
|
||||
|
||||
if (close) {
|
||||
this.get('drop').close();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
42
app/app/components/dropdown-menu.js
Normal file
42
app/app/components/dropdown-menu.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
import stringUtil from '../utils/string';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
target: null,
|
||||
open: "click",
|
||||
position: 'bottom right',
|
||||
contentId: "",
|
||||
drop: null,
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
|
||||
|
||||
// if (this.session.get('isMobile')) {
|
||||
// this.set('open', "click");
|
||||
// }
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
let self = this;
|
||||
|
||||
let drop = new Drop({
|
||||
target: document.getElementById(self.get('target')),
|
||||
content: self.$(".dropdown-menu")[0],
|
||||
classes: 'drop-theme-menu',
|
||||
position: self.get('position'),
|
||||
openOn: self.get('open'),
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
}
|
||||
});
|
||||
|
||||
self.set('drop', drop);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.get('drop').destroy();
|
||||
}
|
||||
});
|
7
app/app/components/focus-input.js
Normal file
7
app/app/components/focus-input.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.TextField.extend({
|
||||
becomeFocused: function() {
|
||||
this.$().focus();
|
||||
}.on('didInsertElement')
|
||||
});
|
7
app/app/components/focus-textarea.js
Normal file
7
app/app/components/focus-textarea.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.TextArea.extend({
|
||||
becomeFocused: function() {
|
||||
this.$().focus();
|
||||
}.on('didInsertElement')
|
||||
});
|
27
app/app/components/folder/document-tags.js
Normal file
27
app/app/components/folder/document-tags.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
documentTags: [],
|
||||
tagz: [],
|
||||
|
||||
didInitAttrs() {
|
||||
let tagz = [];
|
||||
|
||||
if (this.get('documentTags').length > 1) {
|
||||
let tags = this.get('documentTags').split('#');
|
||||
_.each(tags, function(tag) {
|
||||
if (tag.length > 0) {
|
||||
tagz.pushObject("#" + tag);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.set('tagz', tagz);
|
||||
},
|
||||
|
||||
actions: {
|
||||
filterByTag(tag) {
|
||||
this.get('filterByTag')(tag);
|
||||
}
|
||||
}
|
||||
});
|
30
app/app/components/folder/documents-list.js
Normal file
30
app/app/components/folder/documents-list.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
selectedDocuments: [],
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set('selectedDocuments', []);
|
||||
},
|
||||
|
||||
actions: {
|
||||
selectDocument(documentId) {
|
||||
let doc = this.get('documents').findBy('id', documentId);
|
||||
let list = this.get('selectedDocuments');
|
||||
|
||||
doc.set('selected', !doc.get('selected'));
|
||||
|
||||
if (doc.get('selected')) {
|
||||
list.push(documentId);
|
||||
} else {
|
||||
var index = list.indexOf(documentId);
|
||||
if (index > -1) {
|
||||
list.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.set('selectedDocuments', list);
|
||||
this.get('onDocumentsChecked')(list);
|
||||
}
|
||||
}
|
||||
});
|
145
app/app/components/folder/folder-dashboard.js
Normal file
145
app/app/components/folder/folder-dashboard.js
Normal file
|
@ -0,0 +1,145 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
templateService: Ember.inject.service('template'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
folder: {},
|
||||
busy: false,
|
||||
hasSelectedDocuments: false,
|
||||
selectedDocuments: [],
|
||||
importedDocuments: [],
|
||||
savedTemplates: [],
|
||||
isFolderOwner: false,
|
||||
moveFolderId: "",
|
||||
|
||||
hasDocuments: function() {
|
||||
return this.documents.get('length') > 0;
|
||||
}.property('documents.length'),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set('hasSelectedDocuments', false);
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('importedDocuments', []);
|
||||
this.set('isFolderOwner', this.get('folder.userId') === this.session.user.id);
|
||||
|
||||
let self = this;
|
||||
|
||||
this.get('templateService').getSavedTemplates().then(function(saved) {
|
||||
let emptyTemplate = { id: "0", title: "Empty document", selected: true };
|
||||
saved.unshiftObject(emptyTemplate);
|
||||
self.set('savedTemplates', saved);
|
||||
});
|
||||
|
||||
let targets = _.reject(this.get('folders'), { id: this.get('folder').get('id') });
|
||||
this.set('movedFolderOptions', targets);
|
||||
},
|
||||
|
||||
didRender() {
|
||||
if (this.get('hasSelectedDocuments')) {
|
||||
this.addTooltip(document.getElementById("move-documents-button"));
|
||||
this.addTooltip(document.getElementById("delete-documents-button"));
|
||||
} else {
|
||||
if (this.get('isFolderOwner')) {
|
||||
this.addTooltip(document.getElementById("folder-share-button"));
|
||||
this.addTooltip(document.getElementById("folder-settings-button"));
|
||||
}
|
||||
if (this.get('folderService').get('canEditCurrentFolder')) {
|
||||
this.addTooltip(document.getElementById("start-document-button"));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
navigateToDocument(document){
|
||||
this.attrs.showDocument(this.get('folder'), document);
|
||||
},
|
||||
|
||||
actions: {
|
||||
onDocumentsChecked(documents) {
|
||||
this.set('selectedDocuments', documents);
|
||||
this.set('hasSelectedDocuments', documents.length > 0);
|
||||
},
|
||||
|
||||
onEditTemplate(template) {
|
||||
this.navigateToDocument(template);
|
||||
},
|
||||
|
||||
onDocumentTemplate(id /*, title, type*/) {
|
||||
let self = this;
|
||||
|
||||
this.send("showNotification", "Creating");
|
||||
|
||||
this.get('templateService').importSavedTemplate(this.folder.get('id'), id).then(function(document) {
|
||||
self.navigateToDocument(document);
|
||||
});
|
||||
},
|
||||
|
||||
onDocumentImporting(filename) {
|
||||
this.send("showNotification", `Importing ${filename}`);
|
||||
|
||||
let documents = this.get('importedDocuments');
|
||||
documents.push(filename);
|
||||
this.set('importedDocuments', documents);
|
||||
},
|
||||
|
||||
onDocumentImported(filename/*, document*/) {
|
||||
this.send("showNotification", `${filename} ready`);
|
||||
|
||||
let documents = this.get('importedDocuments');
|
||||
documents.pop(filename);
|
||||
this.set('importedDocuments', documents);
|
||||
|
||||
this.attrs.refresh();
|
||||
|
||||
if (documents.length === 0) {
|
||||
// this.get('showDocument')(this.get('folder'), document);
|
||||
}
|
||||
},
|
||||
|
||||
deleteDocuments() {
|
||||
let documents = this.get('selectedDocuments');
|
||||
let self = this;
|
||||
|
||||
documents.forEach(function(document) {
|
||||
self.get('documentService').deleteDocument(document).then(function() {
|
||||
self.get('refresh')();
|
||||
});
|
||||
});
|
||||
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('hasSelectedDocuments', false);
|
||||
this.send("showNotification", "Deleted");
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
setMoveFolder(folderId) {
|
||||
this.set('moveFolderId', folderId);
|
||||
|
||||
let folders = this.get('folders');
|
||||
|
||||
folders.forEach(folder => {
|
||||
folder.set('selected', folder.id === folderId);
|
||||
});
|
||||
},
|
||||
|
||||
moveDocuments() {
|
||||
if (this.get("moveFolderId") === "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.get('onMoveDocument')(this.get('selectedDocuments'), this.get('moveFolderId'));
|
||||
this.set("moveFolderId", "");
|
||||
this.send("showNotification", "Moved");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
98
app/app/components/folder/folder-settings.js
Normal file
98
app/app/components/folder/folder-settings.js
Normal file
|
@ -0,0 +1,98 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
folderService: Ember.inject.service('folder'),
|
||||
users: [],
|
||||
folders: [],
|
||||
folder: {},
|
||||
moveTarget: null,
|
||||
inviteEmail: "",
|
||||
inviteMessage: "",
|
||||
roleMessage: "",
|
||||
permissions: {},
|
||||
|
||||
getDefaultInvitationMessage() {
|
||||
return "Hey there, I am sharing the " + this.folder.get('name') + " (in " + this.session.appMeta.title + ") with you so we can both access the same documents.";
|
||||
},
|
||||
|
||||
willRender() {
|
||||
if (this.inviteMessage.length === 0) {
|
||||
this.set('inviteMessage', this.getDefaultInvitationMessage());
|
||||
}
|
||||
|
||||
if (this.roleMessage.length === 0) {
|
||||
this.set('roleMessage', this.getDefaultInvitationMessage());
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
rename() {
|
||||
if (is.empty(this.folder.get('name'))) {
|
||||
$("#folderName").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendAction("onRename", this.folder);
|
||||
},
|
||||
|
||||
remove() {
|
||||
if (is.null(this.get('moveTarget'))) {
|
||||
$("#delete-target > select").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendAction("onRemove", this.get('moveTarget').get('id'));
|
||||
},
|
||||
|
||||
share() {
|
||||
var email = this.get('inviteEmail').trim().replace(/ /g, '');
|
||||
var message = this.get('inviteMessage').trim();
|
||||
|
||||
if (message.length === 0) {
|
||||
message = this.getDefaultInvitationMessage();
|
||||
}
|
||||
|
||||
if (email.length === 0) {
|
||||
$("#inviteEmail").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var result = {
|
||||
Message: message,
|
||||
Recipients: []
|
||||
};
|
||||
|
||||
// Check for multiple email addresses
|
||||
if (email.indexOf(",") > -1) {
|
||||
result.Recipients = email.split(',');
|
||||
}
|
||||
if (email.indexOf(";") > -1 && result.Recipients.length === 0) {
|
||||
result.Recipients = email.split(';');
|
||||
}
|
||||
|
||||
// Handle just one email address
|
||||
if (result.Recipients.length === 0 && email.length > 0) {
|
||||
result.Recipients.push(email);
|
||||
}
|
||||
|
||||
this.set('inviteEmail', "");
|
||||
|
||||
this.sendAction("onShare", result);
|
||||
},
|
||||
|
||||
setPermissions() {
|
||||
var message = this.get('roleMessage').trim();
|
||||
|
||||
if (message.length === 0) {
|
||||
message = this.getDefaultInvitationMessage();
|
||||
}
|
||||
|
||||
this.get('permissions').forEach(function(permission, index) /* jshint ignore:line */ {
|
||||
Ember.set(permission, 'canView', $("#canView-" + permission.userId).prop('checked'));
|
||||
Ember.set(permission, 'canEdit', $("#canEdit-" + permission.userId).prop('checked'));
|
||||
});
|
||||
|
||||
this.sendAction("onPermission", this.get('folder'), message, this.get('permissions'));
|
||||
}
|
||||
}
|
||||
});
|
74
app/app/components/folder/folders-list.js
Normal file
74
app/app/components/folder/folders-list.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
import constants from '../../utils/constants';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(TooltipMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
publicFolders: [],
|
||||
protectedFolders: [],
|
||||
privateFolders: [],
|
||||
hasPublicFolders: false,
|
||||
hasProtectedFolders: false,
|
||||
hasPrivateFolders: false,
|
||||
newFolder: "",
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("add-folder-button"));
|
||||
}
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
let folders = this.get('folders');
|
||||
let self = this;
|
||||
|
||||
// clear out state
|
||||
this.set('publicFolders', []);
|
||||
this.set('protectedFolders', []);
|
||||
this.set('privateFolders', []);
|
||||
|
||||
_.each(folders, folder => {
|
||||
if (folder.folderType === constants.FolderType.Public) {
|
||||
let folders = self.get('publicFolders');
|
||||
folders.pushObject(folder);
|
||||
self.set('publicFolders', folders);
|
||||
}
|
||||
if (folder.folderType === constants.FolderType.Private) {
|
||||
let folders = self.get('privateFolders');
|
||||
folders.pushObject(folder);
|
||||
self.set('privateFolders', folders);
|
||||
}
|
||||
if (folder.folderType === constants.FolderType.Protected) {
|
||||
let folders = self.get('protectedFolders');
|
||||
folders.pushObject(folder);
|
||||
self.set('protectedFolders', folders);
|
||||
}
|
||||
});
|
||||
|
||||
this.set('hasPublicFolders', this.get('publicFolders.length') > 0);
|
||||
this.set('hasPrivateFolders', this.get('privateFolders.length') > 0);
|
||||
this.set('hasProtectedFolders', this.get('protectedFolders.length') > 0);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
actions: {
|
||||
addFolder() {
|
||||
var folderName = this.get('newFolder');
|
||||
|
||||
if (is.empty(folderName)) {
|
||||
$("#new-folder-name").addClass("error").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
this.attrs.onFolderAdd(folderName);
|
||||
|
||||
this.set('newFolder', "");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
89
app/app/components/folder/start-document.js
Normal file
89
app/app/components/folder/start-document.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, {
|
||||
|
||||
tagName: 'span',
|
||||
selectedTemplate: { id: "0" },
|
||||
canEditTemplate: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.send('setTemplate', this.get('savedTemplates')[0]);
|
||||
},
|
||||
|
||||
actions: {
|
||||
setTemplate(chosen) {
|
||||
if (is.undefined(chosen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('selectedTemplate', chosen);
|
||||
this.set('canEditTemplate', chosen.id !== "0" ? "Edit" : "");
|
||||
|
||||
let templates = this.get('savedTemplates');
|
||||
|
||||
templates.forEach(template => {
|
||||
Ember.set(template, 'selected', template.id === chosen.id);
|
||||
});
|
||||
},
|
||||
|
||||
editTemplate() {
|
||||
let template = this.get('selectedTemplate');
|
||||
|
||||
this.audit.record('edited-saved-template');
|
||||
this.attrs.onEditTemplate(template);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
startDocument() {
|
||||
let template = this.get('selectedTemplate');
|
||||
|
||||
this.audit.record('used-saved-template');
|
||||
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
||||
return true;
|
||||
},
|
||||
|
||||
onOpenCallback() {
|
||||
let self = this;
|
||||
let folderId = this.get('folder.id');
|
||||
let importUrl = this.session.appMeta.getUrl('import/folder/' + folderId);
|
||||
|
||||
let dzone = new Dropzone("#upload-documents", {
|
||||
headers: {'Authorization': 'Bearer ' + self.session.getSessionItem('token') },
|
||||
url: importUrl,
|
||||
method: "post",
|
||||
paramName: 'attachment',
|
||||
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
|
||||
clickable: true,
|
||||
maxFilesize: 10,
|
||||
parallelUploads: 3,
|
||||
uploadMultiple: false,
|
||||
addRemoveLinks: false,
|
||||
autoProcessQueue: true,
|
||||
|
||||
init: function() {
|
||||
this.on("success", function(document) {
|
||||
self.attrs.onDocumentImported(document.name, document);
|
||||
});
|
||||
|
||||
this.on("error", function(x) {
|
||||
console.log("Conversion failed for ", x.name, " obj ",x); // TODO proper error handling
|
||||
});
|
||||
|
||||
this.on("queuecomplete", function() {
|
||||
});
|
||||
|
||||
this.on("addedfile", function(file) {
|
||||
self.attrs.onDocumentImporting(file.name);
|
||||
self.audit.record('converted-document');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
dzone.on("complete", function(file) {
|
||||
dzone.removeFile(file);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
4
app/app/components/header/message-box.js
Normal file
4
app/app/components/header/message-box.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
28
app/app/components/header/page-navigation.js
Normal file
28
app/app/components/header/page-navigation.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
import netUtil from '../../utils/net';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
dashboardMode: false,
|
||||
searchMode: false,
|
||||
profileMode: false,
|
||||
settingsMode: false,
|
||||
folderMode: false,
|
||||
documentMode: false,
|
||||
|
||||
didInitAttrs() {
|
||||
let self = this;
|
||||
if (this.session.authenticated) {
|
||||
this.session.user.accounts.forEach(function(account) {
|
||||
account.active = account.orgId === self.session.appMeta.orgId;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
switchAccount(domain) {
|
||||
this.audit.record('switched-account');
|
||||
window.location.href = netUtil.getAppUrl(domain);
|
||||
}
|
||||
}
|
||||
});
|
17
app/app/components/header/search-box.js
Normal file
17
app/app/components/header/search-box.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
filter: "",
|
||||
|
||||
didInitAttrs() {
|
||||
this.get('onFilter')(this.get('filter'));
|
||||
},
|
||||
|
||||
onKeywordChange: function() {
|
||||
Ember.run.debounce(this, this.fetch, 750);
|
||||
}.observes('filter'),
|
||||
|
||||
fetch() {
|
||||
this.get('onFilter')(this.get('filter'));
|
||||
},
|
||||
});
|
4
app/app/components/layout/page-container.js
Normal file
4
app/app/components/layout/page-container.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
4
app/app/components/layout/page-content.js
Normal file
4
app/app/components/layout/page-content.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
4
app/app/components/layout/page-sidebar.js
Normal file
4
app/app/components/layout/page-sidebar.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
130
app/app/components/onboard/share-folder.js
Normal file
130
app/app/components/onboard/share-folder.js
Normal file
|
@ -0,0 +1,130 @@
|
|||
import Ember from 'ember';
|
||||
import encodingUtil from '../../utils/encoding';
|
||||
import netUtil from '../../utils/net';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
serial: "",
|
||||
folderId: "",
|
||||
slug: "",
|
||||
processing: false,
|
||||
|
||||
didRender() {
|
||||
let self = this;
|
||||
|
||||
$("#stage-1-firstname").focus();
|
||||
|
||||
// Stage 1 - person name keypress handler
|
||||
$("#stage-1-firstname, #stage-1-lastname").keyup(function()
|
||||
{
|
||||
if (!$("#stage-1-firstname").val() || !$("#stage-1-lastname").val())
|
||||
{
|
||||
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".name-status").attr("src", "assets/img/onboard/person-green.png");
|
||||
}
|
||||
});
|
||||
|
||||
// Stage 1 - finish
|
||||
$("#stage-1-next").off('click').on('click', function()
|
||||
{
|
||||
if (!$("#stage-1-firstname").val())
|
||||
{
|
||||
$("#stage-1-firstname").focus();
|
||||
$("#stage-1-firstname").addClass("error");
|
||||
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$("#stage-1-lastname").val())
|
||||
{
|
||||
$("#stage-1-lastname").focus();
|
||||
$("#stage-1-lastname").addClass("error");
|
||||
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
|
||||
return;
|
||||
}
|
||||
|
||||
self.set('processing', false);
|
||||
|
||||
$(".stage-1").fadeOut("slow", function()
|
||||
{
|
||||
if (self.get('processing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.set('processing', true);
|
||||
|
||||
$(".stage-2").fadeIn();
|
||||
$("#stage-2-password").focus();
|
||||
|
||||
// Stage 2 - password keypress handler
|
||||
$("#stage-2-password-confirm").keyup(function()
|
||||
{
|
||||
if ($("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50 ||
|
||||
($("#stage-2-password").val() !== $("#stage-2-password-confirm").val()))
|
||||
{
|
||||
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".password-status").attr("src", "assets/img/onboard/lock-green.png");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Stage 2 - finish
|
||||
$("#stage-2-next").off('click').on('click', function()
|
||||
{
|
||||
if (!$("#stage-2-password").val() || $("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50)
|
||||
{
|
||||
$("#stage-2-password").focus();
|
||||
$("#stage-2-password").addClass("error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$("#stage-2-password-confirm").val())
|
||||
{
|
||||
$("#stage-2-password-confirm").focus();
|
||||
$("#stage-2-password-confirm").addClass("error");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#stage-2-password-confirm").val() !== $("#stage-2-password").val())
|
||||
{
|
||||
$(".mismatch").show();
|
||||
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
|
||||
return;
|
||||
}
|
||||
|
||||
self.set('processing', false);
|
||||
|
||||
$(".stage-2").fadeOut("slow", function()
|
||||
{
|
||||
if (self.get('processing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.set('processing', true);
|
||||
|
||||
$(".stage-3").fadeIn();
|
||||
$("#spinner-1").show();
|
||||
|
||||
var payload = '{ "Password": "' + $("#stage-2-password").val() + '", "Serial": "' + self.serial + '", "Firstname": "' + $("#stage-1-firstname").val() + '", "Lastname": "' + $("#stage-1-lastname").val() + '" }';
|
||||
var password = $("#stage-2-password").val();
|
||||
|
||||
self.get('folderService').onboard(self.folderId, payload).then(function(user) {
|
||||
var credentials = encodingUtil.Base64.encode(netUtil.getSubdomain() + ":" + user.email + ":" + password);
|
||||
self.session.sso(credentials).then(function() {
|
||||
window.location.href = 's/' + self.folderId + "/" + self.slug;
|
||||
});
|
||||
}, function() {
|
||||
window.location.href = "/";
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
23
app/app/components/search/search-results.js
Normal file
23
app/app/components/search/search-results.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
results: [],
|
||||
resultPhrase: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
let count = this.get('results').length;
|
||||
let self = this;
|
||||
|
||||
switch (count) {
|
||||
case 0:
|
||||
self.set("resultPhrase", "No results.");
|
||||
break;
|
||||
case 1:
|
||||
self.set("resultPhrase", "1 reference found");
|
||||
break;
|
||||
default:
|
||||
self.set("resultPhrase", `${count} references found`);
|
||||
}
|
||||
}
|
||||
});
|
21
app/app/components/search/tag-list.js
Normal file
21
app/app/components/search/tag-list.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
documentTags: [],
|
||||
tagz: [],
|
||||
|
||||
didInitAttrs() {
|
||||
let tagz = [];
|
||||
|
||||
if (this.get('documentTags').length > 1) {
|
||||
let tags = this.get('documentTags').split('#');
|
||||
_.each(tags, function(tag) {
|
||||
if (tag.length > 0) {
|
||||
tagz.pushObject(tag);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.set('tagz', tagz);
|
||||
}
|
||||
});
|
80
app/app/components/section/base-editor.js
Normal file
80
app/app/components/section/base-editor.js
Normal file
|
@ -0,0 +1,80 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
drop: null,
|
||||
cancelLabel: "Cancel",
|
||||
actionLabel: "Save",
|
||||
tip: "Short and concise title for the page",
|
||||
busy: false,
|
||||
|
||||
didRender() {
|
||||
let self = this;
|
||||
Mousetrap.bind('esc', function() {
|
||||
self.send('onCancel');
|
||||
return false;
|
||||
});
|
||||
Mousetrap.bind(['ctrl+s', 'command+s'], function() {
|
||||
self.send('onAction');
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#page-title").removeClass("error");
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
let drop = this.get('drop');
|
||||
|
||||
if (is.not.null(drop)) {
|
||||
drop.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
onCancel() {
|
||||
if (this.attrs.isDirty() !== null && this.attrs.isDirty()) {
|
||||
$(".discard-edits-dialog").css("display", "block");
|
||||
|
||||
let drop = new Drop({
|
||||
target: $("#editor-cancel")[0],
|
||||
content: $(".cancel-edits-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: "bottom right",
|
||||
openOn: "always",
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
},
|
||||
remove: false
|
||||
});
|
||||
|
||||
this.set('drop', drop);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction() {
|
||||
if (this.get('busy')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is.empty(this.get('page.title'))) {
|
||||
$("#page-title").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.attrs.onAction(this.get('page.title'));
|
||||
},
|
||||
|
||||
keepEditing() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
},
|
||||
|
||||
discardEdits() {
|
||||
this.attrs.onCancel();
|
||||
}
|
||||
}
|
||||
});
|
7
app/app/components/section/base-renderer.js
Normal file
7
app/app/components/section/base-renderer.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
didReceiveAttrs() {
|
||||
this.set('rendererType', 'section/' + this.get('page.contentType') + '/type-renderer');
|
||||
},
|
||||
});
|
121
app/app/components/section/code/type-editor.js
Normal file
121
app/app/components/section/code/type-editor.js
Normal file
|
@ -0,0 +1,121 @@
|
|||
import Ember from 'ember';
|
||||
import TooltipMixin from '../../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(TooltipMixin, {
|
||||
isDirty: false,
|
||||
pageBody: "",
|
||||
codeEditor: null,
|
||||
syntaxOptions: [],
|
||||
codeSyntax: null,
|
||||
|
||||
didInitAttrs() {
|
||||
let self = this;
|
||||
CodeMirror.modeURL = "codemirror/mode/%N/%N.js";
|
||||
|
||||
let rawBody = this.get('meta.rawBody');
|
||||
let cleanBody = rawBody.replace("</pre>", "");
|
||||
|
||||
cleanBody = cleanBody.replace('<pre class="code-mirror cm-s-solarized cm-s-dark" data-lang="', "");
|
||||
let startPos = cleanBody.indexOf('">');
|
||||
let syntax = {
|
||||
mode: "html",
|
||||
name: "HTML"
|
||||
};
|
||||
|
||||
if (startPos !== -1) {
|
||||
syntax = cleanBody.substring(0, startPos);
|
||||
cleanBody = cleanBody.substring(startPos + 2);
|
||||
}
|
||||
|
||||
this.set('pageBody', cleanBody);
|
||||
|
||||
let opts = [];
|
||||
|
||||
_.each(_.sortBy(CodeMirror.modeInfo, 'name'), function(item) {
|
||||
let i = {
|
||||
mode: item.mode,
|
||||
name: item.name
|
||||
};
|
||||
opts.pushObject(i);
|
||||
|
||||
if (item.mode === syntax) {
|
||||
self.set('codeSyntax', i);
|
||||
}
|
||||
});
|
||||
|
||||
this.set('syntaxOptions', opts);
|
||||
|
||||
// default check
|
||||
if (is.null(this.get("codeSyntax"))) {
|
||||
this.set("codeSyntax", opts.findBy("mode", "html"));
|
||||
}
|
||||
},
|
||||
|
||||
didRender() {
|
||||
this.addTooltip(document.getElementById("set-syntax-zone"));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code-editor"), {
|
||||
theme: "solarized dark",
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
indentUnit: 4,
|
||||
tabSize: 4,
|
||||
value: "",
|
||||
dragDrop: false
|
||||
});
|
||||
|
||||
editor.setSize("100%", $(document).height() - $(".document-editor > .toolbar").height() - 180);
|
||||
|
||||
this.set('codeEditor', editor);
|
||||
|
||||
let syntax = this.get("codeSyntax");
|
||||
|
||||
if (is.not.undefined(syntax)) {
|
||||
CodeMirror.autoLoadMode(editor, syntax.mode);
|
||||
editor.setOption("mode", syntax.mode);
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
this.set('codeEditor', null);
|
||||
},
|
||||
|
||||
// Wrap code in PRE tag with language identifier for subsequent rendering.
|
||||
getPRE() {
|
||||
let codeSyntax = this.get("codeSyntax.mode");
|
||||
let body = this.get('codeEditor').getDoc().getValue();
|
||||
|
||||
return `<pre class="code-mirror cm-s-solarized cm-s-dark" data-lang="${codeSyntax}">${body}</pre>`;
|
||||
},
|
||||
|
||||
actions: {
|
||||
onSyntaxChange(syntax) {
|
||||
let editor = this.get('codeEditor');
|
||||
CodeMirror.autoLoadMode(editor, syntax.mode);
|
||||
editor.setOption("mode", syntax.mode);
|
||||
|
||||
this.set('isDirty', true);
|
||||
this.set('codeSyntax', syntax);
|
||||
},
|
||||
|
||||
isDirty() {
|
||||
return this.get('isDirty');
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(title) {
|
||||
let page = this.get('page');
|
||||
let meta = this.get('meta');
|
||||
page.set('title', title);
|
||||
meta.set('rawBody', this.getPRE());
|
||||
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
46
app/app/components/section/code/type-renderer.js
Normal file
46
app/app/components/section/code/type-renderer.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
codeBody: "",
|
||||
codeSyntax: "htmlmixed",
|
||||
|
||||
didReceiveAttrs() {
|
||||
CodeMirror.modeURL = "codemirror/mode/%N/%N.js";
|
||||
|
||||
let page = this.get('page');
|
||||
let rawBody = page.get('body');
|
||||
let cleanBody = rawBody.replace("</pre>", "").replace('<pre class="code-mirror cm-s-solarized cm-s-dark" data-lang="', "");
|
||||
let startPos = cleanBody.indexOf('">');
|
||||
|
||||
if (startPos !== -1) {
|
||||
this.set('codeSyntax', cleanBody.substring(0, startPos));
|
||||
this.set('codeBody', cleanBody.substring(startPos + 2));
|
||||
}
|
||||
},
|
||||
|
||||
didRender() {
|
||||
let page = this.get('page');
|
||||
let elem = `page-${page.id}-code`;
|
||||
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById(elem), {
|
||||
theme: "solarized dark",
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
indentUnit: 4,
|
||||
tabSize: 4,
|
||||
value: "",
|
||||
dragDrop: false,
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
let syntax = this.get("codeSyntax");
|
||||
CodeMirror.autoLoadMode(editor, syntax);
|
||||
editor.setOption("mode", syntax);
|
||||
|
||||
this.set('codeEditor', editor);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.set('codeEditor', null);
|
||||
}
|
||||
});
|
204
app/app/components/section/gemini/type-editor.js
Normal file
204
app/app/components/section/gemini/type-editor.js
Normal file
|
@ -0,0 +1,204 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import TooltipMixin from '../../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
sectionService: Ember.inject.service('section'),
|
||||
isDirty: false,
|
||||
waiting: false,
|
||||
authenticated: false,
|
||||
user: {},
|
||||
workspaces: [],
|
||||
config: {},
|
||||
|
||||
fieldEditable: function() {
|
||||
if (this.get('page.userId') !== this.session.user.id) {
|
||||
return "readonly";
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}.property('config'),
|
||||
|
||||
didReceiveAttrs() {
|
||||
let config = {};
|
||||
|
||||
try {
|
||||
config = JSON.parse(this.get('meta.config'));
|
||||
} catch (e) {}
|
||||
|
||||
if (is.empty(config)) {
|
||||
config = {
|
||||
APIKey: "",
|
||||
filter: {},
|
||||
itemCount: 0,
|
||||
url: "",
|
||||
userId: 0,
|
||||
username: "",
|
||||
workspaceId: 0,
|
||||
workspaceName: "",
|
||||
};
|
||||
}
|
||||
|
||||
this.set('config', config);
|
||||
|
||||
if (this.get('config.userId') > 0) {
|
||||
this.send('auth');
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
getWorkspaces() {
|
||||
let page = this.get('page');
|
||||
let self = this;
|
||||
this.set('waiting', true);
|
||||
|
||||
this.get('sectionService').fetch(page, "workspace", this.get('config'))
|
||||
.then(function(response) {
|
||||
// console.log(response);
|
||||
let workspaceId = self.get('config.workspaceId');
|
||||
|
||||
if (response.length > 0 && workspaceId === 0) {
|
||||
workspaceId = response[0].Id;
|
||||
}
|
||||
|
||||
self.set("config.workspaceId", workspaceId);
|
||||
self.set('workspaces', response);
|
||||
self.selectWorkspace(workspaceId);
|
||||
|
||||
Ember.run.schedule('afterRender', function() {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
|
||||
response.forEach(function(workspace) {
|
||||
self.addTooltip(document.getElementById("gemini-workspace-" + workspace.Id));
|
||||
});
|
||||
});
|
||||
self.set('waiting', false);
|
||||
}, function(reason) { //jshint ignore: line
|
||||
self.set('workspaces', []);
|
||||
self.set('waiting', false);
|
||||
});
|
||||
},
|
||||
|
||||
getItems() {
|
||||
let page = this.get('page');
|
||||
let self = this;
|
||||
|
||||
this.set('waiting', true);
|
||||
|
||||
this.get('sectionService').fetch(page, "items", this.get('config'))
|
||||
.then(function(response) {
|
||||
// console.log(response);
|
||||
self.set('items', response);
|
||||
self.set('config.itemCount', response.length);
|
||||
self.set('waiting', false);
|
||||
}, function(reason) { //jshint ignore: line
|
||||
self.set('items', []);
|
||||
self.set('waiting', false);
|
||||
});
|
||||
},
|
||||
|
||||
selectWorkspace(id) {
|
||||
let self = this;
|
||||
let w = this.get('workspaces');
|
||||
|
||||
w.forEach(function(w) {
|
||||
Ember.set(w, 'selected', w.Id === id);
|
||||
|
||||
if (w.Id === id) {
|
||||
self.set("config.filter", w.Filter);
|
||||
self.set("config.workspaceId", id);
|
||||
self.set("config.workspaceName", w.Title);
|
||||
// console.log(self.get('config'));
|
||||
}
|
||||
});
|
||||
|
||||
this.set('workspaces', w);
|
||||
this.getItems();
|
||||
},
|
||||
|
||||
actions: {
|
||||
isDirty() {
|
||||
return this.get('isDirty');
|
||||
},
|
||||
|
||||
auth() {
|
||||
// missing data?
|
||||
if (is.empty(this.get('config.url'))) {
|
||||
$("#gemini-url").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.get('config.username'))) {
|
||||
$("#gemini-username").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.get('config.APIKey'))) {
|
||||
$("#gemini-apikey").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// knock out spaces
|
||||
this.set('config.url', this.get('config.url').trim());
|
||||
this.set('config.username', this.get('config.username').trim());
|
||||
this.set('config.APIKey', this.get('config.APIKey').trim());
|
||||
|
||||
// remove trailing slash in URL
|
||||
let url = this.get('config.url');
|
||||
if (url.indexOf("/", url.length - 1) !== -1) {
|
||||
this.set('config.url', url.substring(0, url.length - 1));
|
||||
}
|
||||
|
||||
let page = this.get('page');
|
||||
let self = this;
|
||||
|
||||
this.set('waiting', true);
|
||||
|
||||
this.get('sectionService').fetch(page, "auth", this.get('config'))
|
||||
.then(function(response) {
|
||||
self.set('authenticated', true);
|
||||
self.set('user', response);
|
||||
self.set('config.userId', response.BaseEntity.id);
|
||||
self.set('waiting', false);
|
||||
self.getWorkspaces();
|
||||
}, function(reason) { //jshint ignore: line
|
||||
self.set('authenticated', false);
|
||||
self.set('user', null);
|
||||
self.set('config.userId', 0);
|
||||
self.set('waiting', false);
|
||||
|
||||
switch (reason.status) {
|
||||
case 400:
|
||||
self.showNotification(`Unable to connect to Gemini URL`);
|
||||
break;
|
||||
case 403:
|
||||
self.showNotification(`Unable to authenticate`);
|
||||
break;
|
||||
default:
|
||||
self.showNotification(`Something went wrong, try again!`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onWorkspaceChange(id) {
|
||||
this.set('isDirty', true);
|
||||
this.selectWorkspace(id);
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(title) {
|
||||
let page = this.get('page');
|
||||
let meta = this.get('meta');
|
||||
page.set('title', title);
|
||||
meta.set('rawBody', JSON.stringify(this.get("items")));
|
||||
meta.set('config', JSON.stringify(this.get('config')));
|
||||
meta.set('externalSource', true);
|
||||
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
4
app/app/components/section/gemini/type-renderer.js
Normal file
4
app/app/components/section/gemini/type-renderer.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
54
app/app/components/section/markdown/type-editor.js
Normal file
54
app/app/components/section/markdown/type-editor.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
isDirty: false,
|
||||
pageBody: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set("pageBody", this.get("meta.rawBody"));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
let height = $(document).height() - $(".document-editor > .toolbar").height() - 130;
|
||||
$("#markdown-editor, #markdown-preview").css("height", height);
|
||||
|
||||
this.renderPreview();
|
||||
let self = this;
|
||||
|
||||
$("#markdown-editor").off("keyup").on("keyup", function() {
|
||||
self.renderPreview();
|
||||
self.set('isDirty', true);
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
$("#markdown-editor").off("keyup");
|
||||
},
|
||||
|
||||
renderPreview() {
|
||||
let md = window.markdownit({
|
||||
linkify: true
|
||||
});
|
||||
let result = md.render(this.get("pageBody"));
|
||||
$("#markdown-preview").html(result);
|
||||
},
|
||||
|
||||
actions: {
|
||||
isDirty() {
|
||||
return this.get('isDirty');
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(title) {
|
||||
let page = this.get('page');
|
||||
let meta = this.get('meta');
|
||||
page.set('title', title);
|
||||
meta.set('rawBody', this.get("pageBody"));
|
||||
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
4
app/app/components/section/markdown/type-renderer.js
Normal file
4
app/app/components/section/markdown/type-renderer.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
61
app/app/components/section/table/type-editor.js
Normal file
61
app/app/components/section/table/type-editor.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
isDirty: false,
|
||||
pageBody: "",
|
||||
defaultTable: '<table class="wysiwyg-table" style="width: 100%;"><thead><tr><th><br></th><th><br></th><th><br></th><th><br></th></tr></thead><tbody><tr><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td></tr><tr><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td></tr><tr><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td><td style="width: 25.0000%;"><br></td></tr></tbody></table>',
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set('pageBody', this.get('meta.rawBody'));
|
||||
|
||||
if (is.empty(this.get('pageBody'))) {
|
||||
this.set('pageBody', this.get('defaultTable'));
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
let self = this;
|
||||
|
||||
$('#table-editor').froalaEditor({
|
||||
toolbarButtons: [],
|
||||
height: this.get('editorHeight') - 260,
|
||||
toolbarInline: true,
|
||||
tableResizerOffset: 10
|
||||
});
|
||||
|
||||
$('#table-editor').on('froalaEditor.contentChanged', function() {
|
||||
self.set('isDirty', true);
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
$('#table-editor').froalaEditor('destroy');
|
||||
$('#table-editor').off('froalaEditor.contentChanged');
|
||||
},
|
||||
|
||||
actions: {
|
||||
isDirty() {
|
||||
return this.get('isDirty');
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(title) {
|
||||
let page = this.get('page');
|
||||
let meta = this.get('meta');
|
||||
|
||||
let body = $("#table-editor").froalaEditor('html.get', true);
|
||||
page.set('title', title);
|
||||
|
||||
if (is.empty(body)) {
|
||||
body = this.get('defaultTable');
|
||||
}
|
||||
|
||||
meta.set('rawBody', body);
|
||||
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
4
app/app/components/section/table/type-renderer.js
Normal file
4
app/app/components/section/table/type-renderer.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
93
app/app/components/section/wysiwyg/type-editor.js
Normal file
93
app/app/components/section/wysiwyg/type-editor.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
pageBody: "",
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set('pageBody', this.get('meta.rawBody'));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
let self = this;
|
||||
|
||||
let options = {
|
||||
selector: "#rich-text-editor",
|
||||
relative_urls: false,
|
||||
cache_suffix: "?v=430",
|
||||
browser_spellcheck: false,
|
||||
gecko_spellcheck: false,
|
||||
theme: "modern",
|
||||
statusbar: false,
|
||||
height: $(document).height() - $(".document-editor > .toolbar").height() - 200,
|
||||
entity_encoding: "raw",
|
||||
paste_data_images: true,
|
||||
image_advtab: true,
|
||||
image_caption: true,
|
||||
media_live_embeds: true,
|
||||
fontsize_formats: "8pt 10pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 30pt 32pt 34pt 36pt",
|
||||
formats: {
|
||||
bold: {
|
||||
inline: 'b'
|
||||
},
|
||||
italic: {
|
||||
inline: 'i'
|
||||
}
|
||||
},
|
||||
extended_valid_elements: "b,i,b/strong,i/em",
|
||||
plugins: [
|
||||
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
|
||||
'searchreplace wordcount visualblocks visualchars code codesample fullscreen',
|
||||
'insertdatetime media nonbreaking save table directionality',
|
||||
'emoticons template paste textcolor colorpicker textpattern imagetools'
|
||||
],
|
||||
menu: {
|
||||
edit: {
|
||||
title: 'Edit',
|
||||
items: 'undo redo | cut copy paste pastetext | selectall | searchreplace'
|
||||
},
|
||||
insert: {
|
||||
title: 'Insert',
|
||||
items: 'anchor link media | hr | charmap emoticons | blockquote'
|
||||
},
|
||||
format: {
|
||||
title: 'Format',
|
||||
items: 'bold italic underline strikethrough superscript subscript | formats fonts | removeformat'
|
||||
},
|
||||
table: {
|
||||
title: 'Table',
|
||||
items: 'inserttable tableprops deletetable | cell row column'
|
||||
}
|
||||
},
|
||||
toolbar1: "formatselect fontselect fontsizeselect | bold italic underline | link unlink | image media | codesample | outdent indent | alignleft aligncenter alignright alignjustify | bullist numlist | forecolor backcolor",
|
||||
save_onsavecallback: function() {
|
||||
self.send('onAction');
|
||||
}
|
||||
};
|
||||
|
||||
tinymce.init(options);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
tinymce.remove();
|
||||
},
|
||||
|
||||
actions: {
|
||||
isDirty() {
|
||||
return is.not.undefined(tinymce) && is.not.undefined(tinymce.activeEditor) && tinymce.activeEditor.isDirty();
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.attrs.onCancel();
|
||||
},
|
||||
|
||||
onAction(title) {
|
||||
let page = this.get('page');
|
||||
let meta = this.get('meta');
|
||||
|
||||
page.set('title', title);
|
||||
meta.set('rawBody', tinymce.activeEditor.getContent());
|
||||
|
||||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
4
app/app/components/section/wysiwyg/type-renderer.js
Normal file
4
app/app/components/section/wysiwyg/type-renderer.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
});
|
133
app/app/components/settings/user-list.js
Normal file
133
app/app/components/settings/user-list.js
Normal file
|
@ -0,0 +1,133 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
editUser: null,
|
||||
deleteUser: null,
|
||||
drop: null,
|
||||
password: {},
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.users.forEach(user => {
|
||||
user.set('me', user.get('id') === this.session.user.id);
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
let drop = this.get('drop');
|
||||
|
||||
if (is.not.null(drop)) {
|
||||
drop.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
toggleActive(id) {
|
||||
let user = this.users.findBy("id", id);
|
||||
user.set('active', !user.get('active'));
|
||||
this.attrs.onSave(user);
|
||||
},
|
||||
|
||||
toggleEditor(id) {
|
||||
let user = this.users.findBy("id", id);
|
||||
user.set('editor', !user.get('editor'));
|
||||
this.attrs.onSave(user);
|
||||
},
|
||||
|
||||
toggleAdmin(id) {
|
||||
let user = this.users.findBy("id", id);
|
||||
user.set('admin', !user.get('admin'));
|
||||
this.attrs.onSave(user);
|
||||
},
|
||||
|
||||
edit(id) {
|
||||
let self = this;
|
||||
|
||||
let user = this.users.findBy("id", id);
|
||||
this.set('editUser', user.copy());
|
||||
this.set('password', { password: "", confirmation: ""});
|
||||
$(".edit-user-dialog").css("display", "block");
|
||||
$("input").removeClass("error");
|
||||
|
||||
let drop = new Drop({
|
||||
target: $(".edit-button-" + id)[0],
|
||||
content: $(".edit-user-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: "bottom right",
|
||||
openOn: "always",
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
},
|
||||
remove: false
|
||||
});
|
||||
|
||||
self.set('drop', drop);
|
||||
|
||||
drop.on('open', function() {
|
||||
self.$("#edit-firstname").focus();
|
||||
});
|
||||
},
|
||||
|
||||
confirmDelete(id) {
|
||||
let user = this.users.findBy("id", id);
|
||||
this.set('deleteUser', user);
|
||||
$(".delete-user-dialog").css("display", "block");
|
||||
|
||||
let drop = new Drop({
|
||||
target: $(".delete-button-" + id)[0],
|
||||
content: $(".delete-user-dialog")[0],
|
||||
classes: 'drop-theme-basic',
|
||||
position: "bottom right",
|
||||
openOn: "always",
|
||||
tetherOptions: {
|
||||
offset: "5px 0",
|
||||
targetOffset: "10px 0"
|
||||
},
|
||||
remove: false
|
||||
});
|
||||
|
||||
this.set('drop', drop);
|
||||
},
|
||||
|
||||
cancel() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
},
|
||||
|
||||
save() {
|
||||
let user = this.get('editUser');
|
||||
let password = this.get('password');
|
||||
|
||||
if (is.empty(user.get('firstname'))) {
|
||||
$("#edit-firstname").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(user.get('lastname'))) {
|
||||
$("#edit-lastname").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(user.get('email'))) {
|
||||
$("#edit-email").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
|
||||
this.attrs.onSave(user);
|
||||
|
||||
if (is.not.empty(password.password) && is.not.empty(password.confirmation) &&
|
||||
password.password === password.confirmation) {
|
||||
this.attrs.onPassword(user, password.password);
|
||||
}
|
||||
},
|
||||
|
||||
delete() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
|
||||
let user = this.get('deleteUser');
|
||||
this.attrs.onDelete(user);
|
||||
}
|
||||
}
|
||||
});
|
35
app/app/components/ui-select.js
Normal file
35
app/app/components/ui-select.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
cssClass: "",
|
||||
content: [],
|
||||
prompt: null,
|
||||
optionValuePath: 'id',
|
||||
optionLabelPath: 'name',
|
||||
action: Ember.K, // action to fire on change
|
||||
|
||||
// shadow the passed-in `selection` to avoid
|
||||
// leaking changes to it via a 2-way binding
|
||||
_selection: Ember.computed.reads('selection'),
|
||||
|
||||
actions: {
|
||||
change() {
|
||||
const selectEl = this.$('select')[0];
|
||||
const selectedIndex = selectEl.selectedIndex;
|
||||
const content = this.get('content');
|
||||
|
||||
// decrement index by 1 if we have a prompt
|
||||
const hasPrompt = !!this.get('prompt');
|
||||
const contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex;
|
||||
|
||||
const selection = content[contentIndex];
|
||||
|
||||
// set the local, shadowed selection to avoid leaking
|
||||
// changes to `selection` out via 2-way binding
|
||||
this.set('_selection', selection);
|
||||
|
||||
const changeCallback = this.get('action');
|
||||
changeCallback(selection);
|
||||
}
|
||||
}
|
||||
});
|
41
app/app/components/user-notification.js
Normal file
41
app/app/components/user-notification.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
import Ember from 'ember';
|
||||
import miscUtil from '../utils/misc';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
notifications: [],
|
||||
|
||||
didInsertElement() {
|
||||
this.eventBus.subscribe('notifyUser', this, 'showNotification');
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.eventBus.unsubscribe('notifyUser');
|
||||
},
|
||||
|
||||
showNotification(msg) {
|
||||
let self = this;
|
||||
let notifications = this.get('notifications');
|
||||
notifications.pushObject(msg);
|
||||
this.set('notifications', notifications);
|
||||
|
||||
let elem = this.$(".user-notification")[0];
|
||||
|
||||
Ember.run(() => {
|
||||
self.$(elem).show();
|
||||
|
||||
// FIXME: need a more robust solution
|
||||
miscUtil.interval(function(){
|
||||
let notifications = self.get('notifications');
|
||||
|
||||
if (notifications.length > 0) {
|
||||
notifications.removeAt(0);
|
||||
self.set('notifications', notifications);
|
||||
}
|
||||
|
||||
if (notifications.length === 0) {
|
||||
self.$(elem).hide();
|
||||
}
|
||||
}, 2500, self.get('notifications').length);
|
||||
});
|
||||
},
|
||||
});
|
36
app/app/components/widget-sample.js
Normal file
36
app/app/components/widget-sample.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2015 Documize Inc.
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../mixins/notifier';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, {
|
||||
drop1: null,
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
new Tooltip({target: document.getElementById("sample-1")});
|
||||
new Tooltip({target: document.getElementById("sample-2")});
|
||||
new Tooltip({target: document.getElementById("sample-3")});
|
||||
new Tooltip({target: document.getElementById("sample-4")});
|
||||
|
||||
let drop1 = new Drop({
|
||||
target: document.getElementById('sample-dropdown-1'),
|
||||
content: document.getElementById('sample-dropdown-content-1'),
|
||||
classes: 'drop-theme-basic',
|
||||
position: 'bottom middle',
|
||||
openOn: 'click'
|
||||
});
|
||||
|
||||
this.set('drop1', drop1);
|
||||
},
|
||||
|
||||
actions: {
|
||||
dropClose() {
|
||||
this.get('drop1').close();
|
||||
},
|
||||
|
||||
addFolder() {
|
||||
console.log("adding folder!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
0
app/app/controllers/.gitkeep
Normal file
0
app/app/controllers/.gitkeep
Normal file
98
app/app/helpers/document/file-icon.js
Normal file
98
app/app/helpers/document/file-icon.js
Normal file
|
@ -0,0 +1,98 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export function documentFileIcon(params) {
|
||||
let fileExtension = params[0].toLowerCase();
|
||||
let html = "unknown.png";
|
||||
|
||||
switch (fileExtension)
|
||||
{
|
||||
case "7z":
|
||||
case "7zip":
|
||||
case "zipx":
|
||||
case "zip":
|
||||
case "war":
|
||||
case "rar":
|
||||
case "tar":
|
||||
case "gzip":
|
||||
html = "zip.png";
|
||||
break;
|
||||
case "avi":
|
||||
case "mov":
|
||||
case "mp4":
|
||||
html = "avi.png";
|
||||
break;
|
||||
case "bat":
|
||||
case "sh":
|
||||
case "ps":
|
||||
case "ps1":
|
||||
case "cs":
|
||||
case "vb":
|
||||
case "php":
|
||||
case "java":
|
||||
case "go":
|
||||
case "js":
|
||||
case "html":
|
||||
case "rb":
|
||||
case "py":
|
||||
case "css":
|
||||
case "json":
|
||||
case "config":
|
||||
html = "bat.png";
|
||||
break;
|
||||
case "bin":
|
||||
case "exe":
|
||||
case "dll":
|
||||
html = "bin.png";
|
||||
break;
|
||||
case "bmp":
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "gif":
|
||||
case "tiff":
|
||||
case "svg":
|
||||
case "png":
|
||||
case "psd":
|
||||
case "ai":
|
||||
case "sketch":
|
||||
html = "image.png";
|
||||
break;
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
case "csv":
|
||||
html = "xls.png";
|
||||
break;
|
||||
case "log":
|
||||
case "txt":
|
||||
case "md":
|
||||
case "markdown":
|
||||
html = "txt.png";
|
||||
break;
|
||||
case "mp3":
|
||||
case "wav":
|
||||
html = "mp3.png";
|
||||
break;
|
||||
case "pdf":
|
||||
html = "pdf.png";
|
||||
break;
|
||||
case "ppt":
|
||||
case "pptx":
|
||||
html = "ppt.png";
|
||||
break;
|
||||
case "vsd":
|
||||
case "vsdx":
|
||||
html = "vsd.png";
|
||||
break;
|
||||
case "doc":
|
||||
case "docx":
|
||||
html = "doc.png";
|
||||
break;
|
||||
case "xslt":
|
||||
case "xml":
|
||||
html = "xml.png";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Ember.Handlebars.SafeString(html);
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(documentFileIcon);
|
23
app/app/helpers/document/toc-entry.js
Normal file
23
app/app/helpers/document/toc-entry.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export function documentTocEntry(params) {
|
||||
let currentPage = params[0];
|
||||
let nodeId = params[1];
|
||||
let nodeLevel = params[2];
|
||||
let html = "";
|
||||
let indent = (nodeLevel - 1) * 20;
|
||||
|
||||
html += "<span style='margin-left: " + indent + "px;'></span>";
|
||||
|
||||
if (currentPage === nodeId) {
|
||||
html += "<span class='selected'><i class='material-icons toc-bullet'>remove</i></span>";
|
||||
html += "";
|
||||
} else {
|
||||
html += "<span class=''><i class='material-icons toc-bullet'>remove</i></span>";
|
||||
html += "";
|
||||
}
|
||||
|
||||
return new Ember.Handlebars.SafeString(html);
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(documentTocEntry);
|
8
app/app/helpers/formatted-date.js
Normal file
8
app/app/helpers/formatted-date.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
import dateUtil from '../utils/date';
|
||||
|
||||
export function formattedDate(params) {
|
||||
return dateUtil.toIsoDate(params[0], params[1]);
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(formattedDate);
|
8
app/app/helpers/generate-id.js
Normal file
8
app/app/helpers/generate-id.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
// Usage: {{generate-id 'admin-' 123}}
|
||||
export default Ember.Helper.helper(function(params) {
|
||||
let prefix = params[0];
|
||||
let id = params[1];
|
||||
return prefix + "-" + id;
|
||||
});
|
6
app/app/helpers/is-equal.js
Normal file
6
app/app/helpers/is-equal.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
// Usage: {{is-equal item selection}}
|
||||
export default Ember.Helper.helper(function([leftSide, rightSide]) {
|
||||
return leftSide === rightSide;
|
||||
});
|
6
app/app/helpers/is-not.js
Normal file
6
app/app/helpers/is-not.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
// Usage: {{is-not selection}}
|
||||
export default Ember.Helper.helper(function([value]) {
|
||||
return !value;
|
||||
});
|
5
app/app/helpers/read-path.js
Normal file
5
app/app/helpers/read-path.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Helper.helper(function([object, path]) {
|
||||
return Ember.get(object, path);
|
||||
});
|
9
app/app/helpers/time-ago.js
Normal file
9
app/app/helpers/time-ago.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import dateUtil from '../utils/date';
|
||||
|
||||
// {{time-ago createdAt}}
|
||||
export function timeAgo(params) {
|
||||
return dateUtil.timeAgo(params[0]);
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(timeAgo);
|
11
app/app/helpers/user-initials.js
Normal file
11
app/app/helpers/user-initials.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
// {{user-initials firstname lastname}}
|
||||
export function userInitials(params) {
|
||||
let firstname = params[0];
|
||||
let lastname = params[1];
|
||||
|
||||
return (firstname.substring(0, 1) + lastname.substring(0, 1)).toUpperCase();
|
||||
}
|
||||
|
||||
export default Ember.Helper.helper(userInitials);
|
67
app/app/index.html
Normal file
67
app/app/index.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
{{content-for 'head'}}
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Documize</title>
|
||||
<meta property="dbname" content="{{.DBname}}" />
|
||||
<meta property="dbhash" content="{{.DBhash}}" />
|
||||
<meta name="author" content="Documize" />
|
||||
<meta name="description" content="Documize">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<link rel="shortcut icon" href="/favicon.ico?v=1.1" />
|
||||
<link rel="icon" type="image/png" href="/favicon-32x32.png?v=1.1" sizes="32x32" />
|
||||
<link rel="stylesheet" href="assets/vendor.css">
|
||||
<link rel="stylesheet" href="assets/documize.css"> {{content-for 'head-footer'}}
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var w = window;
|
||||
var ic = w.Intercom;
|
||||
if (typeof ic === "function") {
|
||||
ic('reattach_activator');
|
||||
ic('update', intercomSettings);
|
||||
} else {
|
||||
var d = document;
|
||||
var i = function() {
|
||||
i.c(arguments)
|
||||
};
|
||||
i.q = [];
|
||||
i.c = function(args) {
|
||||
i.q.push(args)
|
||||
};
|
||||
w.Intercom = i;
|
||||
|
||||
function l() {
|
||||
var s = d.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
s.async = true;
|
||||
s.src = 'https://widget.intercom.io/widget/{app_id}';
|
||||
var x = d.getElementsByTagName('script')[0];
|
||||
x.parentNode.insertBefore(s, x);
|
||||
}
|
||||
if (w.attachEvent) {
|
||||
w.attachEvent('onload', l);
|
||||
} else {
|
||||
w.addEventListener('load', l, false);
|
||||
}
|
||||
}
|
||||
})()
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{content-for 'body'}}
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/documize.js"></script>
|
||||
<script src="tinymce/tinymce.min.js?v=430"></script>
|
||||
<script src="codemirror/lib/codemirror.js"></script>
|
||||
<script src="codemirror/mode/meta.js"></script>
|
||||
<script src="codemirror/addon/mode/loadmode.js"></script>
|
||||
<script src="codemirror/addon/runmode/runmode.js"></script>
|
||||
<script src="codemirror/addon/runmode/colorize.js"></script>
|
||||
{{content-for 'body-footer'}}
|
||||
</body>
|
||||
|
||||
</html>
|
23
app/app/initializers/application.js
Normal file
23
app/app/initializers/application.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
export function initialize( /*application*/ ) {
|
||||
// address insecure jquery defaults (kudos: @nathanhammond)
|
||||
$.globalEval = function() {};
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'text script': text => text
|
||||
}
|
||||
});
|
||||
|
||||
Dropzone.autoDiscover = false;
|
||||
|
||||
// global trap for XHR 401
|
||||
$(document).ajaxError(function(e, xhr /*, settings, exception*/ ) {
|
||||
if (xhr.status === 401 && is.not.startWith(window.location.pathname, "/auth/")) {
|
||||
window.location.href = "/auth/login";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'application',
|
||||
initialize: initialize
|
||||
};
|
12
app/app/initializers/audit.js
Normal file
12
app/app/initializers/audit.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
export function initialize(application) {
|
||||
application.inject('route', 'audit', 'service:audit');
|
||||
application.inject('controller', 'audit', 'service:audit');
|
||||
application.inject('component', 'audit', 'service:audit');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'audit',
|
||||
after: 'session',
|
||||
initialize: initialize
|
||||
};
|
11
app/app/initializers/browser.js
Normal file
11
app/app/initializers/browser.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export function initialize(application) {
|
||||
application.inject('route', 'browser', 'service:browser');
|
||||
application.inject('controller', 'browser', 'service:browser');
|
||||
application.inject('component', 'browser', 'service:browser');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'browser',
|
||||
after: "session",
|
||||
initialize: initialize
|
||||
};
|
12
app/app/initializers/event-bus.js
Normal file
12
app/app/initializers/event-bus.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
export function initialize(application) {
|
||||
application.inject('route', 'eventBus', 'service:eventBus');
|
||||
application.inject('component', 'eventBus', 'service:eventBus');
|
||||
application.inject('controller', 'eventBus', 'service:eventBus');
|
||||
application.inject('mixin', 'eventBus', 'service:eventBus');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'eventBus',
|
||||
after: 'session',
|
||||
initialize: initialize
|
||||
};
|
11
app/app/initializers/logger.js
Normal file
11
app/app/initializers/logger.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export function initialize(application) {
|
||||
application.inject('route', 'logger', 'service:logger');
|
||||
application.inject('component', 'logger', 'service:logger');
|
||||
application.inject('controller', 'logger', 'service:logger');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'logger',
|
||||
after: 'session',
|
||||
initialize: initialize
|
||||
};
|
12
app/app/initializers/session.js
Normal file
12
app/app/initializers/session.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
export function initialize(application) {
|
||||
application.inject('route', 'session', 'service:session');
|
||||
application.inject('controller', 'session', 'service:session');
|
||||
application.inject('component', 'session', 'service:session');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'session',
|
||||
after: 'application',
|
||||
before: 'audit',
|
||||
initialize: initialize
|
||||
};
|
13
app/app/mixins/notifier.js
Normal file
13
app/app/mixins/notifier.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
showNotification(msg) {
|
||||
this.eventBus.publish('notifyUser', msg);
|
||||
},
|
||||
|
||||
actions: {
|
||||
showNotification(msg) {
|
||||
this.eventBus.publish('notifyUser', msg);
|
||||
}
|
||||
}
|
||||
});
|
23
app/app/mixins/tooltip.js
Normal file
23
app/app/mixins/tooltip.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
tooltips: [],
|
||||
|
||||
addTooltip(elem) {
|
||||
let t = new Tooltip({target: elem});
|
||||
let tt = this.get('tooltips');
|
||||
tt.push(t);
|
||||
},
|
||||
|
||||
destroyTooltips() {
|
||||
let tt = this.get('tooltips');
|
||||
|
||||
tt.forEach(t => {
|
||||
t.destroy();
|
||||
});
|
||||
|
||||
tt.length = 0;
|
||||
|
||||
this.set('tooltips', tt);
|
||||
}
|
||||
});
|
0
app/app/models/.gitkeep
Normal file
0
app/app/models/.gitkeep
Normal file
26
app/app/pods/auth/forgot/controller.js
Normal file
26
app/app/pods/auth/forgot/controller.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*global is*/
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
userService: Ember.inject.service('user'),
|
||||
email: "",
|
||||
sayThanks: false,
|
||||
|
||||
actions: {
|
||||
forgot: function()
|
||||
{
|
||||
var self = this;
|
||||
var email = this.get('email');
|
||||
|
||||
if (is.empty(email)) {
|
||||
$("#email").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
self.set('sayThanks', true);
|
||||
this.set('email', '');
|
||||
|
||||
this.get('userService').forgotPassword(email);
|
||||
}
|
||||
}
|
||||
});
|
8
app/app/pods/auth/forgot/route.js
Normal file
8
app/app/pods/auth/forgot/route.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('sayThanks', false);
|
||||
}
|
||||
});
|
22
app/app/pods/auth/forgot/template.hbs
Normal file
22
app/app/pods/auth/forgot/template.hbs
Normal file
|
@ -0,0 +1,22 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<form {{action 'forgot' on="submit"}}>
|
||||
{{#if sayThanks}}
|
||||
<div class="reset-thanks margin-bottom-30">Thanks. Check your email for instructions.</div>
|
||||
{{else}}
|
||||
<div class="input-control">
|
||||
<label>Email</label>
|
||||
{{focus-input type="email" value=email id="email"}}
|
||||
</div>
|
||||
<div class="clearfix" />
|
||||
<div class="margin-top-10 margin-bottom-20">
|
||||
<button type="submit" class="regular-button button-blue">Reset</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#link-to 'auth.login'}}Sign In{{/link-to}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
43
app/app/pods/auth/login/controller.js
Normal file
43
app/app/pods/auth/login/controller.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
email: "",
|
||||
password: "",
|
||||
invalidCredentials: false,
|
||||
|
||||
reset() {
|
||||
this.setProperties({
|
||||
email: "",
|
||||
password: ""
|
||||
});
|
||||
|
||||
let dbhash = document.head.querySelector("[property=dbhash]").content;
|
||||
if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") {
|
||||
this.transitionToRoute('setup');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
actions: {
|
||||
login() {
|
||||
let self = this;
|
||||
let creds = this.getProperties('email', 'password');
|
||||
|
||||
this.session.login(creds).then(function() {
|
||||
self.set('invalidCredentials', false);
|
||||
self.audit.record("logged-in");
|
||||
|
||||
var previousTransition = self.session.get('previousTransition');
|
||||
|
||||
if (previousTransition) {
|
||||
previousTransition.retry();
|
||||
self.session.set('previousTransition', null);
|
||||
} else {
|
||||
self.transitionToRoute('folders.folder');
|
||||
}
|
||||
}, function() {
|
||||
self.set('invalidCredentials', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
9
app/app/pods/auth/login/route.js
Normal file
9
app/app/pods/auth/login/route.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
setupController: function(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.reset();
|
||||
this.browser.setTitleAsPhrase("Login");
|
||||
}
|
||||
});
|
23
app/app/pods/auth/login/template.hbs
Normal file
23
app/app/pods/auth/login/template.hbs
Normal file
|
@ -0,0 +1,23 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<form id="login-form" {{action 'login' on="submit"}}>
|
||||
<div class="input-control">
|
||||
<label>Email</label>
|
||||
{{focus-input type="email" value=email id="authEmail"}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Password</label>
|
||||
{{input type="password" value=password id="authPassword"}}
|
||||
</div>
|
||||
<div class="clearfix" />
|
||||
<div class="margin-top-10 margin-bottom-20">
|
||||
<button type="submit" class="regular-button button-blue">Sign in</button>
|
||||
<span class="{{unless invalidCredentials "hide"}} color-red margin-left-20">Invalid credentials</span>
|
||||
</div>
|
||||
{{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
4
app/app/pods/auth/logout/controller.js
Normal file
4
app/app/pods/auth/logout/controller.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
10
app/app/pods/auth/logout/route.js
Normal file
10
app/app/pods/auth/logout/route.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
activate: function(){
|
||||
this.session.logout();
|
||||
this.audit.record("logged-in");
|
||||
this.audit.stop();
|
||||
window.document.location = this.session.appMeta.allowAnonymousAccess ? "/" : "/auth/login";
|
||||
}
|
||||
});
|
1
app/app/pods/auth/logout/template.hbs
Normal file
1
app/app/pods/auth/logout/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{outlet}}
|
38
app/app/pods/auth/reset/controller.js
Normal file
38
app/app/pods/auth/reset/controller.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*global is*/
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
userService: Ember.inject.service('user'),
|
||||
password: "",
|
||||
passwordConfirm: "",
|
||||
mustMatch: false,
|
||||
|
||||
actions: {
|
||||
reset() {
|
||||
let self = this;
|
||||
let password = this.get('password');
|
||||
let passwordConfirm = this.get('passwordConfirm');
|
||||
|
||||
if (is.empty(password)) {
|
||||
$("#newPassword").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (is.empty(passwordConfirm)) {
|
||||
$("#passwordConfirm").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (is.not.equal(password, passwordConfirm)) {
|
||||
$("#newPassword").addClass("error").focus();
|
||||
$("#passwordConfirm").addClass("error");
|
||||
self.set('mustMatch', true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.get('userService').resetPassword(self.model, password).then(function(response) { /* jshint ignore:line */
|
||||
self.transitionToRoute('auth.login');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
7
app/app/pods/auth/reset/route.js
Normal file
7
app/app/pods/auth/reset/route.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function(params) {
|
||||
return params.token;
|
||||
},
|
||||
});
|
24
app/app/pods/auth/reset/template.hbs
Normal file
24
app/app/pods/auth/reset/template.hbs
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<form {{action 'reset' on="submit"}}>
|
||||
<div class="input-control">
|
||||
<label>New Password</label>
|
||||
<div class="tip">Choose a strong password</div>
|
||||
{{focus-input type="password" value=password id="newPassword"}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Confirm Password</label>
|
||||
<div class="tip">Please type your new password again</div>
|
||||
{{input type="password" value=passwordConfirm id="passwordConfirm"}}
|
||||
</div>
|
||||
<div class="clearfix" />
|
||||
<div class="margin-top-10 margin-bottom-20">
|
||||
<button type="submit" class="regular-button button-blue">Reset</button>
|
||||
<span class="{{unless mustMatch "hide"}} color-red margin-left-20">Passwords must match</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
4
app/app/pods/auth/route.js
Normal file
4
app/app/pods/auth/route.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
4
app/app/pods/auth/share/controller.js
Normal file
4
app/app/pods/auth/share/controller.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
16
app/app/pods/auth/share/route.js
Normal file
16
app/app/pods/auth/share/route.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function(params) {
|
||||
this.set('folderId', params.id);
|
||||
this.set('slug', params.slug);
|
||||
this.set('serial', params.serial);
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('serial', this.serial);
|
||||
controller.set('slug', this.slug);
|
||||
controller.set('folderId', this.folderId);
|
||||
}
|
||||
});
|
7
app/app/pods/auth/share/template.hbs
Normal file
7
app/app/pods/auth/share/template.hbs
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="onboarding-container">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
{{onboard/share-folder serial=serial folderId=folderId slug=slug}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
24
app/app/pods/auth/sso/route.js
Normal file
24
app/app/pods/auth/sso/route.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
beforeModel() {
|
||||
this.session.clearSession();
|
||||
},
|
||||
|
||||
model(params) {
|
||||
let token = params.token;
|
||||
|
||||
if (is.undefined(token) || is.null(token) || token.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let self = this;
|
||||
|
||||
this.session.sso(decodeURIComponent(token)).then(function() {
|
||||
self.transitionTo('folders.folder');
|
||||
}, function() {
|
||||
self.transitionTo('auth.login');
|
||||
console.log(">>>>> Documize SSO failure");
|
||||
});
|
||||
},
|
||||
});
|
4
app/app/pods/auth/sso/template.hbs
Normal file
4
app/app/pods/auth/sso/template.hbs
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div class="sso-box">
|
||||
<p>Signing in...</p>
|
||||
<img src="assets/img/busy-gray.gif" />
|
||||
</div>
|
1
app/app/pods/auth/template.hbs
Normal file
1
app/app/pods/auth/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{outlet}}
|
4
app/app/pods/customize/controller.js
Normal file
4
app/app/pods/customize/controller.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
32
app/app/pods/customize/folders/controller.js
Normal file
32
app/app/pods/customize/folders/controller.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
folders: [],
|
||||
|
||||
label: function() {
|
||||
switch (this.get('folders').length) {
|
||||
case 1:
|
||||
return "space";
|
||||
default:
|
||||
return "spaces";
|
||||
}
|
||||
}.property('folders'),
|
||||
|
||||
actions: {
|
||||
changeOwner: function(folderId, userId) {
|
||||
let self = this;
|
||||
this.get('folderService').getFolder(folderId).then(function(folder) {
|
||||
folder.set('userId', userId);
|
||||
|
||||
self.get('folderService').save(folder).then(function() {
|
||||
self.showNotification("Changed");
|
||||
self.audit.record('changed-folder-owner');
|
||||
});
|
||||
|
||||
self.send('onChangeOwner');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
47
app/app/pods/customize/folders/route.js
Normal file
47
app/app/pods/customize/folders/route.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.session.isAdmin) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.get('folderService').getAll();
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
let nonPrivateFolders = model.rejectBy('folderType', 2);
|
||||
controller.set('folders', nonPrivateFolders);
|
||||
|
||||
this.get('folderService').getProtectedFolderInfo().then(function(people){
|
||||
people.forEach(function(person){
|
||||
person.isEveryone = person.userId === '';
|
||||
person.isOwner = false;
|
||||
});
|
||||
|
||||
nonPrivateFolders.forEach(function(folder){
|
||||
let shared = people.filterBy('folderId', folder.get('id'));
|
||||
let person = shared.findBy('userId', folder.get('userId'));
|
||||
if (is.not.undefined(person)) {
|
||||
person.isOwner = true;
|
||||
}
|
||||
|
||||
folder.set('sharedWith', shared);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Folders | Documize";
|
||||
},
|
||||
|
||||
actions: {
|
||||
onChangeOwner() {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
});
|
43
app/app/pods/customize/folders/template.hbs
Normal file
43
app/app/pods/customize/folders/template.hbs
Normal file
|
@ -0,0 +1,43 @@
|
|||
<div class="input-form">
|
||||
<form>
|
||||
<div class="heading">
|
||||
<div class="title">{{folders.length}} shared {{label}}</div>
|
||||
<div class="tip">View and change shared space ownership</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<table class="basic-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="bordered">Space</th>
|
||||
<th class="bordered">Participants</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each folders as |folder|}}
|
||||
<tr>
|
||||
<td class="bordered">
|
||||
{{#link-to 'folders.folder' folder.id folder.slug}}{{folder.name}}{{/link-to}}
|
||||
</td>
|
||||
<td class="bordered">
|
||||
{{#each folder.sharedWith as |person|}}
|
||||
{{#if person.isEveryone}}
|
||||
Everyone
|
||||
{{else}}
|
||||
|
||||
{{#if person.isOwner}}
|
||||
<span class="bold">{{person.firstname}} {{person.lastname}} (owner)</span>
|
||||
{{else}}
|
||||
{{person.firstname}} {{person.lastname}}
|
||||
<a class="action-link" {{action "changeOwner" folder.id person.userId}}>make owner</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<br/>
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
24
app/app/pods/customize/general/controller.js
Normal file
24
app/app/pods/customize/general/controller.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from "../../../mixins/notifier";
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
orgService: Ember.inject.service('organization'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
if (is.empty(this.model.get('title'))) {
|
||||
$("#siteTitle").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (is.empty(this.model.get('message'))) {
|
||||
$("#siteMessage").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.model.set('allowAnonymousAccess', Ember.$("#allowAnonymousAccess").prop('checked'));
|
||||
this.get('orgService').save(this.model);
|
||||
this.showNotification('Saved');
|
||||
}
|
||||
}
|
||||
});
|
19
app/app/pods/customize/general/route.js
Normal file
19
app/app/pods/customize/general/route.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
orgService: Ember.inject.service('organization'),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.session.isAdmin) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.get('orgService').getOrg(this.session.appMeta.get('orgId'));
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Settings | Documize";
|
||||
}
|
||||
});
|
29
app/app/pods/customize/general/template.hbs
Normal file
29
app/app/pods/customize/general/template.hbs
Normal file
|
@ -0,0 +1,29 @@
|
|||
<div class="input-form">
|
||||
<form>
|
||||
<div class="heading">
|
||||
<div class="title">General Settings</div>
|
||||
<div class="tip">Tell people about this Documize instance</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="input-control">
|
||||
<label>Title</label>
|
||||
<div class="tip">Describe the title of this Documize instance</div>
|
||||
{{focus-input id="siteTitle" type="text" value=model.title}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Message</label>
|
||||
<div class="tip">Describe the purpose of this Documize instance</div>
|
||||
{{textarea id="siteMessage" rows="3" value=model.message}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Anonymous Access</label>
|
||||
<div class="tip">Content within "Everyone" will be made available to anonymous users</div>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="allowAnonymousAccess" checked= {{model.allowAnonymousAccess}} />
|
||||
<label for="allowAnonymousAccess">Allow anyone to access this Documize instance</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
12
app/app/pods/customize/route.js
Normal file
12
app/app/pods/customize/route.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*global is*/
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend(
|
||||
{
|
||||
beforeModel: function(transition)
|
||||
{
|
||||
if (is.equal(transition.targetName, 'customize.index')) {
|
||||
this.transitionTo('customize.general');
|
||||
}
|
||||
},
|
||||
});
|
18
app/app/pods/customize/template.hbs
Normal file
18
app/app/pods/customize/template.hbs
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{#header/page-navigation settingsMode=true}}
|
||||
{{header/message-box message="Manage this Documize instance"}}
|
||||
{{/header/page-navigation}}
|
||||
|
||||
{{#layout/page-container}}
|
||||
{{#layout/page-sidebar}}
|
||||
<div class="sidebar-menu">
|
||||
<ul class="options">
|
||||
{{#link-to 'customize.general' activeClass='selected' class="option" tagName="li"}}General{{/link-to}}
|
||||
{{#link-to 'customize.folders' activeClass='selected' class="option" tagName="li"}}Spaces{{/link-to}}
|
||||
{{#link-to 'customize.users' activeClass='selected' class="option" tagName="li"}}Users{{/link-to}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/layout/page-sidebar}}
|
||||
{{#layout/page-content}}
|
||||
{{outlet}}
|
||||
{{/layout/page-content}}
|
||||
{{/layout/page-container}}
|
69
app/app/pods/customize/users/controller.js
Normal file
69
app/app/pods/customize/users/controller.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
newUser: { firstname: "", lastname: "", email: "", active: true },
|
||||
|
||||
actions: {
|
||||
add: function() {
|
||||
if (is.empty(this.newUser.firstname)) {
|
||||
$("#newUserFirstname").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.newUser.lastname)) {
|
||||
$("#newUserLastname").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.newUser.email) || is.not.email(this.newUser.email)) {
|
||||
$("#newUserEmail").addClass("error").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
$("#newUserFirstname").removeClass("error");
|
||||
$("#newUserLastname").removeClass("error");
|
||||
$("#newUserEmail").removeClass("error");
|
||||
|
||||
this.get('userService').add(this.get('newUser')).then(function(/*user*/) {
|
||||
self.showNotification('Added');
|
||||
self.set('newUser', { firstname: "", lastname: "", email: "", active: true });
|
||||
$("#newUserFirstname").focus();
|
||||
|
||||
self.get('userService').getAll().then(function(users) {
|
||||
self.set('model', users);
|
||||
});
|
||||
}, function(error) {
|
||||
let msg = error.status === 409 ? 'Unable to add duplicate user' : 'Unable to add user';
|
||||
self.showNotification(msg);
|
||||
});
|
||||
},
|
||||
|
||||
onDelete(user) {
|
||||
let self = this;
|
||||
this.get('userService').remove(user.get('id')).then(function(){
|
||||
self.showNotification('Deleted');
|
||||
|
||||
self.get('userService').getAll().then(function(users) {
|
||||
self.set('model', users);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onSave(user) {
|
||||
let self = this;
|
||||
this.get('userService').save(user).then(function(){
|
||||
self.showNotification('Saved');
|
||||
|
||||
self.get('userService').getAll().then(function(users) {
|
||||
self.set('model', users);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onPassword(user, password) {
|
||||
this.get('userService').updatePassword(user.get('id'), password);
|
||||
this.showNotification('Password changed');
|
||||
}
|
||||
}
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue