Commit 584e4c9e by Scott

Link title on question page; add [closed] indicator

parent e9f0c3a1
...@@ -75,21 +75,30 @@ ...@@ -75,21 +75,30 @@
), ),
); );
$qa_content['q_list']['qs']=array(); $qa_content['q_list']['qs'] = array();
if (count($questions)) { if (count($questions)) {
$qa_content['title']=$sometitle; $qa_content['title'] = $sometitle;
$defaults=qa_post_html_defaults('Q'); $defaults = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) if (isset($categorypathprefix))
$defaults['categorypathprefix']=$categorypathprefix; $defaults['categorypathprefix'] = $categorypathprefix;
foreach ($questions as $question) foreach ($questions as $question) {
$qa_content['q_list']['qs'][]=qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
$usershtml, null, qa_post_html_options($question, $defaults));
} else if (!empty($fields['raw']['closedbyid'])) {
$qa_content['title']=$nonetitle; $fields['closed'] = array(
'state' => qa_lang_html('main/closed'),
);
}
$qa_content['q_list']['qs'][] = $fields;
}
}
else
$qa_content['title'] = $nonetitle;
if (isset($userid) && isset($categoryid)) { if (isset($userid) && isset($categoryid)) {
$favoritemap=qa_get_favorite_non_qs_map(); $favoritemap=qa_get_favorite_non_qs_map();
......
...@@ -369,6 +369,7 @@ ...@@ -369,6 +369,7 @@
if ($closepost['basetype']=='Q') { if ($closepost['basetype']=='Q') {
$q_view['closed']=array( $q_view['closed']=array(
'state' => qa_lang_html('main/closed'),
'label' => qa_lang_html('question/closed_as_duplicate'), 'label' => qa_lang_html('question/closed_as_duplicate'),
'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())), 'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())),
'url' => qa_q_path_html($closepost['postid'], $closepost['title']), 'url' => qa_q_path_html($closepost['postid'], $closepost['title']),
...@@ -378,6 +379,7 @@ ...@@ -378,6 +379,7 @@
$viewer=qa_load_viewer($closepost['content'], $closepost['format']); $viewer=qa_load_viewer($closepost['content'], $closepost['format']);
$q_view['closed']=array( $q_view['closed']=array(
'state' => qa_lang_html('main/closed'),
'label' => qa_lang_html('question/closed_with_note'), 'label' => qa_lang_html('question/closed_with_note'),
'content' => $viewer->get_html($closepost['content'], $closepost['format'], array( 'content' => $viewer->get_html($closepost['content'], $closepost['format'], array(
'blockwordspreg' => qa_get_block_words_preg(), 'blockwordspreg' => qa_get_block_words_preg(),
......
...@@ -693,8 +693,22 @@ ...@@ -693,8 +693,22 @@
public function title() public function title()
{ {
if (isset($this->content['title'])) $q_view = @$this->content['q_view'];
$this->output($this->content['title']);
// link title where appropriate
$url = isset($q_view['url']) ? $q_view['url'] : false;
if (isset($this->content['title'])) {
$this->output(
$url ? '<a href="'.$url.'">' : '',
$this->content['title'],
$url ? '</a>' : ''
);
}
// add closed note in title
if (!empty($q_view['closed']))
$this->output(' ['.$q_view['closed']['state'].']');
} }
public function favorite_inner_html($favorite) public function favorite_inner_html($favorite)
...@@ -1478,6 +1492,8 @@ ...@@ -1478,6 +1492,8 @@
$this->output( $this->output(
'<div class="qa-q-item-title">', '<div class="qa-q-item-title">',
'<a href="'.$q_item['url'].'">'.$q_item['title'].'</a>', '<a href="'.$q_item['url'].'">'.$q_item['title'].'</a>',
// add closed note in title
empty($q_item['closed']) ? '' : ' ['.$q_item['closed']['state'].']',
'</div>' '</div>'
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment