1. <?php
  2. /**
  3. * Creates the page for displaying the package new release options.
  4. *
  5. * The release options consist of features including, the release date,
  6. * the package version and state, and the release notes and license.
  7. *
  8. * @category   PEAR
  9. * @package    PEAR_PackageFileManager_Frontend_Web
  10. * @author     Laurent Laville <pear@laurent-laville.org>
  11. * @copyright  2005-2006 Laurent Laville
  12. * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
  13. * @since      File available since Release 0.1.0
  14. */
  15.  
  16. /**
  17. * Creates the page for displaying the package new release options.
  18. *
  19. * @category   PEAR
  20. * @package    PEAR_PackageFileManager_Frontend_Web
  21. * @author     Laurent Laville <pear@laurent-laville.org>
  22. * @copyright  2005-2006 Laurent Laville
  23. * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
  24. * @since      Class available since Release 0.1.0
  25. */
  26. class ReleasePage extends TabbedPage
  27. {
  28.     /**
  29.      * Builds the current form-page.
  30.      *
  31.      * @since  0.1.0
  32.      * @access public
  33.      */
  34.     function buildForm()
  35.     {
  36.         $this->buildTabs();
  37.         // tab caption
  38.         $this->addElement('header', null, 'Release Informations ');
  39.  
  40.         $fe =& PEAR_PackageFileManager_Frontend::singleton();
  41.  
  42.         // State options list: (value => text, with value === text)
  43.         $settings = $fe->getOption(array('settings', 'pfm'), false);
  44.         $states = $settings['pfm']['stability'];
  45.         sort($states, SORT_ASC);
  46.         $states = array_combine($states, $states);
  47.  
  48.         // We need a combo box for the release state list.
  49.         $this->addElement('select', 'releaseState', 'State :', $states);
  50.  
  51.         // We need a simple entry box for the release version.
  52.         $this->addElement('text', 'releaseVersion',
  53.                           array('Version :', 'The version number for this release'),
  54.                           array('size' => 30)
  55.         );
  56.  
  57.         // We need a combo box for the api state list.
  58.         $this->addElement('select', 'APIState', 'API State :', $states);
  59.  
  60.         // We need a simple entry box for the api version.
  61.         $this->addElement('text', 'APIVersion',
  62.                           array('API Version :', 'The version number of current API'),
  63.                           array('size' => 30)
  64.         );
  65.  
  66.         // We need a date field for the release date
  67.         $rDate =& $this->addElement('date', 'releaseDate',
  68.                           array('Date : ', 'Publication date of the new release'),
  69.                           array('format' => 'F d Y', 'language' => 'en')
  70.         );
  71.         $rDate->freeze();
  72.  
  73.         // We need a group entry box for the release license.
  74.         $license['content'] =& $this->createElement('text', 'content', 'content', array('size' => 48));
  75.         $license['uri']     =& $this->createElement('text', 'uri'    , 'uri'    , array('size' => 48));
  76.         $this->addGroup($license, 'releaseLicense', 'License :', '');
  77.  
  78.         // We need a text area for the release notes.
  79.         $this->addElement('textarea', 'releaseNotes',
  80.                           array('Notes :', 'Release notes, any text describing what makes this release unique'),
  81.                           array('rows' => 6, 'cols' => 74)
  82.         );
  83.  
  84.         // validation form rules
  85.         $this->addRule('releaseState', 'The state of the new release is required'    , 'required');
  86.         $this->addRule('releaseVersion', 'The version of the new release is required', 'required');
  87.         $this->addRule('releaseNotes', 'Notes of the new release is required'        , 'required');
  88.         $this->addRule('APIState', 'The state of the current API is required'        , 'required');
  89.         $this->addRule('APIVersion', 'The version of the current API is required'    , 'required');
  90.  
  91.         $licenseRules['content'][0] = array('License content is required', 'required');
  92.         $this->addGroupRule('releaseLicense', $licenseRules);
  93.  
  94.         // Buttons of the wizard to do the job
  95.         $this->buildButtons(array('commit'));
  96.     }
  97. }
  98. ?>