Closed (won't fix)
Project:
Glossary
Version:
5.x-2.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2008 at 01:16 UTC
Updated:
25 Apr 2008 at 10:34 UTC
Jump to comment: Most recent file
Comments
Comment #1
nancydruDid you try using the already available related links capability?
Comment #2
harking commentedI looked into the related links capabilities and determined that for our internal use case we would need to have the text in the description link to other terms automatically. From what I understand, the related terms need to be defined manually.
I still feel that the related terms are useful in the case where the description or term might be part of a larger topic and can use a direct link with the "More info" style annotation.
Comment #3
nancydruI will look into this.
George, in the future when you do a patch for a module that is changing frequently, it would help to use the "-p" option on your diff.
Comment #4
nancydruThere are lots of changes to "glossary_filter_form" that seem to have nothing to do with this.
Comment #5
nancydruHmm, I applied the relevant parts of the patch (as best I can tell) and it doesn't seem to do anything. I've tried it with both icon and hovertip settings.
Comment #6
harking commentedThe changes to the glossary filter form allowed the reuse of the filter form elements that were in common.
I'm not sure if the patch can be chopped up. What parts did you try applying?
Comment #7
nancydruIndex: glossary.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/glossary/glossary.module,v
retrieving revision 1.100.2.20
diff -u -r1.100.2.20 glossary.module
--- glossary.module 20 Feb 2008 16:06:41 -0000 1.100.2.20
+++ glossary.module 20 Feb 2008 18:06:24 -0000
@@ -266,7 +266,7 @@
}
}
-function _glossary_filter_process($format, $text) {
+function _glossary_filter_process($format, $text, $current_term = null) {
global $user;
if ($user->glossary_disable_indicator && variable_get('glossary_disable_indicator', false)) {
return $text;
@@ -282,6 +282,12 @@
$terms_replace = array();
foreach ($terms as $term) {
+ //Skip the term if we are creating glossary links inside of another glossary item.
+ if (variable_get('glossary_link_term_to_self', false) == false) {
+ if ($term->name == $current_term) {
+ continue;
+ }
+ }
$term_title = $term->name .': '. strip_tags($term->description);
$fragment = null;
if ($term->nodes > 0) {
@@ -596,7 +602,12 @@
$output .= l(t('Detailed definition of @term', array('@term' => $term->name)), "taxonomy/term/$term->tid");
}
else {
- $output .= $term->description;
+ if (variable_get('glossary_internal_links', true)) {
+ $output .= _glossary_filter_process(0, $term->description, $term->name);
+ }
+ else {
+ $output .= $term->description;
+ }
}
if ($relations = taxonomy_get_related($term->tid, "name")) {
@@ -857,6 +868,28 @@
'#description' => t('Glossary term descriptions may be large and/or include pictures, therefore the Glossary page can take a long time to load if you include the full descriptions.'),
);
+ $form['general']['glossary'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Glossary Internal Links'),
+ '#collapsible' => true,
+ '#collapsed' => false,
+// '#description' => t('Settings for glossary items')
+ );
+
+ $form['general']['glossary']['glossary_internal_links'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Link between glossary terms.'),
+ '#default_value' => variable_get('glossary_internal_links', true),
+ '#description' => t('If checked, glossary descriptions that contain other elements in the glossary will be linked to them.')
+ );
+
+ $form['general']['glossary']['glossary_link_term_to_self'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Link a term back to itself?'),
+ '#default_value' => variable_get('glossary_link_term_to_self', false),
+ '#description' => t('If checked, when a term contains its own term in its description it will be converted into a glossary item. Requires "Link between glossary terms."')
+ );
+
$click_options = array(
t('Show only the single term.'),
t('Advance the whole glossary to the term.'),
Comment #8
harking commentedI think your patch is missing the extra form elements which will set the glossary settings that allow the internal linking to occur.
When the glossary filter does not see the settings it does not insert the links into the keywords.
Comment #9
nancydrusee the picture
Comment #10
harking commentedThis screen shot shows the full patch, with the additional settings for the internal glossary links. The extra fields are required since they tell the glossary filter which vocabularies to apply to the glossary items.
Comment #11
nancydruIt looks like you have global settings and input format settings intermingled. I don't want that. A setting should be one or the other and only on that appropriate settings page.
Comment #12
harking commentedPerhaps another tab would be appropriate. How does that sound?
Comment #13
nancydruIf I don't turn off my unused input formats on my site, I already have 9 tabs.
Maybe I just don't understand how your patch is supposed to work, particularly at the UI level.
Comment #14
harking commented9 input formats is quite a bit. Do you have an input format for each content type?
At the UI level, the patch is just adding another section to configure the glossary filter for when processing content in the glossary pages.
Since the glossary filter needs to know the same amount of information to process the glossary items as it does to process a node's content, it needs the same configuration options. They way I saw to get the filter this information was to add another set of configuration options.
I stuck the new options in the general settings area because I thought it applied to the glossary as a whole.
Comment #15
nancydruNo, only 6 input formats. To start with there is the General tab, followed by the Alphabet tab, followed by the Clear cache tab. Everyone has those 3. Most sites are then going to have 3 input formats (filtered, full, php). My other 3 are because of wanting to omit certain filters in certain cases.
I am trying to keep it so that the tabs for the various input formats contain only settings for that format. The general tab contains settings that all formats would use. I do not want duplication because it can be (and usually is) confusing. I tried using your patch to put the settings only on the general settings page, because they appeared to be general in nature. However, the code did nothing as far as I could tell, so I have removed it again.
Comment #16
nancydruWhen you can construct a patch that fits in with the overall module design and shows me that it does something, feel free to re-open this issue.
Comment #17
harking commentedReopening with an updated patch for 2.2.
Similar to old patch in that the additional control is placed in the "General" tab. The additional features are still disabled by default and the now the fieldset is collapsed by default.
This does not create any additional tabs, and still allows for the additional internal linking features to integrate well.
Comment #18
harking commentedLooking at glossary module again, it seems that internal linking between terms is already being taken care of by the module, and thus this patch for more configuration isn't required.
Comment #19
nancydruOkay, that was easy.