Use objectManager to add and edit notes
This commit is contained in:
committed by
Chris Morgan
parent
a6a62a2299
commit
72a250b2b0
@@ -205,7 +205,9 @@ class Note {
|
||||
|
||||
$sColor = 'blue';
|
||||
}
|
||||
|
||||
|
||||
$oVersion = new version($this->iVersionId);
|
||||
|
||||
$shOutput = html_frame_start("","98%",'',0);
|
||||
|
||||
$shOutput .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\">\n";
|
||||
@@ -219,7 +221,7 @@ class Note {
|
||||
if ($this->canEdit())
|
||||
{
|
||||
$shOutput .= "<tr class=\"color1\" align=\"center\" valign=\"top\"><td>";
|
||||
$shOutput .= "<form method=\"post\" name=\"message\" action=\"admin/editAppNote.php?iNoteId={$this->iNoteId}\">";
|
||||
$shOutput .= "<form method=\"post\" name=\"message\" action=\"objectManager.php?sClass=note&sAction=edit&iId=".$this->iNoteId."&sReturnTo=".urlencode($oVersion->objectMakeUrl())."\">";
|
||||
$shOutput .= '<input type="submit" value="Edit Note" class="button">';
|
||||
$shOutput .= '</form></td></tr>';
|
||||
}
|
||||
@@ -231,11 +233,31 @@ class Note {
|
||||
echo $shOutput;
|
||||
}
|
||||
|
||||
|
||||
function outputEditor()
|
||||
function objectGetCustomVars($sAction)
|
||||
{
|
||||
switch($sAction)
|
||||
{
|
||||
case "add":
|
||||
return array("iVersionId","sNoteTitle");
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function outputEditor($aValues = null)
|
||||
{
|
||||
if($aValues)
|
||||
{
|
||||
if(!$this->iVersionId)
|
||||
$this->iVersionId = $aValues['iVersionId'];
|
||||
|
||||
if(!$this->sTitle)
|
||||
$this->sTitle = $aValues['sNoteTitle'];
|
||||
}
|
||||
|
||||
HtmlAreaLoaderScript(array("editor"));
|
||||
|
||||
|
||||
echo html_frame_start("Edit Application Note {$aClean['noteId']}", "90%","",0);
|
||||
echo html_table_begin("width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body'");
|
||||
|
||||
|
||||
@@ -241,13 +241,7 @@ class ObjectManager
|
||||
echo '<form name="sQform" action="'.$this->makeUrl("edit", $this->iId).
|
||||
'" method="post" enctype="multipart/form-data">',"\n";
|
||||
|
||||
echo '<input type="hidden" name="sClass" value="'.$this->sClass.'" />';
|
||||
echo '<input type="hidden" name="sTitle" value="'.$this->sTitle.'" />';
|
||||
echo '<input type="hidden" name="iId" value="'.$this->iId.'" />';
|
||||
echo '<input type="hidden" name="bIsQueue" '.
|
||||
'value='.($this->bIsQueue ? "true" : "false").' />';
|
||||
echo '<input type="hidden" name="bIsRejected" '.
|
||||
'value='.($this->bIsRejected ? "true" : "false").' />';
|
||||
echo $this->makeUrlFormData();
|
||||
|
||||
$oObject->outputEditor();
|
||||
|
||||
@@ -317,6 +311,7 @@ class ObjectManager
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
|
||||
echo '<input name="sSubmit" type="submit" value="Submit" class="button">'.
|
||||
' ',"\n";
|
||||
echo '<input name="sSubmit" type="submit" value="Delete" class="button" />'."\n";
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
@@ -638,7 +633,7 @@ class ObjectManager
|
||||
}
|
||||
|
||||
/* Display screen for submitting a new entry of given type */
|
||||
function add_entry($sBackLink, $sErrors = "")
|
||||
function add_entry($aClean, $sErrors = "")
|
||||
{
|
||||
$this->checkMethods(array("outputEditor", "getOutputEditorValues",
|
||||
"update", "create"));
|
||||
@@ -661,7 +656,12 @@ class ObjectManager
|
||||
|
||||
echo "<form method=\"post\">\n";
|
||||
|
||||
$oObject->outputEditor();
|
||||
$aVars = $this->get_custom_vars($aClean, "add");
|
||||
|
||||
if($aVars)
|
||||
$oObject->outputEditor($aVars);
|
||||
else
|
||||
$oObject->outputEditor();
|
||||
|
||||
echo "<input type=\"hidden\" name=\"sClass=\"distribution\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"sTitle\" value=\"$this->sTitle\" />\n";
|
||||
|
||||
@@ -901,6 +901,7 @@ class version {
|
||||
|
||||
if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($this->iVersionId) || $_SESSION['current']->isSuperMaintainer($this->iAppId))
|
||||
{
|
||||
$shAdd = '<form method="post" name="sMessage" action="objectManager.php?sClass=note&sAction=add&iVersionId='.$this->iVersionId.'&sReturnTo='.urlencode($this->objectMakeUrl());
|
||||
echo '<tr><td colspan="2" align="center">'."\n";
|
||||
echo '<form method="post" name="sMessage" action="admin/editAppVersion.php">'."\n";
|
||||
echo "\t".'<input type="hidden" name="iAppId" value="'.$oApp->iAppId.'" />'."\n";
|
||||
@@ -911,16 +912,13 @@ class version {
|
||||
echo "<form method=\"post\" name=\"sDelete\" action=\"javascript:self.location = '".$url."'\">\n";
|
||||
echo "\t".'<input type=submit value="Delete Version" class="button" />'."\n";
|
||||
echo '</form>'."\n";
|
||||
echo '<form method="post" name="message" action="admin/addAppNote.php">'."\n";
|
||||
echo "\t".'<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'" />'."\n";
|
||||
echo $shAdd.'" />';
|
||||
echo "\t".'<input type="submit" value="Add Note" class="button" />'."\n";
|
||||
echo '</form>'."\n";
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?iVersionId='.$this->iVersionId.'>'."\n";
|
||||
echo "\t".'<input type=hidden name="sNoteTitle" value="HOWTO" />'."\n";
|
||||
echo $shAdd.'&sNoteTitle=HOWTO" />';
|
||||
echo "\t".'<input type=submit value="Add How To" class="button" />'."\n";
|
||||
echo '</form>'."\n";
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?iVersionId='.$this->iVersionId.'>'."\n";
|
||||
echo "\t".'<input type=hidden name="sNoteTitle" value="WARNING" />'."\n";
|
||||
echo $shAdd.'&sNoteTitle=WARNING" />';
|
||||
echo "\t".'<input type=submit value="Add Warning" class="button" />'."\n";
|
||||
echo '</form>';
|
||||
echo "</td></tr>";
|
||||
|
||||
Reference in New Issue
Block a user