New module 'Lexicon'

This commit is contained in:
Manuel Cillero 2017-07-26 19:25:35 +02:00
parent 9b6128243b
commit 72fc44b96c
12 changed files with 2605 additions and 0 deletions

View file

@ -0,0 +1,274 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public License is
intended to guarantee your freedom to share and change free software--to
make sure the software is free for all its users. This General Public License
applies to most of the Free Software Foundation's software and to any other
program whose authors commit to using it. (Some other Free Software
Foundation software is covered by the GNU Library General Public License
instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the
freedom to distribute copies of free software (and charge for this service if
you wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must make
sure that they, too, receive or can get the source code. And you must show
them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, so that any problems
introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such
program or work, and a "work based on the Program" means either the
Program or any derivative work under copyright law: that is to say, a work
containing the Program or a portion of it, either verbatim or with
modifications and/or translated into another language. (Hereinafter, translation
is included without limitation in the term "modification".) Each licensee is
addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made
by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it,
thus forming a work based on the Program, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that you
also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in
part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print such
an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be
reasonably considered independent and separate works in themselves, then
this License, and its terms, do not apply to those sections when you distribute
them as separate works. But when you distribute the same sections as part
of a whole which is a work based on the Program, the distribution of the
whole must be on the terms of this License, whose permissions for other
licensees extend to the entire whole, and thus to each and every part
regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to
work written entirely by you; rather, the intent is to exercise the right to
control the distribution of derivative or collective works based on the
Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of a
storage or distribution medium does not bring the other work under the scope
of this License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1
and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for
noncommercial distribution and only if you received the program in object
code or executable form with such an offer, in accord with Subsection b
above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source code
means all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation and
installation of the executable. However, as a special exception, the source
code distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
If distribution of executable or object code is made by offering access to
copy from a designated place, then offering equivalent access to copy the
source code from the same place counts as distribution of the source code,
even though third parties are not compelled to copy the source along with the
object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy,
modify, sublicense or distribute the Program is void, and will automatically
terminate your rights under this License. However, parties who have received
copies, or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the
Program (or any work based on the Program), you indicate your acceptance
of this License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these terms and
conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In such
case, this License incorporates the limitation as if written in the body of this
License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that
version or of any later version published by the Free Software Foundation. If
the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make
exceptions for this. Our decision will be guided by the two goals of
preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,53 @@
Lexicon
http://www.drupal.org/project/lexicon
=====================================
DESCRIPTION
-----------
A lexicon is a stock of terms used in a particular profession, subject or style; a vocabulary.
The Lexicon module generates one or more Lexicon pages based on terms in taxonomies and optionally
marks and links them in the content.
The Lexicon module is a branch of the Glossary module (http://www.drupal.org/project/glossary) that
was changed to suit the needs of a project for the Dutch government. The main reason for the changes
is compliancy with the web guidelines of the Dutch government (http://www.webguidelines.nl).
The main differences with the Glossary module are that the Lexicon module:
* Produces output that is valid W3C XHTML 1.0 Strict.
* Enables showing lists of terms without marking the terms in content (this is still an option).
You can choose which vocabularies act as Lexicons and you don't bind them to input filters.
* Has configurable paths and titles for each Lexicon.
* Optionally inserts a "go to top" link for each section on the Lexicon page.
* Optionally "scroll to" internal links on the Lexicon page.
Development of this module is sponsored by Sogeti Netherlands (http://sogeti.doethetmetdrupal.nl).
REQUIREMENTS
------------
Drupal 6.x
Taxonomy
INSTALLING
----------
1. To install the module copy the 'lexicon' folder to your sites/all/modules directory.
2. Go to admin/build/modules. Enable the Lexicon module.
Read more about installing modules at http://drupal.org/node/70151
CONFIGURING AND USING
---------------------
1. Create a taxonomy vocabulary for each Lexicon.
2. Go to admin/settings/lexicon.
3. Select the created taxonomy vocabularies you want to use as Lexicons.
4. Set the desired behavior of the Lexicon module and save the configuration.
5. Configure the alphabar and save the configuration.
6. Optionally set the paths and titles of the Lexicons and save the configuration.
7. Optionally put the suggested menu-items in the right menu and activate them.
Have fun!

View file

@ -0,0 +1,240 @@
abbr.lexicon-indicator,
acronym.lexicon-indicator,
sup.lexicon-indicator,
span.lexicon-indicator,
a.lexicon-indicator,
a.lexicon-icon,
dfn.lexicon-indicator,
img.lexicon-indicator {
cursor: help;
}
span.lexicon-term {
text-decoration: none;
border-bottom: 1px dotted;
cursor: help;
}
a.lexicon-term {
text-decoration: none;
border-bottom: 1px dotted #080;
color: #080;
cursor: help;
}
dl.lexicon-list > dt {
font-weight: bold;
}
dl.lexicon-list > dd {
font-weight: normal;
font-size: 75%;
margin-left: 15px;
}
dl.lexicon-list dt.depth1 {
padding-left: 10px;
}
dl.lexicon-list dt.depth2 {
padding-left: 20px;
}
dl.lexicon-list dt.depth3 {
padding-left: 30px;
}
.lexicon-list dt {
padding-top: 7px;
clear: both;
}
td.lexicon-list-description {
padding-left: 1em !important;
font-style: italic;
font-size: 90%;
}
a.lexicon-edit-term {
font-size: 75%;
font-weight: normal;
margin-left: 2.0em;
}
a.lexicon-search-term {
font-size: 75%;
font-weight: normal;
margin-left: 2.0em;
}
p.lexicon-description {
margin: 0px 2.0em 0.5em 2.0em;
text-indent: 0;
}
div.lexicon-letter {
clear: both;
text-align: center;
font-size: 150%;
font-weight: bold;
text-transform: uppercase;
}
.lexicon-synonyms {
font-style: italic;
color: #888888;
}
.lexicon-related {
font-style: italic;
color: #888888;
}
.lexicon-related a {
text-decoration: underline;
}
.lexicon-related a:visited {
text-decoration: underline;
}
.lexicon-related a:link {
text-decoration: underline;
}
.lexicon-links {
text-align: center;
background-color: #eeeeff;
color: #888888;
}
.lexicon-links a {
font-size: 140%;
text-transform: uppercase;
}
.lexicon-alphabar-instructions {
font-size: 89%;
font-style: italic;
}
.lexicon-admin-links {
clear: both;
margin: 0.5em 0 0 3.0em;
}
.lexicon-admin-links li a {
padding: 5px;
}
.lexicon-list dt img {
float: left;
}
.lexicon-list .taxonomy_image_wrapper {
width: 70px;
float: left;
}
a.clicktip_target {
font-style:normal;
}
span.clicktip_target {
font-style:normal;
}
html > body .hovertip_wrap3 {
background-color: #ffdab9;
border: 3px outset #d2691e;
}
.hovertip h2 {
margin: 0;
padding: 0;
background-color: #D2691E;
color: #ffffff;
}
a.hovertip_target {
font-style:normal;
border-bottom: 3px double #992222;
}
span.hovertip_target {
font-style:normal;
border-bottom: 3px double #992222;
}
.lexicon_radios .form-radios {
margin-top: 0;
}
.lexicon_radios .form-item {
margin-top: 0;
margin-bottom: 0;
}
.lexicon_checkboxes .form-checkboxes {
margin-top: 0;
}
.lexicon_checkboxes .form-item {
margin-top: 0;
margin-bottom: 0;
}
.lexicon_radios label.option {
margin-right: 1em;
float: left;
border: 1px dotted #666666;
padding: 0 4px 1px 0;
}
.lexicon_radios .form-item .description {
clear: both;
}
.lexicon_checkboxes label.option {
margin-right: 1em;
float: left;
padding: 0 4px 1px 0;
}
.lexicon_checkboxes .form-item .description {
clear: both;
}
.lexicon-detailed {
}
.lexicon-detailed h2 {
margin-left: 10px;
}
.lexicon-detailed legend {
text-indent: 0;
}
.lexicon-detailed-link {
font-size: 89%;
text-indent: 2em;
}
.lexicon-interval .description {
display: block;
}
.block-lexicon {
font-size: 89%;
}
.lexicon-block-term-name {
font-weight: bold;
}
span.hovertip img {
text-align: left;
margin-right: 5px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

View file

@ -0,0 +1,9 @@
/**
* jQuery.LocalScroll - Animated scrolling navigation, using anchors.
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 6/3/2008
* @author Ariel Flesler
* @version 1.2.6
**/
;(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);

View file

@ -0,0 +1,11 @@
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 2/19/2008
* @author Ariel Flesler
* @version 1.3.3
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

View file

@ -0,0 +1,8 @@
// Run the javascript on page load.
if (Drupal.jsEnabled) {
$(document).ready(function () {
$.localScroll();
});
}

View file

@ -0,0 +1,42 @@
function lexicon_replace_handler(event) {
// Disable superscript field if not selected.
if ($("input[@name=lexicon_replace]:checked").val() == 'superscript') {
$("input[@name=lexicon_superscript]").parents("div.lexicon_superscript").show();
}
else {
$("input[@name=lexicon_superscript]").parents("div.lexicon_superscript").hide();
}
// Disable icon URL field if not selected.
var selected = $("input[@name=lexicon_replace]:checked").val();
if (selected == 'icon' || selected == 'iconterm') {
$("input[@name=lexicon_icon]").parents("div.lexicon_icon").show();
}
else {
$("input[@name=lexicon_icon]").parents("div.lexicon_icon").hide();;
}
}
function lexicon_link_related_handler(event) {
// Disable one-way field if not selected.
if ($("input[@name=lexicon_link_related]:checked").val() == 1) {
$("input[@name=lexicon_link_related_how]").parents("div.lexicon_link_related_how").show();
}
else {
$("input[@name=lexicon_link_related_how]").val(0);
$("input[@name=lexicon_link_related_how]").parents("div.lexicon_link_related_how").hide();
}
}
// Run the javascript on page load.
if (Drupal.jsEnabled) {
$(document).ready(function () {
// On page load, determine the current settings.
lexicon_replace_handler();
lexicon_link_related_handler();
// Bind the functions to click events.
$("input[@name=lexicon_replace]").bind("click", lexicon_replace_handler);
$("input[@name=lexicon_link_related]").bind("click", lexicon_link_related_handler);
});
}

View file

@ -0,0 +1,538 @@
<?php
/**
* @file
* Lexicon administration functions and forms.
*/
/*
* This is the introductory stuff for the settings.
*/
function lexicon_settings_page() {
$mb_status = extension_loaded('mbstring') ? t('enabled') : t('disabled');
$overload = ini_get('mbstring.func_overload') ? t('enabled') : t('disabled');
$output = '<p>'. t('Multibyte string support is !status; multibyte function overload is !overload.', array('!status' => $mb_status, '!overload' => $overload)) .'</p>';
$output .= drupal_get_form('lexicon_general_settings_form');
drupal_add_js(drupal_get_path('module', 'lexicon') . '/js/lexicon_admin.js');
return $output;
}
function lexicon_general_settings_form() {
$form = array();
$form['general'] = array(
'#type' => 'fieldset',
'#title' => t('General settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$options = array();
$result = db_query('SELECT vid, name FROM {vocabulary} ORDER BY name');
while ($vocabulary = db_fetch_array($result)) {
$options[$vocabulary['vid']] = filter_xss_admin($vocabulary['name']);
}
if (!$options) {
drupal_set_message(t('No vocabularies were found. Until you set up, and select, at least one vocabulary to use as a Lexicon, no lexicon is displayed and no substitutions can be done.'));
}
$form['general']['lexicon_vids'] = array(
'#type' => 'checkboxes',
'#title' => t('Which vocabularies act as lexicons.'),
'#default_value' => variable_get('lexicon_vids', array()),
'#options' => $options,
'#description' => t('Select one or more vocabularies which hold terms for your lexicons.'),
'#multiple' => TRUE,
'#required' => TRUE,
'#prefix' => '<div class="lexicon_checkboxes">',
'#suffix' => '</div>',
);
$form['lexicon_page'] = array(
'#type' => 'fieldset',
'#title' => t('Lexicon Page'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['lexicon_page']['lexicon_page_per_letter'] = array(
'#type' => 'checkbox',
'#title' => t('Show lexicon across many smaller pages.'),
'#default_value' => variable_get('lexicon_page_per_letter', FALSE),
'#description' => t('Do you want to show all terms on one lexicon page or break up the lexicon into a page for each first letter (i.e. many pages).'),
);
$form['lexicon_page']['lexicon_separate_letters'] = array(
'#type' => 'checkbox',
'#title' => t('Separate letters.'),
'#default_value' => variable_get('lexicon_separate_letters', FALSE),
'#description' => t('Separate the terms by the first letters. This will create a large letter at the beginning of each section.'),
);
$form['lexicon_page']['lexicon_allow_no_description'] = array(
'#type' => 'checkbox',
'#title' => t('Show lexicon terms even if there is no description.'),
'#default_value' => variable_get('lexicon_allow_no_description', FALSE),
'#description' => t('By default, Lexicon omits terms from the list if there is no term description. This setting overrides that. This is useful on free-tagging vocabularies that rarely get descriptions.'),
);
$form['lexicon_page']['lexicon_show_description'] = array(
'#type' => 'checkbox',
'#title' => t('Show lexicon term descriptions on the Lexicon page.'),
'#default_value' => variable_get('lexicon_show_description', FALSE),
'#description' => t('Lexicon term descriptions may be large and/or include pictures, therefore the Lexicon page can take a long time to load if you include the full descriptions.'),
);
$form['lexicon_page']['lexicon_show_detailed'] = array(
'#type' => 'checkbox',
'#title' => t('Show detailed descriptions on the Lexicon page.'),
'#default_value' => variable_get('lexicon_show_detailed', FALSE),
'#description' => t('Lexicon terms may have nodes associated with them. This option allows you to include the teasers of those nodes under the term.'),
);
$form['lexicon_page']['lexicon_link_related'] = array(
'#type' => 'checkbox',
'#title' => t('Link related terms on the Lexicon page.'),
'#default_value' => variable_get('lexicon_link_related', TRUE),
'#description' => t('Do you want terms that are related to link to each other? The type of link is determined by "Clicking on a term link will" above.'),
);
$form['lexicon_page']['lexicon_link_related_how'] = array(
'#type' => 'checkbox',
'#title' => t('Related terms link one-way.'),
'#default_value' => variable_get('lexicon_link_related_how', FALSE),
'#description' => t('By default, links are two way, that is if "a" is related to "b" then "b" is also related to "a". This option changes that so that "b" points to "a" only if it is set explicitly for the term. Requires "Link related" above to be selected.'),
'#prefix' => '<div class="lexicon_link_related_how">',
'#suffix' => '</div>',
);
$form['lexicon_page']['lexicon_term_class'] = array(
'#type' => 'textfield',
'#title' => t('Term link class'),
'#default_value' => variable_get('lexicon_term_class', 'lexicon-term'),
'#description' => t('This is the style class that will be used for "acronym," "abbr," and "hovertip" links. It should only be used by those with specific site standards.'),
);
$form['lexicon_page']['lexicon_show_edit'] = array(
'#type' => 'checkbox',
'#title' => t('Show "edit" link.'),
'#default_value' => variable_get('lexicon_show_edit', TRUE),
'#description' => t('Determines whether or not to show an "edit term" link for each entry.'),
);
$form['lexicon_page']['lexicon_show_search'] = array(
'#type' => 'checkbox',
'#title' => t('Show "search" link.'),
'#default_value' => variable_get('lexicon_show_search', TRUE),
'#description' => t('Determines whether or not to show an "search for term" link for each entry.'),
);
$form['lexicon_page']['lexicon_go_to_top_link'] = array(
'#type' => 'checkbox',
'#title' => t('Show "go to top" link.'),
'#default_value' => variable_get('lexicon_go_to_top_link', FALSE),
'#description' => t('Determines whether or not to show a "go to top" link after each group of lexicon items per letter.'),
);
$form['lexicon_page']['lexicon_go_to_top_link_fragment'] = array(
'#type' => 'textfield',
'#title' => t('"Go to top" link anchor name.'),
'#default_value' => variable_get('lexicon_go_to_top_link_fragment', 'top'),
'#description' => t('Sets the "go to top" link anchor name to link to.'),
);
$form['lexicon_page']['lexicon_local_links_scroll'] = array(
'#type' => 'checkbox',
'#title' => t('Use scroll animation for local links.'),
'#default_value' => variable_get('lexicon_local_links_scroll', FALSE),
'#description' => t('Determines whether or not to animate scrolling to sections when following local links on the page.'),
);
$form['mark_terms'] = array(
'#type' => 'fieldset',
'#title' => t('Term marking settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['mark_terms']['lexicon_mark_terms'] = array(
'#type' => 'checkbox',
'#title' => t('Mark terms in content.'),
'#default_value' => variable_get('lexicon_mark_terms', TRUE),
'#description' => t('Determines whether or not to mark terms in the content.'),
);
$form['mark_terms']['match'] = array(
'#type' => 'fieldset',
'#title' => t('Term matching'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['mark_terms']['match']["lexicon_match"] = array(
'#type' => 'radios',
'#title' => t('Match type'),
'#default_value' => variable_get("lexicon_match", 'b'),
'#options' => array(
'b' => t('Word'),
'lr' => t('Right or left substring'),
'l' => t('Left substring'),
'r' => t('Right substring'),
's' => t('Any substring'),
),
'#description' => t('Choose the match type of lexicon links. "Word" means a word break must occur on both sides of the term. "Right or left" requires a word break on either side. "Left" requires a word break on the left side of the term. "Right" requires a word break on the right. "Any" means any substring will match.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['mark_terms']['match']["lexicon_case"] = array(
'#type' => 'radios',
'#title' => t('Case sensitivity'),
'#default_value' => variable_get("lexicon_case", '1'),
'#options' => array(
t('Case insensitive'),
t('Case sensitive')
),
'#description' => t('Match either case sensitive or not. Case sensitive matches are not very resource intensive.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['mark_terms']['match']["lexicon_replace_all"] = array(
'#type' => 'radios',
'#title' => t('Replace matches'),
'#default_value' => variable_get("lexicon_replace_all", 0),
'#options' => array(
t('Only the first match'),
t('All matches')
),
'#description' => t('Whether only the first match should be replaced or all matches.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['mark_terms']['match']["lexicon_blocking_tags"] = array(
'#type' => 'textarea',
'#title' => t('Blocked elements'),
'#default_value' => variable_get("lexicon_blocking_tags", 'abbr acronym'),
'#cols' => 60,
'#rows' => 1,
'#maxlength' => 512,
'#description' => t('Which HTML elements (tags) should not include Lexicon links;
that is, text within these elements will not be scanned for lexicon terms.
Enter the list separated by a space and do not include < and > characters (e.g. h1 h2).
To use a %span element to skip text, prefix the class name with a dot (e.g. ".skipping-this").
All "a," "code," and "pre" elements will be skipped by default.
', array('%span' => 'span')),
);
$form['mark_terms']['indicator'] = array(
'#type' => 'fieldset',
'#title' => t('Link style'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$click_options = array(
t('Show only the single term.'),
t('Advance the whole lexicon to the term.'),
);
$form['mark_terms']['indicator']['lexicon_click_option'] = array(
'#type' => 'radios',
'#title' => t('Clicking on a term link will'),
'#options' => $click_options,
'#default_value' => variable_get('lexicon_click_option', 0),
'#description' => t('Set the link to show only the single term or the whole lexicon.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['mark_terms']['indicator']["lexicon_link"] = array(
'#type' => 'radios',
'#options' => array(
'none' => t('none'),
'normal' => t('normal'),
'absolute' => t('absolute'),
),
'#title' => t('Link type'),
'#default_value' => variable_get("lexicon_link", 'normal'),
'#description' => t('You may choose no linking of terms ("none"), standard site linking ("normal"), or "absolute" links. RSS feeds need absolute links to ensure they point back to this site. If you are not providing RSS feeds, it is better to choose one of the other types.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$indicator_options = array(
'superscript' => t('Superscript'),
'icon' => t('Icon'),
'iconterm' => t('Icon + Term'),
'abbr' => t('Use !type element', array('!type' => l('abbr', 'http://www.w3.org/TR/html401/struct/text.html#edef-ABBR'))),
'acronym' => t('Use !type element', array('!type' => l('acronym', 'http://www.w3.org/TR/html401/struct/text.html#edef-ACRONYM'))),
'cite' => t('Use !type element', array('!type' => l('cite', 'http://www.w3.org/TR/html401/struct/text.html#edef-CITE'))),
'dfn' => t('Use !type element', array('!type' => l('dfn', 'http://www.w3.org/TR/html401/struct/text.html#edef-DFN'))),
);
if (module_exists('hovertip')) {
$indicator_options['hovertip'] = t('Hovertip');
$indicator_options['clicktip'] = t('Clicktip');
}
$form['mark_terms']['indicator']['lexicon_replace'] = array(
'#type' => 'radios',
'#title' => t('Term Indicator'),
'#default_value' => variable_get("lexicon_replace", 'superscript'),
'#options' => $indicator_options,
'#description' => t('This determines how the link to the lexicon term will be indicated. The "phrase" items are linked to the standards in case you want to study them.'),
'#validate' => array('lexicon_indicator_intercept' => array()),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['mark_terms']['indicator']["lexicon_superscript"] = array(
'#type' => 'textfield',
'#title' => t('Superscript'),
'#default_value' => variable_get("lexicon_superscript", 'i'),
'#size' => 15,
'#maxlength' => 255,
'#description' => t('If you chose "superscript" above, enter the superscript text.'),
'#validate' => array('lexicon_indicator_intercept' => array()),
'#prefix' => '<div class="lexicon_superscript">',
'#suffix' => '</div>',
);
$mypath = base_path() . drupal_get_path('module', 'lexicon');
$form['mark_terms']['indicator']["lexicon_icon"] = array(
'#type' => 'textfield',
'#title' => t('Lexicon Icon URL'),
'#default_value' => variable_get("lexicon_icon", $mypath .'/imgs/lexicon.gif'),
'#size' => 50,
'#maxlength' => 255,
'#description' => t('If you chose "icon" above, enter the URL of the lexicon icon relative to the root ("%root") of your Drupal site.', array('%root' => base_path())),
'#prefix' => '<div class="lexicon_icon">',
'#suffix' => '</div>',
);
$form['mark_terms']['indicator']['lexicon_disable_indicator'] = array(
'#type' => 'checkbox',
'#title' => t('Allow the user to disable lexicon links.'),
'#default_value' => variable_get('lexicon_disable_indicator', FALSE),
'#description' => t('Determines whether or not the individual user may disable the Lexicon indicators.'),
);
$form['lexicon_clear_filter_cache_on_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Clear the filter cache when settings are submitted.'),
'#default_value' => TRUE,
'#description' => t('Changes in the filter behaviour are only visible when the filter cache is flushed. This setting ensures that the filter cache is flushed when the settings are submitted.'),
'#prefix' => '<div class="lexicon_clear_filter_cache_on_submit">',
'#suffix' => '</div>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 5,
);
return $form;
}
function lexicon_general_settings_form_submit($form, &$form_state) {
variable_set('lexicon_vids', $form_state['values']['lexicon_vids']);
variable_set('lexicon_disable_indicator', $form_state['values']['lexicon_disable_indicator']);
variable_set('lexicon_click_option', $form_state['values']['lexicon_click_option']);
variable_set('lexicon_show_edit', $form_state['values']['lexicon_show_edit']);
variable_set('lexicon_show_search', $form_state['values']['lexicon_show_search']);
variable_set('lexicon_go_to_top_link', $form_state['values']['lexicon_go_to_top_link']);
variable_set('lexicon_go_to_top_link_fragment', $form_state['values']['lexicon_go_to_top_link_fragment']);
variable_set('lexicon_local_links_scroll', $form_state['values']['lexicon_local_links_scroll']);
variable_set('lexicon_page_per_letter', $form_state['values']['lexicon_page_per_letter']);
variable_set('lexicon_separate_letters', $form_state['values']['lexicon_separate_letters']);
variable_set('lexicon_allow_no_description', $form_state['values']['lexicon_allow_no_description']);
variable_set('lexicon_show_description', $form_state['values']['lexicon_show_description']);
variable_set('lexicon_show_detailed', $form_state['values']['lexicon_show_detailed']);
variable_set('lexicon_link_related', $form_state['values']['lexicon_link_related']);
variable_set('lexicon_link_related_how', $form_state['values']['lexicon_link_related_how']);
variable_set('lexicon_term_class', $form_state['values']['lexicon_term_class']);
variable_set('lexicon_mark_terms', $form_state['values']['lexicon_mark_terms']);
variable_set('lexicon_match', $form_state['values']['lexicon_match']);
variable_set('lexicon_case', $form_state['values']['lexicon_case']);
variable_set('lexicon_replace_all', $form_state['values']['lexicon_replace_all']);
variable_set('lexicon_blocking_tags', $form_state['values']['lexicon_blocking_tags']);
variable_set('lexicon_link', $form_state['values']['lexicon_link']);
variable_set('lexicon_replace', $form_state['values']['lexicon_replace']);
variable_set('lexicon_superscript', $form_state['values']['lexicon_superscript']);
variable_set('lexicon_icon', $form_state['values']['lexicon_icon']);
if ($form_state['values']['lexicon_clear_filter_cache_on_submit'] == 1) {
_lexicon_clear_filter_cache(NULL, TRUE);
}
drupal_set_message(t('Configuration has been updated.'));
return;
}
/*
* This is the form for the getting the user's alphabet for the alphabar.
*/
function lexicon_alphabet_form() {
global $language;
$form = array();
$form['alphabet'] = array(
'#type' => 'textarea',
'#title' => t('Enter all the letters of your alphabet, in the correct order, and in lower case.'),
'#default_value' => implode(' ', variable_get('lexicon_alphabet', range('a', 'z'))),
'#description' => t('Separate the letters by a blank.'),
'#rows' => 1,
);
$form['digits'] = array(
'#type' => 'textarea',
'#title' => t('Enter all the digits of your alphabet, in the correct order.'),
'#default_value' => implode(' ', variable_get('lexicon_digits', range('0', '9'))),
'#description' => t("Separate the digits by a blank. If you don't want terms to start with digits, leave this blank."),
'#rows' => 1,
);
$form['suppress_unused'] = array(
'#type' => 'checkbox',
'#title' => t('Suppress unused letters?'),
'#default_value' => variable_get('lexicon_suppress_unused', FALSE),
'#description' => t('This will cause unused letters to be omitted from the alphabar.'),
);
$ab_seps = array(
' ' => t('&lt;none>'),
'|' => t('vertical bar (pipe)'),
'&bull;' => t('bullet'),
'&#8211;' => t('en-dash (&#8211;)'),
'&#8212;' => t('em-dash (&#8212;)'),
'_' => t('underscore'),
);
$form['alphabar_separator'] = array(
'#type' => 'radios',
'#options' => $ab_seps,
'#title' => t('Alphabar separator'),
'#default_value' => variable_get('lexicon_alphabar_separator', '|'),
'#description' => t('This is the character that will separate the letters in the alphabar.'),
'#prefix' => '<div class="lexicon_radios">',
'#suffix' => '</div>',
);
$form['alphabar_instruction'] = array(
'#type' => 'textarea',
'#title' => t('Alphabar instruction'),
'#default_value' => variable_get('lexicon_alphabar_instruction', _alphabar_instruction_default()),
'#description' => t('This is the text that will appear immediately below the alphabar.'),
'#rows' => 1,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 5,
);
return $form;
}
function lexicon_alphabet_form_submit($form, &$form_state) {
variable_set('lexicon_alphabet', explode(' ', $form_state['values']['alphabet']));
if ($form_state['values']['digits']) {
variable_set('lexicon_digits', explode(' ', $form_state['values']['digits']));
}
else {
variable_set('lexicon_digits', array());
}
variable_set('lexicon_suppress_unused', $form_state['values']['suppress_unused']);
variable_set('lexicon_alphabar_separator', $form_state['values']['alphabar_separator']);
variable_set('lexicon_alphabar_instruction', $form_state['values']['alphabar_instruction']);
drupal_set_message(t('Configuration saved'), 'status');
}
/*
* This is the form for the path and title settings for the lexicons.
*/
function lexicon_paths_and_titles_form() {
$form = array();
drupal_add_js(drupal_get_path('module', 'lexicon') .'/js/lexicon.js', 'module');
$vids = array();
$vids = variable_get('lexicon_vids', array());
if (!$vids) {
drupal_set_message(t('No vocabularies were found. Until you set up, and select, at least one vocabulary for Lexicon, no settings can be entered.'));
}
$form['vids'] = array(
'#type' => 'value',
'#value' => $vids,
);
foreach ($vids as $vid) {
// Don't create form-items for vocabularies that have not been setup as Lexicon vocabularies.
if ($vid != 0) {
$result = db_query('SELECT name FROM {vocabulary} WHERE vid = ' . $vid);
$vocabulary = db_fetch_array($result);
$vocabulary_name = filter_xss_admin($vocabulary['name']);
$form['paths_and_titles_' . $vid] = array(
'#type' => 'fieldset',
'#title' => t('Path and title settings for ') . $vocabulary_name,
'#collapsible' => FALSE,
);
$form['paths_and_titles_' . $vid]['lexicon_path_' . $vid] = array(
'#type' => 'textfield',
'#title' => t('The path of the lexicon for this vocabulary'),
'#default_value' => variable_get('lexicon_path_' . $vid, 'lexicon/' . $vid),
'#description' => t('Determines the path that is used for the lexicon page for this vocabulary. Default is:') . ' <em>lexicon/' . $vid . '</em>.',
'#required' => TRUE,
);
$form['paths_and_titles_' . $vid]['lexicon_title_' . $vid] = array(
'#type' => 'textfield',
'#title' => t('The title of the lexicon for this vocabulary'),
'#default_value' => variable_get('lexicon_title_'. $vid, $vocabulary_name),
'#description' => t('Determines the title that is used for the lexicon page for this vocabulary. Default is:') . ' <em>' . $vocabulary_name .'</em>.',
'#required' => TRUE,
);
}
}
$form['lexicon_clear_menu_cache_on_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Clear the cache when settings are submitted.'),
'#default_value' => TRUE,
'#description' => t('Changes in the paths and titles are only visible when the menucache is flushed. This setting ensures that the menucache is flushed when the settings are submitted.'),
'#prefix' => '<div class="lexicon_clear_menu_cache_on_submit">',
'#suffix' => '</div>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 5,
);
return $form;
}
function lexicon_paths_and_titles_form_submit($form, &$form_state) {
$vids = $form_state['values']['vids'];
foreach ($vids as $vid) {
if ($vid != 0 ) {
variable_set('lexicon_path_' . $vid, $form_state['values']['lexicon_path_' . $vid]);
variable_set('lexicon_title_' . $vid, $form_state['values']['lexicon_title_' . $vid]);
}
}
if ($form_state['values']['lexicon_clear_menu_cache_on_submit'] == 1) {
_lexicon_clear_menu_cache();
_lexicon_clear_filter_cache(NULL, TRUE);
}
drupal_set_message(t('Configuration saved'), 'status');
}

View file

@ -0,0 +1,12 @@
name = Lexicon
description = Maintain a lexicon on your site.
dependencies[] = taxonomy
core = 6.x
; Information added by drupal.org packaging script on 2011-04-14
version = "6.x-1.4"
core = "6.x"
project = "lexicon"
datestamp = "1302799616"

View file

@ -0,0 +1,91 @@
<?php
/**
* @file
* Lexicon module installation functions.
*/
/**
* Implementation of hook_requirements().
*/
function lexicon_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
// check that php is compiled with ctype support
$requirements['ctype'] = array(
'title' => $t('Character type functions (ctype)'),
);
if (function_exists('ctype_alnum')) {
$requirements['ctype']['value'] = $t('Enabled');
$requirements['ctype']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['ctype']['value'] = $t('Disabled');
$requirements['ctype']['description'] = $t('The Lexicon module requires that you configure PHP with --enable-ctype.');
$requirements['ctype']['severity'] = REQUIREMENT_ERROR;
}
return $requirements;
}
/**
* Implementation of hook_install().
*/
function lexicon_install() {
drupal_set_message(t('The Lexicon module has been installed. To use the module you first have to configure it <a href="!settings_uri">here</a>.', array('!settings_uri' => url('admin/settings/lexicon'))));
}
/**
* Implementation of hook_uninstall().
* There are no tables, so we delete all variables and clear the filter cache.
* It is left to the user to dispose of any vocabularies that are no longer needed.
*/
function lexicon_uninstall() {
$vids = variable_get('lexicon_vids', array());
//Delete the settings for each Lexicon vocabulary
foreach ($vids as $vid) {
variable_del('lexicon_path_' . $vid);
variable_del('lexicon_title_' . $vid);
variable_del('lexicon_vids');
}
//Delete the rest of the variables
variable_del('lexicon_vids');
variable_del('lexicon_disable_indicator');
variable_del('lexicon_click_option');
variable_del('lexicon_show_edit');
variable_del('lexicon_show_search');
variable_del('lexicon_go_to_top_link');
variable_del('lexicon_go_to_top_link_fragment');
variable_del('lexicon_local_links_scroll');
variable_del('lexicon_page_per_letter');
variable_del('lexicon_seperate_letters');
variable_del('lexicon_allow_no_description');
variable_del('lexicon_show_description');
variable_del('lexicon_show_detailed');
variable_del('lexicon_link_related');
variable_del('lexicon_link_related_how');
variable_del('lexicon_term_class');
variable_del('lexicon_mark_terms');
variable_del('lexicon_match');
variable_del('lexicon_case');
variable_del('lexicon_replace_all');
variable_del('lexicon_blocking_tags');
variable_del('lexicon_link');
variable_del('lexicon_replace');
variable_del('lexicon_superscript');
variable_del('lexicon_icon');
variable_del('lexicon_alphabet');
variable_del('lexicon_digits');
variable_del('lexicon_suppress_unused');
variable_del('lexicon_alphabar_separator');
variable_del('lexicon_alphabar_instruction');
// Let's make sure the filter cache is cleared of our stuff.
cache_clear_all(NULL, 'cache_filter');
drupal_set_message(t('The Lexicon module has been uninstalled. You will still need to decide what to do with vocabularies that were used.'), 'warning');
}

File diff suppressed because it is too large Load diff