svn: /pear2/BugManager/trunk/ src/BugManager/IssueView/EditForm.php src/BugManager/Main.php src/BugManager/Site/PEAR2.php www/config.sample.php www/templates/pear2/Main.tpl.php

[email protected] (Brett Bieber) Thu, 09 Sep 2010 02:43:44 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
saltybeagle                              Thu, 09 Sep 2010 02:43:44 +0000

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

Log:
* Get PEAR2 website template functioning for the PEAR2 BugManager instance.
* Switch PEAR2's actor interface to SimpleChannelServer-based.
* See config.sample.php for how to reference a PEAR2 website instance.

Changed paths:
    U   pear2/BugManager/trunk/src/BugManager/IssueView/EditForm.php
    U   pear2/BugManager/trunk/src/BugManager/Main.php
    U   pear2/BugManager/trunk/src/BugManager/Site/PEAR2.php
    U   pear2/BugManager/trunk/www/config.sample.php
    A   pear2/BugManager/trunk/www/templates/pear2/
    A   pear2/BugManager/trunk/www/templates/pear2/Main.tpl.php

Modified: pear2/BugManager/trunk/src/BugManager/IssueView/EditForm.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/IssueView/EditForm.php	2010-09-09 02:37:28 UTC (rev 303192)
+++ pear2/BugManager/trunk/src/BugManager/IssueView/EditForm.php	2010-09-09 02:43:44 UTC (rev 303193)
@@ -2,10 +2,16 @@

 namespace PEAR2\BugManager\IssueView;

+use pear2\BugManager\Issue;
+
 class EditForm
 {
-    public $packagename;
     public $bug;
+
+    function __construct($packagename)
+    {
+        $this->bug = new Issue;
+    }
 }

 ?>
\ No newline at end of file

Modified: pear2/BugManager/trunk/src/BugManager/Main.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/Main.php	2010-09-09 02:37:28 UTC (rev 303192)
+++ pear2/BugManager/trunk/src/BugManager/Main.php	2010-09-09 02:43:44 UTC (rev 303193)
@@ -41,7 +41,7 @@

     public $title;

-    protected $options = array(
+    public $options = array(
             // Set the default view
             'view'=>'intro',
         );

Modified: pear2/BugManager/trunk/src/BugManager/Site/PEAR2.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/Site/PEAR2.php	2010-09-09 02:37:28 UTC (rev 303192)
+++ pear2/BugManager/trunk/src/BugManager/Site/PEAR2.php	2010-09-09 02:43:44 UTC (rev 303193)
@@ -34,14 +34,6 @@
         return new \PEAR2\BugManager\Category\Pear2Package('PEAR2');
     }

-    function defaultActorManager()
-    {
-        if (isset(PEAR::$defaultActorManager)) {
-            return PEAR::$defaultActorManager;
-        }
-        return new PEAR\ActorManager('localhost', 'pear', 'pear', 'pear');
-    }
-
     function __toString()
     {
        return 'PEAR2';

Modified: pear2/BugManager/trunk/www/config.sample.php
===================================================================
--- pear2/BugManager/trunk/www/config.sample.php	2010-09-09 02:37:28 UTC (rev 303192)
+++ pear2/BugManager/trunk/www/config.sample.php	2010-09-09 02:43:44 UTC (rev 303193)
@@ -17,6 +17,12 @@
  *              new \PEAR2\Pyrus\ChannelFile('./channel.xml'));
  * </code>
  *
+ * For the PEAR2 website:
+ *
+ * <code>
+ * $site = new PEAR2\BugManager\Site\PEAR2(
+ *              new \PEAR2\Pyrus\ChannelFile('/path/to/pear2.php.net/www/channel.xml'));
+ * </code>
  */
 if (!ini_get('date.timezone')) {
     date_default_timezone_set('America/Chicago');

Added: pear2/BugManager/trunk/www/templates/pear2/Main.tpl.php
===================================================================
--- pear2/BugManager/trunk/www/templates/pear2/Main.tpl.php	                        (rev 0)
+++ pear2/BugManager/trunk/www/templates/pear2/Main.tpl.php	2010-09-09 02:43:44 UTC (rev 303193)
@@ -0,0 +1,26 @@
+<?php
+// Set the path to the pear2 website
+$pear2_dir = dirname(dirname($context::site()->channel->path));
+
+// Add a new autoloader to grab the PEAR2Web classes
+spl_autoload_register(function($class) use ($pear2_dir) {
+    $file = str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
+    include $pear2_dir.'/src/'.$file;
+});
+
+// include the pear2 configuration file to set the base url
+include $pear2_dir.'/config.inc.php';
+
+// create a pear2 web instance
+$passthru = new PEAR2\SimpleChannelFrontend\Main($context::site()->channel);
+$passthru->page_content = $context->actionable;
+
+// Assign context
+$context = $passthru;
+
+// add pear2 templates to the current path
+$savant->addTemplatePath($pear2_dir.'/www/templates/pear2/html/');
+
+// pull in the pear2 website Main template
+include($pear2_dir.'/www/templates/pear2/html/Main.tpl.php');
+