svn: /pear/pearweb/trunk/public_html/channels/ add.php

[email protected] ("Daniel O'Connor") Sat, 09 Apr 2011 13:51:57 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
clockwerx                                Sat, 09 Apr 2011 13:51:57 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310089

Log:
Prompt for project label ("PEAR"), add to database

Changed paths:
    U   pear/pearweb/trunk/public_html/channels/add.php

Modified: pear/pearweb/trunk/public_html/channels/add.php
===================================================================
--- pear/pearweb/trunk/public_html/channels/add.php	2011-04-09 13:44:44 UTC (rev 310088)
+++ pear/pearweb/trunk/public_html/channels/add.php	2011-04-09 13:51:57 UTC (rev 310089)
@@ -24,7 +24,7 @@
 require_once "Net/URL2.php";
 require_once "Damblan/Log.php";
 require_once "Damblan/Log/Mail.php";
-
+require_once 'pear-database-channel.php';
 require_once 'HTML/QuickForm2/Renderer.php';
 require_once 'HTML/QuickForm2/Element/Input.php';

@@ -89,7 +89,12 @@
 $email->addRule('callback', '', array('callback'  => 'filter_var',
                                       'arguments' => array(FILTER_VALIDATE_EMAIL)));

-$project_name = $form->addElement("text", "project[name]", array('required' => 'required', 'placeholder' => 'PHPUnit'))
+$project_name = $form->addElement("text", "project[name]", array('required' => 'required', 'placeholder' => 'pear.phpunit.de'))
+                    ->setLabel("Channel discover")
+                    ->addFilter("htmlspecialchars")
+                    ->addRule('required', "Please enter your project channel discover line");
+
+$project_label = $form->addElement("text", "project[label]", array('required' => 'required', 'placeholder' => 'PHPUnit'))
                     ->setLabel("Project Name")
                     ->addFilter("htmlspecialchars")
                     ->addRule('required', "Please enter your project name");
@@ -186,7 +191,7 @@
                     echo $form;
                     break;
                 }
-                $text = sprintf("[Channels] Please add %s (%s) to the channel index.",
+                $text = sprintf("[Channels] Please activate %s (%s) on the channel index.",
                                 $project_name->getValue(),
                                 $link->getValue());
                 $from = sprintf('"%s" <%s>',
@@ -203,6 +208,10 @@

                 $logger->log($text);

+                // Add the channel to the DB, but not yet activated
+                channel::add($project_name);
+                channel::edit($project_name, $project_label, $project_link, $name, $email);
+
                 echo "<div class=\"success\">Thanks for your submission.  It will ";
                 echo "be reviewed as soon as possible.</div>\n";
             } while (false);