home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / Progress2 / Generator / pages.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  22.1 KB  |  527 lines

  1. <?php
  2. /**
  3.  * Copyright (c) 2005-2008, Laurent Laville <pear@laurent-laville.org>
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  *     * Redistributions of source code must retain the above copyright
  12.  *       notice, this list of conditions and the following disclaimer.
  13.  *     * Redistributions in binary form must reproduce the above copyright
  14.  *       notice, this list of conditions and the following disclaimer in the
  15.  *       documentation and/or other materials provided with the distribution.
  16.  *     * Neither the name of the authors nor the names of its contributors
  17.  *       may be used to endorse or promote products derived from this software
  18.  *       without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * PHP versions 4 and 5
  33.  *
  34.  * @category  HTML
  35.  * @package   HTML_Progress2
  36.  * @author    Laurent Laville <pear@laurent-laville.org>
  37.  * @copyright 2005-2008 Laurent Laville
  38.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  39.  * @version   CVS: $Id: pages.php,v 1.9 2008/03/20 21:27:55 farell Exp $
  40.  * @link      http://pear.php.net/package/HTML_Progress2
  41.  * @since     File available since Release 2.0.0RC1
  42.  */
  43.  
  44.  
  45. /**
  46.  * Common wizard presentation.
  47.  *
  48.  * Creates all tabs and buttons as common layout for the interactive tools:
  49.  * HTML Progress2 Generator.
  50.  *
  51.  * @category  HTML
  52.  * @package   HTML_Progress2
  53.  * @author    Laurent Laville <pear@laurent-laville.org>
  54.  * @copyright 2005-2008 Laurent Laville
  55.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  56.  * @version   Release: 2.4.0
  57.  * @link      http://pear.php.net/package/HTML_Progress2
  58.  * @access    private
  59.  * @since     Class available since Release 2.1.0
  60.  */
  61.  
  62. class TabbedPage extends HTML_QuickForm_Page
  63. {
  64.     /**
  65.      * Builds tabs of the Wizard.
  66.      *
  67.      * @return void
  68.      * @since  version 2.1.0 (2006-08-12)
  69.      * @access public
  70.      */
  71.     function buildTabs()
  72.     {
  73.         $this->_formBuilt = true;
  74.  
  75.         // Here we get all page names in the controller
  76.         $pages  = array();
  77.         $myName = $current = $this->getAttribute('id');
  78.         while (null !== ($current = $this->controller->getPrevName($current))) {
  79.             $pages[] = $current;
  80.         }
  81.         $pages   = array_reverse($pages);
  82.         $pages[] = $current = $myName;
  83.         while (null !== ($current = $this->controller->getNextName($current))) {
  84.             $pages[] = $current;
  85.         }
  86.         // Here we display buttons for all pages, the current one's is disabled
  87.         foreach ($pages as $pageName) {
  88.             $disabled = ($pageName == $myName ? array('disabled' => 'disabled')
  89.                                               : array());
  90.  
  91.             $tabs[] = $this->createElement('submit',
  92.                                            $this->getButtonName($pageName),
  93.                                            ucfirst($pageName),
  94.                                            array('class' => 'flat') + $disabled);
  95.         }
  96.         $this->addGroup($tabs, 'tabs', null, ' ', false);
  97.     }
  98.  
  99.     /**
  100.      * Builds command buttons of the Wizard.
  101.      *
  102.      * @param mixed $disable  (optional) array of button identifier to disable
  103.      * @param array $commands (optional) additional commands list
  104.      *
  105.      * @return void
  106.      * @since  version 2.1.0 (2006-08-12)
  107.      * @access public
  108.      */
  109.     function buildButtons($disable = null, $commands = null)
  110.     {
  111.         $buttons = array('back', 'next', 'cancel', 'reset',
  112.                          'dump', 'apply', 'process');
  113.         if (isset($commands)) {
  114.             $buttons = array_merge($buttons, $commands);
  115.         }
  116.  
  117.         if (!isset($disable)) {
  118.             $disable = array();
  119.         } elseif (!isset($disable[0])) {
  120.             $disable = array($disable);
  121.         }
  122.  
  123.         $attributes = array('class' => 'cmdButton');
  124.         $confirm    = array('class' => 'cmdButton',
  125.                             'onclick' => "return(confirm('Are you sure ?'));");
  126.         $prevnext   = array();
  127.  
  128.         foreach ($buttons as $event) {
  129.             switch ($event) {
  130.             case 'cancel':
  131.                 $type  = 'submit';
  132.                 $attrs = $confirm;
  133.                 break;
  134.             case 'reset':
  135.                 $type  = 'reset';
  136.                 $attrs = $confirm;
  137.                 break;
  138.             default :
  139.                 $type  = 'submit';
  140.                 $attrs = $attributes;
  141.                 break;
  142.             }
  143.             if (in_array($event, $disable)) {
  144.                 $attrs['disabled'] = 'true';
  145.             }
  146.             if ($event == 'dump') {
  147.                 $dump = $this->controller->_act[$event];
  148.                 if ($dump === false) {
  149.                     continue;
  150.                 }
  151.                 $opts = array('1' => 'Progress2 dump info',
  152.                               '2' => 'Forms values container',
  153.                               '3' => 'Included Files',
  154.                               '4' => 'Declared Classes',
  155.                               '5' => 'Declared Actions');
  156.  
  157.                 $prevnext[] =&HTML_QuickForm::createElement('select',
  158.                                                             'dumpOption',
  159.                                                             '', $opts);
  160.             }
  161.             $prevnext[] =&HTML_QuickForm::createElement($type,
  162.                                               $this->getButtonName($event),
  163.                                               ucfirst($event),
  164.                                               HTML_Common::_getAttrString($attrs));
  165.         }
  166.         $this->addGroup($prevnext, 'buttons', '', ' ', false);
  167.     }
  168. }
  169.  
  170. /**
  171.  * Class for first Tab:
  172.  * Progress main properties
  173.  *
  174.  * @category HTML
  175.  * @package  HTML_Progress2
  176.  * @author   Laurent Laville <pear@laurent-laville.org>
  177.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  178.  * @link     http://pear.php.net/package/HTML_Progress2
  179.  * @ignore
  180.  */
  181. class Property1 extends TabbedPage
  182. {
  183.     /**
  184.      * Builds the form that define the main properties of your progress bar
  185.      *
  186.      * @return void
  187.      */
  188.     function buildForm()
  189.     {
  190.         $this->buildTabs();
  191.         // tab caption
  192.         $this->addElement('header', null,
  193.                           'Progress2 Generator - Control Panel: main properties');
  194.  
  195.         $shape[] =& $this->createElement('radio', null, null, 'Horizontal', '1');
  196.         $shape[] =& $this->createElement('radio', null, null, 'Vertical', '2');
  197.         $this->addGroup($shape, 'shape', 'Shape:');
  198.  
  199.         $way[] =& $this->createElement('radio', null, null, 'Natural', 'natural');
  200.         $way[] =& $this->createElement('radio', null, null, 'Reverse', 'reverse');
  201.         $this->addGroup($way, 'way', 'Direction:');
  202.  
  203.         $autosize[] =& $this->createElement('radio', null, null, 'Yes', true);
  204.         $autosize[] =& $this->createElement('radio', null, null, 'No', false);
  205.         $this->addGroup($autosize, 'autosize', 'Best size:');
  206.  
  207.         $psize['width']    =& $this->createElement('text',
  208.                                                    'width', 'width',
  209.                                                    array('size' => 4));
  210.         $psize['height']   =& $this->createElement('text',
  211.                                                    'height', 'height',
  212.                                                    array('size' => 4));
  213.         $psize['left']     =& $this->createElement('text',
  214.                                                    'left', 'left',
  215.                                                    array('size' => 4));
  216.         $psize['top']      =& $this->createElement('text',
  217.                                                    'top', 'top',
  218.                                                    array('size' => 4));
  219.         $psize['position'] =& $this->createElement('text',
  220.                                                    'position', 'position',
  221.                                                    array('disabled' => 'true'));
  222.         $psize['bgcolor']  =& $this->createElement('text',
  223.                                                    'bgcolor', 'bgcolor',
  224.                                                    array('size' => 7));
  225.         $this->addGroup($psize, 'progresssize',
  226.                                 'Size, position and color:', ' ');
  227.  
  228.         $this->addElement('text', 'rAnimSpeed',
  229.                           array('Animation speed :',
  230.                                 '(0-1000 ; 0:fast, 1000:slow)'));
  231.         $this->addRule('rAnimSpeed',
  232.                        'Should be between 0 and 1000',
  233.                        'rangelength', array(0,1000), 'client');
  234.  
  235.         // Buttons of the wizard to do the job
  236.         $this->buildButtons(array('back','apply','process'));
  237.     }
  238. }
  239.  
  240. /**
  241.  * Class for second Tab:
  242.  * Cell properties
  243.  *
  244.  * @category HTML
  245.  * @package  HTML_Progress2
  246.  * @author   Laurent Laville <pear@laurent-laville.org>
  247.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  248.  * @link     http://pear.php.net/package/HTML_Progress2
  249.  * @ignore
  250.  */
  251. class Property2 extends TabbedPage
  252. {
  253.     /**
  254.      * Builds the form that define cell properties of your progress bar
  255.      *
  256.      * @return void
  257.      */
  258.     function buildForm()
  259.     {
  260.         $this->buildTabs();
  261.         // tab caption
  262.         $this->addElement('header', null,
  263.                           'Progress2 Generator - Control Panel: cell properties');
  264.  
  265.         $this->addElement('text', 'cellid', 'Id mask:', array('size' => 32));
  266.         $this->addElement('text', 'cellclass', 'CSS class:', array('size' => 32));
  267.  
  268.         $cellvalue['min'] =& $this->createElement('text',
  269.                                                   'min', 'minimum',
  270.                                                   array('size' => 4));
  271.         $cellvalue['max'] =& $this->createElement('text',
  272.                                                   'max', 'maximum',
  273.                                                   array('size' => 4));
  274.         $cellvalue['inc'] =& $this->createElement('text',
  275.                                                   'inc', 'increment',
  276.                                                   array('size' => 4));
  277.         $this->addGroup($cellvalue, 'cellvalue', 'Value:', ' ');
  278.  
  279.         $cellsize['width']   =& $this->createElement('text',
  280.                                                      'width', 'width',
  281.                                                      array('size' => 4));
  282.         $cellsize['height']  =& $this->createElement('text',
  283.                                                      'height', 'height',
  284.                                                      array('size' => 4));
  285.         $cellsize['spacing'] =& $this->createElement('text',
  286.                                                      'spacing', 'spacing',
  287.                                                      array('size' => 2));
  288.         $cellsize['count']   =& $this->createElement('text',
  289.                                                      'count', 'count',
  290.                                                      array('size' => 2));
  291.         $this->addGroup($cellsize, 'cellsize', 'Size:', ' ');
  292.  
  293.         $cellcolor['active']   =& $this->createElement('text',
  294.                                                        'active', 'active',
  295.                                                        array('size' => 7));
  296.         $cellcolor['inactive'] =& $this->createElement('text',
  297.                                                        'inactive', 'inactive',
  298.                                                        array('size' => 7));
  299.         $cellcolor['bgcolor']  =& $this->createElement('text',
  300.                                                        'bgcolor', 'background',
  301.                                                        array('size' => 7));
  302.         $this->addGroup($cellcolor, 'cellcolor', 'Color:', ' ');
  303.  
  304.         $cellfont['family'] =& $this->createElement('text',
  305.                                                     'family', 'family',
  306.                                                     array('size' => 32));
  307.         $cellfont['size']   =& $this->createElement('text',
  308.                                                     'size', 'size',
  309.                                                     array('size' => 2));
  310.         $cellfont['color']  =& $this->createElement('text',
  311.                                                     'color', 'color',
  312.                                                     array('size' => 7));
  313.         $this->addGroup($cellfont, 'cellfont', 'Font:', ' ');
  314.  
  315.         // Buttons of the wizard to do the job
  316.         $this->buildButtons(array('apply','process'));
  317.     }
  318. }
  319.  
  320. /**
  321.  * Class for third Tab:
  322.  * Progress border properties
  323.  *
  324.  * @category HTML
  325.  * @package  HTML_Progress2
  326.  * @author   Laurent Laville <pear@laurent-laville.org>
  327.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  328.  * @link     http://pear.php.net/package/HTML_Progress2
  329.  * @ignore
  330.  */
  331. class Property3 extends TabbedPage
  332. {
  333.     /**
  334.      * Builds the form that define border properties of your progress bar
  335.      *
  336.      * @return void
  337.      */
  338.     function buildForm()
  339.     {
  340.         $this->buildTabs();
  341.         // tab caption
  342.         $this->addElement('header', null,
  343.                           'Progress2 Generator - Control Panel: border properties');
  344.  
  345.         $borderpainted[] =& $this->createElement('radio', null, null, 'Yes', true);
  346.         $borderpainted[] =& $this->createElement('radio', null, null, 'No', false);
  347.         $this->addGroup($borderpainted, 'borderpainted', 'Display the border:');
  348.  
  349.         $this->addElement('text', 'borderclass', 'CSS class:', array('size' => 32));
  350.  
  351.         $borderstyle['style'] =& $this->createElement('select',
  352.                                                       'style', 'style',
  353.                                                       array('solid' => 'Solid',
  354.                                                             'dashed' => 'Dashed',
  355.                                                             'dotted' => 'Dotted',
  356.                                                             'inset' => 'Inset',
  357.                                                             'outset' => 'Outset'));
  358.         $borderstyle['width'] =& $this->createElement('text',
  359.                                                       'width', 'width',
  360.                                                       array('size' => 2));
  361.         $borderstyle['color'] =& $this->createElement('text',
  362.                                                       'color', 'color',
  363.                                                       array('size' => 7));
  364.         $this->addGroup($borderstyle, 'borderstyle', null, ' ');
  365.  
  366.         // Buttons of the wizard to do the job
  367.         $this->buildButtons(array('apply','process'));
  368.     }
  369. }
  370.  
  371. /**
  372.  * Class for fourth Tab:
  373.  * Label properties
  374.  *
  375.  * @category HTML
  376.  * @package  HTML_Progress2
  377.  * @author   Laurent Laville <pear@laurent-laville.org>
  378.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  379.  * @link     http://pear.php.net/package/HTML_Progress2
  380.  * @ignore
  381.  */
  382. class Property4 extends TabbedPage
  383. {
  384.     /**
  385.      * Builds the form that define label properties of your progress bar
  386.      *
  387.      * @return void
  388.      */
  389.     function buildForm()
  390.     {
  391.         $this->buildTabs();
  392.         // tab caption
  393.         $this->addElement('header', null,
  394.                           'Progress2 Generator - Control Panel: string properties');
  395.  
  396.         $stringpainted[] =& $this->createElement('radio', null, null, 'Yes', true);
  397.         $stringpainted[] =& $this->createElement('radio', null, null, 'No', false);
  398.         $this->addGroup($stringpainted, 'stringpainted', 'Render a custom string:');
  399.  
  400.         $this->addElement('text', 'stringid', 'Id:', array('size' => 32));
  401.         $this->addElement('text', 'stringclass', 'CSS class:', array('size' => 32));
  402.         $this->addElement('text', 'stringvalue', 'Content:', array('size' => 32));
  403.  
  404.         $stringsize['width']   =& $this->createElement('text',
  405.                                                        'width', 'width',
  406.                                                        array('size' => 4));
  407.         $stringsize['height']  =& $this->createElement('text',
  408.                                                        'height', 'height',
  409.                                                        array('size' => 4));
  410.         $stringsize['left']    =& $this->createElement('text',
  411.                                                        'left', 'left',
  412.                                                        array('size' => 4));
  413.         $stringsize['top']     =& $this->createElement('text',
  414.                                                        'top', 'top',
  415.                                                        array('size' => 4));
  416.         $stringsize['bgcolor'] =& $this->createElement('text',
  417.                                                        'bgcolor', 'bgcolor',
  418.                                                        array('size' => 7));
  419.         $this->addGroup($stringsize, 'stringsize', 'Size, position and color:', ' ');
  420.  
  421.         $stringvalign[] =& $this->createElement('radio', null, null,
  422.                                                 'Left', 'left');
  423.         $stringvalign[] =& $this->createElement('radio', null, null,
  424.                                                 'Right', 'right');
  425.         $stringvalign[] =& $this->createElement('radio', null, null,
  426.                                                 'Top', 'top');
  427.         $stringvalign[] =& $this->createElement('radio', null, null,
  428.                                                 'Bottom', 'bottom');
  429.         $this->addGroup($stringvalign, 'stringvalign', 'Vertical alignment:');
  430.  
  431.         $stringalign[] =& $this->createElement('radio', null, null,
  432.                                                'Left', 'left');
  433.         $stringalign[] =& $this->createElement('radio', null, null,
  434.                                                'Right', 'right');
  435.         $stringalign[] =& $this->createElement('radio', null, null,
  436.                                                'Center', 'center');
  437.         $this->addGroup($stringalign, 'stringalign', 'Horizontal alignment:');
  438.  
  439.         $stringfont['family'] =& $this->createElement('text',
  440.                                                       'family', 'family',
  441.                                                       array('size' => 40));
  442.         $stringfont['size']   =& $this->createElement('text',
  443.                                                       'size', 'size',
  444.                                                       array('size' => 2));
  445.         $stringfont['color']  =& $this->createElement('text',
  446.                                                       'color', 'color',
  447.                                                       array('size' => 7));
  448.         $this->addGroup($stringfont, 'stringfont', 'Font:', ' ');
  449.  
  450.         $stringweight[] =& $this->createElement('radio', null, null,
  451.                                                 'normal', 'normal');
  452.         $stringweight[] =& $this->createElement('radio', null, null,
  453.                                                 'Bold', 'bold');
  454.         $this->addGroup($stringweight, 'stringweight', 'Font weight:');
  455.  
  456.         // Buttons of the wizard to do the job
  457.         $this->buildButtons(array('apply','process'));
  458.     }
  459. }
  460.  
  461. /**
  462.  * Class for fifth Tab:
  463.  * Show a preview of your progress bar design.
  464.  *
  465.  * @category HTML
  466.  * @package  HTML_Progress2
  467.  * @author   Laurent Laville <pear@laurent-laville.org>
  468.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  469.  * @link     http://pear.php.net/package/HTML_Progress2
  470.  * @ignore
  471.  */
  472. class Preview extends TabbedPage
  473. {
  474.     /**
  475.      * Builds the form that show a preview of your progress bar design
  476.      *
  477.      * @return void
  478.      */
  479.     function buildForm()
  480.     {
  481.         $this->buildTabs();
  482.         // tab caption
  483.         $this->addElement('header', null,
  484.                           'Progress2 Generator - Control Panel: run demo');
  485.  
  486.         $this->addElement('static', 'progressBar',
  487.                           'Your progress meter looks like:');
  488.  
  489.         // Buttons of the wizard to do the job
  490.         $this->buildButtons(array('reset','process'));
  491.     }
  492. }
  493.  
  494. /**
  495.  * Class for sixth Tab:
  496.  * Save PHP and/or CSS code
  497.  *
  498.  * @category HTML
  499.  * @package  HTML_Progress2
  500.  * @author   Laurent Laville <pear@laurent-laville.org>
  501.  * @license  http://www.opensource.org/licenses/bsd-license.php  New BSD License
  502.  * @link     http://pear.php.net/package/HTML_Progress2
  503.  * @ignore
  504.  */
  505. class Save extends TabbedPage
  506. {
  507.     /**
  508.      * Builds the form that allow to save your PHP/CSS code
  509.      *
  510.      * @return void
  511.      */
  512.     function buildForm()
  513.     {
  514.         $this->buildTabs();
  515.         // tab caption
  516.         $this->addElement('header', null,
  517.                           'Progress2 Generator - Control Panel: save PHP/CSS code');
  518.  
  519.         $code[] =& $this->createElement('checkbox', 'P', null, 'PHP');
  520.         $code[] =& $this->createElement('checkbox', 'C', null, 'CSS');
  521.         $this->addGroup($code, 'phpcss', 'PHP and/or StyleSheet source code:');
  522.  
  523.         // Buttons of the wizard to do the job
  524.         $this->buildButtons(array('next','apply'));
  525.     }
  526. }
  527. ?>