Skip to content

Commit

Permalink
fixed roles
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahY committed Dec 25, 2011
1 parent 5688371 commit 7c1d519
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
29 changes: 27 additions & 2 deletions qa-wiki-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function admin_form(&$qa_content)

qa_opt('wiki_send_enable',(bool)qa_post_text('wiki_send_enable'));
qa_opt('wiki_send_allow',(int)qa_post_text('wiki_send_allow'));
qa_opt('wiki_send_allow_points',(int)qa_post_text('wiki_send_allow_points'));
qa_opt('wiki_page_css',qa_post_text('wiki_page_css'));

$ok = qa_lang('admin/options_saved');
Expand All @@ -87,6 +88,12 @@ function admin_form(&$qa_content)
}
$ok = qa_lang('admin/options_reset');
}

if(qa_opt('wiki_send_allow')!=106) {
qa_set_display_rules($qa_content, array(
'wiki_send_allow_points' => 'wiki_send_allow_points_hidden',
));
}

// Create the form for display

Expand All @@ -100,16 +107,26 @@ function admin_form(&$qa_content)
'value' => qa_opt('wiki_send_enable'),
);

$permitoptions=qa_admin_permit_options(QA_PERMIT_EXPERTS, QA_PERMIT_ADMINS, (!QA_FINAL_EXTERNAL_USERS) && qa_opt('confirm_user_emails'));
$permitoptions=qa_admin_permit_options(QA_PERMIT_ALL, QA_PERMIT_ADMINS, (!QA_FINAL_EXTERNAL_USERS) && qa_opt('confirm_user_emails'));

$fields[] = array(
'id' => 'wiki_send_allow',
'label' => 'Roles allowed to send answers to wiki',
'tags' => 'NAME="wiki_send_allow" ID="wiki_send_allow"',
'tags' => 'onclick="if(this.selectedIndex==2) jQuery(\'#wiki_send_allow_points\').show(); else jQuery(\'#wiki_send_allow_points\').hide()" NAME="wiki_send_allow" ID="wiki_send_allow"',
'type' => 'select',
'options' => $permitoptions,
'value' => $permitoptions[qa_opt('wiki_send_allow')],
);

$fields[] = array(
'id' => 'wiki_send_allow_points',
'label' => 'Minimum points',
'tags' => 'NAME="wiki_send_allow_points"',
'type' => 'number',
'value' => qa_opt('wiki_send_allow_points'),
);


$fields[] = array(
'type' => 'blank',
);
Expand All @@ -126,6 +143,14 @@ function admin_form(&$qa_content)
'ok' => ($ok && !isset($error)) ? $ok : null,

'fields' => $fields,

'hidden' => array(
array(
'id' => 'wiki_send_allow_points_hidden',
'tags' => 'NAME="wiki_send_allow_points_hidden"',
'value' => 'false',
)
),

'buttons' => array(
array(
Expand Down
4 changes: 2 additions & 2 deletions qa-wiki-layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function head_custom() {
if(strpos($this->request,'wiki') === 0) {
$this->output('<style>',str_replace('^',QA_HTML_THEME_LAYER_URLTOROOT,qa_opt('wiki_page_css')),'</style>');
}

if($this->template == 'question' && qa_opt('wiki_send_enable') && qa_opt('wiki_send_allow') <= qa_get_logged_in_level() && isset($this->content['a_list']['as']) && count($this->content['a_list']['as'])) {
error_log(qa_opt('expert_question_roles'));
if($this->template == 'question' && qa_opt('wiki_send_enable') && !qa_permit_value_error(qa_opt('wiki_send_allow'), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags()) && isset($this->content['a_list']['as']) && count($this->content['a_list']['as'])) {
$wikified = $this->wiki_meta();
foreach($this->content['a_list']['as'] as $idx => $answer) {
if(qa_clicked('a_to_wiki_'.$idx)) {
Expand Down

0 comments on commit 7c1d519

Please sign in to comment.