FINAL suepr merge step : added all modules to this super repos
339
sites/all/modules/contrib/taxonomy/taxonomy_manager/LICENSE.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
172
sites/all/modules/contrib/taxonomy/taxonomy_manager/README.txt
Normal file
@@ -0,0 +1,172 @@
|
||||
|
||||
README - TAXONOMY MANAGER
|
||||
**************************
|
||||
|
||||
|
||||
SHORT PROJECT DESCRIPTION
|
||||
--------------------------
|
||||
This module provides a powerful interface for managing vocabularies of the taxonomy module.
|
||||
It's especially very useful for long sets of vocabularies.
|
||||
|
||||
Features:
|
||||
* dynamic tree view
|
||||
* mass deleting
|
||||
* mass adding of new terms
|
||||
* moving of terms in hierarchies
|
||||
* merging of terms (Term merge module)
|
||||
* fast weight changing with up and down arrows (and AJAX saving)
|
||||
* AJAX powered term editing form
|
||||
* simple search interface
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
------------
|
||||
- Taxonomy module enabled
|
||||
- JavaScript enabled in your browser
|
||||
- a user with 'administer taxonomy' permission
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
1. Place the entire taxonomy_manager directory into your Drupal sites/all/modules/ directory.
|
||||
|
||||
2. Enable the taxonomy manager module by navigating to:
|
||||
|
||||
administer > site building > modules
|
||||
|
||||
|
||||
UPGRAGE to 7.x
|
||||
---------------
|
||||
The table 'taxonomy_manager_merge' is deprecated and won't be used by now. This table stores
|
||||
which terms were merged into which destination term. If you do not need this information, you
|
||||
can manually remove this table.
|
||||
|
||||
|
||||
USING THE TAXONOMY MANAGER
|
||||
--------------------------
|
||||
To use the Taxonomy Manager go to administer > content management > taxonomy manager. This page
|
||||
contains a list of all available vocabularies. By clicking at one of the vocabularies, you get
|
||||
redirected to the Taxonomy Manager interface, where you can edit the whole tree structure and
|
||||
terms.
|
||||
If you want to edit any general vocabulary settings or if you want to create a new one, go to
|
||||
the categories (administer > content management > categories) page.
|
||||
|
||||
The interface contains a search bar, a toolbar with some operations, a tree view and if a term
|
||||
gets selected a form for editing the term data.
|
||||
The following lines describe all operations and some terminology.
|
||||
|
||||
- Tree View
|
||||
The tree view shows all terms of the vocabulary with their hierarchical relations. If your
|
||||
list of terms gets very long, there is a paging mechanism included with a page size of 50 terms.
|
||||
If you are having hierarchical vocabularies, all parent terms have a plus symbol, which
|
||||
means you can expand them to show their child terms. Use the minus symbol to collapse
|
||||
them again.
|
||||
In multiple hierarchies, if one term has more parents, the term gets shown under
|
||||
each of its parents.
|
||||
|
||||
- Adding of terms
|
||||
For adding new term, click on the 'Add' Button. A fieldset containing some textfields expands.
|
||||
If you want to close this fieldset, click 'Cancel'.
|
||||
To insert a new term, fill in any textfield. Each textfield can only contain one term.
|
||||
You don't have to fill in all textfields, they can be left empty.
|
||||
Depending on your hierarchy settings, it's possible to insert terms and to directly assign
|
||||
a parent to them. If you want to do this, select a parent term in the tree view by marking
|
||||
the checkbox. If you have multiple hierarchies enabled, it's even possible to assign the
|
||||
new inserted terms to more parents at once by selecting more terms in the tree view.
|
||||
|
||||
- Weight Editing
|
||||
Every term has a weight. This weight determines the position the terms get listed. If terms
|
||||
have the same weight, they are ordered alphabetically.
|
||||
If you want to change the weight, you have 3 ways to do that.
|
||||
1st way: select the terms you want to move by one position (can be more terms at once) and press
|
||||
either the up or the down button in the toolbar. All saving is done automatically through
|
||||
AJAX.
|
||||
2nd way: every term in tree view has a mouseover effect. When you move your mouse over a term, two
|
||||
small up and down arrows will appear. Click them to move this term by one
|
||||
position.
|
||||
3rd way: click on the term, where you want to change the weight. A form for editing the
|
||||
term data appears on the right side of the tree view. At the bottom of this
|
||||
form, there is a select field, which shows the current weight. By changing the
|
||||
value, the tree view gets automatically reordered and the values are saved to the
|
||||
database through AJAX.
|
||||
|
||||
- Deleting
|
||||
If you want to delete terms from the vocabulary, select them by marking the checkbox and click
|
||||
the 'Delete' button. A fieldset, where you have to confirm the deletion, expands.
|
||||
For hierarchical vocabularies (single or multi), the fieldset contains an option, which says:
|
||||
'Delete children of selected, if there are any'. Check this if you want to delete all children
|
||||
of a selected parent term. Otherwise, if you are deleting the last parent of terms, the terms
|
||||
get added to root level.
|
||||
|
||||
- Moving
|
||||
This operation is only available in hierarchical (single or multiple) vocabularies. It allows
|
||||
you to change hierarchies by moving terms from one parent to one other.
|
||||
Select all terms you want to move by marking the checkbox. Click the 'Move' button. A fieldset with
|
||||
some options expands.
|
||||
This fielset contains a autocomplete field, where you have to determine the parent term (under which
|
||||
the terms should be moved). If you want to move terms to the root level, leave this field empty.
|
||||
This autocomplete form allows you to either choose a parent term from the list of exisitng terms
|
||||
or to insert a new terms, which will be used as parent (this parent term will be added to the root
|
||||
level).
|
||||
In multiple hierarchical vocabularies, it's possible to move terms to more parents in one step by
|
||||
inserting more terms into the autocomplete field and separating them by commas. Additional, there
|
||||
appears an option ('Keep old parents and add new one'), which prevents the replacing of old parents.
|
||||
|
||||
- Merging
|
||||
With the merging action, you can put terms with the same meaning together (e.g. your vocabulary
|
||||
contains: SoC, Summer of Code, GSoC, Google Summer of Code). All terms, that get merged into
|
||||
one other, get synonyms of resulting term (here called merged or main term). Additional
|
||||
all term-node association gets automatically updated (this means nodes, that had a merging term
|
||||
assigned, now get the resulting merged term instead). All merging terms are deleted afterwards.
|
||||
In the Taxonomy Manager, you can do that by selecting all terms you want to merge and to click
|
||||
the 'Merge' button. A fieldset with an autocomplete field an some options expands. In the
|
||||
autocomplete field you have to specify the resulting merged term (into which the selected get merged).
|
||||
The merged term can be either chosen from the list of existing terms or can be inserted automatically
|
||||
and used as merged term.
|
||||
Additional, there are some options available (they depend on the vocabulary settings). If you want
|
||||
to add any kind of relations (parents, children, related terms) from the merging terms to the
|
||||
resulting merged term, select one (or more) of them.
|
||||
|
||||
The default taxonomy term page, which shows all assigned nodes, is overriden by the Taxonomy
|
||||
Manager, so that former merged terms can be considered (if someone calls a term, that was merged,
|
||||
it redirects to the resulting merged term).
|
||||
|
||||
NOTE: At the moment, the Taxonomy Manager only cares about the term-node association inserted
|
||||
into the term_node table (by the taxonomy module). If you are using any CCK modules, like
|
||||
CCK Taxonomy or Content Taxonomy, which (can) save the term - node association in cck tables,
|
||||
don't use the Merging action, because changes are not handled.
|
||||
If you are using Views filters instead of the default taxonomy term page, merged terms are
|
||||
either respected.
|
||||
If you want to customize this by yourself or have some other module, you can use following
|
||||
function taxonomy_manager_merge_get_main_term($tid) for getting the main term id (if there
|
||||
is any main term, else return 0). The term merge history gets saved in the
|
||||
taxonomy_manager_merge table (main_tid, merged_tid) and gets additional cached, so that
|
||||
checking for a merged terms causes nearly no performance loss.
|
||||
|
||||
- Editing term data
|
||||
If you want to edit or read some term properties, click on the term. A fieldset on the right side
|
||||
of the tree view gets loaded. This contains all term related information and can be edited. If you
|
||||
want to change the term name or the description, fill in any changes you want and click the saving
|
||||
symbol. All saving is done through AJAX, so no reload is necessary.
|
||||
Additional, this page contains listing of synonyms, related terms and parents (depends on your
|
||||
vocabulary settings).
|
||||
Every listed entry has an delete operation. By clicking the delete symbol, the relation gets deleted.
|
||||
In case of synonyms, the names get deleted from the database. If you are deleting a related term or a
|
||||
parent, this doesn't delete the term itself, only the relation.
|
||||
For adding new synonyms, the listing has a textfield below. Insert there any new synonym and click the
|
||||
plus symbol.
|
||||
For adding a new related term or a new parent (if multi hierarchy), there is a autocomplete field below
|
||||
the listing. Use this to insert new terms or to choose existing ones and assign them to the current term.
|
||||
|
||||
- Using the search
|
||||
At the top of the page, there is a collapsed fieldset, called 'Search'. This search allows you to
|
||||
directly select an existing term for editing. Else, if your input doesn't match an existing term,
|
||||
the value will be used for filtering root level terms (this doesn't affect any child term).
|
||||
|
||||
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
Matthias Hutterer
|
||||
User: mh86@drupal.org
|
||||
Email: m_hutterer@hotmail.com
|
@@ -0,0 +1,571 @@
|
||||
|
||||
/**
|
||||
* Taxonomy Manager Tree formating
|
||||
*/
|
||||
|
||||
#taxonomy-manager-double-tree-form,
|
||||
#taxonomy-manager-form {
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form #edit-jump,
|
||||
#taxonomy-manager-form #edit-jump {
|
||||
float: right;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
#edit-toolbar,
|
||||
#edit-add {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form fieldset,
|
||||
#taxonomy-manager-form fieldset {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form .left,
|
||||
#taxonomy-manager-form .left {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#taxonomy2-manager-tree-outer-div,
|
||||
#taxonomy-manager-tree-outer-div {
|
||||
overflow: auto;
|
||||
width: 46%;
|
||||
}
|
||||
|
||||
#taxonomy2-manager-tree-outer-div fieldset,
|
||||
#taxonomy-manager-tree-outer-div fieldset {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.taxonomy-manager-tree-size {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
/*height: 7px;*/
|
||||
text-align: right;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.taxonomy-manager-tree-size img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#taxonomy2-manager-tree-wrapper,
|
||||
#taxonomy-manager-tree-wrapper {
|
||||
margin-top: 0em;
|
||||
}
|
||||
|
||||
/* address .treeview additional with #taxonomy-manager to make it compatible with the admin module */
|
||||
#taxonomy-manager .treeview,
|
||||
.treeview,
|
||||
.treeview ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#taxonomy-manager .treeview .form-item,
|
||||
.treeview .form-item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#taxonomy-manager .treeview li,
|
||||
.treeview li {
|
||||
margin: 0;
|
||||
padding: 0 0 0 15px;
|
||||
}
|
||||
|
||||
#taxonomy-manager .hitArea,
|
||||
.hitArea {
|
||||
float: left;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
margin-left: -15px;
|
||||
cursor: pointer;
|
||||
_background: #fff;
|
||||
_filter: alpha(opacity=0);
|
||||
_display: inline;
|
||||
}
|
||||
|
||||
#taxonomy-manager .treeview li,
|
||||
.treeview li {
|
||||
background: url(../images/tv-item.gif) 0 0 no-repeat;
|
||||
}
|
||||
#taxonomy-manager .treeview .collapsable,
|
||||
.treeview .collapsable {
|
||||
background-image: url(../images/tv-collapsable.gif);
|
||||
}
|
||||
#taxonomy-manager .treeview .expandable,
|
||||
.treeview .expandable {
|
||||
background-image: url(../images/tv-expandable.gif);
|
||||
}
|
||||
#taxonomy-manager .treeview .last,
|
||||
.treeview .last {
|
||||
background-image: url(../images/tv-item-last.gif);
|
||||
}
|
||||
#taxonomy-manager .treeview .lastCollapsable,
|
||||
.treeview .lastCollapsable {
|
||||
background-image: url(../images/tv-collapsable-last.gif);
|
||||
}
|
||||
#taxonomy-manager .treeview .lastExpandable,
|
||||
.treeview .lastExpandable {
|
||||
background-image: url(../images/tv-expandable-last.gif);
|
||||
}
|
||||
|
||||
.term-line {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.term-item {
|
||||
display: inline;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.term-has-more-siblings {
|
||||
height: 38px;
|
||||
cursor: pointer;
|
||||
background-image: url(../images/2downarrow.png);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.term-next-count {
|
||||
display: inline;
|
||||
color: #4ca108;
|
||||
line-height: 38px;
|
||||
padding-left: 38px;
|
||||
}
|
||||
|
||||
|
||||
.term-operations {
|
||||
display: inline;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.term-operations span.select-all-children {
|
||||
text-decoration: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/select-all-children.png);
|
||||
}
|
||||
.term-operations span.deselect-all-children {
|
||||
text-decoration: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/deselect-all-children.png);
|
||||
}
|
||||
|
||||
.term-operations img.term-up,
|
||||
.term-operations img.term-down,
|
||||
.term-operations span.select-all-children,
|
||||
.term-operations span.deselect-all-children,
|
||||
.term-operations a img {
|
||||
cursor: pointer;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.term-operations a:link,
|
||||
.term-operations a:visited,
|
||||
.term-operations a:hover,
|
||||
.term-operations a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.highlightActiveTerm div.form-item {
|
||||
background-color:#dddddd;
|
||||
}
|
||||
.highlightActiveTerm a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.taxonomy-manager-select-helpers {
|
||||
padding-left: 5px;
|
||||
}
|
||||
span.taxonomy-manager-select-helpers span {
|
||||
padding-right: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
span.taxonomy-manager-select-helpers span.select-all-children {
|
||||
text-decoration: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/select-all-children-bw.png);
|
||||
}
|
||||
span.taxonomy-manager-select-helpers span.select-all-children:hover {
|
||||
background-image: url(../images/select-all-children.png);
|
||||
}
|
||||
span.taxonomy-manager-select-helpers span.deselect-all-children {
|
||||
text-decoration: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/deselect-all-children-bw.png);
|
||||
}
|
||||
span.taxonomy-manager-select-helpers span.deselect-all-children:hover {
|
||||
background-image: url(../images/deselect-all-children.png);
|
||||
}
|
||||
|
||||
div.form-item-taxonomy-manager-top-language,
|
||||
div.form-item-taxonomy2-manager-top-language {
|
||||
padding-right: 0.5em;
|
||||
text-align: right;
|
||||
display: inline;
|
||||
}
|
||||
div.form-item-taxonomy-manager-top-language label,
|
||||
div.form-item-taxonomy2-manager-top-language label {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.taxonomy-manager-tree-top {
|
||||
text-align: right;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-operations {
|
||||
float: left;
|
||||
margin-left: 8px;
|
||||
margin-right: 8px;
|
||||
margin-top: 120px;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.taxonomy-manager-double-tree-operations-buttons input {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#double-tree-msg {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.taxonomy-manager-term-load-helper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Taxonomy Manger Toolbar
|
||||
*/
|
||||
#taxonomy-manager-toolbar-throbber {
|
||||
float: right;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
#taxonomy-manager-toolbar-buttons {
|
||||
float:left;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.taxonomy-manager-buttons,
|
||||
#taxonomy-manager-form input.taxonomy-manager-buttons {
|
||||
cursor: pointer;
|
||||
color: #5a5a5a;
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 15px;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
font-family: "Lucida Grande", Verdana, sans-serif;
|
||||
border: 1px solid #e4e4e4;
|
||||
border-bottom: 1px solid #b4b4b4;
|
||||
border-left-color: #D2D2D2;
|
||||
border-right-color: #D2D2D2;
|
||||
padding-left: 30px;
|
||||
padding-bottom: 3px;
|
||||
padding-right: 3px;
|
||||
padding-top: 0px;
|
||||
height: 30px;
|
||||
margin-bottom:0px;
|
||||
|
||||
background-repeat: no-repeat;
|
||||
background-position:6px;
|
||||
background-color: #F0EFEF;
|
||||
background-attachment: scroll;
|
||||
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.add,
|
||||
#taxonomy-manager-form input.add {
|
||||
background-image: url(../images/list-add.png);
|
||||
}
|
||||
|
||||
input#edit-weight-up {
|
||||
background-image: url(../images/go-up.png);
|
||||
}
|
||||
|
||||
input#edit-weight-down {
|
||||
background-image: url(../images/go-down.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.delete,
|
||||
#taxonomy-manager-form input.delete {
|
||||
background-image: url(../images/list-remove.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.move,
|
||||
#taxonomy-manager-form input.move {
|
||||
background-image: url(../images/move.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.merge,
|
||||
#taxonomy-manager-form input.merge {
|
||||
background-image: url(../images/merge.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.cancel,
|
||||
#taxonomy-manager-form input.cancel {
|
||||
background-image: url(../images/dialog-cancel.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.search,
|
||||
#taxonomy-manager-form input.search {
|
||||
background-image: url(../images/edit-find.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.export,
|
||||
#taxonomy-manager-form input.export {
|
||||
background-image: url(../images/csv.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.save,
|
||||
#taxonomy-manager-form input.save {
|
||||
background-image: url(../images/document-save.png);
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.double-tree,
|
||||
#taxonomy-manager-form input.double-tree {
|
||||
background-position:8px;
|
||||
padding-left: 32px;
|
||||
background-image: url(../images/double-tree.png);
|
||||
}
|
||||
|
||||
#taxonomy-manager-double-tree-form input.double-tree-disable,
|
||||
#taxonomy-manager-form input.double-tree-disable {
|
||||
background-image: url(../images/double-tree-disable.png);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fixing position of autocomplete in seven theme
|
||||
*/
|
||||
fieldset#edit-search,
|
||||
fieldset#edit-move,
|
||||
fieldset#edit-term-merge {
|
||||
position: static;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Taxonomy Manager Search
|
||||
*/
|
||||
#edit-search .fieldset-wrapper {
|
||||
overflow: visible; /*fixes hidden autocomplete result in FF*/
|
||||
}
|
||||
|
||||
#edit-search-field .form-item {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Term Data Form
|
||||
*/
|
||||
|
||||
|
||||
.term-data-overlay {
|
||||
position: absolute;
|
||||
left: 280px;
|
||||
top: 100px;
|
||||
width: 500px;
|
||||
z-index: 100;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.term-data-overlay fieldset {
|
||||
border-width: 5px;
|
||||
}
|
||||
|
||||
.term-data-overlay legend span{
|
||||
cursor: move;
|
||||
background-image: url(../images/move-small.png);
|
||||
background-repeat:no-repeat;
|
||||
background-position: 8px 3px;
|
||||
padding-left: 24px;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
#term-data-close {
|
||||
padding-top: 8px;
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
line-height: 100%;
|
||||
|
||||
}
|
||||
|
||||
#term-data-close span {
|
||||
text-decoration: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/dialog-cancel-small.png);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#term-data-close span:hover {
|
||||
background-image: url(../images/dialog-cancel-small-hover.png);
|
||||
}
|
||||
|
||||
td.term-data-autocomplete-add,
|
||||
td.taxonomy-term-data-operations {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*.term-data-autocomplete-add span {
|
||||
text-decoration: none;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display:block;
|
||||
background-image: url(../images/list-add.png);
|
||||
}
|
||||
|
||||
.term-data-autocomplete-add span:hover {
|
||||
text-decoration: none;
|
||||
background-image: url(../images/list-add-hover.png);
|
||||
}
|
||||
|
||||
.taxonomy-term-data-operations span {
|
||||
text-decoration: none;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display:block;
|
||||
background-image: url(../images/list-remove.png);
|
||||
}
|
||||
|
||||
.taxonomy-term-data-operations span:hover {
|
||||
text-decoration: none;
|
||||
background-image: url(../images/list-remove-hover.png);
|
||||
}*/
|
||||
|
||||
#taxonomy-term-data #edit-term-data-name-wrapper {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#taxonomy-term-data .resizable-textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#taxonomy-term-data fieldset {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#taxonomy-manager .messages {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#taxonomy-term-data input.form-submit {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
#taxonomy-term-data input.save {
|
||||
margin: 10px 0;
|
||||
padding: 0 50px;
|
||||
padding-left: 40px;
|
||||
padding-bottom: 3px;
|
||||
padding-right: 15px;
|
||||
padding-top: 0px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
|
||||
#taxonomy-term-data .filter-wrapper .fieldset-wrapper {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
#taxonomy-term-data .filter-guidelines {
|
||||
display:none; //hide descriptions, they use too much space
|
||||
}
|
||||
|
||||
.term-data-form-file-field-info {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.taxonomy-term-data-operations {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.term-data-autocomplete {
|
||||
display: inline;
|
||||
}
|
||||
.term-data-autocomplete-add {
|
||||
/*display: inline;*/
|
||||
cursor: pointer;
|
||||
}
|
||||
.term-data-autocomplete-add img {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#taxonomy-term-data .form-item-term-data-name input {
|
||||
width: 100%;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
#term-data-description {
|
||||
height: 130px;
|
||||
}
|
||||
|
||||
#taxonomy-term-data .form-item {
|
||||
margin-bottom: 0.3em;
|
||||
margin-top: 0.3em;
|
||||
}
|
||||
|
||||
|
||||
#taxonomy-term-data table .form-item {
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
#taxonomy-term-data table {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
#taxonomy-term-data td, th {
|
||||
padding-top: 0.1em;
|
||||
padding-bottom: 0.1em;
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
#edit-term-data-save {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
span.taxonomy-manager-message-close {
|
||||
float:right;
|
||||
}
|
||||
|
||||
/**
|
||||
overwrites some css settings from the admin module, which break the layout of the taxonomy manager
|
||||
*/
|
||||
#taxonomy-manager div.form-item:after,
|
||||
#taxonomy-manager ul.links:after,
|
||||
#taxonomy-manager div.admin-panel .body:after,
|
||||
#taxonomy-manager .clear-block:after {
|
||||
display: inline;
|
||||
}
|
||||
|
After Width: | Height: | Size: 899 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 379 B |
After Width: | Height: | Size: 560 B |
After Width: | Height: | Size: 717 B |
After Width: | Height: | Size: 533 B |
After Width: | Height: | Size: 834 B |
After Width: | Height: | Size: 792 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 445 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 547 B |
After Width: | Height: | Size: 742 B |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 598 B |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 877 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 452 B |
After Width: | Height: | Size: 584 B |
After Width: | Height: | Size: 85 B |
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 89 B |
After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 65 B |
After Width: | Height: | Size: 750 B |
@@ -0,0 +1,63 @@
|
||||
|
||||
/**
|
||||
* @file shows / hides form elements
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.TaxonomyManagerHideForm = {
|
||||
attach: function(context, settings) {
|
||||
$('#edit-toolbar', context).once('hideForm', function() {
|
||||
for (var key in settings.hideForm) {
|
||||
Drupal.attachHideForm(settings.hideForm[key].div, settings.hideForm[key].show_button, settings.hideForm[key].hide_button);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds click events to show / hide button
|
||||
*/
|
||||
Drupal.attachHideForm = function(div, show_button, hide_button) {
|
||||
var hide = true;
|
||||
var div = $("#"+ div);
|
||||
var show_button = $("#"+ show_button);
|
||||
var hide_button = $("#"+ hide_button);
|
||||
|
||||
// don't hide if there is an error in the form
|
||||
$(div).find("input").each(function() {
|
||||
if ($(this).hasClass("error")) {
|
||||
hide = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!hide) {
|
||||
$(div).show();
|
||||
}
|
||||
$(show_button).click(function() {
|
||||
Drupal.hideOtherForms(div);
|
||||
$(div).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
$(hide_button).click(function() {
|
||||
$(div).hide();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that hides all forms, except the current one.
|
||||
*/
|
||||
Drupal.hideOtherForms = function(currentFormDiv) {
|
||||
var currentFormDivId = $(currentFormDiv).attr('id');
|
||||
var settings = Drupal.settings.hideForm || [];
|
||||
for (var key in settings) {
|
||||
var div = settings[key].div;
|
||||
if (div != currentFormDivId) {
|
||||
$('#' + div).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})(jQuery);
|
@@ -0,0 +1,145 @@
|
||||
|
||||
/**
|
||||
* @file js support for term editing form for ajax saving and tree updating
|
||||
*/
|
||||
|
||||
|
||||
(function ($) {
|
||||
|
||||
//global var that holds the current term link object
|
||||
var active_term = new Object();
|
||||
|
||||
/**
|
||||
* attaches term data form, used after 'Saves changes' submit
|
||||
*/
|
||||
Drupal.behaviors.TaxonomyManagerTermData = {
|
||||
attach: function(context) {
|
||||
if (!$('#taxonomy-term-data-replace').hasClass('processed')) {
|
||||
$('#taxonomy-term-data-replace').addClass('processed');
|
||||
Drupal.attachTermDataForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* attaches Term Data functionality, called by tree.js
|
||||
*/
|
||||
Drupal.attachTermData = function(ul) {
|
||||
Drupal.attachTermDataLinks(ul);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds click events to the term links in the tree structure
|
||||
*/
|
||||
Drupal.attachTermDataLinks = function(ul) {
|
||||
$(ul).find('a.term-data-link').click(function() {
|
||||
Drupal.activeTermSwapHighlight(this);
|
||||
var li = $(this).parents("li:first");
|
||||
Drupal.loadTermDataForm(Drupal.getTermId(li), false);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* attaches click events to next siblings
|
||||
*/
|
||||
Drupal.attachTermDataToSiblings = function(all, currentIndex) {
|
||||
var nextSiblings = $(all).slice(currentIndex);
|
||||
$(nextSiblings).find('a.term-data-link').click(function() {
|
||||
var li = $(this).parents("li:first");
|
||||
Drupal.loadTermDataForm(Drupal.getTermId(li), false);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* adds click events to term data form, which is already open, when page gets loaded
|
||||
*/
|
||||
Drupal.attachTermDataForm = function() {
|
||||
active_term = $('div.highlightActiveTerm').find('a');
|
||||
var tid = $('#taxonomy-term-data').find('input:hidden[name="tid"]').val();
|
||||
if (tid) {
|
||||
new Drupal.TermData(tid).form();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* loads term data form
|
||||
*/
|
||||
Drupal.loadTermDataForm = function(tid, refreshTree) {
|
||||
// Triggers an AJAX button
|
||||
$('#edit-load-tid').val(tid);
|
||||
if (refreshTree) {
|
||||
$('#edit-load-tid-refresh-tree').attr("checked", "checked");
|
||||
}
|
||||
else {
|
||||
$('#edit-load-tid-refresh-tree').attr("checked", "");
|
||||
}
|
||||
$('#edit-load-tid-submit').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* TermData Object
|
||||
*/
|
||||
Drupal.TermData = function(tid) {
|
||||
this.tid = tid;
|
||||
this.div = $('#taxonomy-term-data');
|
||||
}
|
||||
|
||||
/**
|
||||
* adds events to possible operations
|
||||
*/
|
||||
Drupal.TermData.prototype.form = function() {
|
||||
var termdata = this;
|
||||
|
||||
$(this.div).find('#term-data-close span').click(function() {
|
||||
termdata.div.children().hide();
|
||||
});
|
||||
|
||||
$(this.div).find('a.taxonomy-term-data-name-link').click(function() {
|
||||
var tid = this.href.split("/").pop();
|
||||
Drupal.loadTermDataForm(tid, true);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(this.div).find("legend").each(function() {
|
||||
var staticOffsetX, staticOffsetY = null;
|
||||
var left, top = 0;
|
||||
var div = termdata.div;
|
||||
var pos = $(div).position();
|
||||
$(this).mousedown(startDrag);
|
||||
|
||||
function startDrag(e) {
|
||||
if (staticOffsetX == null && staticOffsetY == null) {
|
||||
staticOffsetX = e.pageX;
|
||||
staticOffsetY = e.pageY;
|
||||
}
|
||||
$(document).mousemove(performDrag).mouseup(endDrag);
|
||||
return false;
|
||||
}
|
||||
|
||||
function performDrag(e) {
|
||||
left = e.pageX - staticOffsetX;
|
||||
top = e.pageY - staticOffsetY;
|
||||
$(div).css({position: "absolute", "left": pos.left + left +"px", "top": pos.top + top +"px"});
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* hightlights current term
|
||||
*/
|
||||
Drupal.activeTermSwapHighlight = function(link) {
|
||||
try {
|
||||
$(active_term).parents('div.term-line').removeClass('highlightActiveTerm');
|
||||
} catch(e) {}
|
||||
active_term = link;
|
||||
$(active_term).parents('div.term-line:first').addClass('highlightActiveTerm');
|
||||
}
|
||||
|
||||
})(jQuery);
|
477
sites/all/modules/contrib/taxonomy/taxonomy_manager/js/tree.js
Normal file
@@ -0,0 +1,477 @@
|
||||
|
||||
/**
|
||||
* @files js for collapsible tree view with some helper functions for updating tree structure
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.TaxonomyManagerTree = {
|
||||
attach: function(context, settings) {
|
||||
var treeSettings = settings.taxonomytree || [];
|
||||
if (treeSettings instanceof Array) {
|
||||
for (var i=0; i<treeSettings.length; i++) {
|
||||
if (!$('#'+ treeSettings[i].id +'.tm-processed').length) {
|
||||
new Drupal.TaxonomyManagerTree(treeSettings[i].id, treeSettings[i].vid, treeSettings[i].parents);
|
||||
}
|
||||
}
|
||||
}
|
||||
//only add throbber for TM sites
|
||||
var throbberSettings = settings.TMAjaxThrobber || [];
|
||||
if (throbberSettings['add']) {
|
||||
if (!$('#taxonomy-manager-toolbar-throbber.tm-processed').length) {
|
||||
$('#taxonomy-manager-toolbar-throbber').addClass('tm-processed');
|
||||
Drupal.attachThrobber();
|
||||
Drupal.attachResizeableTreeDiv();
|
||||
Drupal.attachGlobalSelectAll();
|
||||
}
|
||||
}
|
||||
Drupal.attachMsgCloseLink(context);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Drupal.TaxonomyManagerTree = function(id, vid, parents) {
|
||||
this.div = $("#"+ id);
|
||||
this.ul = $(this.div).children();
|
||||
|
||||
this.form = $(this.div).parents('form');
|
||||
this.form_build_id = $(this.form).children().children(':input[name="form_build_id"]').val();
|
||||
this.form_id = $(this.form).children().children(' :input[name="form_id"]').val();
|
||||
this.form_token = $(this.form).children().children(' :input[name="form_token"]').val();
|
||||
this.language = this.getLanguage();
|
||||
this.treeId = id;
|
||||
this.vocId = vid;
|
||||
this.formParents = parents;
|
||||
this.childFormUrl = Drupal.settings.childForm['url'];
|
||||
this.siblingsFormUrl = Drupal.settings.siblingsForm['url'];
|
||||
|
||||
this.attachTreeview(this.ul);
|
||||
this.attachSiblingsForm(this.ul);
|
||||
this.attachSelectAllChildren(this.ul);
|
||||
this.attachLanguageSelector();
|
||||
|
||||
//attach term data js, if enabled
|
||||
var term_data_settings = Drupal.settings.termData || [];
|
||||
if (term_data_settings['url']) {
|
||||
Drupal.attachTermData(this.ul);
|
||||
}
|
||||
$(this.div).addClass("tm-processed");
|
||||
}
|
||||
|
||||
/**
|
||||
* adds collapsible treeview to a given list
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.attachTreeview = function(ul, currentIndex) {
|
||||
var tree = this;
|
||||
if (currentIndex) {
|
||||
ul = $(ul).slice(currentIndex);
|
||||
}
|
||||
var expandableParent = $(ul).find("div.hitArea");
|
||||
$(expandableParent).click(function() {
|
||||
var li = $(this).parent();
|
||||
tree.loadChildForm(li);
|
||||
tree.toggleTree(li);
|
||||
});
|
||||
$(expandableParent).parent("li.expandable, li.lastExpandable").children("ul").hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* toggles a collapsible/expandable tree element by swaping classes
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.toggleTree = function(node) {
|
||||
$(node).children("ul").toggle();
|
||||
this.swapClasses(node, "expandable", "collapsable");
|
||||
this.swapClasses(node, "lastExpandable", "lastCollapsable");
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function for swapping two classes
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.swapClasses = function(node, c1, c2) {
|
||||
if ($(node).hasClass(c1)) {
|
||||
$(node).removeClass(c1).addClass(c2);
|
||||
}
|
||||
else if ($(node).hasClass(c2)) {
|
||||
$(node).removeClass(c2).addClass(c1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* loads child terms and appends html to list
|
||||
* adds treeview, weighting etc. js to inserted child list
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.loadChildForm = function(li, update, callback) {
|
||||
var tree = this;
|
||||
if ($(li).is(".has-children") || update == true) {
|
||||
$(li).removeClass("has-children");
|
||||
if (update) {
|
||||
$(li).children("ul").remove();
|
||||
}
|
||||
var parentId = Drupal.getTermId(li);
|
||||
var url = tree.childFormUrl +'/'+ this.treeId +'/'+ this.vocId +'/'+ parentId;
|
||||
var param = new Object();
|
||||
param['form_build_id'] = this.form_build_id;
|
||||
param['form_id'] = this.form_id;
|
||||
param['tree_id'] = this.treeId;
|
||||
param['form_parents'] = this.formParents;
|
||||
param['language'] = this.language;
|
||||
|
||||
$.ajax({
|
||||
data: param,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
success: function(response, status) {
|
||||
$(li).append(response.data);
|
||||
var ul = $(li).children("ul");
|
||||
tree.attachTreeview(ul);
|
||||
tree.attachSiblingsForm(ul);
|
||||
tree.attachSelectAllChildren(ul);
|
||||
|
||||
//only attach other features if enabled!
|
||||
var weight_settings = Drupal.settings.updateWeight || [];
|
||||
if (weight_settings['up']) {
|
||||
Drupal.attachUpdateWeightTerms(li);
|
||||
}
|
||||
var term_data_settings = Drupal.settings.termData || [];
|
||||
if (term_data_settings['url']) {
|
||||
Drupal.attachTermDataLinks(ul);
|
||||
}
|
||||
if (typeof(callback) == "function") {
|
||||
callback(li, tree);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function for reloading root tree elements
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.loadRootForm = function(tids) {
|
||||
var tree = this;
|
||||
var url = this.childFormUrl +'/'+ this.treeId +'/'+ this.vocId +'/0/';
|
||||
|
||||
var param = new Object();
|
||||
param['form_build_id'] = this.form_build_id;
|
||||
param['form_id'] = this.form_id;
|
||||
param['tree_id'] = this.treeId;
|
||||
param['form_parents'] = this.formParents;
|
||||
param['language'] = this.language;
|
||||
param['terms_to_expand'] = tids; // can either be a single term id or concatinated ids
|
||||
|
||||
$.ajax({
|
||||
data: param,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
success: function(response, status) {
|
||||
$('#'+ tree.treeId).html(response.data);
|
||||
var ul = $('#'+ tree.treeId).children("ul");
|
||||
tree.attachTreeview(ul);
|
||||
tree.attachSiblingsForm(ul);
|
||||
tree.attachSelectAllChildren(ul);
|
||||
Drupal.attachUpdateWeightTerms(ul);
|
||||
Drupal.attachTermDataLinks(ul);
|
||||
|
||||
var lang = $('#edit-'+ tree.treeId +'-language').val();
|
||||
if (lang != "" && lang != tree.langauge) {
|
||||
$(tree.div).parent().siblings("div.taxonomy-manager-tree-top").find("select.language-selector option[value="+ lang +"]").attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* adds link for loading next siblings terms, when click terms get loaded through ahah
|
||||
* adds all needed js like treeview, weightning, etc.. to new added terms
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.attachSiblingsForm = function(ul) {
|
||||
var tree = this;
|
||||
var url = this.siblingsFormUrl;
|
||||
|
||||
var list = "li.has-more-siblings div.term-has-more-siblings";
|
||||
if (ul) {
|
||||
list = $(ul).find(list);
|
||||
}
|
||||
|
||||
$(list).bind('click', function() {
|
||||
$(this).unbind("click");
|
||||
var li = this.parentNode;
|
||||
var all = $('li', li.parentNode);
|
||||
var currentIndex = all.index(li);
|
||||
|
||||
var page = Drupal.getPage(li);
|
||||
var prev_id = Drupal.getTermId(li);
|
||||
var parentId = Drupal.getParentId(li);
|
||||
|
||||
url += '/'+ tree.treeId +'/'+ page +'/'+ prev_id +'/'+ parentId;
|
||||
|
||||
var param = new Object();
|
||||
param['form_build_id'] = tree.form_build_id;
|
||||
param['form_id'] = tree.form_id;
|
||||
param['tree_id'] = tree.treeId;
|
||||
param['form_parents'] = tree.formParents;
|
||||
param['language'] = tree.language;
|
||||
|
||||
$.ajax({
|
||||
data: param,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
success: function(response, status) {
|
||||
$(list).remove();
|
||||
$(li).after(response.data);
|
||||
tree.attachTreeview($('li', li.parentNode), currentIndex);
|
||||
tree.attachSelectAllChildren($('li', li.parentNode), currentIndex);
|
||||
|
||||
//only attach other features if enabled!
|
||||
var weight_settings = Drupal.settings.updateWeight || [];
|
||||
if (weight_settings['up']) {
|
||||
Drupal.attachUpdateWeightTerms($('li', li.parentNode), currentIndex);
|
||||
}
|
||||
var term_data_settings = Drupal.settings.termData || [];
|
||||
if (term_data_settings['url']) {
|
||||
Drupal.attachTermDataToSiblings($('li', li.parentNode), currentIndex);
|
||||
}
|
||||
|
||||
$(li).removeClass("last").removeClass("has-more-siblings");
|
||||
$(li).children().children('.term-operations').hide();
|
||||
tree.swapClasses(li, "lastExpandable", "expandable");
|
||||
tree.attachSiblingsForm($(li).parent());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* helper function for getting out the current page
|
||||
*/
|
||||
Drupal.getPage = function(li) {
|
||||
return $(li).find("input:hidden[class=page]").attr("value");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns terms id of a given list element
|
||||
*/
|
||||
Drupal.getTermId = function(li) {
|
||||
return $(li).children().children("input:hidden[class=term-id]").attr("value");
|
||||
}
|
||||
|
||||
/**
|
||||
* return term id of a prent of a given list element
|
||||
* if no parent exists (root level), returns 0
|
||||
*/
|
||||
Drupal.getParentId = function(li) {
|
||||
var parentId;
|
||||
try {
|
||||
var parentLi = $(li).parent("ul").parent("li");
|
||||
parentId = Drupal.getTermId(parentLi);
|
||||
} catch(e) {
|
||||
return 0;
|
||||
}
|
||||
return parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* update classes for tree view, if list elements get swaped
|
||||
*/
|
||||
Drupal.updateTree = function(upTerm, downTerm) {
|
||||
if ($(upTerm).is(".last")) {
|
||||
$(upTerm).removeClass("last");
|
||||
Drupal.updateTreeDownTerm(downTerm);
|
||||
}
|
||||
else if ($(upTerm).is(".lastExpandable")) {
|
||||
$(upTerm).removeClass("lastExpandable").addClass("expandable");
|
||||
Drupal.updateTreeDownTerm(downTerm);
|
||||
}
|
||||
else if ($(upTerm).is(".lastCollapsable")) {
|
||||
$(upTerm).removeClass("lastCollapsable").addClass("collapsable");
|
||||
Drupal.updateTreeDownTerm(downTerm);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update classes for tree view for a list element moved downwards
|
||||
*/
|
||||
Drupal.updateTreeDownTerm = function(downTerm) {
|
||||
if ($(downTerm).is(".expandable")) {
|
||||
$(downTerm).removeClass("expandable").addClass("lastExpandable");
|
||||
}
|
||||
else if ($(downTerm).is(".collapsable")) {
|
||||
$(downTerm).removeClass("collapsable").addClass("lastCollapsable");
|
||||
}
|
||||
else {
|
||||
$(downTerm).addClass("last");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds button next to parent term to select all available child checkboxes
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.attachSelectAllChildren = function(parent, currentIndex) {
|
||||
var tree = this;
|
||||
if (currentIndex) {
|
||||
parent = $(parent).slice(currentIndex);
|
||||
}
|
||||
$(parent).find('span.select-all-children').click(function() {
|
||||
tree.SelectAllChildrenToggle(this);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (un-)selects nested checkboxes
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.SelectAllChildrenToggle = function(span) {
|
||||
var tree = this;
|
||||
if ($(span).hasClass("select-all-children")) {
|
||||
var li = $(span).parents("li:first");
|
||||
if ($(li).hasClass("has-children")) {
|
||||
this.loadChildForm(li, true, function(li, tree) {
|
||||
tree.swapClasses(li, "expandable", "collapsable");
|
||||
tree.swapClasses(li, "lastExpandable", "lastCollapsable");
|
||||
var this_span = $(li).find('span.select-all-children:first');
|
||||
tree.SelectAllChildrenToggle(this_span);
|
||||
return;
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(span).removeClass("select-all-children").addClass("deselect-all-children");
|
||||
$(span).attr("title", Drupal.t("Deselect all children"));
|
||||
$(span).parents("li:first").find('ul:first').each(function() {
|
||||
var first_element = $(this).find('.term-line:first');
|
||||
$(first_element).parent().siblings("li").find('div.term-line:first :checkbox').attr('checked', true);
|
||||
$(first_element).find(' :checkbox').attr('checked', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(span).removeClass("deselect-all-children").addClass("select-all-children");
|
||||
$(span).parents(".term-line").siblings("ul").find(':checkbox').attr("checked", false);
|
||||
$(span).attr("title", Drupal.t("Select all children"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* language selector
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.attachLanguageSelector = function() {
|
||||
var tree = this;
|
||||
var selector = $(tree.div).parent().siblings("div.taxonomy-manager-tree-top").find("select.language-selector");
|
||||
$(selector).not(".selector-processed").change(function() {
|
||||
tree.language = $(this).val();
|
||||
tree.loadRootForm();
|
||||
});
|
||||
$(selector).addClass("selector-processed");
|
||||
|
||||
}
|
||||
Drupal.TaxonomyManagerTree.prototype.getLanguage = function() {
|
||||
var lang = $('#edit-taxonomy-manager-top-language').val();
|
||||
if (typeof(lang) == "undefined") {
|
||||
return "";
|
||||
}
|
||||
return lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* return array of selected terms
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.getSelectedTerms = function() {
|
||||
var terms = new Array();
|
||||
$(this.div).find("input[type=checkbox][checked]").each(function() {
|
||||
var term = $(this).parents("li").eq(0);
|
||||
terms.push(term);
|
||||
});
|
||||
return terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns li node for a given term id, if it exists in the tree
|
||||
*/
|
||||
Drupal.TaxonomyManagerTree.prototype.getLi = function(termId) {
|
||||
return $(this.div).find("input:hidden[class=term-id][value="+ termId +"]").parent().parent();
|
||||
}
|
||||
|
||||
Drupal.attachMsgCloseLink = function(context) {
|
||||
$(context).find('div.messages').once(function() {
|
||||
$('<span class="taxonomy-manager-message-close"><a href="" title="'+ Drupal.t('Close') +'">x</a></span>').appendTo(this).click(function() {
|
||||
$(this).parent().fadeOut('fast', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* attaches a throbber element to the taxonomy manager
|
||||
*/
|
||||
Drupal.attachThrobber = function() {
|
||||
var div = $('#taxonomy-manager');
|
||||
var throbber = $('<img src="'+ Drupal.settings.taxonomy_manager['modulePath'] +'images/ajax-loader.gif" alt="" height="25">');
|
||||
throbber.appendTo("#taxonomy-manager-toolbar-throbber").hide();
|
||||
|
||||
throbber.ajaxStart(function() {
|
||||
$(this).show();
|
||||
});
|
||||
throbber.ajaxStop(function() {
|
||||
$(this).hide();
|
||||
});
|
||||
throbber.ajaxError(function() {
|
||||
alert("An AJAX error occurred. Reload the page and check your logs.");
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* makes the div resizeable
|
||||
*/
|
||||
Drupal.attachResizeableTreeDiv = function() {
|
||||
$('img.div-grippie').each(function() {
|
||||
var staticOffset = null;
|
||||
var div = $(this).parents("fieldset").parent();
|
||||
$(this).mousedown(startDrag);
|
||||
|
||||
function startDrag(e) {
|
||||
staticOffset = div.width() - e.pageX;
|
||||
div.css('opacity', 0.5);
|
||||
$(document).mousemove(performDrag).mouseup(endDrag);
|
||||
return false;
|
||||
}
|
||||
|
||||
function performDrag(e) {
|
||||
div.width(Math.max(200, staticOffset + e.pageX) + 'px');
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
|
||||
div.css('opacity', 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds select all / remove selection functionality.
|
||||
*/
|
||||
Drupal.attachGlobalSelectAll = function() {
|
||||
$('span.taxonomy-manager-select-helpers').once(function() {
|
||||
var form = $(this).parents('.form-wrapper:first');
|
||||
$(this).find('span.select-all-children').click(function() {
|
||||
// Only select those that are visible to the end user.
|
||||
$(form).parent().find(' :checkbox:visible').attr('checked', true);
|
||||
});
|
||||
$(this).find('span.deselect-all-children').click(function() {
|
||||
$(form).parent().find(':checkbox').attr("checked", false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
@@ -0,0 +1,239 @@
|
||||
|
||||
/**
|
||||
* @file js for changing weights of terms with Up and Down arrows
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
//object to store weights (tid => weight)
|
||||
var termWeightsData = new Object();
|
||||
|
||||
Drupal.behaviors.TaxonomyManagerWeights = {
|
||||
attach: function(context, settings) {
|
||||
var weightSettings = settings.updateWeight || [];
|
||||
if (!$('#edit-toolbar.tm-weights-processed').length) {
|
||||
$('#edit-toolbar').addClass('tm-weights-processed');
|
||||
termWeightsData['form_token'] = $('input[name=form_token]').val();
|
||||
termWeightsData['form_id'] = $('input[name=form_id]').val();
|
||||
termWeightsData['weights'] = new Object();
|
||||
Drupal.attachUpdateWeightToolbar(weightSettings['up'], weightSettings['down']);
|
||||
Drupal.attachUpdateWeightTerms();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds click events for Up and Down buttons in the toolbar, which
|
||||
* allow the moving of selected (can be more) terms
|
||||
*/
|
||||
Drupal.attachUpdateWeightToolbar = function(upButton, downButton) {
|
||||
var selected;
|
||||
var url = Drupal.settings.updateWeight['url'];
|
||||
|
||||
$('#'+ upButton).click(function() {
|
||||
selected = Drupal.getSelectedTerms();
|
||||
for (var i=0; i < selected.length; i++) {
|
||||
var upTerm = selected[i];
|
||||
var downTerm = $(upTerm).prev();
|
||||
|
||||
Drupal.orderTerms(upTerm, downTerm);
|
||||
}
|
||||
if (selected.length > 0) {
|
||||
$.post(url, termWeightsData);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#'+ downButton).click(function() {
|
||||
selected = Drupal.getSelectedTerms();
|
||||
for (var i=selected.length-1; i >= 0; i--) {
|
||||
var downTerm = selected[i];
|
||||
var upTerm = $(downTerm).next();
|
||||
|
||||
Drupal.orderTerms(upTerm, downTerm);
|
||||
}
|
||||
if (selected.length > 0) {
|
||||
$.post(url, termWeightsData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* adds small up and down arrows to each term
|
||||
* arrows get displayed on mouseover
|
||||
*/
|
||||
Drupal.attachUpdateWeightTerms = function(parent, currentIndex) {
|
||||
var settings = Drupal.settings.updateWeight || [];
|
||||
var disable = settings['disable_mouseover'];
|
||||
|
||||
if (!disable) {
|
||||
var url = Drupal.settings.updateWeight['url'];
|
||||
|
||||
var termLineClass = 'div.term-line';
|
||||
var termUpClass = 'img.term-up';
|
||||
var termDownClass = 'img.term-down';
|
||||
|
||||
if (parent && currentIndex) {
|
||||
parent = $(parent).slice(currentIndex);
|
||||
}
|
||||
if (parent) {
|
||||
termLineClass = $(parent).find(termLineClass);
|
||||
termUpClass = $(parent).find(termUpClass);
|
||||
termDownClass = $(parent).find(termDownClass);
|
||||
}
|
||||
|
||||
$(termLineClass).mouseover(function() {
|
||||
$(this).find('div.term-operations').show();
|
||||
});
|
||||
|
||||
$(termLineClass).mouseout(function() {
|
||||
$(this).find('div.term-operations').hide();
|
||||
});
|
||||
|
||||
$(termUpClass).click(function() {
|
||||
var upTerm = $(this).parents("li").eq(0);
|
||||
var downTerm = $(upTerm).prev();
|
||||
|
||||
Drupal.orderTerms(upTerm, downTerm);
|
||||
$.post(url, termWeightsData);
|
||||
|
||||
$(downTerm).find(termLineClass).unbind('mouseover');
|
||||
setTimeout(function() {
|
||||
$(upTerm).find('div.term-operations').hide();
|
||||
$(downTerm).find(termLineClass).mouseover(function() {
|
||||
$(this).find('div.term-operations').show();
|
||||
});
|
||||
}, 1500);
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(termDownClass).click(function() {
|
||||
var downTerm = $(this).parents("li").eq(0);
|
||||
var upTerm = $(downTerm).next();
|
||||
|
||||
Drupal.orderTerms(upTerm, downTerm);
|
||||
$.post(url, termWeightsData);
|
||||
|
||||
$(upTerm).find(termLineClass).unbind('mouseover');
|
||||
setTimeout(function() {
|
||||
$(downTerm).find('div.term-operations').hide();
|
||||
$(upTerm).find(termLineClass).mouseover(function() {
|
||||
$(this).find('div.term-operations').show();
|
||||
});
|
||||
}, 1500);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* return array of selected terms
|
||||
*/
|
||||
Drupal.getSelectedTerms = function() {
|
||||
var terms = new Array();
|
||||
$('.treeview').find("input:checked").each(function() {
|
||||
var term = $(this).parents("li").eq(0);
|
||||
terms.push(term);
|
||||
});
|
||||
|
||||
return terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* reorders terms
|
||||
* - swap list elements in DOM
|
||||
* - post updated weights to callback in php
|
||||
* - update classes of tree view
|
||||
*/
|
||||
Drupal.orderTerms = function(upTerm, downTerm) {
|
||||
try {
|
||||
Drupal.getTermId(upTerm);
|
||||
Drupal.swapTerms(upTerm, downTerm);
|
||||
Drupal.swapWeights(upTerm, downTerm);
|
||||
Drupal.updateTree(upTerm, downTerm);
|
||||
} catch(e) {
|
||||
//no next item, because term to update is last child, continue
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* simple swap of two elements
|
||||
*/
|
||||
Drupal.swapTerms = function(upTerm, downTerm) {
|
||||
$(upTerm).after(downTerm);
|
||||
$(downTerm).before(upTerm);
|
||||
}
|
||||
|
||||
/**
|
||||
* updating weights of swaped terms
|
||||
* if two terms have different weights, then weights are being swapped
|
||||
* else, if both have same weights, upTerm gets decreased
|
||||
*
|
||||
* if prev/next siblings of up/down terms have same weights as current
|
||||
* swapped, they have to be updated by de/increasing weight (by 1) to ensure
|
||||
* unique position of swapped terms
|
||||
*/
|
||||
Drupal.swapWeights = function(upTerm, downTerm) {
|
||||
var upWeight = Drupal.getWeight(upTerm);
|
||||
var downWeight = Drupal.getWeight(downTerm);
|
||||
var downTid = Drupal.getTermId(downTerm);
|
||||
var upTid = Drupal.getTermId(upTerm);
|
||||
|
||||
//same weight, decrease upTerm
|
||||
if (upWeight == downWeight) {
|
||||
termWeightsData['weights'][upTid] = --upWeight;
|
||||
}
|
||||
//different weights, swap
|
||||
else {
|
||||
termWeightsData['weights'][upTid] = downWeight;
|
||||
termWeightsData['weights'][downTid] = upWeight;
|
||||
}
|
||||
|
||||
//update prev siblings if necessary
|
||||
try {
|
||||
if (Drupal.getWeight($(upTerm).prev()) >= upWeight) {
|
||||
$(upTerm).prevAll().each(function() {
|
||||
var id = Drupal.getTermId(this);
|
||||
var weight = Drupal.getWeight(this);
|
||||
termWeightsData['weights'][id] = --weight;
|
||||
});
|
||||
}
|
||||
} catch(e) {
|
||||
//no prev
|
||||
}
|
||||
|
||||
//update next siblings if necessary
|
||||
try {
|
||||
if (Drupal.getWeight($(downTerm).next()) <= downWeight) {
|
||||
$(downTerm).nextAll().each(function() {
|
||||
var id = Drupal.getTermId(this);
|
||||
var weight = Drupal.getWeight(this);
|
||||
termWeightsData['weights'][id] = ++weight;
|
||||
});
|
||||
}
|
||||
} catch(e) {
|
||||
//no next
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* helper to return weight of a term
|
||||
*/
|
||||
Drupal.getWeight = function(li) {
|
||||
var id = Drupal.getTermId(li);
|
||||
var weight;
|
||||
|
||||
if (termWeightsData['weights'][id] != null) {
|
||||
weight = termWeightsData['weights'][id];
|
||||
}
|
||||
else {
|
||||
weight = $(li).find("input:hidden[class=weight-form]").attr("value");
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
})(jQuery);
|
@@ -0,0 +1,14 @@
|
||||
name = Taxonomy Manager
|
||||
description = Tool for administrating taxonomy terms.
|
||||
core = "7.x"
|
||||
dependencies[] = taxonomy
|
||||
files[] = taxonomy_manager.admin.inc
|
||||
configure = admin/config/user-interface/taxonomy-manager-settings
|
||||
package = Taxonomy
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-05-20
|
||||
version = "7.x-1.0"
|
||||
core = "7.x"
|
||||
project = "taxonomy_manager"
|
||||
datestamp = "1369041918"
|
||||
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the Taxonomy Manager
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function taxonomy_manager_uninstall() {
|
||||
variable_del('taxonomy_manager_pager_tree_page_size');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_update_N().
|
||||
* Resets 'taxonomy_override_selector' variable.
|
||||
*/
|
||||
function taxonomy_manager_update_7001() {
|
||||
// remove parent selector in core taxonomy term edit pages
|
||||
variable_set('taxonomy_override_selector', FALSE);
|
||||
return t('Successfully updated Taxonomy Manager settings.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove merge_redirect variable.
|
||||
*/
|
||||
function taxonomy_manager_update_7002() {
|
||||
variable_del('taxonomy_manager_disable_merge_redirect');
|
||||
}
|