mirror of
https://github.com/documize/community.git
synced 2025-07-19 21:29:42 +02:00
initial commit
This commit is contained in:
commit
18933c6767
1841 changed files with 810642 additions and 0 deletions
3
.dockerignore
Normal file
3
.dockerignore
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
.git
|
||||||
|
bin
|
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
_uploads
|
||||||
|
_diffs
|
||||||
|
_convert
|
||||||
|
.srclib-cache
|
||||||
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# Documize build artifacts
|
||||||
|
bin/*
|
||||||
|
dist/*
|
||||||
|
/documize/web/bindata/*
|
||||||
|
app/dist/*
|
||||||
|
app/dist-prod/*
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
# Go specific
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
_testmain.go
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
/plugin-libreoffice/plugin-libreoffice
|
||||||
|
/plugin-libreoffice/plugin-libreoffice-osx
|
||||||
|
|
||||||
|
# Ember specific
|
||||||
|
/app/dist
|
||||||
|
/app/dist-prod
|
||||||
|
/app/tmp
|
||||||
|
/app/bower_components
|
||||||
|
/app/node_modules
|
||||||
|
/app/.sass-cache
|
||||||
|
/app/connect.lock
|
||||||
|
/app/coverage/*
|
||||||
|
/app/libpeerconnection.log
|
||||||
|
/app/npm-debug.log
|
||||||
|
/app/testem.log
|
||||||
|
|
||||||
|
# Misc.
|
||||||
|
documize/web/bindata_assetfs.go
|
||||||
|
build
|
||||||
|
plugin-msword/plugin-msword
|
||||||
|
plugin-msword/plugin-msword-osx
|
||||||
|
npm-debug.log
|
||||||
|
debug
|
||||||
|
*.pem
|
||||||
|
*.crt
|
||||||
|
Dockerfile
|
||||||
|
container.sh
|
||||||
|
make.sh
|
50
.jsbeautifyrc
Normal file
50
.jsbeautifyrc
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"css": {
|
||||||
|
"indent_size": 4,
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": true,
|
||||||
|
"preserve_newlines": true,
|
||||||
|
"max_preserve_newlines": 2,
|
||||||
|
"newline_between_rules": true
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
"indent_size": 4,
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": true,
|
||||||
|
"preserve_newlines": true,
|
||||||
|
"max_preserve_newlines": 2,
|
||||||
|
"wrap_line_length": 0,
|
||||||
|
"indent_handlebars": true,
|
||||||
|
"indent_inner_html": false,
|
||||||
|
"indent_scripts": "keep"
|
||||||
|
},
|
||||||
|
"hbs": {
|
||||||
|
"indent_size": 4,
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": true,
|
||||||
|
"max_preserve_newlines": 2,
|
||||||
|
"preserve_newlines": true,
|
||||||
|
"wrap_line_length": 0
|
||||||
|
},
|
||||||
|
"js": {
|
||||||
|
"indent_size": 4,
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": true,
|
||||||
|
"preserve_newlines": true,
|
||||||
|
"wrap_line_length": 0,
|
||||||
|
"break_chained_methods": false,
|
||||||
|
"max_preserve_newlines": 2,
|
||||||
|
"jslint_happy": true,
|
||||||
|
"brace_style": "collapse-preserve-inline",
|
||||||
|
"keep_function_indentation": false,
|
||||||
|
"space_after_anon_function": false,
|
||||||
|
"space_before_conditional": true,
|
||||||
|
"space_in_empty_paren": false,
|
||||||
|
"space_in_paren": false
|
||||||
|
},
|
||||||
|
"sql": {
|
||||||
|
"indent_size": 4,
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": true
|
||||||
|
}
|
||||||
|
}
|
4
.jshintignore
Normal file
4
.jshintignore
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
app/public/tinymce/**
|
||||||
|
app/public/tinymce/
|
||||||
|
app/public/tinymce
|
||||||
|
|
10
.vscodeignore
Normal file
10
.vscodeignore
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
dist/**
|
||||||
|
tmp/**
|
||||||
|
build/**
|
||||||
|
cache/**
|
||||||
|
node_modules/**
|
||||||
|
bower_components/**
|
||||||
|
.sass-cache/**
|
||||||
|
connect.lock/**
|
||||||
|
coverage/*/**
|
||||||
|
libpeerconnection.log
|
3
CONTRIBUTING.md
Normal file
3
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Please see this document for contribution guidelines and process:
|
||||||
|
|
||||||
|
https://developers.documize.com/s/leFaXwlU/open-source/d/VzO94aMOCgABGyfe/contributing
|
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/>.
|
16
README.md
Normal file
16
README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Documize Community Edition
|
||||||
|
|
||||||
|
To discover Documize please visit https://documize.com
|
||||||
|
|
||||||
|
Documize® is a registered trade mark of Documize Inc.
|
||||||
|
|
||||||
|
This repository is copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
|
||||||
|
This software (Documize Community Edition) is licensed under GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
You can operate outside the AGPL restrictions by purchasing Documize Enterprise Edition and obtaining a commercial license by contacting <sales@documize.com>.
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
* [Install from binary guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/V16L08ucxwABhZF6/install-documize-from-binary-guide)
|
||||||
|
* [Install for development guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/V16LOMucxwABhZF1/install-documize-for-development-guide)
|
||||||
|
* [Configuration guide](https://developers.documize.com/s/VzO9ZqMOCgABGyfW/installation/d/VzSL8cVZ4QAB2B4Y/configure-documize-guide)
|
4
app/.bowerrc
Normal file
4
app/.bowerrc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"directory": "bower_components",
|
||||||
|
"analytics": false
|
||||||
|
}
|
3
app/.ember-cli
Normal file
3
app/.ember-cli
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"disableAnalytics": true
|
||||||
|
}
|
17
app/.gitignore
vendored
Normal file
17
app/.gitignore
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/bower_components
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/.sass-cache
|
||||||
|
/connect.lock
|
||||||
|
/coverage/*
|
||||||
|
/libpeerconnection.log
|
||||||
|
npm-debug.log
|
||||||
|
testem.log
|
6
app/.jshintignore
Normal file
6
app/.jshintignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
public/tinymce/**
|
||||||
|
public/tinymce/
|
||||||
|
public/tinymce
|
||||||
|
public/codemirror/**
|
||||||
|
public/codemirror/
|
||||||
|
public/codemirror
|
48
app/.jshintrc
Normal file
48
app/.jshintrc
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"predef": [
|
||||||
|
"server",
|
||||||
|
"document",
|
||||||
|
"window",
|
||||||
|
"-Promise",
|
||||||
|
"moment",
|
||||||
|
"$",
|
||||||
|
"_",
|
||||||
|
"is",
|
||||||
|
"Mousetrap",
|
||||||
|
"CodeMirror",
|
||||||
|
"Intercom",
|
||||||
|
"Materialize",
|
||||||
|
"tinymce",
|
||||||
|
"Tether",
|
||||||
|
"Tooltip",
|
||||||
|
"Drop",
|
||||||
|
"Dropzone",
|
||||||
|
"dragula",
|
||||||
|
"datetimepicker"
|
||||||
|
],
|
||||||
|
"browser": true,
|
||||||
|
"boss": true,
|
||||||
|
"curly": true,
|
||||||
|
"debug": false,
|
||||||
|
"devel": true,
|
||||||
|
"eqeqeq": true,
|
||||||
|
"evil": true,
|
||||||
|
"forin": false,
|
||||||
|
"immed": false,
|
||||||
|
"laxbreak": false,
|
||||||
|
"newcap": true,
|
||||||
|
"noarg": true,
|
||||||
|
"noempty": false,
|
||||||
|
"nonew": false,
|
||||||
|
"nomen": false,
|
||||||
|
"onevar": false,
|
||||||
|
"plusplus": false,
|
||||||
|
"regexp": false,
|
||||||
|
"undef": true,
|
||||||
|
"sub": true,
|
||||||
|
"strict": false,
|
||||||
|
"white": false,
|
||||||
|
"eqnull": true,
|
||||||
|
"esnext": true,
|
||||||
|
"unused": true
|
||||||
|
}
|
23
app/.travis.yml
Normal file
23
app/.travis.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "0.12"
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- node_modules
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
|
||||||
|
- "npm config set spin false"
|
||||||
|
- "npm install -g npm@^2"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- npm install -g bower
|
||||||
|
- npm install
|
||||||
|
- bower install
|
||||||
|
|
||||||
|
script:
|
||||||
|
- npm test
|
3
app/.watchmanconfig
Normal file
3
app/.watchmanconfig
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"ignore_dirs": ["tmp", "dist", "dist-prod"]
|
||||||
|
}
|
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
34
app/app/app.js
Normal file
34
app/app/app.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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;
|
26
app/app/authenticators/anonymous.js
Normal file
26
app/app/authenticators/anonymous.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import Base from 'ember-simple-auth/authenticators/base';
|
||||||
|
|
||||||
|
const {
|
||||||
|
RSVP: { resolve }
|
||||||
|
} = Ember;
|
||||||
|
|
||||||
|
export default Base.extend({
|
||||||
|
restore(data) {
|
||||||
|
return resolve(data);
|
||||||
|
},
|
||||||
|
authenticate(data) {
|
||||||
|
return resolve(data);
|
||||||
|
}
|
||||||
|
});
|
69
app/app/authenticators/documize.js
Normal file
69
app/app/authenticators/documize.js
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import Base from 'ember-simple-auth/authenticators/base';
|
||||||
|
import encodingUtil from '../utils/encoding';
|
||||||
|
import netUtil from '../utils/net';
|
||||||
|
|
||||||
|
const {
|
||||||
|
isPresent,
|
||||||
|
RSVP: { resolve, reject },
|
||||||
|
inject: { service }
|
||||||
|
} = Ember;
|
||||||
|
|
||||||
|
export default Base.extend({
|
||||||
|
|
||||||
|
ajax: service(),
|
||||||
|
appMeta: service(),
|
||||||
|
|
||||||
|
restore(data) {
|
||||||
|
// TODO: verify authentication data
|
||||||
|
if (data) {
|
||||||
|
return resolve(data);
|
||||||
|
}
|
||||||
|
return reject();
|
||||||
|
},
|
||||||
|
|
||||||
|
authenticate(credentials) {
|
||||||
|
let domain = netUtil.getSubdomain();
|
||||||
|
|
||||||
|
let encoded;
|
||||||
|
|
||||||
|
if (typeof credentials === 'object') {
|
||||||
|
|
||||||
|
let { password, email } = credentials;
|
||||||
|
|
||||||
|
if (!isPresent(password) || !isPresent(email)) {
|
||||||
|
return Ember.RSVP.reject("invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
encoded = encodingUtil.Base64.encode(`${domain}:${email}:${password}`);
|
||||||
|
} else if (typeof credentials === 'string') {
|
||||||
|
encoded = credentials;
|
||||||
|
} else {
|
||||||
|
return Ember.RSVP.reject("invalid");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var headers = {
|
||||||
|
'Authorization': 'Basic ' + encoded
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.get('ajax').post('public/authenticate', {
|
||||||
|
headers
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
invalidate() {
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
});
|
28
app/app/components/document/document-editor.js
Normal file
28
app/app/components/document/document-editor.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
64
app/app/components/document/document-sidebar-edits.js
Normal file
64
app/app/components/document/document-sidebar-edits.js
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
176
app/app/components/document/document-sidebar-toc.js
Normal file
176
app/app/components/document/document-sidebar-toc.js
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
import tocUtil from '../../utils/toc';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
|
document: {},
|
||||||
|
folder: {},
|
||||||
|
pages: [],
|
||||||
|
page: "",
|
||||||
|
state: {
|
||||||
|
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('onEntryClick', 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');
|
||||||
|
this.destroyTooltips();
|
||||||
|
},
|
||||||
|
|
||||||
|
onDocumentPageAdded(pageId) {
|
||||||
|
this.send('onEntryClick', pageId);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Controls what user can do with the toc (left sidebar).
|
||||||
|
// Identifies the target pages.
|
||||||
|
setState(pageId) {
|
||||||
|
this.set('page', pageId);
|
||||||
|
|
||||||
|
let toc = this.get('pages');
|
||||||
|
let page = _.findWhere(toc, { id: pageId });
|
||||||
|
|
||||||
|
let state = tocUtil.getState(toc, page);
|
||||||
|
|
||||||
|
if (!this.get('isEditor') || is.empty(pageId)) {
|
||||||
|
state.actionablePage = state.upDisabled = state.downDisabled = state.indentDisabled = state.outdentDisabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('state', state);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
// Page up - above pages shunt down.
|
||||||
|
pageUp() {
|
||||||
|
if (this.get('state.upDisabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let state = this.get('state');
|
||||||
|
let pages = this.get('pages');
|
||||||
|
let page = _.findWhere(pages, { id: this.get('page') });
|
||||||
|
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
||||||
|
|
||||||
|
if (pendingChanges.length > 0) {
|
||||||
|
this.attrs.changePageSequence(pendingChanges);
|
||||||
|
|
||||||
|
this.send('onEntryClick', this.get('page'));
|
||||||
|
this.audit.record("moved-page-up");
|
||||||
|
this.showNotification("Moved up");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Move down -- pages below shift up.
|
||||||
|
pageDown() {
|
||||||
|
if (this.get('state.downDisabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let state = this.get('state');
|
||||||
|
var pages = this.get('pages');
|
||||||
|
var page = _.findWhere(pages, { id: this.get('page') });
|
||||||
|
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
||||||
|
|
||||||
|
if (pendingChanges.length > 0) {
|
||||||
|
this.attrs.changePageSequence(pendingChanges);
|
||||||
|
|
||||||
|
this.send('onEntryClick', 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.get('state.indentDisabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let state = this.get('state');
|
||||||
|
var pages = this.get('pages');
|
||||||
|
var page = _.findWhere(pages, { id: this.get('page') });
|
||||||
|
let pendingChanges = tocUtil.indent(state, pages, page);
|
||||||
|
|
||||||
|
if (pendingChanges.length > 0) {
|
||||||
|
this.attrs.changePageLevel(pendingChanges);
|
||||||
|
|
||||||
|
this.showNotification("Indent");
|
||||||
|
this.audit.record("changed-page-sequence");
|
||||||
|
this.send('onEntryClick', this.get('page'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Outdent - changes a page from H3 to H2, etc.
|
||||||
|
pageOutdent() {
|
||||||
|
if (this.get('state.outdentDisabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let state = this.get('state');
|
||||||
|
var pages = this.get('pages');
|
||||||
|
var page = _.findWhere(pages, { id: this.get('page') });
|
||||||
|
let pendingChanges = tocUtil.outdent(state, pages, page);
|
||||||
|
|
||||||
|
if (pendingChanges.length > 0) {
|
||||||
|
this.attrs.changePageLevel(pendingChanges);
|
||||||
|
|
||||||
|
this.showNotification("Outdent");
|
||||||
|
this.audit.record("changed-page-sequence");
|
||||||
|
this.send('onEntryClick', this.get('page'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onEntryClick(id) {
|
||||||
|
this.setState(id);
|
||||||
|
this.attrs.gotoPage(id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
17
app/app/components/document/document-sidebar-viewers.js
Normal file
17
app/app/components/document/document-sidebar-viewers.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
document: {},
|
||||||
|
meta: [],
|
||||||
|
});
|
51
app/app/components/document/document-sidebar.js
Normal file
51
app/app/components/document/document-sidebar.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(TooltipMixin, {
|
||||||
|
documentService: Ember.inject.service('document'),
|
||||||
|
|
||||||
|
document: {},
|
||||||
|
folder: {},
|
||||||
|
|
||||||
|
didRender() {
|
||||||
|
if (this.session.authenticated) {
|
||||||
|
this.addTooltip(document.getElementById("owner-avatar"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElements() {
|
||||||
|
this.destroyElements();
|
||||||
|
},
|
||||||
|
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
|
||||||
|
// close dialog
|
||||||
|
close() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
141
app/app/components/document/document-toolbar.js
Normal file
141
app/app/components/document/document-toolbar.js
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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'),
|
||||||
|
localStorage: Ember.inject.service(),
|
||||||
|
drop: null,
|
||||||
|
users: [],
|
||||||
|
saveTemplate: {
|
||||||
|
name: "",
|
||||||
|
description: ""
|
||||||
|
},
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.set('saveTemplate.name', this.get('document.name'));
|
||||||
|
this.set('saveTemplate.description', this.get('document.excerpt'));
|
||||||
|
},
|
||||||
|
|
||||||
|
didRender() {
|
||||||
|
if (this.get('isEditor')) {
|
||||||
|
this.addTooltip(document.getElementById("attachment-button"));
|
||||||
|
this.addTooltip(document.getElementById("save-template-button"));
|
||||||
|
this.addTooltip(document.getElementById("set-meta-button"));
|
||||||
|
this.addTooltip(document.getElementById("delete-document-button"));
|
||||||
|
this.addTooltip(document.getElementById("add-section-button"));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addTooltip(document.getElementById("print-document-button"));
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
if (this.get('isEditor')) {
|
||||||
|
let self = this;
|
||||||
|
let documentId = this.get('document.id');
|
||||||
|
let url = this.get('appMeta.url');
|
||||||
|
let uploadUrl = `${url}/documents/${documentId}/attachments`;
|
||||||
|
|
||||||
|
let dzone = new Dropzone("#attachment-button > i", {
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('session.session.authenticated.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: {
|
||||||
|
deleteDocument() {
|
||||||
|
this.attrs.onDocumentDelete();
|
||||||
|
},
|
||||||
|
|
||||||
|
printDocument() {
|
||||||
|
window.print();
|
||||||
|
},
|
||||||
|
|
||||||
|
saveTemplate() {
|
||||||
|
var name = this.get('saveTemplate.name');
|
||||||
|
var excerpt = this.get('saveTemplate.description');
|
||||||
|
|
||||||
|
if (is.empty(name)) {
|
||||||
|
$("#new-template-name").addClass("error").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.empty(excerpt)) {
|
||||||
|
$("#new-template-desc").addClass("error").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showNotification('Template saved');
|
||||||
|
this.attrs.onSaveTemplate(name, excerpt);
|
||||||
|
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
136
app/app/components/document/document-view.js
Normal file
136
app/app/components/document/document-view.js
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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'),
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
/* Parameters */
|
||||||
|
document: null,
|
||||||
|
// pages: [],
|
||||||
|
attachments: [],
|
||||||
|
folder: null,
|
||||||
|
folders: [],
|
||||||
|
isEditor: false,
|
||||||
|
/* Internal */
|
||||||
|
drop: null,
|
||||||
|
deleteAttachment: {
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
},
|
||||||
|
|
||||||
|
noSections: Ember.computed('pages', function () {
|
||||||
|
return this.get('pages.length') === 0;
|
||||||
|
}),
|
||||||
|
|
||||||
|
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, deleteChildren) {
|
||||||
|
let page = this.get('pages').findBy("id", id);
|
||||||
|
|
||||||
|
if (is.undefined(page)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
id: id,
|
||||||
|
title: page.get('title'),
|
||||||
|
children: deleteChildren
|
||||||
|
};
|
||||||
|
|
||||||
|
this.attrs.onDeletePage(params);
|
||||||
|
},
|
||||||
|
|
||||||
|
// onTagChange event emitted from document/tag-editor component
|
||||||
|
onTagChange(tags) {
|
||||||
|
let doc = this.get('document');
|
||||||
|
doc.set('tags', tags);
|
||||||
|
this.get('documentService').save(doc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
86
app/app/components/document/editor-history.js
Normal file
86
app/app/components/document/editor-history.js
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
34
app/app/components/document/index-entry.js
Normal file
34
app/app/components/document/index-entry.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
page: {},
|
||||||
|
tagName: "li",
|
||||||
|
classNames: ["item"],
|
||||||
|
|
||||||
|
// indentLevel: Ember.computed('page', function() {
|
||||||
|
// let nodeLevel = this.get('page.level');
|
||||||
|
// let indent = (nodeLevel - 1) * 20;
|
||||||
|
// return indent;
|
||||||
|
// }),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
// this.set('classNames', ["item", "margin-left-" + this.get("page.tocIndent")]);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
onClick(id) {
|
||||||
|
this.get('onClick')(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
55
app/app/components/document/page-heading.js
Normal file
55
app/app/components/document/page-heading.js
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
|
||||||
|
const {
|
||||||
|
computed: { oneWay, or, notEmpty },
|
||||||
|
computed
|
||||||
|
} = Ember;
|
||||||
|
|
||||||
|
export default Ember.Component.extend(TooltipMixin, {
|
||||||
|
deleteChildren: false,
|
||||||
|
|
||||||
|
checkId: computed('page', function () {
|
||||||
|
let id = this.get('page.id');
|
||||||
|
return `delete-check-button-${id}`;
|
||||||
|
}),
|
||||||
|
|
||||||
|
dropTarget: computed('page', function () {
|
||||||
|
let id = this.get('page.id');
|
||||||
|
return `delete-page-button-${id}`;
|
||||||
|
}),
|
||||||
|
|
||||||
|
didRender() {
|
||||||
|
if (this.get('isEditor')) {
|
||||||
|
let self = this;
|
||||||
|
$(".page-edit-button, .page-delete-button").each(function (i, el) {
|
||||||
|
self.addTooltip(el);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this.destroyTooltips();
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
editPage(id) {
|
||||||
|
this.attrs.onEditPage(id);
|
||||||
|
},
|
||||||
|
|
||||||
|
deletePage(id) {
|
||||||
|
this.attrs.onDeletePage(id, this.get('deleteChildren'));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
40
app/app/components/document/page-wizard.js
Normal file
40
app/app/components/document/page-wizard.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../mixins/notifier';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(NotifierMixin, {
|
||||||
|
|
||||||
|
didRender() {
|
||||||
|
let self = this;
|
||||||
|
Mousetrap.bind('esc', function() {
|
||||||
|
self.send('onCancel');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
onCancel() {
|
||||||
|
this.attrs.onCancel();
|
||||||
|
},
|
||||||
|
|
||||||
|
addSection(section) {
|
||||||
|
|
||||||
|
if (section.preview) {
|
||||||
|
this.showNotification("Coming soon!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.attrs.onAction(section);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
111
app/app/components/document/tag-editor.js
Normal file
111
app/app/components/document/tag-editor.js
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
118
app/app/components/dropdown-dialog.js
Normal file
118
app/app/components/dropdown-dialog.js
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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",
|
||||||
|
constrainToWindow: true,
|
||||||
|
constrainToScrollParent: true,
|
||||||
|
|
||||||
|
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,
|
||||||
|
// optimizations: {
|
||||||
|
// moveElement: false
|
||||||
|
// },
|
||||||
|
constraints: [{
|
||||||
|
to: 'window',
|
||||||
|
attachment: 'together'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
52
app/app/components/dropdown-menu.js
Normal file
52
app/app/components/dropdown-menu.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
});
|
18
app/app/components/focus-input.js
Normal file
18
app/app/components/focus-input.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.TextField.extend({
|
||||||
|
becomeFocused: function() {
|
||||||
|
this.$().focus();
|
||||||
|
}.on('didInsertElement')
|
||||||
|
});
|
18
app/app/components/focus-textarea.js
Normal file
18
app/app/components/focus-textarea.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.TextArea.extend({
|
||||||
|
becomeFocused: function() {
|
||||||
|
this.$().focus();
|
||||||
|
}.on('didInsertElement')
|
||||||
|
});
|
38
app/app/components/folder/document-tags.js
Normal file
38
app/app/components/folder/document-tags.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
46
app/app/components/folder/documents-list.js
Normal file
46
app/app/components/folder/documents-list.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
selectedDocuments: [],
|
||||||
|
|
||||||
|
emptyState: Ember.computed('documents', function() {
|
||||||
|
return this.get('documents.length') === 0;
|
||||||
|
}),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.set('selectedDocuments', []);
|
||||||
|
this.audit.record('viewed-space');
|
||||||
|
},
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
110
app/app/components/folder/folder-settings.js
Normal file
110
app/app/components/folder/folder-settings.js
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
folderService: Ember.inject.service('folder'),
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
users: [],
|
||||||
|
folders: [],
|
||||||
|
folder: {},
|
||||||
|
moveTarget: null,
|
||||||
|
inviteEmail: "",
|
||||||
|
inviteMessage: "",
|
||||||
|
roleMessage: "",
|
||||||
|
permissions: {},
|
||||||
|
|
||||||
|
getDefaultInvitationMessage() {
|
||||||
|
return "Hey there, I am sharing the " + this.folder.get('name') + " (in " + this.get("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'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
140
app/app/components/folder/folder-toolbar.js
Normal file
140
app/app/components/folder/folder-toolbar.js
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
|
||||||
|
const {
|
||||||
|
computed
|
||||||
|
} = Ember;
|
||||||
|
|
||||||
|
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
|
documentService: Ember.inject.service('document'),
|
||||||
|
templateService: Ember.inject.service('template'),
|
||||||
|
folderService: Ember.inject.service('folder'),
|
||||||
|
session: Ember.inject.service(),
|
||||||
|
|
||||||
|
folder: {},
|
||||||
|
busy: false,
|
||||||
|
importedDocuments: [],
|
||||||
|
savedTemplates: [],
|
||||||
|
isFolderOwner: computed.equal('folder.userId', 'session.user.id'),
|
||||||
|
moveFolderId: "",
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.set('isFolderOwner', this.get('folder.userId') === this.get("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: {
|
||||||
|
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() {
|
||||||
|
this.attrs.onDeleteDocument();
|
||||||
|
},
|
||||||
|
|
||||||
|
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.attrs.onMoveDocument(this.get('moveFolderId'));
|
||||||
|
this.set("moveFolderId", "");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
84
app/app/components/folder/folders-list.js
Normal file
84
app/app/components/folder/folders-list.js
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
122
app/app/components/folder/start-document.js
Normal file
122
app/app/components/folder/start-document.js
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../mixins/notifier';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(NotifierMixin, {
|
||||||
|
localStorage: Ember.inject.service(),
|
||||||
|
tagName: 'span',
|
||||||
|
selectedTemplate: {
|
||||||
|
id: "0"
|
||||||
|
},
|
||||||
|
canEditTemplate: "",
|
||||||
|
drop: null,
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.send('setTemplate', this.get('savedTemplates')[0]);
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
if (is.not.null(this.get('drop'))) {
|
||||||
|
this.get('drop').destroy();
|
||||||
|
this.set('drop', null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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() {
|
||||||
|
if (is.not.null(this.get('drop'))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let folderId = this.get('folder.id');
|
||||||
|
let url = this.get('appMeta.url');
|
||||||
|
let importUrl = `${url}/import/folder/${folderId}`;
|
||||||
|
|
||||||
|
Dropzone.options.uploadDocuments = false;
|
||||||
|
|
||||||
|
let dzone = new Dropzone("#upload-documents", {
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('session.session.authenticated.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);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.set('drop', dzone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/layout/button-home.js
Normal file
14
app/app/components/layout/button-home.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
14
app/app/components/layout/zone-container.js
Normal file
14
app/app/components/layout/zone-container.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
15
app/app/components/layout/zone-content.js
Normal file
15
app/app/components/layout/zone-content.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
});
|
21
app/app/components/layout/zone-header.js
Normal file
21
app/app/components/layout/zone-header.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
title: "",
|
||||||
|
message: "",
|
||||||
|
|
||||||
|
hasMessage: Ember.computed('message', function() {
|
||||||
|
return this.get('message').length !== 0;
|
||||||
|
})
|
||||||
|
});
|
41
app/app/components/layout/zone-navigation.js
Normal file
41
app/app/components/layout/zone-navigation.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import netUtil from '../../utils/net';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
folderService: Ember.inject.service('folder'),
|
||||||
|
folder: null,
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
|
||||||
|
didInitAttrs() {
|
||||||
|
if (this.get("session.authenticated")) {
|
||||||
|
this.get("session.user.accounts").forEach((account)=>{
|
||||||
|
// TODO: do not mutate account.active here
|
||||||
|
account.active = account.orgId === this.get("appMeta.orgId");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
if (this.get('folder') === null) {
|
||||||
|
this.set("folder", this.get('folderService.currentFolder'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
switchAccount(domain) {
|
||||||
|
this.audit.record('switched-account');
|
||||||
|
window.location.href = netUtil.getAppUrl(domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
15
app/app/components/layout/zone-sidebar.js
Normal file
15
app/app/components/layout/zone-sidebar.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
});
|
124
app/app/components/onboard/share-folder.js
Normal file
124
app/app/components/onboard/share-folder.js
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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 = "/";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
56
app/app/components/search/search-results.js
Normal file
56
app/app/components/search/search-results.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
results: [],
|
||||||
|
resultPhrase: "",
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
let results = this.get('results');
|
||||||
|
let temp = _.groupBy(results, 'documentId');
|
||||||
|
let documents = [];
|
||||||
|
|
||||||
|
_.each(temp, function(document) {
|
||||||
|
let refs = [];
|
||||||
|
|
||||||
|
if (document.length > 1) {
|
||||||
|
refs = document.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(refs, function(ref, index) {
|
||||||
|
ref.comma = index === refs.length-1 ? "" : ", ";
|
||||||
|
});
|
||||||
|
|
||||||
|
let hasRefs = refs.length > 0;
|
||||||
|
|
||||||
|
documents.pushObject( {
|
||||||
|
doc: document[0],
|
||||||
|
ref: refs,
|
||||||
|
hasReferences: hasRefs
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let phrase = 'Nothing found';
|
||||||
|
|
||||||
|
if (results.length > 0) {
|
||||||
|
let places = documents.length === 1 ? "place" : "places";
|
||||||
|
let references = results.length === 1 ? "secton" : "sections";
|
||||||
|
let i = results.length;
|
||||||
|
let j = documents.length;
|
||||||
|
phrase = `${i} ${references} in ${j} ${places}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('resultPhrase', phrase);
|
||||||
|
this.set('documents', documents);
|
||||||
|
}
|
||||||
|
});
|
32
app/app/components/search/tag-list.js
Normal file
32
app/app/components/search/tag-list.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
91
app/app/components/section/base-editor.js
Normal file
91
app/app/components/section/base-editor.js
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
drop: null,
|
||||||
|
cancelLabel: "Close",
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
18
app/app/components/section/base-renderer.js
Normal file
18
app/app/components/section/base-renderer.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.set('rendererType', 'section/' + this.get('page.contentType') + '/type-renderer');
|
||||||
|
},
|
||||||
|
});
|
132
app/app/components/section/code/type-editor.js
Normal file
132
app/app/components/section/code/type-editor.js
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
57
app/app/components/section/code/type-renderer.js
Normal file
57
app/app/components/section/code/type-renderer.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
208
app/app/components/section/gemini/type-editor.js
Normal file
208
app/app/components/section/gemini/type-editor.js
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
import SectionMixin from '../../../mixins/section';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||||
|
sectionService: Ember.inject.service('section'),
|
||||||
|
isDirty: false,
|
||||||
|
waiting: false,
|
||||||
|
authenticated: false,
|
||||||
|
user: {},
|
||||||
|
workspaces: [],
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/gemini/type-renderer.js
Normal file
14
app/app/components/section/gemini/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
455
app/app/components/section/github/type-editor.js
Normal file
455
app/app/components/section/github/type-editor.js
Normal file
|
@ -0,0 +1,455 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
import SectionMixin from '../../../mixins/section';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||||
|
sectionService: Ember.inject.service('section'),
|
||||||
|
isDirty: false,
|
||||||
|
busy: false,
|
||||||
|
authenticated: false,
|
||||||
|
config: {},
|
||||||
|
owners: null,
|
||||||
|
repos: null,
|
||||||
|
noRepos: false,
|
||||||
|
showCommits: false,
|
||||||
|
showIssueNum: false,
|
||||||
|
showLabels: false,
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
if (is.undefined(this.get('config.clientId')) || is.undefined(this.get('config.callbackUrl'))) {
|
||||||
|
self.get('sectionService').fetch(page, "config", {})
|
||||||
|
.then(function (cfg) {
|
||||||
|
let config = {};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
clientId: cfg.clientID,
|
||||||
|
callbackUrl: cfg.authorizationCallbackURL,
|
||||||
|
owner: null,
|
||||||
|
owner_name: "",
|
||||||
|
repo: null,
|
||||||
|
repo_name: "",
|
||||||
|
report: null,
|
||||||
|
lists: [],
|
||||||
|
branch: "",
|
||||||
|
branchURL: "",
|
||||||
|
branchSince: "",
|
||||||
|
branchLines: "30",
|
||||||
|
state: null,
|
||||||
|
issues: "",
|
||||||
|
userId: "",
|
||||||
|
pageId: page.get('id'),
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
let metaConfig = JSON.parse(self.get('meta.config'));
|
||||||
|
config.owner = metaConfig.owner;
|
||||||
|
config.repo = metaConfig.repo;
|
||||||
|
config.report = metaConfig.report;
|
||||||
|
config.lists = metaConfig.lists;
|
||||||
|
config.branchSince = metaConfig.branchSince;
|
||||||
|
config.branchLines = metaConfig.branchLines;
|
||||||
|
config.state = metaConfig.state;
|
||||||
|
config.issues = metaConfig.issues;
|
||||||
|
config.userId = metaConfig.userId;
|
||||||
|
config.pageId = metaConfig.pageId;
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
self.set('config', config);
|
||||||
|
self.set('config.pageId', page.get('id'));
|
||||||
|
|
||||||
|
// On auth callback capture code
|
||||||
|
let code = window.location.search;
|
||||||
|
|
||||||
|
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
||||||
|
let tok = code.replace("?code=", "");
|
||||||
|
self.get('sectionService').fetch(page, "saveSecret", { "token": tok })
|
||||||
|
.then(function () {
|
||||||
|
console.log("github auth code saved to db");
|
||||||
|
self.send('authStage2');
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
console.log(error);
|
||||||
|
self.send('auth');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (config.userId !== self.get("session.session.authenticated.user.id")) {
|
||||||
|
console.log("github auth wrong user ID, switching");
|
||||||
|
self.set('config.userId', self.get("session.session.authenticated.user.id"));
|
||||||
|
}
|
||||||
|
self.get('sectionService').fetch(page, "checkAuth", self.get('config'))
|
||||||
|
.then(function () {
|
||||||
|
console.log("github auth code valid");
|
||||||
|
self.send('authStage2');
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
console.log(error);
|
||||||
|
self.send('auth'); // require auth if the db token is invalid
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this.destroyTooltips();
|
||||||
|
},
|
||||||
|
|
||||||
|
getOwnerLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let owners = this.get('owners');
|
||||||
|
let thisOwner = this.get('config.owner');
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
||||||
|
if (owners.length) {
|
||||||
|
thisOwner = owners[0];
|
||||||
|
this.set('config.owner', thisOwner);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.set('config.owner', owners.findBy('id', thisOwner.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('owner', thisOwner);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "repos", self.get('config'))
|
||||||
|
.then(function (lists) {
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('repos', lists);
|
||||||
|
self.getRepoLists();
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch repositories");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getRepoLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let repos = this.get('repos');
|
||||||
|
let thisRepo = this.get('config.repo');
|
||||||
|
|
||||||
|
if (is.null(repos) || is.undefined(repos) || repos.length === 0) {
|
||||||
|
this.set('noRepos', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('noRepos', false);
|
||||||
|
|
||||||
|
if (is.null(thisRepo) || is.undefined(thisRepo) || thisRepo.owner !== this.get('config.owner').name) {
|
||||||
|
if (repos.length) {
|
||||||
|
thisRepo = repos[0];
|
||||||
|
this.set('config.repo', thisRepo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.set('config.repo', repos.findBy('id', thisRepo.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('repo', thisRepo);
|
||||||
|
|
||||||
|
this.getReportLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
getReportLists() {
|
||||||
|
let reports = [];
|
||||||
|
reports[0] = {
|
||||||
|
id: "commitsData", // used as method for fetching Go data
|
||||||
|
name: "Commits on a branch"
|
||||||
|
};
|
||||||
|
reports[1] = {
|
||||||
|
id: "issuesData", // used as method for fetching Go data
|
||||||
|
name: "Issues"
|
||||||
|
};
|
||||||
|
|
||||||
|
this.set("reports", reports);
|
||||||
|
|
||||||
|
let thisReport = this.get('config.report');
|
||||||
|
|
||||||
|
if (is.null(thisReport) || is.undefined(thisReport)) {
|
||||||
|
thisReport = reports[0];
|
||||||
|
this.set('config.report', thisReport);
|
||||||
|
} else {
|
||||||
|
this.set('config.report', reports.findBy('id', thisReport.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('report', thisReport);
|
||||||
|
|
||||||
|
this.renderSwitch(thisReport);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
renderSwitch(thisReport) {
|
||||||
|
|
||||||
|
if (is.undefined(this.get('initDateTimePicker'))) {
|
||||||
|
$.datetimepicker.setLocale('en');
|
||||||
|
$('#branch-since').datetimepicker();
|
||||||
|
this.set('initDateTimePicker', "Done");
|
||||||
|
}
|
||||||
|
|
||||||
|
let bl = this.get('config.branchLines');
|
||||||
|
if (is.undefined(bl) || bl === "" || bl <= 0) {
|
||||||
|
this.set('config.branchLines', "30");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('showCommits', false);
|
||||||
|
this.set('showLabels', false);
|
||||||
|
switch (thisReport.id) {
|
||||||
|
case 'commitsData':
|
||||||
|
this.set('showCommits', true);
|
||||||
|
this.getBranchLists();
|
||||||
|
break;
|
||||||
|
case 'issuesData':
|
||||||
|
this.set('showLabels', true);
|
||||||
|
this.getLabelLists();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getBranchLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "branches", self.get('config'))
|
||||||
|
.then(function (lists) {
|
||||||
|
let savedLists = self.get('config.lists');
|
||||||
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lists.length > 0) {
|
||||||
|
let noIncluded = true;
|
||||||
|
|
||||||
|
lists.forEach(function (list) {
|
||||||
|
let included = false;
|
||||||
|
var saved;
|
||||||
|
if (is.not.undefined(savedLists)) {
|
||||||
|
saved = savedLists.findBy("id", list.id);
|
||||||
|
}
|
||||||
|
if (is.not.undefined(saved)) {
|
||||||
|
included = saved.included;
|
||||||
|
noIncluded = false;
|
||||||
|
}
|
||||||
|
list.included = included;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (noIncluded) {
|
||||||
|
lists[0].included = true; // make the first entry the default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.set('config.lists', lists);
|
||||||
|
self.set('busy', false);
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch repository branches");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getLabelLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
let states = [];
|
||||||
|
states[0] = {
|
||||||
|
id: "open",
|
||||||
|
name: "Open Issues"
|
||||||
|
};
|
||||||
|
states[1] = {
|
||||||
|
id: "closed",
|
||||||
|
name: "Closed Issues"
|
||||||
|
};
|
||||||
|
states[2] = {
|
||||||
|
id: "all",
|
||||||
|
name: "All Issues"
|
||||||
|
};
|
||||||
|
|
||||||
|
this.set("states", states);
|
||||||
|
|
||||||
|
let thisState = this.get('config.state');
|
||||||
|
|
||||||
|
if (is.null(thisState) || is.undefined(thisState)) {
|
||||||
|
thisState = states[0];
|
||||||
|
this.set('config.state', thisState);
|
||||||
|
} else {
|
||||||
|
this.set('config.state', states.findBy('id', thisState.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('state', thisState);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "labels", self.get('config'))
|
||||||
|
.then(function (lists) {
|
||||||
|
let savedLists = self.get('config.lists');
|
||||||
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lists.length > 0) {
|
||||||
|
lists.forEach(function (list) {
|
||||||
|
var saved;
|
||||||
|
if (is.not.undefined(savedLists)) {
|
||||||
|
saved = savedLists.findBy("id", list.id);
|
||||||
|
}
|
||||||
|
let included = false;
|
||||||
|
if (is.not.undefined(saved)) {
|
||||||
|
included = saved.included;
|
||||||
|
}
|
||||||
|
list.included = included;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
self.set('config.lists', lists);
|
||||||
|
self.set('busy', false);
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch repository labels");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
isDirty() {
|
||||||
|
return this.get('isDirty');
|
||||||
|
},
|
||||||
|
|
||||||
|
onListCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
|
let list = lists.findBy('id', id);
|
||||||
|
|
||||||
|
// restore the list of branches to the default state
|
||||||
|
lists.forEach(function (lst) {
|
||||||
|
Ember.set(lst, 'included', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (list !== null) {
|
||||||
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onLabelCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
|
let list = lists.findBy('id', id);
|
||||||
|
|
||||||
|
if (list !== null) {
|
||||||
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
authStage2() {
|
||||||
|
let self = this;
|
||||||
|
self.set('config.userId', self.get("session.session.authenticated.user.id"));
|
||||||
|
self.set('authenticated', true);
|
||||||
|
self.set('busy', true);
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
self.get('sectionService').fetch(page, "owners", self.get('config'))
|
||||||
|
.then(function (owners) {
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('owners', owners);
|
||||||
|
self.getOwnerLists();
|
||||||
|
}, function (error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch owners");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
auth() {
|
||||||
|
let self = this;
|
||||||
|
self.set('busy', true);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
let target = "https://github.com/login/oauth/authorize?client_id=" + self.get('config.clientId') +
|
||||||
|
"&scope=repo&redirect_uri=" + encodeURIComponent(self.get('config.callbackUrl')) +
|
||||||
|
"&state=" + encodeURIComponent(window.location.href);
|
||||||
|
window.location.href = target;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onOwnerChange(thisOwner) {
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.owner', thisOwner);
|
||||||
|
this.set('config.repos', []);
|
||||||
|
this.set('config.lists', []);
|
||||||
|
this.getOwnerLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
onRepoChange(thisRepo) {
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.repo', thisRepo);
|
||||||
|
this.set('config.lists', []);
|
||||||
|
this.getRepoLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
onReportChange(thisReport) {
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.report', thisReport);
|
||||||
|
this.getReportLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
onStateChange(thisState) {
|
||||||
|
this.set('config.state', thisState);
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel() {
|
||||||
|
this.attrs.onCancel();
|
||||||
|
},
|
||||||
|
|
||||||
|
onAction(title) {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let thisLines = this.get('config.branchLines');
|
||||||
|
if (is.undefined(thisLines) || thisLines === "") {
|
||||||
|
this.set('config.branchLines', 30);
|
||||||
|
} else if (thisLines < 1) {
|
||||||
|
this.set('config.branchLines', 1);
|
||||||
|
} else if (thisLines > 100) {
|
||||||
|
this.set('config.branchLines', 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
let meta = this.get('meta');
|
||||||
|
page.set('title', title);
|
||||||
|
meta.set('rawBody', '');
|
||||||
|
meta.set('config', JSON.stringify(this.get('config')));
|
||||||
|
meta.set('externalSource', true);
|
||||||
|
|
||||||
|
let thisReport = this.get('config.report');
|
||||||
|
this.get('sectionService').fetch(page, thisReport.id, this.get('config'))
|
||||||
|
.then(function (response) {
|
||||||
|
meta.set('rawBody', JSON.stringify(response));
|
||||||
|
self.set('busy', false);
|
||||||
|
self.attrs.onAction(page, meta);
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.attrs.onAction(page, meta);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/github/type-renderer.js
Normal file
14
app/app/components/section/github/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
65
app/app/components/section/markdown/type-editor.js
Normal file
65
app/app/components/section/markdown/type-editor.js
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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;
|
||||||
|
$("#section-markdown-editor, #section-markdown-preview").css("height", height);
|
||||||
|
|
||||||
|
this.renderPreview();
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
$("#section-markdown-editor").off("keyup").on("keyup", function () {
|
||||||
|
self.renderPreview();
|
||||||
|
self.set('isDirty', true);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
$("#section-markdown-editor").off("keyup");
|
||||||
|
},
|
||||||
|
|
||||||
|
renderPreview() {
|
||||||
|
let md = window.markdownit({
|
||||||
|
linkify: true
|
||||||
|
});
|
||||||
|
let result = md.render(this.get("pageBody"));
|
||||||
|
$("#section-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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/markdown/type-renderer.js
Normal file
14
app/app/components/section/markdown/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
193
app/app/components/section/papertrail/type-editor.js
Normal file
193
app/app/components/section/papertrail/type-editor.js
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
import SectionMixin from '../../../mixins/section';
|
||||||
|
import netUtil from '../../../utils/net';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||||
|
sectionService: Ember.inject.service('section'),
|
||||||
|
isDirty: false,
|
||||||
|
waiting: false,
|
||||||
|
authenticated: false,
|
||||||
|
config: {},
|
||||||
|
items: {},
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
let config = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
config = JSON.parse(this.get('meta.config'));
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (is.empty(config)) {
|
||||||
|
config = {
|
||||||
|
APIToken: "",
|
||||||
|
query: "",
|
||||||
|
max: 10,
|
||||||
|
group: null,
|
||||||
|
system: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('config', config);
|
||||||
|
|
||||||
|
if (this.get('config.APIToken').length > 0) {
|
||||||
|
this.send('auth');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this.destroyTooltips();
|
||||||
|
},
|
||||||
|
|
||||||
|
displayError(reason) {
|
||||||
|
if (netUtil.isAjaxAccessError(reason)) {
|
||||||
|
this.showNotification(`Unable to authenticate`);
|
||||||
|
} else {
|
||||||
|
this.showNotification(`Something went wrong, try again!`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
isDirty() {
|
||||||
|
return this.get('isDirty');
|
||||||
|
},
|
||||||
|
|
||||||
|
auth() {
|
||||||
|
// missing data?
|
||||||
|
this.set('config.APIToken', this.get('config.APIToken').trim());
|
||||||
|
|
||||||
|
if (is.empty(this.get('config.APIToken'))) {
|
||||||
|
$("#papertrail-apitoken").addClass("error").focus();
|
||||||
|
console.log("auth token empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let page = this.get('page');
|
||||||
|
let config = this.get('config');
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
this.set('waiting', true);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "auth", config)
|
||||||
|
.then(function (response) {
|
||||||
|
self.set('authenticated', true);
|
||||||
|
self.set('items', response);
|
||||||
|
self.set('config.APIToken', '********'); // reset the api token once it has been sent to the host
|
||||||
|
console.log("auth token OK");
|
||||||
|
|
||||||
|
self.get('sectionService').fetch(page, "options", config)
|
||||||
|
.then(function (response) {
|
||||||
|
self.set('options', response);
|
||||||
|
self.set('waiting', false);
|
||||||
|
|
||||||
|
let options = self.get('options');
|
||||||
|
let group = _.findWhere(options.groups, { id: config.group.id });
|
||||||
|
if (is.not.undefined(group)) {
|
||||||
|
Ember.set(config, 'group', group);
|
||||||
|
}
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.set('config.APIToken', ''); // clear the api token
|
||||||
|
self.displayError(reason);
|
||||||
|
console.log("get options call failed");
|
||||||
|
});
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.set('config.APIToken', ''); // clear the api token
|
||||||
|
self.displayError(reason);
|
||||||
|
console.log("auth token invalid");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onGroupsChange(group) {
|
||||||
|
let config = this.get('config');
|
||||||
|
let page = this.get('page');
|
||||||
|
let self = this;
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.group', group);
|
||||||
|
this.set('waiting', true);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "auth", config)
|
||||||
|
.then(function (response) {
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.set('items', response);
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.displayError(reason);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onSystemsChange(system) {
|
||||||
|
let config = this.get('config');
|
||||||
|
let page = this.get('page');
|
||||||
|
let self = this;
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.system', system);
|
||||||
|
this.set('waiting', true);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "auth", config)
|
||||||
|
.then(function (response) {
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.set('items', response);
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.displayError(reason);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel() {
|
||||||
|
this.attrs.onCancel();
|
||||||
|
},
|
||||||
|
|
||||||
|
onAction(title) {
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
let meta = this.get('meta');
|
||||||
|
page.set('title', title);
|
||||||
|
meta.set('externalSource', true);
|
||||||
|
|
||||||
|
let config = this.get('config');
|
||||||
|
let max = 10;
|
||||||
|
if (is.number(parseInt(config.max))) {
|
||||||
|
max = parseInt(config.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ember.set(config, 'max', max);
|
||||||
|
this.set('waiting', true);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "auth", this.get('config'))
|
||||||
|
.then(function (response) {
|
||||||
|
self.set('items', response);
|
||||||
|
let items = self.get('items');
|
||||||
|
|
||||||
|
if (items.events.length > max) {
|
||||||
|
items.events = items.events.slice(0, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.set('config', JSON.stringify(config));
|
||||||
|
meta.set('rawBody', JSON.stringify(items));
|
||||||
|
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.attrs.onAction(page, meta);
|
||||||
|
}, function (reason) { //jshint ignore: line
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.set('waiting', false);
|
||||||
|
self.showNotification(`Something went wrong, try again!`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/papertrail/type-renderer.js
Normal file
14
app/app/components/section/papertrail/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
72
app/app/components/section/table/type-editor.js
Normal file
72
app/app/components/section/table/type-editor.js
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/table/type-renderer.js
Normal file
14
app/app/components/section/table/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
244
app/app/components/section/trello/type-editor.js
Normal file
244
app/app/components/section/trello/type-editor.js
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
/*global Trello*/
|
||||||
|
import Ember from 'ember';
|
||||||
|
import NotifierMixin from '../../../mixins/notifier';
|
||||||
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
import SectionMixin from '../../../mixins/section';
|
||||||
|
|
||||||
|
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||||
|
sectionService: Ember.inject.service('section'),
|
||||||
|
isDirty: false,
|
||||||
|
busy: false,
|
||||||
|
authenticated: false,
|
||||||
|
config: {},
|
||||||
|
boards: null,
|
||||||
|
noBoards: false,
|
||||||
|
appKey: "",
|
||||||
|
|
||||||
|
boardStyle: Ember.computed('config.board', function() {
|
||||||
|
let board = this.get('config.board');
|
||||||
|
|
||||||
|
if (is.null(board) || is.undefined(board)) {
|
||||||
|
return "#4c4c4c";
|
||||||
|
}
|
||||||
|
|
||||||
|
let color = board.prefs.backgroundColor;
|
||||||
|
return Ember.String.htmlSafe("background-color: " + color);
|
||||||
|
}),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
let page = this.get('page');
|
||||||
|
let config = {};
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
try {
|
||||||
|
config = JSON.parse(this.get('meta.config'));
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
|
if (is.empty(config)) {
|
||||||
|
config = {
|
||||||
|
token: "",
|
||||||
|
user: null,
|
||||||
|
board: null,
|
||||||
|
lists: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('config', config);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "config", {})
|
||||||
|
.then(function(s) {
|
||||||
|
self.set('appKey', s.appKey);
|
||||||
|
|
||||||
|
// On auth callback capture user token
|
||||||
|
let hashToken = window.location.hash;
|
||||||
|
if (is.not.undefined(hashToken) && is.not.null(hashToken)) {
|
||||||
|
let token = hashToken.replace("#token=", "");
|
||||||
|
if (is.not.empty(token)) {
|
||||||
|
self.set('config.token', token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.get('appKey') !== "" && self.get('config.token') !== "") {
|
||||||
|
self.send('auth');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Ember.$.getScript("https://api.trello.com/1/client.js?key=" + self.get('appKey'), function() {
|
||||||
|
Trello.deauthorize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, function(error) { //jshint ignore: line
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this.destroyTooltips();
|
||||||
|
},
|
||||||
|
|
||||||
|
getBoardLists() {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let boards = this.get('boards');
|
||||||
|
let board = this.get('config.board');
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
if (is.null(boards) || is.undefined(boards) || boards.length === 0) {
|
||||||
|
this.set('noBoards', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('noBoards', false);
|
||||||
|
|
||||||
|
if (is.null(board) || is.undefined(board)) {
|
||||||
|
if (boards.length) {
|
||||||
|
board = boards[0];
|
||||||
|
this.set('config.board', board);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.set('config.board', boards.findBy('id', board.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "lists", self.get('config'))
|
||||||
|
.then(function(lists) {
|
||||||
|
let savedLists = self.get('config.lists');
|
||||||
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
lists.forEach(function(list) {
|
||||||
|
let saved = savedLists.findBy("id", list.id);
|
||||||
|
let included = true;
|
||||||
|
if (is.not.undefined(saved)) {
|
||||||
|
included = saved.included;
|
||||||
|
}
|
||||||
|
list.included = included;
|
||||||
|
});
|
||||||
|
|
||||||
|
self.set('config.lists', lists);
|
||||||
|
self.set('busy', false);
|
||||||
|
}, function(error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch board lists");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
isDirty() {
|
||||||
|
return this.get('isDirty');
|
||||||
|
},
|
||||||
|
|
||||||
|
onListCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
|
let list = lists.findBy('id', id);
|
||||||
|
|
||||||
|
if (list !== null) {
|
||||||
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
auth() {
|
||||||
|
if (this.get('appKey') === "") {
|
||||||
|
$("#trello-appkey").addClass('error').focus();
|
||||||
|
this.set('authenticated', false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
|
||||||
|
self.set('busy', true);
|
||||||
|
|
||||||
|
Ember.$.getScript("https://api.trello.com/1/client.js?key=" + this.get('appKey'), function() {
|
||||||
|
Trello.authorize({
|
||||||
|
type: "redirect",
|
||||||
|
interactive: true,
|
||||||
|
name: "Documize",
|
||||||
|
scope: {
|
||||||
|
read: true,
|
||||||
|
write: false
|
||||||
|
},
|
||||||
|
expiration: "never",
|
||||||
|
persist: true,
|
||||||
|
success: function() {
|
||||||
|
self.set('authenticated', true);
|
||||||
|
self.set('config.token', Trello.token());
|
||||||
|
self.set('busy', true);
|
||||||
|
|
||||||
|
Trello.members.get("me", function(user) {
|
||||||
|
self.set('config.user', user);
|
||||||
|
}, function(error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.get('sectionService').fetch(page, "boards", self.get('config'))
|
||||||
|
.then(function(boards) {
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('boards', boards);
|
||||||
|
self.getBoardLists();
|
||||||
|
}, function(error) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to fetch boards");
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
self.set('busy', false);
|
||||||
|
self.set('authenticated', false);
|
||||||
|
self.showNotification("Unable to authenticate");
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onBoardChange(board) {
|
||||||
|
this.set('isDirty', true);
|
||||||
|
this.set('config.board', board);
|
||||||
|
this.set('config.lists', []);
|
||||||
|
this.getBoardLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel() {
|
||||||
|
this.attrs.onCancel();
|
||||||
|
},
|
||||||
|
|
||||||
|
onAction(title) {
|
||||||
|
this.set('busy', true);
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
let page = this.get('page');
|
||||||
|
let meta = this.get('meta');
|
||||||
|
page.set('title', title);
|
||||||
|
meta.set('rawBody', '');
|
||||||
|
meta.set('config', JSON.stringify(this.get('config')));
|
||||||
|
meta.set('externalSource', true);
|
||||||
|
|
||||||
|
this.get('sectionService').fetch(page, "cards", this.get('config'))
|
||||||
|
.then(function(response) {
|
||||||
|
meta.set('rawBody', JSON.stringify(response));
|
||||||
|
self.set('busy', false);
|
||||||
|
self.attrs.onAction(page, meta);
|
||||||
|
}, function(reason) { //jshint ignore: line
|
||||||
|
self.set('busy', false);
|
||||||
|
self.attrs.onAction(page, meta);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/trello/type-renderer.js
Normal file
14
app/app/components/section/trello/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
114
app/app/components/section/wysiwyg/type-editor.js
Normal file
114
app/app/components/section/wysiwyg/type-editor.js
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
pageBody: "",
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof tinymce === 'undefined') {
|
||||||
|
$.getScript(this.get("appMeta").getBaseUrl("tinymce/tinymce.min.js?v=430"), function() {
|
||||||
|
window.tinymce.dom.Event.domLoaded = true;
|
||||||
|
tinymce.baseURL = "//" + window.location.host + "/tinymce";
|
||||||
|
tinymce.suffix = ".min";
|
||||||
|
tinymce.init(options);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
14
app/app/components/section/wysiwyg/type-renderer.js
Normal file
14
app/app/components/section/wysiwyg/type-renderer.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({});
|
147
app/app/components/settings/user-list.js
Normal file
147
app/app/components/settings/user-list.js
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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.get('session.session.authenticated.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
46
app/app/components/ui-select.js
Normal file
46
app/app/components/ui-select.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
52
app/app/components/user-notification.js
Normal file
52
app/app/components/user-notification.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
55
app/app/components/widget-sample.js
Normal file
55
app/app/components/widget-sample.js
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
// 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
113
app/app/helpers/document/file-icon.js
Normal file
113
app/app/helpers/document/file-icon.js
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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 "html":
|
||||||
|
html = "html.png";
|
||||||
|
break;
|
||||||
|
case "css":
|
||||||
|
html = "css.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case "bat":
|
||||||
|
case "sh":
|
||||||
|
case "ps":
|
||||||
|
case "ps1":
|
||||||
|
case "cs":
|
||||||
|
case "vb":
|
||||||
|
case "php":
|
||||||
|
case "java":
|
||||||
|
case "go":
|
||||||
|
case "js":
|
||||||
|
case "rb":
|
||||||
|
case "py":
|
||||||
|
case "json":
|
||||||
|
case "config":
|
||||||
|
case "xml":
|
||||||
|
html = "code.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":
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Ember.Handlebars.SafeString(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Ember.Helper.helper(documentFileIcon);
|
19
app/app/helpers/formatted-date.js
Normal file
19
app/app/helpers/formatted-date.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
19
app/app/helpers/generate-id.js
Normal file
19
app/app/helpers/generate-id.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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;
|
||||||
|
});
|
17
app/app/helpers/is-equal.js
Normal file
17
app/app/helpers/is-equal.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
// Usage: {{is-equal item selection}}
|
||||||
|
export default Ember.Helper.helper(function([leftSide, rightSide]) {
|
||||||
|
return leftSide === rightSide;
|
||||||
|
});
|
17
app/app/helpers/is-not.js
Normal file
17
app/app/helpers/is-not.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
// Usage: {{is-not selection}}
|
||||||
|
export default Ember.Helper.helper(function([value]) {
|
||||||
|
return !value;
|
||||||
|
});
|
16
app/app/helpers/read-path.js
Normal file
16
app/app/helpers/read-path.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Helper.helper(function([object, path]) {
|
||||||
|
return Ember.get(object, path);
|
||||||
|
});
|
20
app/app/helpers/time-ago.js
Normal file
20
app/app/helpers/time-ago.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
22
app/app/helpers/user-initials.js
Normal file
22
app/app/helpers/user-initials.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
32
app/app/index.html
Normal file
32
app/app/index.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!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'}}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{{content-for 'body'}}
|
||||||
|
<script src="assets/vendor.js"></script>
|
||||||
|
<script src="assets/documize.js"></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>
|
28
app/app/initializers/application.js
Normal file
28
app/app/initializers/application.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
export function initialize( /*application*/ ) {
|
||||||
|
// address insecure jquery defaults (kudos: @nathanhammond)
|
||||||
|
$.globalEval = function() {};
|
||||||
|
$.ajaxSetup({
|
||||||
|
crossDomain: true,
|
||||||
|
converters: {
|
||||||
|
'text script': text => text
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Dropzone.autoDiscover = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'application',
|
||||||
|
initialize: initialize
|
||||||
|
};
|
22
app/app/initializers/audit.js
Normal file
22
app/app/initializers/audit.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
22
app/app/initializers/browser.js
Normal file
22
app/app/initializers/browser.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
23
app/app/initializers/event-bus.js
Normal file
23
app/app/initializers/event-bus.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
22
app/app/initializers/logger.js
Normal file
22
app/app/initializers/logger.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
24
app/app/initializers/session.js
Normal file
24
app/app/initializers/session.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
export function initialize(application) {
|
||||||
|
application.inject('route', 'session', 'service:session');
|
||||||
|
application.inject('controller', 'session', 'service:session');
|
||||||
|
application.inject('component', 'session', 'service:session');
|
||||||
|
application.inject('mixin', 'session', 'service:session');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'session',
|
||||||
|
after: 'application',
|
||||||
|
before: 'audit',
|
||||||
|
initialize: initialize
|
||||||
|
};
|
24
app/app/mixins/notifier.js
Normal file
24
app/app/mixins/notifier.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Mixin.create({
|
||||||
|
showNotification(msg) {
|
||||||
|
this.eventBus.publish('notifyUser', msg);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
showNotification(msg) {
|
||||||
|
this.eventBus.publish('notifyUser', msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
26
app/app/mixins/section.js
Normal file
26
app/app/mixins/section.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Mixin.create({
|
||||||
|
isReadonly: function () {
|
||||||
|
if (this.get('page.userId') === this.get('session.session.authenticated.user.id')) {
|
||||||
|
return undefined;
|
||||||
|
} else {
|
||||||
|
return "readonly";
|
||||||
|
}
|
||||||
|
}.property('page'),
|
||||||
|
|
||||||
|
isMine: function () {
|
||||||
|
return this.get('page.userId') === this.get('session.session.authenticated.user.id');
|
||||||
|
}.property('page')
|
||||||
|
});
|
42
app/app/mixins/tooltip.js
Normal file
42
app/app/mixins/tooltip.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Mixin.create({
|
||||||
|
tooltips: [],
|
||||||
|
|
||||||
|
addTooltip(elem) {
|
||||||
|
|
||||||
|
if(elem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
35
app/app/pods/auth/forgot/controller.js
Normal file
35
app/app/pods/auth/forgot/controller.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
19
app/app/pods/auth/forgot/route.js
Normal file
19
app/app/pods/auth/forgot/route.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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>
|
48
app/app/pods/auth/login/controller.js
Normal file
48
app/app/pods/auth/login/controller.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Controller.extend({
|
||||||
|
email: "",
|
||||||
|
password: "",
|
||||||
|
invalidCredentials: false,
|
||||||
|
session: Ember.inject.service('session'),
|
||||||
|
audit: Ember.inject.service('audit'),
|
||||||
|
|
||||||
|
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 creds = this.getProperties('email', 'password');
|
||||||
|
|
||||||
|
this.get('session').authenticate('authenticator:documize', creds)
|
||||||
|
.then((response) => {
|
||||||
|
this.get('audit').record("logged-in");
|
||||||
|
this.transitionToRoute('folders.folder');
|
||||||
|
return response;
|
||||||
|
}).catch(() => {
|
||||||
|
this.set('invalidCredentials', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
20
app/app/pods/auth/login/route.js
Normal file
20
app/app/pods/auth/login/route.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
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>
|
14
app/app/pods/auth/logout/controller.js
Normal file
14
app/app/pods/auth/logout/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Controller.extend({});
|
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