diff --git a/modules/faq/faq.admin.inc b/modules/faq/faq.admin.inc deleted file mode 100644 index e5889c5..0000000 --- a/modules/faq/faq.admin.inc +++ /dev/null @@ -1,497 +0,0 @@ - 'textfield', - '#title' => t('Title'), - '#default_value' => variable_get('faq_title', 'Frequently Asked Questions'), - ); - - $form['body_filter']['faq_description'] = array( - '#type' => 'textarea', - '#title' => t('FAQ Description'), - '#default_value' => variable_get('faq_description', ''), - '#description' => t('Your FAQ description. This will be placed at the top of the page, above the questions and can serve as an introductory text.'), - '#rows' => 5, - ); - $form['body_filter']['faq_description_format'] = filter_form(variable_get('faq_description_format', ''), NULL, array('faq_description_format')); - $form['faq_custom_breadcrumbs'] = array( - '#type' => 'checkbox', - '#title' => t('Create custom breadcrumbs for the FAQ'), - '#description' => t('This option set the breadcrumb path to "%home > %faqtitle > category trail".', array('%home' => t('Home'), '%faqtitle' => variable_get('faq_title', 'Frequently Asked Questions'))), - '#default_value' => variable_get('faq_custom_breadcrumbs', TRUE), - ); - - return system_settings_form($form); -} - -/** - * Define the elements for the FAQ Settings page - Questions tab. - * - * @return - * The form code inside the $form array. - */ -function faq_questions_settings_form() { - - drupal_add_js(array('faq' => array('faq_hide_qa_accordion' => variable_get('faq_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(array('faq' => array('faq_category_hide_qa_accordion' => variable_get('faq_category_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(drupal_get_path('module', 'faq') .'/faq.js', 'module'); - - $display_options['questions_inline'] = t('Questions inline'); - $display_options['questions_top'] = t('Clicking on question takes user to answer further down the page'); - $display_options['hide_answer'] = t('Clicking on question opens/hides answer under question'); - $display_options['new_page'] = t('Clicking on question opens the answer in a new page'); - - $form['faq_display'] = array( - '#type' => 'radios', - '#options' => $display_options, - '#title' => t('Page layout'), - '#description' => t('This controls how the questions and answers are displayed on the page and what happens when someone clicks on the question.'), - '#default_value' => variable_get('faq_display', 'questions_top'), - ); - - $form['faq_questions_misc'] = array( - '#type' => 'fieldset', - '#title' => t('Miscellaneous layout settings'), - '#collapsible' => TRUE, - ); - - $form['faq_questions_misc']['faq_question_listing'] = array( - '#type' => 'select', - '#options' => array('ol' => t('Ordered list'), 'ul' => t('Unordered list')), - '#title' => t('Questions listing style'), - '#description' => t("This allows to select how the questions listing is presented. It only applies to the layouts: 'Clicking on question takes user to answer further down the page' and 'Clicking on question opens the answer in a new page'. An ordered listing would number the questions, whereas an unordered list will have a bullet to the left of each question."), - '#default_value' => variable_get('faq_question_listing', 'ul'), - ); - - $form['faq_questions_misc']['faq_qa_mark'] = array( - '#type' => 'checkbox', - '#title' => t('Label questions and answers'), - '#description' => t('This option is only valid for the "Questions Inline" and "Clicking on question takes user to answer further down the page" layouts. It labels all questions on the faq page with the "question label" setting and all answers with the "answer label" setting. For example these could be set to "Q:" and "A:".'), - '#default_value' => variable_get('faq_qa_mark', FALSE), - ); - - $form['faq_questions_misc']['faq_question_label'] = array( - '#type' => 'textfield', - '#title' => t('Question Label'), - '#description' => t('The label to pre-pend to the question text in the "Questions Inline" layout if labelling is enabled.'), - '#default_value' => variable_get('faq_question_label', 'Q:'), - ); - - $form['faq_questions_misc']['faq_answer_label'] = array( - '#type' => 'textfield', - '#title' => t('Answer Label'), - '#description' => t('The label to pre-pend to the answer text in the "Questions Inline" layout if labelling is enabled.'), - '#default_value' => variable_get('faq_answer_label', 'A:'), - ); - - $form['faq_questions_misc']['faq_question_length'] = array( - '#type' => 'radios', - '#title' => t('Question length'), - '#options' => array('long' => t('Display longer text'), 'short' => t('Display short text'), 'both' => t('Display both short and long questions')), - '#description' => t("The length of question text to display on the FAQ page. The short question will always be displayed in the FAQ blocks."), - '#default_value' => variable_get('faq_question_length', 'short'), - ); - - $form['faq_questions_misc']['faq_question_long_form'] = array( - '#type' => 'checkbox', - '#title' => t('Allow long question text to be configured'), - '#default_value' => variable_get('faq_question_long_form', 1), - ); - - $form['faq_questions_misc']['faq_hide_qa_accordion'] = array( - '#type' => 'checkbox', - '#title' => t('Use accordion effect for "opens/hides answer under question" layout'), - '#description' => t('This enables an "accordion" style effect where when a question is clicked, the answer appears beneath, and is then hidden when another question is opened.'), - '#default_value' => variable_get('faq_hide_qa_accordion', FALSE), - ); - - $form['faq_questions_misc']['faq_show_expand_all'] = array( - '#type' => 'checkbox', - '#title' => t('Show "expand / collapse all" links for collapsed questions'), - '#description' => t('The links will only be displayed if using the "opens/hides answer under question" or "opens/hides questions and answers under category" layouts.'), - '#default_value' => variable_get('faq_show_expand_all', FALSE), - ); - - $form['faq_questions_misc']['faq_use_teaser'] = array( - '#type' => 'checkbox', - '#title' => t('Use answer teaser'), - '#description' => t("This enables the display of the answer teaser text instead of the full answer when using the 'Questions inline' or 'Clicking on question takes user to answer further down the page' display options. This is useful when you have long descriptive text. The user can see the full answer by clicking on the question."), - '#default_value' => variable_get('faq_use_teaser', FALSE), - ); - - $form['faq_questions_misc']['faq_show_node_links'] = array( - '#type' => 'checkbox', - '#title' => t('Show node links'), - '#description' => t('This enables the display of links under the answer text on the faq page. Examples of these links include "Read more", "Add comment".'), - '#default_value' => variable_get('faq_show_node_links', FALSE), - ); - - $form['faq_questions_misc']['faq_back_to_top'] = array( - '#type' => 'textfield', - '#title' => t('"Back to Top" link text'), - '#description' => t('This allows the user to change the text displayed for the links which return the user to the top of the page on certain page layouts. Defaults to "Back to Top". Leave blank to have no link.'), - '#default_value' => variable_get('faq_back_to_top', 'Back to Top'), - ); - - $form['faq_questions_misc']['faq_disable_node_links'] = array( - '#type' => 'checkbox', - '#title' => t('Disable question links to nodes'), - '#description' => t('This allows the user to prevent the questions being links to the faq node in all layouts except "Clicking on question opens the answer in a new page".'), - '#default_value' => variable_get('faq_disable_node_links', FALSE), - ); - - $form['faq_questions_misc']['faq_default_sorting'] = array( - '#type' => 'select', - '#title' => t('Default sorting for unordered FAQs'), - '#options' => array('DESC' => t('Date Descending'), 'ASC' => t('Date Ascending')), - '#description' => t("This controls the default ordering behaviour for new FAQ nodes which haven't been assigned a position."), - '#default_value' => variable_get('faq_default_sorting', 'DESC'), - ); - - return system_settings_form($form); -} - -/** - * Define the elements for the FAQ Settings page - categories tab. - * - * @return - * The form code inside the $form array. - */ -function faq_categories_settings_form() { - if (!module_exists("taxonomy")) { - drupal_set_message(t('Categorization of questions will not work without the "taxonomy" module being enabled.'), 'error'); - } - drupal_add_js(array('faq' => array('faq_hide_qa_accordion' => variable_get('faq_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(array('faq' => array('faq_category_hide_qa_accordion' => variable_get('faq_category_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(drupal_get_path('module', 'faq') .'/faq.js', 'module'); - - // Set up a hidden variable. - $form['faq_display'] = array( - '#type' => 'hidden', - '#value' => variable_get('faq_display', 'questions_top'), - ); - - $form['faq_use_categories'] = array( - '#type' => 'checkbox', - '#title' => t('Categorize questions'), - '#description' => t('This allows the user to display the questions according to the categories configured on the add/edit FAQ page. Use of sub-categories is only recommended for large lists of questions. The Taxonomy module must be enabled and you must configure a FAQ vocabulary at Content Management > Taxonomy.', array('@url' => url('admin/content/taxonomy'))), - '#default_value' => variable_get('faq_use_categories', FALSE), - ); - - $category_options['none'] = t("Don't display"); - $category_options['categories_inline'] = t('Categories inline'); - $category_options['hide_qa'] = t('Clicking on category opens/hides questions and answers under category'); - $category_options['new_page'] = t('Clicking on category opens the questions/answers in a new page'); - - $form['faq_category_display'] = array( - '#type' => 'radios', - '#options' => $category_options, - '#title' => t('Categories layout'), - '#description' => t('This controls how the categories are displayed on the page and what happens when someone clicks on the category.'), - '#default_value' => variable_get('faq_category_display', 'categories_inline'), - ); - - $form['faq_category_misc'] = array( - '#type' => 'fieldset', - '#title' => t('Miscellaneous layout settings'), - '#collapsible' => TRUE, - ); - - $form['faq_category_misc']['faq_category_listing'] = array( - '#type' => 'select', - '#options' => array('ol' => t('Ordered list'), 'ul' => t('Unordered list')), - '#title' => t('Categories listing style'), - '#description' => t("This allows to select how the categories listing is presented. It only applies to the 'Clicking on category opens the questions/answers in a new page' layout. An ordered listing would number the categories, whereas an unordered list will have a bullet to the left of each category."), - '#default_value' => variable_get('faq_category_listing', 'ul'), - ); - - $form['faq_category_misc']['faq_category_hide_qa_accordion'] = array( - '#type' => 'checkbox', - '#title' => t('Use accordion effect for "opens/hides questions and answers under category" layout'), - '#description' => t('This enables an "accordion" style effect where when a category is clicked, the questions appears beneath, and is then hidden when another category is opened.'), - '#default_value' => variable_get('faq_category_hide_qa_accordion', FALSE), - ); - - $form['faq_category_misc']['faq_count'] = array( - '#type' => 'checkbox', - '#title' => t('Show FAQ count'), - '#description' => t('This displays the number of questions in a category after the category name.'), - '#default_value' => variable_get('faq_count', FALSE), - ); - - $form['faq_category_misc']['faq_answer_category_name'] = array( - '#type' => 'checkbox', - '#title' => t('Display category name for answers'), - '#description' => t("This allows the user to toggle the visibility of the category name above each answer section for the 'Clicking on question takes user to answer further down the page' question/answer display."), - '#default_value' => variable_get('faq_answer_category_name', FALSE), - ); - - $form['faq_category_misc']['faq_group_questions_top'] = array( - '#type' => 'checkbox', - '#title' => t("Group questions and answers for 'Categories inline'"), - '#description' => t("This controls how categories are implemented with the 'Clicking on question takes user to answer further down the page' question/answer display."), - '#default_value' => variable_get('faq_group_questions_top', FALSE), - ); - - $form['faq_category_misc']['faq_hide_child_terms'] = array( - '#type' => 'checkbox', - '#title' => t('Only show sub-categories when parent category is selected'), - '#description' => t("This allows the user more control over how and when sub-categories are displayed. It does not affect the 'Categories inline' display."), - '#default_value' => variable_get('faq_hide_child_terms', FALSE), - ); - - $form['faq_category_misc']['faq_show_term_page_children'] = array( - '#type' => 'checkbox', - '#title' => t('Show sub-categories on FAQ category pages'), - '#description' => t("Sub-categories with 'faq' nodes will be displayed on the per category FAQ page. This will also happen if 'Only show sub-categories when parent category is selected' is set."), - '#default_value' => variable_get('faq_show_term_page_children', FALSE), - ); - - if (module_exists('taxonomy')) { - $form['faq_category_advanced'] = array( - '#type' => 'fieldset', - '#title' => t('Advanced category settings'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - - $vocab_options = array(); - $vocabularies = taxonomy_get_vocabularies('faq'); - foreach ($vocabularies as $vid => $vobj) { - $vocab_options[$vid] = $vobj->name; - } - if (!empty($vocab_options)) { - $form['faq_category_advanced']['faq_omit_vocabulary'] = array( - '#type' => 'checkboxes', - '#title' => t('Omit vocabulary'), - '#description' => t('Terms from these vocabularies will be excluded from the FAQ pages.'), - '#default_value' => variable_get('faq_omit_vocabulary', array()), - '#options' => $vocab_options, - '#multiple' => TRUE, - ); - } - - $form['faq_category_advanced']['faq_enable_term_links'] = array( - '#type' => 'checkbox', - '#title' => t('Enable FAQ taxonomy links'), - '#description' => t('Node links to taxonomy terms will be re-written to point at the FAQ pages instead.'), - '#default_value' => variable_get('faq_enable_term_links', 1), - ); - } - - return system_settings_form($form); -} - -/** - * Define the elements for the FAQ Settings page - order tab. - * - * @param $form_state - * Store the submitted form values. - * @return - * The form code, before being converted to HTML format. - */ -function faq_order_settings_form($form_state, $category = NULL) { - $order = $date_order = ''; - - drupal_add_js(array('faq' => array('faq_hide_qa_accordion' => variable_get('faq_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(array('faq' => array('faq_category_hide_qa_accordion' => variable_get('faq_category_hide_qa_accordion', FALSE))), 'setting'); - drupal_add_js(drupal_get_path('module', 'faq') .'/faq.js', 'module'); - drupal_add_css(drupal_get_path('module', 'faq') .'/faq.css'); - - $use_categories = variable_get('faq_use_categories', FALSE); - if (!$use_categories) { - $step = "order"; - } - elseif (!isset($form_state['values']) && empty($category)) { - $step = "categories"; - } - else { - $step = "order"; - } - $form['step'] = array( - '#type' => 'value', - '#value' => $step, - ); - - // Categorized q/a. - if ($step == "categories") { - - // Get list of categories. - $vocabularies = taxonomy_get_vocabularies('faq'); - $options = array(); - foreach ($vocabularies as $vid => $vobj) { - $tree = taxonomy_get_tree($vid); - foreach ($tree as $term) { - if (!taxonomy_term_count_nodes($term->tid, 'faq')) { - continue; - } - $options[$term->tid] = faq_tt("taxonomy:term:$term->tid:name", $term->name); - $form['choose_cat']['faq_category'] = array( - '#type' => 'select', - '#title' => t('Choose a category'), - '#description' => t('Choose a category that you wish to order the questions for.'), - '#options' => $options, - '#multiple' => FALSE, - ); - - $form['choose_cat']['search'] = array( - '#type' => 'submit', - '#value' => t('Search'), - '#submit' => array('faq_order_settings_choose_cat_form_submit'), - ); - } - } - - } - - else { - $default_sorting = variable_get('faq_default_sorting', 'DESC'); - $default_weight = 0; - if ($default_sorting != 'DESC') { - $default_weight = 1000000; - } - - $options = array(); - if (!empty($form_state['values']['faq_category'])) { - $category = $form_state['values']['faq_category']; - } - - // Uncategorized ordering. - if (empty($category)) { - $category = 0; - // Descending. - if ($default_sorting == 'DESC') { - $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = '%d' WHERE n.type='faq' AND n.status = 1 ORDER BY effective_weight ASC, n.sticky DESC, n.created DESC", "n", "nid"), $default_weight, $category); - } - // Ascending. - else { - $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = '%d' WHERE n.type='faq' AND n.status = 1 ORDER BY effective_weight ASC, n.sticky DESC, n.created ASC", "n", "nid"), $default_weight, $category); - } - } - // Categorized ordering. - else { - // Descending. - if ($default_sorting == 'DESC') { - $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON (n.nid = tn.nid AND n.vid = tn.vid) LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = '%d' WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY effective_weight ASC, n.sticky DESC, n.created DESC", "n", "nid"), $default_weight, $category, $category); - } - // Ascending. - else { - $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON (n.nid = tn.nid AND n.vid = tn.vid) LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = '%d' WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY effective_weight ASC, n.sticky DESC, n.created ASC", "n", "nid"), $default_weight, $category, $category); - } - } - - - while ($node = db_fetch_object($result)) { - $options[$node->nid] = check_plain($node->title); - } - - $form['weight']['faq_category'] = array( - '#type' => 'value', - '#value' => $category, - ); - - // Show table ordering form. - $form['order_no_cats']['#tree'] = TRUE; - $form['order_no_cats']['#theme'] = 'faq_draggable_question_order_table'; - - $i = 0; - foreach ($options as $nid => $title) { - $form['order_no_cats'][$i]['nid'] = array('#type' => 'hidden', '#value' => $nid); - $form['order_no_cats'][$i]['title'] = array('#value' => $title); - $form['order_no_cats'][$i]['sort'] = array('#type' => 'weight', '#delta' => count($options), '#default_value' => $i); - $i++; - } - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Save order'), - '#weight' => 3, - '#submit' => array('faq_order_settings_reorder_form_submit'), - ); - } - - - return $form; -} - -/** - * Function set the rebuild of the form in the FAQ Settings - Weight tab. - * - * @param $form - * Array, containing the form structure. - * @param &$form_state - * The 'rebuild' key inside $form_state['rebuild'] structure, overrides the - * 'redirect' key: when it is set to TRUE, the form will be rebuilt from - * scratch and displayed on screen. - */ -function faq_order_settings_choose_cat_form_submit($form, &$form_state) { - $form_state['rebuild'] = TRUE; -} - -/** - * Save the options set by the user in the FAQ Settings - Weight tab. - * - * @param $form - * Array, containing the form structure. - * @param &$form_state - * $form_state['values'] stores the submitted values from the form. - */ -function faq_order_settings_reorder_form_submit($form, &$form_state) { - if ($form_state['values']['op'] == t('Save order') && !empty($form_state['values']['order_no_cats'])) { - - foreach ($form_state['values']['order_no_cats'] as $i => $faq) { - $nid = $faq['nid']; - $index = $faq['sort']; - $result = db_query("DELETE FROM {faq_weights} WHERE tid = %d AND nid = %d", $form_state['values']['faq_category'], $nid); - $result = db_query("INSERT INTO {faq_weights} (tid, nid, weight) VALUES(%d, %d, %d)", $form_state['values']['faq_category'], $nid, $index); - - // If node translation module enabled, update order of the translation - // node counterparts. - if (module_exists('translation')) { - $node = node_load($nid); - if ($node->tnid) { - $translations = translation_node_get_translations($node->tnid); - if (!empty($translations)) { - foreach ($translations as $language => $tnode) { - $result = db_query("DELETE FROM {faq_weights} WHERE tid = %d AND nid = %d", $form_state['values']['faq_category'], $tnode->nid); - $result = db_query("INSERT INTO {faq_weights} (tid, nid, weight) VALUES(%d, %d, %d)", $form_state['values']['faq_category'], $tnode->nid, $index); - } - } - } - } - } - - drupal_set_message(t('Configuration has been updated.')); - } -} - diff --git a/modules/faq/faq.css b/modules/faq/faq.css deleted file mode 100644 index 8f2f54f..0000000 --- a/modules/faq/faq.css +++ /dev/null @@ -1,63 +0,0 @@ -.faq-category-indent { - padding-left: 20px; -} - -.faq-more-link { - font-size: 0.85em; - margin-left: 30em; - margin-top: 0; - margin-bottom: -1.25em; - text-align: right; -} - -.faq-top-link { - font-size: 0.8em; - margin-top:0; - margin-bottom: 0; - padding-bottom: 1.0em; -} - -.faq-question { - padding-top: 5px; - padding-left: 20px; -} - -.faq-answer { - padding-left: 40px; -} - -.faq-answer .faq-answer-label { - float: left; - margin-right: 0.5em; -} - - -.faq-dl-hide-answer { - padding-bottom: 15px; -} - -img.faq-tax-image { - float: left; - padding: 0px 3px 0px 3px; -} - -div.faq-detailed-question { - font-style: italic; -} - -.faq .collapsible { - display: block; -} - -.faq .collapsed { - display: none; -} - -.faq #faq-expand-all { - text-align: right; - display: none; -} -.faq #faq-expand-all a.faq-expand-all-link, -.faq #faq-expand-all a.faq-collapse-all-link { - display: none; -} diff --git a/modules/faq/faq.info b/modules/faq/faq.info deleted file mode 100644 index b0e2cc8..0000000 --- a/modules/faq/faq.info +++ /dev/null @@ -1,10 +0,0 @@ -name = Frequently Asked Questions -description = "Manages configuration of questions for a FAQ page." -package = Core - extended -core = 6.x - -; Information added by drupal.org packaging script on 2012-02-22 -version = "6.x-1.13" -core = "6.x" -project = "faq" -datestamp = "1329951344" diff --git a/modules/faq/faq.install b/modules/faq/faq.install deleted file mode 100644 index 24f3af8..0000000 --- a/modules/faq/faq.install +++ /dev/null @@ -1,170 +0,0 @@ - 'A table containing the weight of each faq node by category.', - 'fields' => array( - 'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a term or category. This will be 0 for non-categorized nodes.'), - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a node.'), - 'weight' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'description' => 'A number representing the weight of a node. Nodes with lower weight values will appear above those with higher weight values.'), - ), - 'primary key' => array('nid', 'tid'), - ); - - $schema['faq_questions'] = array( - 'description' => 'A table containing the long question text of each faq node revision.', - 'fields' => array( - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a node.'), - 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a node revision.'), - 'question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => 'The faq short question text.'), - 'detailed_question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => 'The faq long question text.'), - ), - 'primary key' => array('nid', 'vid'), - ); - - - return $schema; -} - -/** - * Implementation of hook_install(). - * - * Inserts the FAQ module's schema in the SQL database. - */ -function faq_install() { - drupal_install_schema('faq'); - variable_set('node_options_faq', array('status')); -} - -/** - * Implementation of hook_uninstall(). - * - * Remove the variables, nodes and schema corresponding to the FAQ module. - */ -function faq_uninstall() { - // Delete the variables we created. - // General settings. - variable_del('faq_title'); - variable_del('faq_description'); - variable_del('faq_description_format'); - // Questions page. - variable_del('faq_display'); - variable_del('faq_question_listing'); - variable_del('faq_qa_mark'); - variable_del('faq_question_label'); - variable_del('faq_answer_label'); - variable_del('faq_question_length'); - variable_del('faq_hide_qa_accordion'); - variable_del('faq_show_expand_all'); - variable_del('faq_use_teaser'); - variable_del('faq_show_node_links'); - variable_del('faq_back_to_top'); - variable_del('faq_disable_node_links'); - variable_del('faq_default_sorting'); - // Categories page. - variable_del('faq_use_categories'); - variable_del('faq_category_display'); - variable_del('faq_category_listing'); - variable_del('faq_category_hide_qa_accordion'); - variable_del('faq_count'); - variable_del('faq_answer_category_name'); - variable_del('faq_group_questions_top'); - variable_del('faq_hide_child_terms'); - variable_del('faq_show_term_page_children'); - variable_del('faq_omit_vocabulary'); - variable_del('faq_enable_term_links'); - // Block settings. - variable_del('faq_block_recent_faq_count'); - variable_del('faq_block_random_faq_count'); - // Custom breadcrumbs control - variable_del('faq_custom_breadcrumbs'); - - // Deprecated. - variable_del('faq_more_link'); - - drupal_uninstall_schema('faq'); - - // Clear the cache tables. - cache_clear_all('*', 'cache', TRUE); - cache_clear_all('*', 'cache_filter', TRUE); - cache_clear_all('*', 'cache_menu', TRUE); - cache_clear_all('*', 'cache_page', TRUE); -} - -/** - * Create 'faq_weights' table in order to upgrade from older installations. - * - * Should have been created with faq_update_600x() naming convention, but too - * late now. - * - * @return - * An array containing the structure of the SQL schema. - */ -function faq_update_1() { - $schema['faq_weights'] = array( - 'description' => 'A table containing the weight of each faq node by category.', - 'fields' => array( - 'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'weight' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0), - ), - 'primary key' => array('nid', 'tid'), - ); - - $ret = array(); - db_create_table($ret, 'faq_weights', $schema['faq_weights']); - - return $ret; -} - -/** - * Create 'faq_questions' table in order to upgrade from older installations. - * - * Should have been created with faq_update_600x() naming convention, but too - * late now. - * - * @return - * An array containing the results of the update. - */ -function faq_update_2() { - $schema['faq_questions'] = array( - 'description' => 'A table containing the long question text of each faq node revision.', - 'fields' => array( - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a node.'), - 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The primary identifier for a node revision.'), - 'question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => 'The faq long question text.'), - ), - 'primary key' => array('nid', 'vid'), - ); - - $ret = array(); - db_create_table($ret, 'faq_questions', $schema['faq_questions']); - - $ret[] = update_sql("INSERT INTO {faq_questions} (nid, vid, question) SELECT r.nid, r.vid, r.title FROM {node_revisions} r, {node} n WHERE n.nid = r.nid AND n.type = 'faq'"); - - return $ret; -} - -/** - * Add the 'detailed_question' column to the 'faq_questions' table. - * - * @return - * An array containing the results of the update. - */ -function faq_update_6003() { - $ret = array(); - db_add_field($ret, 'faq_questions', 'detailed_question', array('type' => 'text', 'size' => 'normal', 'not null' => TRUE)); - $ret[] = update_sql("UPDATE {faq_questions} SET detailed_question = question"); - return $ret; -} diff --git a/modules/faq/faq.js b/modules/faq/faq.js deleted file mode 100644 index 9f07fb1..0000000 --- a/modules/faq/faq.js +++ /dev/null @@ -1,272 +0,0 @@ - -function teaser_handler(event) { - if ($("input[name=faq_display]:checked").val() != "new_page") { - if ($("input[name=faq_use_teaser]:checked").val() == 1) { - $("input[name=faq_more_link]").removeAttr("disabled"); - } - else { - $("input[name=faq_more_link]").attr("disabled", "disabled"); - } - } -} - -function faq_display_handler(event) { - // Enable / disable "questions_inline" and "questions_top" only settings. - if ($("input[name=faq_display]:checked").val() == "questions_inline" || $("input[name=faq_display]:checked").val() == "questions_top") { - $("input[name=faq_back_to_top]").removeAttr("disabled"); - $("input[name=faq_qa_mark]").removeAttr("disabled"); - // Enable / disable label settings according to "qa_mark" setting. - if ($("input[name=faq_qa_mark]:checked").val() == 1) { - $("input[name=faq_question_label]").removeAttr("disabled"); - $("input[name=faq_answer_label]").removeAttr("disabled"); - } - else { - $("input[name=faq_question_label]").attr("disabled", "disabled"); - $("input[name=faq_answer_label]").attr("disabled", "disabled"); - } - } - else { - $("input[name=faq_back_to_top]").attr("disabled", "disabled"); - $("input[name=faq_qa_mark]").attr("disabled", "disabled"); - $("input[name=faq_question_label]").attr("disabled", "disabled"); - $("input[name=faq_answer_label]").attr("disabled", "disabled"); - } - - // Enable / disable "hide_answer" only settings. - if ($("input[name=faq_display]:checked").val() != "hide_answer") { - $("input[name=faq_hide_qa_accordion]").attr("disabled", "disabled"); - } - else { - $("input[name=faq_hide_qa_accordion]").removeAttr("disabled"); - } - - // Enable / disable "new_page" only settings. - if ($("input[name=faq_display]:checked").val() != "new_page") { - $("input[name=faq_use_teaser]").removeAttr("disabled"); - $("input[name=faq_more_link]").removeAttr("disabled"); - $("input[name=faq_disable_node_links]").removeAttr("disabled"); - } - else { - $("input[name=faq_use_teaser]").attr("disabled", "disabled"); - $("input[name=faq_more_link]").attr("disabled", "disabled"); - $("input[name=faq_disable_node_links]").attr("disabled", "disabled"); - } - teaser_handler(event); - - // Enable / disable "new_page" and "questions_top" only settings. - if ($("input[name=faq_display]:checked").val() == "new_page" || - $("input[name=faq_display]:checked").val() == "questions_top") { - $("select[name=faq_question_listing]").removeAttr("disabled"); - } - else { - $("select[name=faq_question_listing]").attr("disabled", "disabled"); - } - -} - -function qa_mark_handler(event) { - if ($("input[name=faq_display]:checked").val() == "questions_inline") { - // Enable / disable label settings according to "qa_mark" setting. - if ($("input[name=faq_qa_mark]:checked").val() == 1) { - $("input[name=faq_question_label]").removeAttr("disabled"); - $("input[name=faq_answer_label]").removeAttr("disabled"); - } - else { - $("input[name=faq_question_label]").attr("disabled", "disabled"); - $("input[name=faq_answer_label]").attr("disabled", "disabled"); - } - } -} - -function questions_top_handler(event) { - $("input[name=faq_display]").val() == "questions_top" ? - $("input[name=faq_group_questions_top]").removeAttr("disabled"): - $("input[name=faq_group_questions_top]").attr("disabled", "disabled"); - - $("input[name=faq_display]").val() == "questions_top" ? - $("input[name=faq_answer_category_name]").removeAttr("disabled"): - $("input[name=faq_answer_category_name]").attr("disabled", "disabled"); -} - - -function child_term_handler(event) { - if ($("input[name=faq_hide_child_terms]:checked").val() == 1) { - $("input[name=faq_show_term_page_children]").attr("disabled", "disabled"); - } - else if ($("input[name=faq_category_display]:checked").val() != "categories_inline") { - $("input[name=faq_show_term_page_children]").removeAttr("disabled"); - } -} - - -function categories_handler(event) { - if ($("input[name=faq_display]").val() == "questions_top") { - $("input[name=faq_category_display]:checked").val() == "categories_inline" ? - $("input[name=faq_group_questions_top]").removeAttr("disabled"): - $("input[name=faq_group_questions_top]").attr("disabled", "disabled"); - $("input[name=faq_category_display]:checked").val() == "new_page" ? - $("input[name=faq_answer_category_name]").attr("disabled", "disabled"): - $("input[name=faq_answer_category_name]").removeAttr("disabled"); - } - else { - $("input[name=faq_group_questions_top]").attr("disabled", "disabled"); - } - - // Enable / disable "hide_qa" only settings. - if ($("input[name=faq_category_display]:checked").val() != "hide_qa") { - $("input[name=faq_category_hide_qa_accordion]").attr("disabled", "disabled"); - } - else { - $("input[name=faq_category_hide_qa_accordion]").removeAttr("disabled"); - } - - $("input[name=faq_category_display]:checked").val() == "categories_inline" ? - $("input[name=faq_hide_child_terms]").attr("disabled", "disabled"): - $("input[name=faq_hide_child_terms]").removeAttr("disabled"); - $("input[name=faq_category_display]:checked").val() == "categories_inline" ? - $("input[name=faq_show_term_page_children]").attr("disabled", "disabled"): - $("input[name=faq_show_term_page_children]").removeAttr("disabled"); - $("input[name=faq_category_display]:checked").val() == "new_page" ? - $("select[name=faq_category_listing]").removeAttr("disabled"): - $("select[name=faq_category_listing]").attr("disabled", "disabled"); - - child_term_handler(); -} - -Drupal.behaviors.initFaqModule = function (context) { - // Hide/show answer for a question. - var faq_hide_qa_accordion = Drupal.settings.faq.faq_hide_qa_accordion; - $('div.faq-dd-hide-answer', context).addClass("collapsible collapsed"); - - if (!faq_hide_qa_accordion) { - $('div.faq-dd-hide-answer:not(.faq-processed)', context).addClass('faq-processed').hide(); - } - - $('div.faq-dt-hide-answer:not(.faq-processed)', context).addClass('faq-processed').click(function() { - if (faq_hide_qa_accordion) { - $('div.faq-dt-hide-answer').not($(this)).removeClass('faq-qa-visible'); - } - $(this).toggleClass('faq-qa-visible'); - $(this).parent().addClass('faq-viewed'); - $('div.faq-dd-hide-answer').not($(this).next('div.faq-dd-hide-answer')).addClass("collapsed"); - if (!faq_hide_qa_accordion) { - $(this).next('div.faq-dd-hide-answer').slideToggle('fast', function() { - $(this).parent().toggleClass('expanded'); - }); - } - $(this).next('div.faq-dd-hide-answer').toggleClass("collapsed"); - - // Change the fragment, too, for permalink/bookmark. - // To keep the current page from scrolling, refs - // http://stackoverflow.com/questions/1489624/modifying-document-location-hash-without-page-scrolling/1489802#1489802 - var hash = $(this).find('a').attr('id'); - var fx, node = $('#' + hash); - if (node.length) { - fx = $('
') - .css({position: 'absolute', visibility: 'hidden', top: $(window).scrollTop() + 'px'}) - .attr('id', hash) - .appendTo(document.body); - node.attr('id', ''); - } - document.location.hash = hash; - if (node.length) { - fx.remove(); - node.attr('id', hash); - } - - // Scroll the page if the collapsed FAQ is not visible. - // If we have the toolbar so the title may be hidden by the bar. - var mainScrollTop = Math.max($('html', context).scrollTop(), $('body', context).scrollTop()); - // We compute mainScrollTop because the behaviour is different on FF, IE and CR - if (mainScrollTop > $(this).offset().top) { - $('html, body', context).animate({ - scrollTop: $(this).offset().top - }, 1); - } - - return false; - }); - - // Show any question identified by a fragment - if (/^#\w+$/.test(document.location.hash)) { - $('div.faq-dt-hide-answer > ' + document.location.hash).parent().triggerHandler('click'); - } - - // Hide/show q/a for a category. - var faq_category_hide_qa_accordion = Drupal.settings.faq.faq_category_hide_qa_accordion; - $('div.faq-qa-hide', context).addClass("collapsible collapsed"); - if (!faq_category_hide_qa_accordion) { - $('div.faq-qa-hide', context).hide(); - } - $('div.faq-qa-header .faq-header:not(.faq-processed)', context).addClass('faq-processed').click(function() { - if (faq_category_hide_qa_accordion) { - $('div.faq-qa-header .faq-header').not($(this)).removeClass('faq-category-qa-visible'); - } - $(this).toggleClass('faq-category-qa-visible'); - $('div.faq-qa-hide').not($(this).parent().next('div.faq-qa-hide')).addClass("collapsed"); - if (!faq_category_hide_qa_accordion) { - $(this).parent().next('div.faq-qa-hide').slideToggle('fast', function() { - $(this).parent().toggleClass('expanded'); - }); - } - $(this).parent().next('div.faq-qa-hide').toggleClass("collapsed"); - - // Scroll the page if the collapsed FAQ is not visible. - // If we have the toolbar so the title may be hidden by the bar. - var mainScrollTop = Math.max($('html', context).scrollTop(), $('body', context).scrollTop()); - // We compute mainScrollTop because the behaviour is different on FF, IE and CR - if (mainScrollTop > $(this).offset().top) { - $('html, body', context).animate({ - scrollTop: $(this).offset().top - }, 1); - } - - return false; - }); - - - // Show expand all link. - if (!faq_hide_qa_accordion && !faq_category_hide_qa_accordion) { - $('#faq-expand-all', context).show(); - $('#faq-expand-all a.faq-expand-all-link', context).show(); - - // Add collapse link click event. - $('#faq-expand-all a.faq-collapse-all-link:not(.faq-processed)', context).addClass('faq-processed').click(function () { - $(this).hide(); - $('#faq-expand-all a.faq-expand-all-link').show(); - $('div.faq-qa-hide').slideUp('slow', function() { - $(this).removeClass('expanded'); - }); - $('div.faq-dd-hide-answer').slideUp('slow', function() { - $(this).removeClass('expanded'); - }); - }); - - // Add expand link click event. - $('#faq-expand-all a.faq-expand-all-link:not(.faq-processed)', context).addClass('faq-processed').click(function () { - $(this).hide(); - $('#faq-expand-all a.faq-collapse-all-link').show(); - $('div.faq-qa-hide').slideDown('slow', function() { - $(this).addClass('expanded'); - }); - $('div.faq-dd-hide-answer').slideDown('slow', function() { - $(this).addClass('expanded'); - }); - }); - } - - - - // Handle faq_category_settings_form. - faq_display_handler(); - questions_top_handler(); - categories_handler(); - teaser_handler(); - $("input[name=faq_display]:not(.faq-processed)", context).addClass('faq-processed').bind("click", faq_display_handler); - $("input[name=faq_qa_mark]:not(.faq-processed)", context).addClass('faq-processed').bind("click", qa_mark_handler); - $("input[name=faq_use_teaser]:not(.faq-processed)", context).addClass('faq-processed').bind("click", teaser_handler); - $("input[name=faq_category_display]:not(.faq-processed)", context).addClass('faq-processed').bind("click", categories_handler); - $("input[name=faq_hide_child_terms]:not(.faq-processed)", context).addClass('faq-processed').bind("click", child_term_handler); -} - - diff --git a/modules/faq/faq.module b/modules/faq/faq.module deleted file mode 100644 index 6c21067..0000000 --- a/modules/faq/faq.module +++ /dev/null @@ -1,1520 +0,0 @@ -'. t("This module allows users with the 'create faq' permission to create question and answer pairs which will be displayed on the 'faq' page. The 'faq' page is automatically generated from the FAQ nodes configured and the layout of this page can be modified on the settings page. Users will need the 'view faq page' permission in order to view the 'faq' page.") .''. - ''. t("To create a question and answer, the user must create a 'FAQ' node (Create content >> FAQ). This screen allows the user to edit the question and answer text. If the 'Taxonomy' module is enabled and there are some terms configured for the FAQ node type, it will also be possible to put the questions into different categories when editing.") .'
'. - ''. t("The 'Frequently Asked Questions' settings configuration screen will allow users with 'administer faq' permissions to specify different layouts of the questions and answers.") .'
'. - ''. t("All users with 'view faq page' permissions will be able to view the generated FAQ page at 'www.example.com/faq'.") .'
'; - return $output; - case 'admin/modules#description': - return t('Allows the user to configure the layout of questions and answers on a FAQ page.'); - } -} - -/** - * Implements hook_perm(). - */ -function faq_perm() { - return array('administer faq', 'view faq page', 'edit own faq', 'edit faq', 'create faq', 'administer faq order', 'delete faq content', 'delete own faq content'); -} - - -/** - * Implements hook_access(). - */ -function faq_access($op, $node, $account = NULL) { - global $user; - if (empty($account)) { - $account = $user; - } - - if ($op != 'create') { - $node = (object)$node; - } - if ($op == 'create') { - if (user_access('create faq')) { - return TRUE; - } - } - elseif ($op == 'update') { - if (user_access('edit faq')) { - return TRUE; - } - elseif (user_access('edit own faq') && $account->uid == $node->uid) { - return TRUE; - } - } - elseif ($op == 'delete') { - if (user_access('delete faq content')) { - return TRUE; - } - elseif (user_access('delete own faq content') && $account->uid == $node->uid) { - return TRUE; - } - } -} - -/** - * Implements hook_menu(). - */ -function faq_menu() { - $items = array(); - - $items['faq'] = array( - 'title' => 'Frequently Asked Questions', - 'page callback' => 'faq_page', - 'access callback' => 'user_access', - 'access arguments' => array('view faq page'), - 'weight' => 1, - ); - - $items['faq/list'] = array( - 'title' => 'List', - 'page callback' => 'faq_page', - 'access callback' => 'user_access', - 'access arguments' => array('view faq page'), - 'weight' => -10, - 'type' => MENU_DEFAULT_LOCAL_TASK, - ); - - $items['faq/order'] = array( - 'title' => 'Order', - 'description' => 'Allows the user to configure the order of questions and answers on a FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('faq_order_settings_form'), - 'access callback' => 'user_access', - 'access arguments' => array('administer faq order'), - 'type' => MENU_LOCAL_TASK, - 'weight' => -8, - ); - - $items['faq/%'] = array( - 'title' => 'Frequently Asked Questions', - 'page callback' => 'faq_page', - 'page arguments' => array(1), - 'access callback' => 'user_access', - 'access arguments' => array('view faq page'), - 'type' => MENU_CALLBACK, - ); - - $items['faq/%/list'] = array( - 'title' => 'List', - 'page callback' => 'faq_page', - 'page arguments' => array(1), - 'access callback' => 'user_access', - 'access arguments' => array('view faq page'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - - $items['faq/%/order'] = array( - 'title' => 'Order', - 'description' => 'Allows the user to configure the order of questions and answers on a FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('faq_order_settings_form', 1), - 'access callback' => 'user_access', - 'access arguments' => array('administer faq order'), - 'type' => MENU_LOCAL_TASK, - 'weight' => -8, - ); - - $items['admin/settings/faq'] = array( - 'title' => 'Frequently Asked Questions', - 'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'faq_settings_page', - 'access callback' => 'user_access', - 'access arguments' => array('administer faq'), - ); - $items['admin/settings/faq/general'] = array( - 'title' => 'General', - 'description' => 'Allows the user to configure the header and descriptive text for the FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('faq_general_settings_form'), - 'access callback' => 'user_access', - 'access arguments' => array('administer faq'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - $items['admin/settings/faq/questions'] = array( - 'title' => 'Questions', - 'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('faq_questions_settings_form'), - 'access callback' => 'user_access', - 'access arguments' => array('administer faq'), - 'type' => MENU_LOCAL_TASK, - 'weight' => -9, - ); - $items['admin/settings/faq/categories'] = array( - 'title' => 'Categories', - 'description' => 'Allows the user to configure the layout of questions and answers using categories on a FAQ page.', - 'file' => 'faq.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('faq_categories_settings_form'), - 'access callback' => 'user_access', - 'access arguments' => array('administer faq'), - 'type' => MENU_LOCAL_TASK, - 'weight' => -8, - ); - return $items; -} - -/** - * Implements hook_node_info(). - * - * Defines the FAQ node/content type. - * @return - * An array, containing the title, module name and the description. - */ -function faq_node_info() { - return array( - 'faq' => array( - 'name' => t('FAQ'), - 'module' => 'faq', - 'description' => t('A frequently asked question and its answer.'), - 'title_label' => t('Question'), - 'body_label' => t('Answer'), - ) - ); -} - -/** - * Defines the form where new questions and answers are written. - * - * @param &$node - * The node being added or edited. - * @param &$param - * The hook can set this variable to an associative array of attributes to add - * to the enclosing