Moved all collateral reorder operations into the Wobject superclass.

This commit is contained in:
JT Smith 2002-09-30 04:52:28 +00:00
parent 82490a390f
commit d309be32f5
6 changed files with 40 additions and 117 deletions

View file

@ -26,17 +26,6 @@ our $namespace = "FAQ";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub _reorderQuestions {
my ($sth, $i, $qid);
$sth = WebGUI::SQL->read("select questionId from FAQ_question where wobjectId=$_[0] order by sequenceNumber");
while (($qid) = $sth->array) {
WebGUI::SQL->write("update FAQ_question set sequenceNumber='$i' where questionId=$qid");
$i++;
}
$sth->finish;
}
#-------------------------------------------------------------------
sub duplicate {
my ($w, %data, $newQuestionId, $sth);
@ -83,7 +72,7 @@ sub www_deleteQuestionConfirm {
my ($output);
if (WebGUI::Privilege::canEditPage()) {
$_[0]->deleteCollateral("FAQ_question","questionId",$session{form}{qid});
_reorderQuestions($_[0]->get("wobjectId"));
$_[0]->reorderCollateral("FAQ_question","questionId");
return "";
} else {
return WebGUI::Privilege::insufficient();