Index: faq.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faq/Attic/faq.admin.inc,v retrieving revision 1.1.2.7 diff -u -p -r1.1.2.7 faq.admin.inc --- faq.admin.inc 21 Dec 2008 19:18:01 -0000 1.1.2.7 +++ faq.admin.inc 22 Dec 2008 01:25:54 -0000 @@ -114,6 +114,14 @@ function faq_questions_settings_form() { '#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'), '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', 'long'), + ); + $form['faq_questions_misc']['faq_use_teaser'] = array( '#type' => 'checkbox', '#title' => t('Use answer teaser'), Index: faq.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.css,v retrieving revision 1.1.2.6.2.3 diff -u -p -r1.1.2.6.2.3 faq.css --- faq.css 21 Dec 2008 18:58:26 -0000 1.1.2.6.2.3 +++ faq.css 22 Dec 2008 01:25:54 -0000 @@ -36,3 +36,6 @@ img.faq-tax-image { padding: 0px 3px 0px 3px; } +div.faq-detailed-question { + font-style: italic; +} Index: faq.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faq/Attic/faq.install,v retrieving revision 1.1.4.16.2.20 diff -u -p -r1.1.4.16.2.20 faq.install --- faq.install 21 Nov 2008 14:19:42 -0000 1.1.4.16.2.20 +++ faq.install 22 Dec 2008 01:25:54 -0000 @@ -28,7 +28,8 @@ function faq_schema() { 'fields' => array( 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('The primary identifier for a node.')), 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('The primary identifier for a node revision.')), - 'question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => t('The faq long question text.')), + 'question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => t('The faq short question text.')), + 'detailed_question' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'description' => t('The faq long question text.')), ), 'primary key' => array('nid', 'vid'), ); @@ -127,7 +128,7 @@ function faq_update_1() { * late now. * * @return - * An array containing the structure of the SQL schema. + * An array containing the results of the update. */ function faq_update_2() { $schema['faq_questions'] = array( @@ -147,3 +148,16 @@ function faq_update_2() { 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; +} Index: faq.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v retrieving revision 1.1.4.52.2.91 diff -u -p -r1.1.4.52.2.91 faq.module --- faq.module 21 Dec 2008 19:46:13 -0000 1.1.4.52.2.91 +++ faq.module 22 Dec 2008 01:25:54 -0000 @@ -181,15 +181,25 @@ function faq_node_name($node) { function faq_form(&$node, &$param) { $type = node_get_types('type', $node); - // Question. + // Short question. $form['title'] = array( - '#type' => 'textarea', + '#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => $node->title, '#required' => TRUE, '#weight' => 0, + '#description' => t('Question to be answered. This will appear in all question listings, such as the FAQ blocks.'), + ); + + // Detailed question. + $form['detailed_question'] = array( + '#type' => 'textarea', + '#title' => t('Question details (optional)'), + '#default_value' => $node->detailed_question, + '#required' => TRUE, + '#weight' => -1, '#rows' => 3, - '#description' => t('Question to be answered'), + '#description' => t('Longer question text. This will be displayed in all layouts where the answer appears, in addition to the shorter question text.'), ); // Answer. @@ -207,7 +217,7 @@ function faq_form(&$node, &$param) { * The node object. */ function faq_insert($node) { - $ret = db_query("INSERT INTO {faq_questions} (nid, vid, question) VALUES(%d, %d, '%s')", $node->nid, $node->vid, $node->title); + $ret = db_query("INSERT INTO {faq_questions} (nid, vid, question, detailed_question) VALUES(%d, %d, '%s', '%s')", $node->nid, $node->vid, $node->title, $node->detailed_question); } /** @@ -221,7 +231,7 @@ function faq_update($node) { faq_insert($node); } else { - db_query("UPDATE {faq_questions} SET question = '%s' WHERE nid = %d AND vid = %d", $node->title, $node->nid, $node->vid); + db_query("UPDATE {faq_questions} SET question = '%s', detailed_question = '%s' WHERE nid = %d AND vid = %d", $node->title, $node->detailed_question, $node->nid, $node->vid); if (!db_affected_rows()) { faq_insert($node); } @@ -248,9 +258,15 @@ function faq_delete(&$node) { * The node object. */ function faq_load($node) { - $result = db_fetch_object(db_query('SELECT question FROM {faq_questions} WHERE nid = %d AND vid = %d', $node->nid, $node->vid)); + $result = db_fetch_object(db_query('SELECT question, detailed_question FROM {faq_questions} WHERE nid = %d AND vid = %d', $node->nid, $node->vid)); if ($result) { - $result->title = $result->question; + $question_length = variable_get('faq_question_length', 'long'); + if ($question_length == 'long' && !empty($result->detailed_question)) { + $result->title = $result->detailed_question; + } + else { + $result->title = $result->question; + } } return $result; } @@ -281,7 +297,15 @@ function faq_nodeapi(&$node, $op, $tease * The node object. */ function faq_view($node, $teaser = FALSE, $page = FALSE) { + drupal_add_css(drupal_get_path('module', 'faq') .'/faq.css'); $node = node_prepare($node, $teaser); + $node->detailed_question = check_markup($node->detailed_question, $node->format, FALSE); + $content = $node->content['body']['#value']; + + $question_length = variable_get('faq_question_length', 'long'); + if (!empty($node->detailed_question) && $question_length == 'both') { + $node->content['body']['#value'] = '