From d762f9eb9d039c6ef8ab409e7eb5b4fdbcf5a655 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 26 May 2002 03:23:08 +0000 Subject: [PATCH] Changed to allow inline editing of questions. --- lib/WebGUI/Wobject/FAQ.pm | 49 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/lib/WebGUI/Wobject/FAQ.pm b/lib/WebGUI/Wobject/FAQ.pm index e5d3b18f7..9aa6b224f 100644 --- a/lib/WebGUI/Wobject/FAQ.pm +++ b/lib/WebGUI/Wobject/FAQ.pm @@ -99,7 +99,7 @@ sub www_deleteQuestionConfirm { if (WebGUI::Privilege::canEditPage()) { WebGUI::SQL->write("delete from FAQ_question where questionId=$session{form}{qid}"); _reorderQuestions($_[0]->get("wobjectId")); - return $_[0]->www_edit(); + return ""; } else { return WebGUI::Privilege::insufficient(); } @@ -107,7 +107,7 @@ sub www_deleteQuestionConfirm { #------------------------------------------------------------------- sub www_edit { - my ($f, $output, @question, $sth, $proceed); + my ($f, $output, $proceed); if (WebGUI::Privilege::canEditPage()) { if ($_[0]->get("wobjectId") eq "new") { $proceed = 1; @@ -117,23 +117,6 @@ sub www_edit { $f = WebGUI::HTMLForm->new; $f->yesNo("proceed",WebGUI::International::get(1,$namespace),$proceed); $output = $_[0]->SUPER::www_edit($f->printRowsOnly); - unless ($_[0]->get("wobjectId") eq "new") { - $output .= '

'.WebGUI::International::get(9,$namespace).'

'; - $output .= ''; - $sth = WebGUI::SQL->read("select questionId,question from FAQ_question where wobjectId=" - .$_[0]->get("wobjectId")." order by sequenceNumber"); - while (@question = $sth->array) { - $output .= ''; - } - $sth->finish; - $output .= '
' - .editIcon('func=editQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question[0]) - .deleteIcon('func=deleteQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question[0]) - .moveUpIcon('func=moveQuestionUp&wid='.$_[0]->get("wobjectId").'&qid='.$question[0]) - .moveDownIcon('func=moveQuestionDown&wid='.$_[0]->get("wobjectId").'&qid='.$question[0]) - .''.$question[1].'
'; - } return $output; } else { return WebGUI::Privilege::insufficient(); @@ -194,7 +177,7 @@ sub www_editQuestionSave { $session{form}{qid} = "new"; return $_[0]->www_editQuestion(); } else { - return $_[0]->www_edit(); + return ""; } } else { return WebGUI::Privilege::insufficient(); @@ -211,7 +194,7 @@ sub www_moveQuestionDown { WebGUI::SQL->write("update FAQ_question set sequenceNumber=sequenceNumber+1 where questionId=$session{form}{qid}"); WebGUI::SQL->write("update FAQ_question set sequenceNumber=sequenceNumber-1 where questionId=$data[0]"); } - return $_[0]->www_edit(); + return ""; } else { return WebGUI::Privilege::insufficient(); } @@ -227,7 +210,7 @@ sub www_moveQuestionUp { WebGUI::SQL->write("update FAQ_question set sequenceNumber=sequenceNumber-1 where questionId=$session{form}{qid}"); WebGUI::SQL->write("update FAQ_question set sequenceNumber=sequenceNumber+1 where questionId=$data[0]"); } - return $_[0]->www_edit(); + return ""; } else { return WebGUI::Privilege::insufficient(); } @@ -235,14 +218,26 @@ sub www_moveQuestionUp { #------------------------------------------------------------------- sub www_view { - my (@question, $output, $sth, $qNa); + my (%question, $output, $sth, $qNa); + tie %question,'Tie::CPHash'; $output = $_[0]->displayTitle; $output .= $_[0]->description; + if ($session{var}{adminOn}) { + $output .= '' + .WebGUI::International::get(9,$namespace).''; + } $output .= '

'.$qNa;