? faq.module.vmod ? faq.module.vtea ? po Index: faq-category-questions-inline.tpl.php =================================================================== RCS file: faq-category-questions-inline.tpl.php diff -N faq-category-questions-inline.tpl.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ faq-category-questions-inline.tpl.php 19 Jan 2008 11:02:04 -0000 @@ -0,0 +1,126 @@ + 0) { + $hdr = 'h6'; +} +else { + $hdr = 'h5'; +} + +?>
+ +
+ + < class="faq_header"> + + + + () + + > + + + + +

+ +

+ +
+
+ + + +
+ < class="faq_category_list"> + $subcat): ?> +
  • + + + () + + +

    + +

    + +
    +
  • + + > +
    + + +
    + + + $subcat_html): ?> +
    + +
    + + + +
    + $node): ?> +
    + + + + +
    +
    + + + + + + + + +
    + +
    + +
    + +
    Index: faq.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v retrieving revision 1.1.4.52.2.27 diff -u -p -r1.1.4.52.2.27 faq.module --- faq.module 9 Jan 2008 12:36:21 -0000 1.1.4.52.2.27 +++ faq.module 19 Jan 2008 11:02:09 -0000 @@ -818,6 +818,7 @@ function faq_theme() { 'arguments' => array('result' => NULL, 'display_vars' => NULL), ), 'faq_category_questions_inline' => array( + 'template' => 'faq-category-questions-inline', 'arguments' => array('result' => NULL, 'display_vars' => NULL, 'term' => NULL, 'class' => NULL), ), 'faq_new_page' => array( @@ -1370,10 +1371,14 @@ function template_preprocess_faq_questio $variables['nodes'] = $nodes; } -function theme_faq_category_questions_inline($result, $display_vars, $term, $class) { +function template_preprocess_faq_category_questions_inline(&$variables) { + $result = $variables['result']; + $display_vars = $variables['display_vars']; + $term = $variables['term']; + $class = $variables['class']; + $this_page = 'faq'; $get_sub_terms = 0; - $count = 0; if (arg(0) == 'faq' && is_numeric(arg(1))) { $this_page .= "/". arg(1); $get_sub_terms = arg(1); @@ -1382,114 +1387,82 @@ function theme_faq_category_questions_in // configure "back to top" link $back_to_top = ''; if (!empty($display_vars['back_to_top'])) { - $back_to_top = ''; + $back_to_top = l(t($display_vars['back_to_top']), $this_page, array('attributes' => array(), 'query' => NULL, 'fragment' => '')); } + $variables['back_to_top'] = $back_to_top; // configure labels - $que_label = ''; - $ans_label = ''; + $question_label = ''; + $answer_label = ''; if ($display_vars['faq_qa_mark']) { - $que_label = t($display_vars["faq_question_label"]) .' '; - $ans_label = ''. t($display_vars["faq_answer_label"]) .' '; + $question_label = t($display_vars["faq_question_label"]) .' '; + $answer_label = t($display_vars["faq_answer_label"]) .' '; } + $variables['question_label'] = $question_label; + $variables['answer_label'] = $answer_label; // get number of questions, and account for hidden sub-cats + $count = 0; if ($display_vars['faq_count'] && $display_vars['hide_sub_categories']) { $count = taxonomy_term_count_nodes($term->tid, 'faq'); } + $variables['display_faq_count'] = $display_vars['faq_count']; // get taxonomy image - $term_img = ''; + $variables['term_img'] = ''; if (module_exists('taxonomy_image')) { - $term_img = taxonomy_image_display($term->tid, 'class="faq_tax_image"'); + $variables['term_img'] = taxonomy_image_display($term->tid, 'class="faq_tax_image"'); } // configure header - $hdr = "h5"; - if ($term->depth > 0) $hdr = "h6"; - $header = "<$hdr class=\"faq_header\">"; - $header .= $term_img; + $variables['display_header'] = $display_vars['display_header']; + $variables['category_depth'] = $term->depth; if ($display_vars['category_display'] == 'hide_qa') { - $header .= l($term->name, "faq/$term->tid"); + $variables['header_title'] = l($term->name, "faq/$term->tid"); } else { - $header .= check_plain($term->name); + $variables['header_title'] = check_plain($term->name); } - if ($display_vars['faq_count']) $header .= " (%%FAQ_COUNT%%)"; - $header .= "\n"; // configure category description - $desc = ''; - if (!empty($term->description)) { - $desc = '

    '; - $desc .= $term->description ."

    \n"; - } - $desc .= '
    '; - + $variables['description'] = $term->description; // get list of sub-categories if necessary - $sub_cats = ''; + $scats = array(); if (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'new_page') { $list = taxonomy_get_children($term->tid); - $scats = array(); foreach ($list as $tid => $sub_term) { $sub_count = taxonomy_term_count_nodes($sub_term->tid, 'faq'); if ($sub_count) { - - // configure sub cat description - $sub_cat_desc = ''; - if (!empty($sub_term->description)) { - $sub_cat_desc = '

    '; - $sub_cat_desc .= $sub_term->description ."

    "; - } - // get taxonomy image $sub_term_img = ''; if (module_exists('taxonomy_image')) { $sub_term_img = taxonomy_image_display($sub_term->tid, 'class="faq_tax_image"'); - } - // configure sub cat header - if ($display_vars['faq_count']) { - $scats_hdr = l($sub_term->name, "faq/$sub_term->tid") ." ($sub_count) $sub_cat_desc"; - $scats_hdr .= '
    '; - } - else { - $scats_hdr = l($sub_term->name, "faq/$sub_term->tid") . $sub_cat_desc; - $scats_hdr .= '
    '; - } - - $scats[] = $scats_hdr; + $scat_vars['link'] = l($sub_term->name, "faq/$sub_term->tid"); + $scat_vars['description'] = $sub_term->description; + $scat_vars['count'] = $sub_count; + $scat_vars['img'] = $sub_term_img; + $scats[] = $scat_vars; } } - $list_style = variable_get('faq_category_listing', 'ul'); - $sub_cats .= theme('item_list', $scats, NULL, $list_style, array("class" => "faq_category_list")); } + $variables['subcat_list'] = $scats; + $variables['subcat_list_style'] = variable_get('faq_category_listing', 'ul'); - - $output = '
    '."\n"; - if ($display_vars['display_header'] == 1) { - $output .= '
    '. $header . $desc ."
    \n"; - } - else { - $output .= '
    '. $term_img . $desc ."
    \n"; - } - $output .= $sub_cats; - $sub_cats = ''; - - + // configure class (faq_qa or faq_qa_hide) if ($get_sub_terms == $term->tid) { - $output .= '
    '."\n"; + $variables['container_class'] = 'faq_qa'; } else { - $output .= '
    '."\n"; + $variables['container_class'] = $class; } - + // configure subcategory bodies (theme recursively) + $sub_cat_htmls = array(); if (($get_sub_terms && $display_vars['category_display'] == 'categories_inline') || (($display_vars['show_cat_sub_cats'] || $display_vars['hide_sub_categories']) && $display_vars['category_display'] == 'hide_qa')) { $list = taxonomy_get_children($term->tid); @@ -1498,53 +1471,47 @@ function theme_faq_category_questions_in if (taxonomy_term_count_nodes($sub_term->tid, 'faq')) { $sub_result = db_query(db_rewrite_sql("SELECT n.nid, n.title, r.body, r.teaser, r.format, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid AND r.vid = n.vid INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY weight, n.sticky DESC, n.created DESC", "n", "nid"), $sub_term->tid); $display_vars['display_header'] = 1; - $sub_cats .= '
    '; - $sub_cats .= theme('faq_category_questions_inline', $sub_result, $display_vars, $sub_term, $class); - $sub_cats .= '
    '; + $sub_cat_htmls[] = theme('faq_category_questions_inline', $sub_result, $display_vars, $sub_term, $variables['class']); } } - $output .= $sub_cats; } + $variables['subcat_body_list'] = $sub_cat_htmls; - if ($result) { - $output .= "
    \n"; + if (!$result) { + $variables['question_count'] = 0; + return; + } - while ($node = db_fetch_object($result)) { - $node = node_load($node->nid); - if (node_access("view", $node)) { - if (!$display_vars['hide_sub_categories']) { - $count++; - } - $output .= '
    '; - $output .= l($que_label . $node->title, "node/$node->nid") ."
    \n"; + $nodes = array(); + while ($node = db_fetch_object($result)) { + $node = node_load($node->nid); + if (node_access("view", $node)) { + if (!$display_vars['hide_sub_categories']) { + $count++; + } + $node_var = array(); + $node_var['link'] = l($node->title, "node/$node->nid"); - // should we display teaser or full text - if ($display_vars['use_teaser']) { - $more_link = ''; - if (!empty($display_vars['more_link']) && strlen($node->teaser) < strlen($node->body)) { - $more_link = ''; - } - $output .= '
    '; - $output .= check_markup($ans_label . $node->teaser, $node->format, FALSE); - $output .= $more_link . $back_to_top ."
    \n"; + // Should we display teaser or full text? + if ($display_vars['use_teaser']) { + if (!empty($display_vars['more_link']) && strlen($node->teaser) < strlen($node->body)) { + $node_var['more_link'] = l(t($display_vars['more_link']), "node/$node->nid"); } + $node_var['body'] = check_markup($node->teaser, $node->format, FALSE); + } - // full text - else { - $output .= '
    '; - $output .= check_markup($ans_label . $node->body, $node->format, FALSE); - $output .= $back_to_top ."
    \n"; - } + // Full text. + else { + $node_var['body'] = check_markup($node->body, $node->format, FALSE); } + + $nodes[] = $node_var; } - $output .= "
    \n"; } - $output .= "
    \n
    \n"; - - if ($display_vars['faq_count']) $output = str_replace('%%FAQ_COUNT%%', $count, $output); - return $output; + $variables['nodes']=$nodes; + $variables['question_count'] = $count; + $variables['use_teaser'] = $display_vars['use_teaser']; } function template_preprocess_faq_new_page(&$variables) {