Revert "Add support for application-wide notes & how-tos"
This reverts commit e546738913.
This commit is contained in:
@@ -835,9 +835,6 @@ class Application {
|
||||
if($_SESSION['current']->isSuperMaintainer($this->iAppId) || $_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
echo ' <form method="post" name="sEdit" action="admin/editAppFamily.php"><input type="hidden" name="iAppId" value="'.$this->iAppId.'"><input type="submit" value="Edit Application" class="button"></form>';
|
||||
echo '<form method="post" action="objectManager.php?sClass=note&sAction=add&sTitle=Add+note&iAppId='.$this->iAppId.'&sNoteTitle=HOWTO&sReturnTo='.urlencode($this->objectMakeUrl()).'">';
|
||||
echo '<input type="submit" value="Add note / how-to" />';
|
||||
echo '</form>';
|
||||
}
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
@@ -880,8 +877,6 @@ class Application {
|
||||
|
||||
// display bundle
|
||||
$this->displayBundle();
|
||||
|
||||
note::displayNotesForEntry(null, $this->iAppId);
|
||||
}
|
||||
|
||||
public static function lookup_name($appId)
|
||||
|
||||
@@ -288,21 +288,4 @@ function html_note($shTitle, $shBody)
|
||||
return $shRet;
|
||||
}
|
||||
|
||||
function html_radiobuttons($aIds, $aOptions, $sName, $sDefault = '')
|
||||
{
|
||||
$shRet = '';
|
||||
|
||||
for($i = 0; $i < sizeof($aIds); $i++)
|
||||
{
|
||||
if($aIds[$i] == $sDefault)
|
||||
$shChecked = ' checked="checked"';
|
||||
else
|
||||
$shChecked = '';
|
||||
|
||||
$shRet .= '<input type="radio" name="'.$sName.'" value="'.$aIds[$i]."\"$shChecked> " . $aOptions[$i].'<br />';
|
||||
}
|
||||
|
||||
return $shRet;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
107
include/note.php
107
include/note.php
@@ -7,17 +7,12 @@ require_once(BASE."include/version.php");
|
||||
/************************************/
|
||||
|
||||
|
||||
define('APPNOTE_SHOW_FOR_ALL', -1);
|
||||
define('APPNOTE_SHOW_FOR_VERSIONS', -2);
|
||||
define('APPNOTE_SHOW_FOR_APP', -3);
|
||||
|
||||
/**
|
||||
* Note class for handling notes
|
||||
*/
|
||||
class Note {
|
||||
var $iNoteId;
|
||||
var $iVersionId;
|
||||
var $iAppId;
|
||||
var $sTitle;
|
||||
var $shDescription;
|
||||
var $iSubmitterId;
|
||||
@@ -43,7 +38,6 @@ class Note {
|
||||
{
|
||||
$this->iNoteId = $oRow->noteId;
|
||||
$this->iVersionId = $oRow->versionId;
|
||||
$this->iAppId = $oRow->appId;
|
||||
$this->sTitle = $oRow->noteTitle;
|
||||
$this->shDescription = $oRow->noteDesc;
|
||||
$this->sSubmitTime = $oRow->submitTime;
|
||||
@@ -60,11 +54,11 @@ class Note {
|
||||
function create()
|
||||
{
|
||||
$hResult = query_parameters("INSERT INTO appNotes (versionId, ".
|
||||
"appId, noteTitle, noteDesc, submitterId, ".
|
||||
"noteTitle, noteDesc, submitterId, ".
|
||||
"submitTime) ".
|
||||
"VALUES('?', '?', '?', '?', '?', ?)",
|
||||
$this->iVersionId, $this->iAppId,
|
||||
$this->sTitle, $this->shDescription,
|
||||
"VALUES('?', '?', '?', '?', ?)",
|
||||
$this->iVersionId, $this->sTitle,
|
||||
$this->shDescription,
|
||||
$_SESSION['current']->iUserId,
|
||||
"NOW()");
|
||||
|
||||
@@ -158,18 +152,9 @@ class Note {
|
||||
|
||||
function SendNotificationMail($sAction="add",$sMsg=null)
|
||||
{
|
||||
if(!$this->iAppId)
|
||||
{
|
||||
$oVersion = new version($this->iVersionId);
|
||||
$sAppName = version::fullName($this->iVersionId);
|
||||
$sMsg .= $oVersion->objectMakeUrl()."\n";
|
||||
} else
|
||||
{
|
||||
$oApp = new application($this->iAppId);
|
||||
$sAppName = $oApp->sName;
|
||||
$sMsg .= $oApp->objectMakeUrl()."\n";
|
||||
}
|
||||
|
||||
$oVersion = new version($this->iVersionId);
|
||||
$sAppName = version::fullName($this->iVersionId);
|
||||
$sMsg .= $oVersion->objectMakeUrl()."\n";
|
||||
switch($sAction)
|
||||
{
|
||||
case "add":
|
||||
@@ -234,14 +219,7 @@ class Note {
|
||||
$sClass = 'defaultnote';
|
||||
}
|
||||
|
||||
if(!$aVars || !getInput('shReturnTo', $aVars))
|
||||
{
|
||||
$oVersion = new version($this->iVersionId);
|
||||
$shReturnTo = $oVersion->objectMakeUrl();
|
||||
} else
|
||||
{
|
||||
$shReturnTo = $aVars['shReturnTo'];
|
||||
}
|
||||
$oVersion = new version($this->iVersionId);
|
||||
|
||||
$shOutput = html_frame_start("","98%",'',0);
|
||||
|
||||
@@ -254,7 +232,7 @@ class Note {
|
||||
if((!$aVars || $aVars['bEditing'] != "true") && $this->canEdit())
|
||||
{
|
||||
$shOutput .= "<tr class=\"color1\" align=\"center\" valign=\"top\"><td>";
|
||||
$shOutput .= "<form method=\"post\" name=\"message\" action=\"objectManager.php?sClass=note&sAction=edit&iId=".$this->iNoteId."&sReturnTo=".urlencode($shReturnTo)."\">";
|
||||
$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>';
|
||||
}
|
||||
@@ -265,37 +243,6 @@ class Note {
|
||||
echo $shOutput;
|
||||
}
|
||||
|
||||
function displayNotesForEntry($iVersionId, $iAppId = null)
|
||||
{
|
||||
if($iVersionId)
|
||||
{
|
||||
$oVersion = new version($iVersionId);
|
||||
$oApp = $oVersion->objectGetParent();
|
||||
$hResult = query_parameters("SELECT noteId FROM appNotes WHERE versionId = '?' OR (appId = '?' AND (versionId = '?' OR versionId = '?'))", $iVersionId, $oApp->objectGetId(), APPNOTE_SHOW_FOR_ALL, APPNOTE_SHOW_FOR_VERSIONS);
|
||||
} else if($iAppId)
|
||||
{
|
||||
$hResult = query_parameters("SELECT noteId FROM appNotes WHERE appId = '?' AND versionId = '?' OR versionId = '?'", $iAppId, APPNOTE_SHOW_FOR_ALL, APPNOTE_SHOW_FOR_APP);
|
||||
}
|
||||
|
||||
if(!$hResult)
|
||||
return;
|
||||
|
||||
if($iVersionId)
|
||||
$oVersion = new version($iVersionId);
|
||||
else
|
||||
$oApp = new application($iAppId);
|
||||
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oNote = new note($oRow->noteId);
|
||||
|
||||
$shReturnTo = $iVersionId ? $oVersion->objectMakeUrl() : $oApp->objectMakeUrl();
|
||||
|
||||
$aVars = array('shReturnTo' => $shReturnTo, 'bEditing' => 'false');
|
||||
$oNote->display($aVars);
|
||||
}
|
||||
}
|
||||
|
||||
function objectGetCustomVars($sAction)
|
||||
{
|
||||
switch($sAction)
|
||||
@@ -304,7 +251,7 @@ class Note {
|
||||
return array("bEditing");
|
||||
|
||||
case "add":
|
||||
return array('iVersionId','iAppId','sNoteTitle');
|
||||
return array("iVersionId","sNoteTitle");
|
||||
|
||||
default:
|
||||
return null;
|
||||
@@ -318,12 +265,6 @@ class Note {
|
||||
if(!$this->iVersionId)
|
||||
$this->iVersionId = $aValues['iVersionId'];
|
||||
|
||||
if(!$this->iAppId)
|
||||
$this->iAppId = getInput('iAppId', $aValues);
|
||||
|
||||
if($this->iAppId && !$this->iVersionId)
|
||||
$this->iVersionId = APPNOTE_SHOW_FOR_ALL;
|
||||
|
||||
if(!$this->sTitle)
|
||||
$this->sTitle = $aValues['sNoteTitle'];
|
||||
}
|
||||
@@ -335,9 +276,7 @@ class Note {
|
||||
|
||||
echo '<input type="hidden" name="bEditing" value="true">';
|
||||
echo '<input type="hidden" name="iNoteId" value="'.$this->iNoteId.'">';
|
||||
if(!$this->iAppId)
|
||||
echo '<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'">';
|
||||
echo '<input type="hidden" name="iAppId" value="'.$this->iAppId.'">';
|
||||
echo '<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'">';
|
||||
|
||||
echo '<tr><td class=color1>Title</td>'."\n";
|
||||
echo ' <td class=color0><input size=80% type="text" name="sNoteTitle" type="text" value="'.$this->sTitle.'"></td></tr>',"\n";
|
||||
@@ -346,14 +285,6 @@ class Note {
|
||||
echo '<textarea cols="80" rows="20" id="editor" name="shNoteDesc">'.$this->shDescription.'</textarea>',"\n";
|
||||
echo '</p>';
|
||||
echo '</td></tr>'."\n";
|
||||
if($this->iAppId)
|
||||
{
|
||||
$aIds = array(APPNOTE_SHOW_FOR_ALL, APPNOTE_SHOW_FOR_VERSIONS, APPNOTE_SHOW_FOR_APP);
|
||||
$aOptions = array('Show on both application and version pages', 'Show on version pages only', 'Show on application page only');
|
||||
echo '<tr><td class="color1">Display mode</td>'."\n";
|
||||
echo '<td class="color0">'.html_radiobuttons($aIds, $aOptions, 'iVersionId', $this->iVersionId);
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '<tr><td colspan="2" align="center" class="color3">',"\n";
|
||||
|
||||
echo html_table_end();
|
||||
@@ -364,8 +295,7 @@ class Note {
|
||||
/* $aValues can be $_REQUEST or any array with the values from outputEditor() */
|
||||
function GetOutputEditorValues($aValues)
|
||||
{
|
||||
$this->iVersionId = getInput('iVersionId', $aValues);
|
||||
$this->iAppId = getInput('iAppId', $aValues);
|
||||
$this->iVersionId = $aValues['iVersionId'];
|
||||
$this->sTitle = $aValues['sNoteTitle'];
|
||||
$this->shDescription = $aValues['shNoteDesc'];
|
||||
}
|
||||
@@ -473,11 +403,16 @@ class Note {
|
||||
function canEdit()
|
||||
{
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
return true;
|
||||
} else if($this->iVersionId)
|
||||
{
|
||||
if(maintainer::isUserMaintainer($_SESSION['current'],
|
||||
$this->iVersionId))
|
||||
{
|
||||
return true;
|
||||
else if($this->iVersionId && !$this->iAppId)
|
||||
return maintainer::isUserMaintainer($_SESSION['current'], $this->iVersionId);
|
||||
else if($this->iAppId)
|
||||
return maintainer::isUserSuperMaintainer($_SESSION['current'], $this->iAppId);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,15 @@ class version {
|
||||
|
||||
view_version_bugs($this->iVersionId, $this->get_buglink_ids());
|
||||
|
||||
echo note::displayNotesForEntry($this->iVersionId);
|
||||
/* display the notes for the application */
|
||||
$hNotes = query_parameters("SELECT noteId FROM appNotes WHERE versionId = '?'",
|
||||
$this->iVersionId);
|
||||
|
||||
while( $oRow = query_fetch_object($hNotes) )
|
||||
{
|
||||
$oNote = new Note($oRow->noteId);
|
||||
$oNote->display();
|
||||
}
|
||||
|
||||
// Comments Section
|
||||
if($this->iVersionId)
|
||||
|
||||
28
runonce.php
28
runonce.php
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('path.php');
|
||||
require_once(BASE.'include/incl.php');
|
||||
|
||||
$hFile = fopen('runonce', 'r');
|
||||
|
||||
if(filesize('runonce') && fread($hFile, filesize('runonce')) == '1')
|
||||
{
|
||||
fclose($hFile);
|
||||
echo "The command has already been run";
|
||||
exit;
|
||||
}
|
||||
|
||||
fclose($hFile);
|
||||
|
||||
$hResult = mysql_query("ALTER TABLE appNotes ADD appId int not null AFTER versionId");
|
||||
|
||||
if($hResult)
|
||||
echo "The command was executed successfully";
|
||||
else
|
||||
echo "The command failed, error was: " . mysql_error();
|
||||
|
||||
$hFile = fopen('runonce', 'w');
|
||||
fwrite($hFile, '1');
|
||||
fclose($hFile);
|
||||
|
||||
?>
|
||||
@@ -167,7 +167,6 @@ create table appNotes (
|
||||
noteTitle varchar(255),
|
||||
noteDesc text,
|
||||
versionId int not null,
|
||||
appId int not null,
|
||||
submitterId int not null,
|
||||
submitTime datetime not null,
|
||||
key(noteId)
|
||||
|
||||
Reference in New Issue
Block a user