Commit 584e4c9e by Scott

Link title on question page; add [closed] indicator

parent e9f0c3a1
......@@ -75,21 +75,30 @@
),
);
$qa_content['q_list']['qs']=array();
$qa_content['q_list']['qs'] = array();
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))
$defaults['categorypathprefix']=$categorypathprefix;
$defaults['categorypathprefix'] = $categorypathprefix;
foreach ($questions as $question)
$qa_content['q_list']['qs'][]=qa_any_to_q_html_fields($question, $userid, qa_cookie_get(),
$usershtml, null, qa_post_html_options($question, $defaults));
foreach ($questions as $question) {
$fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
} else
$qa_content['title']=$nonetitle;
if (!empty($fields['raw']['closedbyid'])) {
$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)) {
$favoritemap=qa_get_favorite_non_qs_map();
......
......@@ -369,6 +369,7 @@
if ($closepost['basetype']=='Q') {
$q_view['closed']=array(
'state' => qa_lang_html('main/closed'),
'label' => qa_lang_html('question/closed_as_duplicate'),
'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())),
'url' => qa_q_path_html($closepost['postid'], $closepost['title']),
......@@ -378,6 +379,7 @@
$viewer=qa_load_viewer($closepost['content'], $closepost['format']);
$q_view['closed']=array(
'state' => qa_lang_html('main/closed'),
'label' => qa_lang_html('question/closed_with_note'),
'content' => $viewer->get_html($closepost['content'], $closepost['format'], array(
'blockwordspreg' => qa_get_block_words_preg(),
......
......@@ -693,8 +693,22 @@
public function title()
{
if (isset($this->content['title']))
$this->output($this->content['title']);
$q_view = @$this->content['q_view'];
// 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)
......@@ -1478,6 +1492,8 @@
$this->output(
'<div class="qa-q-item-title">',
'<a href="'.$q_item['url'].'">'.$q_item['title'].'</a>',
// add closed note in title
empty($q_item['closed']) ? '' : ' ['.$q_item['closed']['state'].']',
'</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