Module: appdb Branch: master Commit: 6f1de3983796ec23dcc29e79b77aab26c2bdc5b3 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=6f1de3983796ec23dcc29e79b...
Author: Alexander Nicolaysen Sørnes <alexander@linux-xqqm.(none)> Date: Thu Jul 30 00:51:52 2009 +0200
note: Allow moving from app to version, fix some mail texts
---
include/note.php | 68 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/include/note.php b/include/note.php index 3be1b94..57f92a4 100644 --- a/include/note.php +++ b/include/note.php @@ -10,6 +10,7 @@ require_once(BASE."include/version.php"); define('APPNOTE_SHOW_FOR_ALL', -1); define('APPNOTE_SHOW_FOR_VERSIONS', -2); define('APPNOTE_SHOW_FOR_APP', -3); +define('DISPLAYMODE_COUNT', 3);
/** * Note class for handling notes @@ -121,17 +122,28 @@ class Note { $this->iVersionId, $this->iNoteId)) return false;
- if(!$this->iAppId) + if(!$this->iAppId && !$oNote->iAppId) // Changed version only { $sVersionBefore = Version::lookup_name($oNote->iVersionId); $sVersionAfter = Version::lookup_name($this->iVersionId); $sWhatChanged .= "Version was changed from ".$sVersionBefore." to ".$sVersionAfter.".\n\n"; - } else + } else if(!$this->iAppId) // Moved from app to version + { + $sVersionAfter = Version::fullName($this->iVersionId); + $oApp = new application($oNote->iAppId); + $sOldApp = $oApp->sName; + $sWhatChanged .= "Moved from application $sOldApp to version $sVersionAfter.\n\n"; + } else if($oNote->hasRealVersionId()) // Moved from version to app { $oApp = new application($this->iAppId); $sNewApp = $oApp->sName; $sVersionBefore = version::fullName($oNote->iVersionId); $sWhatChanged .= "Moved from version $sVersionBefore to application $sNewApp.\n\n"; + } else // Change display mode for app note + { + $sOldMode = $oNote->getDisplayModeName(); + $sNewMode = $this->getDisplayModeName(); + $sWhatChanged .= "Display mode was changed from '$sOldMode' to '$sNewMode'.\n\n"; } } if (($this->iAppId || $this->iVersionId) && $this->iAppId!=$oNote->iAppId) @@ -336,6 +348,34 @@ class Note { return note::isRealVersionId($this->iVersionId); }
+ public static function getDisplayModeIds() + { + return array(APPNOTE_SHOW_FOR_ALL, APPNOTE_SHOW_FOR_VERSIONS, APPNOTE_SHOW_FOR_APP); + } + + public static function getDisplayModeNames() + { + return array('Show on both application and version pages', 'Show on all version pages only', 'Show on application page only'); + } + + public function getDisplayModeName($iModeId = null) + { + if(!$iModeId) + $iModeId = $this->iVersionId; + + $aNames = note::getDisplayModeNames(); + $iIndex = 0; + + foreach(note::getDisplayModeIds() as $iId) + { + if($iId == $iModeId) + return $aNames[$iIndex]; + $iIndex++; + } + + return ''; + } + function outputEditor($aValues = null) { if($aValues) @@ -377,21 +417,27 @@ class Note { echo '</p>'; echo '</td></tr>'."\n";
- if($this->iAppId); - $oApp = new application($this->iAppId); if($this->iAppId || $oApp->canEdit()) { + $oApp = new application($this->iAppId); + $aIds = $this->getDisplayModeIds(); + $aOptions = $this->getDisplayModeNames(); + + echo '<tr><td class="color1">Display mode</td>'."\n"; + echo '<td class="color0">'.html_radiobuttons($aIds, $aOptions, 'iVersionId', $this->iVersionId); + + /* Allow the note to be moved to a single version */ $aIds = array(); $aOptions = array(); - if($this->isRealVersionId($this->iVersionId)) + echo 'Show on one of the following version pages only:<br />'; + foreach($oApp->getVersions(true) as $oAppVersion) // Only accepted versions { - $aIds[] = $this->iVersionId; - $aOptions[] = 'Show for this version only'; + + $aIds[] = $oAppVersion->objectGetId(); + $aOptions[] = $oAppVersion->objectMakeLink(); } - $aIds = array_merge($aIds, array(APPNOTE_SHOW_FOR_ALL, APPNOTE_SHOW_FOR_VERSIONS, APPNOTE_SHOW_FOR_APP)); - $aOptions = array_merge($aOptions, array('Show on both application and version pages', 'Show on all 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 html_radiobuttons($aIds, $aOptions, 'iVersionId', $this->iVersionId); + echo '</td></tr>'; } else if(!$this->iAppId) {