ChangeSet ID: 26132 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2006/06/29 14:22:26
Modified files: . : appview.php include : note.php version.php
Log message: Chris Morgan cmorgan@alum.wpi.edu Cleanup note class, move display of notes into the class. External code creates and calls Note::show() to display the note.
Patch: http://cvs.winehq.org/patch.py?id=26132
Old revision New revision Changes Path 1.84 1.85 +0 -49 appdb/appview.php 1.11 1.12 +48 -0 appdb/include/note.php 1.60 1.61 +5 -3 appdb/include/version.php
Index: appdb/appview.php diff -u -p appdb/appview.php:1.84 appdb/appview.php:1.85 --- appdb/appview.php:1.84 29 Jun 2006 19:22:26 -0000 +++ appdb/appview.php 29 Jun 2006 19:22:26 -0000 @@ -82,55 +82,6 @@ function display_bundle($iAppId) echo html_frame_end(); }
-/* Show note */ -function show_note($sType,$oData) -{ - global $oVersion; - - switch($sType) - { - case 'WARNING': - $color = 'red'; - $title = 'Warning'; - break; - - case 'HOWTO'; - $color = 'green'; - $title = 'HOWTO'; - break; - - default: - - if(!empty($oData->noteTitle)) - $title = $oData->noteTitle; - else - $title = 'Note'; - - $color = 'blue'; - } - - $s = html_frame_start("","98%",'',0); - - $s .= "<table width="100%" border="0" cellspacing="0">\n"; - $s .= "<tr bgcolor="".$color."" align="center" valign="top"><td><b>".$title."</b></td></tr>\n"; - $s .= "<tr><td class="note">\n"; - $s .= $oData->noteDesc; - $s .= "</td></tr>\n"; - - if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($oVersion->iVersionId) || $_SESSION['current']->isSuperMaintainer($oVersion->iAppId)) - { - $s .= "<tr class="color1" align="center" valign="top"><td>"; - $s .= "<form method="post" name="message" action="admin/editAppNote.php?noteId={$oData->noteId}">"; - $s .= '<input type="submit" value="Edit Note" class="button">'; - $s .= '</form></td></tr>'; - } - - $s .= "</table>\n"; - $s .= html_frame_end(); - - return $s; -} - if(!is_numeric($aClean['appId']) && !is_numeric($aClean['versionId'])) { util_show_error_page("Something went wrong with the application or version id"); Index: appdb/include/note.php diff -u -p appdb/include/note.php:1.11 appdb/include/note.php:1.12 --- appdb/include/note.php:1.11 29 Jun 2006 19:22:26 -0000 +++ appdb/include/note.php 29 Jun 2006 19:22:26 -0000 @@ -158,5 +158,53 @@ class Note { if($sEmail) mail_appdb($sEmail, $sSubject ,$sMsg); } + + /* Show note */ + function show() + { + switch($this->sTitle) + { + case 'WARNING': + $sColor = 'red'; + $sTitle = 'Warning'; + break; + + case 'HOWTO': + $sColor = 'green'; + $sTitle = 'HOWTO'; + break; + + default: + if(!empty($this->sTitle)) + $sTitle = $this->sTitle; + else + $sTitle = 'Note'; + + $sColor = 'blue'; + } + + $shOutput = html_frame_start("","98%",'',0); + + $shOutput .= "<table width="100%" border="0" cellspacing="0">\n"; + $shOutput .= "<tr bgcolor="".$sColor."" align="center" valign="top"><td><b>".$sTitle."</b></td></tr>\n"; + $shOutput .= "<tr><td class="note">\n"; + $shOutput .= $this->sDescription; + $shOutput .= "</td></tr>\n"; + + if ($_SESSION['current']->hasPriv("admin") || + $_SESSION['current']->isMaintainer($this->iVersionId) || + $_SESSION['current']->isSuperMaintainer($this->iAppId)) + { + $shOutput .= "<tr class="color1" align="center" valign="top"><td>"; + $shOutput .= "<form method="post" name="message" action="admin/editAppNote.php?noteId={$this->iNoteId}">"; + $shOutput .= '<input type="submit" value="Edit Note" class="button">'; + $shOutput .= '</form></td></tr>'; + } + + $shOutput .= "</table>\n"; + $shOutput .= html_frame_end(); + + echo $shOutput; + } } ?> Index: appdb/include/version.php diff -u -p appdb/include/version.php:1.60 appdb/include/version.php:1.61 --- appdb/include/version.php:1.60 29 Jun 2006 19:22:26 -0000 +++ appdb/include/version.php 29 Jun 2006 19:22:26 -0000 @@ -827,12 +827,14 @@ class Version {
view_version_bugs($this->iVersionId, $this->aBuglinkIds);
- $rNotes = query_parameters("SELECT * FROM appNotes WHERE versionId = '?'", + /* display the notes for the application */ + $hNotes = query_parameters("SELECT noteId FROM appNotes WHERE versionId = '?'", $this->iVersionId);
- while( $oNote = mysql_fetch_object($rNotes) ) + while( $oRow = mysql_fetch_object($hNotes) ) { - echo show_note($oNote->noteTitle,$oNote); + $oNote = new Note($oRow->noteId); + $oNote->show(); }
// Comments Section