Exemplo n.º 1
0
// Set defaults for the form elements
$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => htmlspecialchars($row['name']), 'license' => htmlspecialchars($row['license']), 'summary' => htmlspecialchars($row['summary']), 'description' => htmlspecialchars($row['description']), 'category' => (int) $row['categoryid'], 'homepage' => htmlspecialchars($row['homepage']), 'doc_link' => htmlspecialchars($row['doc_link']), 'bug_link' => htmlspecialchars($row['bug_link']), 'cvs_link' => htmlspecialchars($row['cvs_link']), 'unmaintained' => $row['unmaintained'] ? true : false, 'newpk_id' => (int) $row['newpk_id'], 'new_channel' => htmlspecialchars($row['new_channel']), 'new_package' => htmlspecialchars($row['new_package']))));
$form->addElement('text', 'name', array('maxlength' => "80", 'accesskey' => "c"))->setLabel('Pa<span class="accesskey">c</span>kage Name');
$form->addElement('text', 'license', array('maxlength' => "50", 'placeholder' => 'BSD'))->setLabel('License:');
$form->addElement('textarea', 'summary', array('cols' => "75", 'rows' => "7", 'maxlength' => "255"))->setLabel('Summary');
$form->addElement('textarea', 'description', array('cols' => "75", 'rows' => "12"))->setLabel('Description');
$form->addElement('select', 'category')->setLabel('Category:')->loadOptions($rows);
$manager = new Tags_Manager();
$sl = $form->addElement('select', 'tags', array('multiple' => 'multiple'))->setLabel('Tags:')->loadOptions(array('' => '(none)') + $manager->getTags(false, true));
$sl->setValue(array_keys($manager->getTags($row['name'], true)));
$form->addElement('text', 'homepage', array('maxlength' => 255, 'accesskey' => "O"))->setLabel('H<span class="accesskey">o</span>mepage:');
$form->addElement('text', 'doc_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/manual'))->setLabel('Documentation URI:');
$form->addElement('url', 'bug_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/bugs'))->setLabel('Bug Tracker URI:');
$form->addElement('url', 'cvs_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/svn/trunk'))->setLabel('Web version control URI');
$form->addElement('checkbox', 'unmaintained')->setLabel('Is this package unmaintained ?');
$packages = package::listAllwithReleases();
$rows = array(0 => '');
foreach ($packages as $id => $info) {
    if ($id == $_GET['id']) {
        continue;
    }
    $rows[$id] = $info['name'];
}
$form->addElement('select', 'newpk_id')->setLabel('Superseeded by:')->loadOptions($rows);
$form->addElement('text', 'new_channel', array('maxlength' => 255, 'placeholder' => 'pear.phpunit.de'))->setLabel('Moved to channel:');
$form->addElement('text', 'new_package', array('maxlength' => 255, 'placeholder' => 'PHPUnit'));
$form->addElement('submit', 'submit')->setLabel('Save Changes');
$csrf_token_value = create_csrf_token($csrf_token_name);
$form->addElement('hidden', $csrf_token_name)->setValue($csrf_token_value);
print $form->render($renderer);
?>