Beispiel #1
0
 protected function getConfigureForm()
 {
     $contentTemplates = array('empty' => 'Empty page');
     if (file_exists('db.txt')) {
         $contentTemplates = array('backup' => '[ Restore from backup ]') + $contentTemplates;
     }
     $scriptPath = Curry_URL::getScriptPath();
     if (($pos = strrpos($scriptPath, '/')) !== false) {
         $scriptPath = substr($scriptPath, 0, $pos + 1);
     } else {
         $scriptPath = '';
     }
     $form = new Curry_Form(array('csrfCheck' => false, 'elements' => array('name' => array('text', array('label' => 'Project name', 'value' => Curry_Core::$config->curry->name)), 'email' => array('text', array('label' => 'Webmaster email', 'value' => Curry_Core::$config->curry->adminEmail)), 'base_url' => array('text', array('label' => 'Base URL', 'value' => $scriptPath == '/' ? '' : $scriptPath, 'placeholder' => 'auto-detect')), 'template' => array('select', array('label' => 'Content template', 'multiOptions' => $contentTemplates)), 'development_mode' => array('checkbox', array('label' => 'Development mode', 'value' => Curry_Core::$config->curry->developmentMode)), 'save' => array('submit', array('label' => 'Save')))));
     $form->addSubForm(new Curry_Form_SubForm(array('legend' => 'Create administrator account', 'elements' => array('username' => array('text', array('label' => 'Username', 'value' => 'admin')), 'password' => array('password', array('label' => 'Password', 'renderPassword' => true)), 'password_confirm' => array('password', array('label' => 'Confirm password', 'renderPassword' => true, 'validators' => array(array('identical', false, array('token' => 'password')))))))), 'admin', 5);
     $form->addSubForm(new Curry_Form_SubForm(array('legend' => 'Create user account', 'elements' => array('username' => array('text', array('label' => 'Username', 'value' => 'user')), 'password' => array('password', array('label' => 'Password', 'renderPassword' => true)), 'password_confirm' => array('password', array('label' => 'Confirm password', 'renderPassword' => true, 'validators' => array(array('identical', false, array('token' => 'password')))))))), 'user', 6);
     return $form;
 }