From 0339fa60c2a467e49649e5bbc563eec81e6f9a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Tue, 21 Jul 2009 16:02:05 +0200 Subject: [PATCH] Revert "Add support for application-wide notes & how-tos" This reverts commit e546738913abf539bc6bb0f0249e60db194b5b12. --- include/application.php | 5 -- include/html.php | 17 ------- include/note.php | 107 ++++++++-------------------------------- include/version.php | 10 +++- runonce | 1 - runonce.php | 28 ----------- tables/appdb_tables.sql | 1 - 7 files changed, 30 insertions(+), 139 deletions(-) delete mode 100755 runonce delete mode 100644 runonce.php diff --git a/include/application.php b/include/application.php index ed62f46..c5ef52b 100644 --- a/include/application.php +++ b/include/application.php @@ -835,9 +835,6 @@ class Application { if($_SESSION['current']->isSuperMaintainer($this->iAppId) || $_SESSION['current']->hasPriv("admin")) { echo '
'; - echo '
'; - echo ''; - echo '
'; } 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) diff --git a/include/html.php b/include/html.php index 4cb60dc..ac6cfa0 100644 --- a/include/html.php +++ b/include/html.php @@ -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 .= ' " . $aOptions[$i].'
'; - } - - return $shRet; -} - ?> diff --git a/include/note.php b/include/note.php index 1d8f06d..1558d66 100644 --- a/include/note.php +++ b/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 .= ""; - $shOutput .= "
iNoteId."&sReturnTo=".urlencode($shReturnTo)."\">"; + $shOutput .= "iNoteId."&sReturnTo=".urlencode($oVersion->objectMakeUrl())."\">"; $shOutput .= ''; $shOutput .= '
'; } @@ -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 ''; echo ''; - if(!$this->iAppId) - echo ''; - echo ''; + echo ''; echo 'Title'."\n"; echo ' ',"\n"; @@ -346,14 +285,6 @@ class Note { echo '',"\n"; echo '

'; echo ''."\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 'Display mode'."\n"; - echo ''.html_radiobuttons($aIds, $aOptions, 'iVersionId', $this->iVersionId); - echo ''; - } echo '',"\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; } diff --git a/include/version.php b/include/version.php index 180283d..b1bceae 100644 --- a/include/version.php +++ b/include/version.php @@ -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) diff --git a/runonce b/runonce deleted file mode 100755 index 56a6051..0000000 --- a/runonce +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/runonce.php b/runonce.php deleted file mode 100644 index c509366..0000000 --- a/runonce.php +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/tables/appdb_tables.sql b/tables/appdb_tables.sql index c6a12ad..f481355 100644 --- a/tables/appdb_tables.sql +++ b/tables/appdb_tables.sql @@ -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)