Use objectManager to add and edit notes
This commit is contained in:
committed by
Chris Morgan
parent
a6a62a2299
commit
72a250b2b0
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/************************/
|
||||
/* Add Application Note */
|
||||
/************************/
|
||||
|
||||
require("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require_once(BASE."include/note.php");
|
||||
|
||||
//FIXME: get rid of appId references everywhere, as version is enough.
|
||||
$sQuery = "SELECT appId FROM appVersion WHERE versionId = '?'";
|
||||
$hResult = query_parameters($sQuery, $aClean['iVersionId']);
|
||||
$oRow = query_fetch_object($hResult);
|
||||
$appId = $oRow->appId;
|
||||
|
||||
//check for admin privs
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->isMaintainer($aClean['iVersionId']) &&
|
||||
!$_SESSION['current']->isSuperMaintainer($aClean['iAppId']))
|
||||
{
|
||||
util_show_error_page_and_exit("Insufficient Privileges!");
|
||||
}
|
||||
|
||||
//set link for version
|
||||
if(is_numeric($aClean['iVersionId']) and !empty($aClean['iVersionId']))
|
||||
{
|
||||
$oVersion = new version($aClean['iVersionId']);
|
||||
$sVersionLink = $oVersion->objectMakeUrl();
|
||||
}
|
||||
else
|
||||
exit;
|
||||
|
||||
$oNote = new Note();
|
||||
$oNote->GetOutputEditorValues($aClean);
|
||||
|
||||
if($aClean['sSub'] == "Submit")
|
||||
{
|
||||
$oNote->create();
|
||||
util_redirect_and_exit($sVersionLink);
|
||||
}
|
||||
else if($aClean['sSub'] == 'Preview' OR empty($aClean['sSubmit']))
|
||||
{
|
||||
// show form
|
||||
apidb_header("Application Note");
|
||||
|
||||
if($aClean['sSub'] == 'Preview')
|
||||
$oNote->show(true);
|
||||
|
||||
echo "<form method=post action='addAppNote.php'>\n";
|
||||
|
||||
$oNote->outputEditor();
|
||||
|
||||
echo '<center>';
|
||||
echo '<input type="submit" name="sSub" value="Preview"> ',"\n";
|
||||
echo '<input type="submit" name="sSub" value="Submit"></td></tr>',"\n";
|
||||
echo '</center>';
|
||||
|
||||
echo html_back_link(1,$sVersionLink);
|
||||
apidb_footer();
|
||||
}
|
||||
?>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/****************/
|
||||
/* Edit AppNote */
|
||||
/****************/
|
||||
|
||||
require("path.php");
|
||||
require(BASE."include/incl.php");
|
||||
require_once(BASE."include/note.php");
|
||||
|
||||
if(!is_numeric($aClean['iNoteId']))
|
||||
util_show_error_page_and_exit('Wrong note ID');
|
||||
|
||||
/* Get note data */
|
||||
$oNote = new Note($aClean['iNoteId']);
|
||||
$oVersion = new version($oNote->iVersionId);
|
||||
|
||||
/* Check for privs */
|
||||
if(!$oNote->canEdit())
|
||||
util_show_error_page_and_exit("Insufficient Privileges!");
|
||||
|
||||
if(!empty($aClean['sSub']))
|
||||
{
|
||||
$oNote->GetOutputEditorValues($aClean); /* retrieve the updated values */
|
||||
|
||||
if ($aClean['sSub'] == 'Delete')
|
||||
{
|
||||
$oNote->delete();
|
||||
}
|
||||
else if ($aClean['sSub'] == 'Update')
|
||||
{
|
||||
$oNote->update();
|
||||
}
|
||||
util_redirect_and_exit($oVersion->objectMakeUrl());
|
||||
} else /* display note */
|
||||
{
|
||||
// show form
|
||||
apidb_header("Application Note");
|
||||
|
||||
/* if preview is set display the note for review */
|
||||
if($aClean['sPreview'])
|
||||
{
|
||||
$oNote->GetOutputEditorValues($aClean); /* retrieve the updated values */
|
||||
$oNote->display(true);
|
||||
}
|
||||
|
||||
echo "<form method=post action='editAppNote.php'>\n";
|
||||
|
||||
/* display the editor for this note */
|
||||
$oNote->outputEditor();
|
||||
|
||||
echo '<center>';
|
||||
echo '<input type="submit" name=sPreview value="Preview"> ',"\n";
|
||||
echo '<input type="submit" name=sSub value="Update"> ',"\n";
|
||||
echo '<input type="submit" name=sSub value="Delete"></td></tr>',"\n";
|
||||
echo '</center>';
|
||||
|
||||
echo html_back_link(1,$oVersion->objectMakeUrl());
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
?>
|
||||
Reference in New Issue
Block a user