예제 #1
0
파일: edit.php 프로젝트: bitweaver/stickies
if (!$gContent->isvalid()) {
    $gBitSystem->fatalError(tra('Unknown content to create sticky note'));
}
$gSticky = new BitSticky(isset($_REQUEST['sticky_id']) ? $_REQUEST['sticky_id'] : '', NULL, $gContent->mContentId);
if (!$gSticky->load()) {
    $gSticky->mInfo['notated_content_id'] = $gContent->mContentId;
}
if (!empty($_REQUEST['save_sticky'])) {
    if ($gSticky->store($_REQUEST)) {
        header('Location: ' . $gContent->getDisplayUrl());
    }
} elseif (!empty($_REQUEST['preview'])) {
} elseif (!empty($_REQUEST['delete'])) {
    $formHash['content_id'] = $gContent->mContentId;
    $formHash['sticky_id'] = $gSticky->mStickyId;
    $formHash['delete'] = TRUE;
    if (!empty($_POST['confirm'])) {
        if ($gSticky->expunge()) {
            header('Location: ' . $gContent->getDisplayUrl());
            die;
        } else {
            $gBitSystem->confirmDialog($formHash, array('error' => implode($gContent->mErrors), 'warning' => tra('Are you sure you want to remove this sticky note?') . ' ' . $gSticky->mInfo['title']));
        }
    } else {
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to remove this sticky note?') . ' ' . $gSticky->mInfo['title']));
    }
}
// WYSIWYG and Quicktag variable
$gBitSmarty->assign('textarea_id', LIBERTY_TEXT_AREA);
$gBitSmarty->assign_by_ref('stickyInfo', $gSticky->mInfo);
$gBitSystem->display('bitpackage:stickies/edit_sticky.tpl', tra('Edit Sticky Note for ') . $gContent->getTitle(), array('display_mode' => 'edit'));