ChangeSet ID: 31197 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner(a)winehq.org 2007/06/13 20:27:59 Modified files: . : objectManager.php include : objectManager.php Log message: Chris Morgan <cmorgan(a)alum.wpi.edu> Add some common responses to the entry processing page, selectable via radio buttons. This should make admin responses more consistent and make it quicker and easier to process submissions. Patch: http://cvs.winehq.org/patch.py?id=31197 Old revision New revision Changes Path 1.13 1.14 +2 -2 appdb/objectManager.php 1.27 1.28 +59 -0 appdb/include/objectManager.php Index: appdb/objectManager.php diff -u -p appdb/objectManager.php:1.13 appdb/objectManager.php:1.14 --- appdb/objectManager.php:1.13 14 Jun 2007 1:27:59 -0000 +++ appdb/objectManager.php 14 Jun 2007 1:27:59 -0000 @@ -54,8 +54,8 @@ if($aClean['bIsRejected'] == 'true') $oOtherObject = new $oObject->sClass($oObject->iId); -/* Certain actions must be performed before the header is set - processForm return TRUE on success, or a user-readable list of errors +/* Certain actions must be performed before the header is set. */ +/* processForm returns TRUE on success, or a user-readable list of errors on failure */ $sErrors = $oObject->processForm($aClean); Index: appdb/include/objectManager.php diff -u -p appdb/include/objectManager.php:1.27 appdb/include/objectManager.php:1.28 --- appdb/include/objectManager.php:1.27 14 Jun 2007 1:27:59 -0000 +++ appdb/include/objectManager.php 14 Jun 2007 1:27:59 -0000 @@ -13,6 +13,10 @@ class ObjectManager var $oMultiPage; var $oTableRow; + // an array of common responses used when replying to + // queued entries + var $aCommonResponses; + function ObjectManager($sClass, $sTitle = "list", $iId = false) { $this->sClass = $sClass; @@ -20,6 +24,23 @@ class ObjectManager $this->iId = $iId; $this->oMultiPage = new MultiPage(FALSE); $this->oTableRow = new TableRow(null); + + // initialize the common responses array + $this->aCommonResponses = array(); + $this->aCommonResponses[] = "Thank you for your submission."; + $this->aCommonResponses[] = "Please move crash/debug output to a bug". + " in Wine's Bugzilla at http://bugs.winehq.org and resubmit."; + $this->aCommonResponses[] = "We appreciate your submission but it". + " needs to be more detailed before it will be most useful to other users of". + " the Application Datbase.". + " Please try to improve the entry and resubmit."; + $this->aCommonResponses[] = "We appreciate your submission but it". + " requires improvement to its grammar and/or spelling". + " before it will be most useful to other users of". + " the Application Database.". + " Please try to improve the entry and resubmit."; + $this->aCommonResponses[] = "Please do not copy large amount of text from". + " the program's website"; } /* Check whether the associated class has the given method */ @@ -194,6 +215,29 @@ class ObjectManager echo '<td><textarea name="sReplyText" style="width: 100%" cols="80" '. 'rows="10">'.$sDefaultReply.'</textarea></td></tr>',"\n"; + + ///////////////////////////////////////////////// + // output radio buttons for some common responses + echo '<tr valign=top><td class="color0"></td><td class="color0">'. + '<b>Common replies</b><br/> Email <a href="mailto:'.APPDB_OWNER_EMAIL.'">'. + APPDB_OWNER_EMAIL.'</a> if you want to suggest a new common reply.</td></tr>',"\n"; + + // NOTE: We use the label tag so the user can click anywhere in + // the text of the radio button to select the radio button. + // Otherwise the user has to click on the very small circle portion + // of the button to select it + foreach($this->aCommonResponses as $iIndex => $sReply) + { + echo '<tr valign=top><td class="color0"></td>',"\n"; + echo '<td class="color0"><label for="'.$iIndex.'"><input'. + ' type="radio" name="sOMCommonReply" id="'.$iIndex.'" value="'.$sReply.'"/>'. + $sReply.'</label></td>',"\n"; + echo '</tr>',"\n"; + } + // end output radio buttons for common responses + ///////////////////////////////////////////////// + + /* buttons for operations we can perform on this entry */ echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n"; echo '<input name="sSubmit" type="submit" value="Submit" class="button" '. @@ -407,6 +451,12 @@ class ObjectManager /* Process form data generated by adding or updating an entry */ function processForm($aClean) { + // FIXME: hack so if we modify $aClean in here any objects that use the global + // $aClean will see the modified value. Should be replaced when we have + // general purpose objectManager email code in place since the sReplyText value + // is the value we modify and we'll be passing that into methods in the future + global $aClean; + if(!$aClean['sSubmit']) return; @@ -425,6 +475,15 @@ class ObjectManager $aClean['sReplyText'] = ""; } + // handle the common response radio button value + // if sReplyText is empty, if sOMCommonReply was set because + // the user selected a radio button then use that text instead + if(($aClean['sReplyText'] == "") && isset($aClean['sOMCommonReply'])) + { + $aClean['sReplyText'] = $aClean['sOMCommonReply']; + } + + $oObject->getOutputEditorValues($aClean); /* Check input, if necessary */