svn: /pear2/sandbox/pear2.php.net/trunk/www/ css/package-list.css css/search.css templates/pear2/html/Category.tpl.php templates/pear2/html/Main.tpl.php templates/pear2/html/PackageDetails.tpl.php templates/pear2/html/PackageList.tpl.php templates/pear2/html/Search.tpl.php templates/pear2/html/SearchForm.tpl.php

[email protected] (Michael Gauthier)
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
gauthierm                                Thu, 24 Jun 2010 22:42:26 +0000

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

Log:
- remove full package list page
- clean up package search page
- hilight search keywords.

Changed paths:
    A   pear2/sandbox/pear2.php.net/trunk/www/css/package-list.css
    A   pear2/sandbox/pear2.php.net/trunk/www/css/search.css
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Category.tpl.php
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Main.tpl.php
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageList.tpl.php
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Search.tpl.php
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/SearchForm.tpl.php
svn-diffs-300738.txt (text/x-diff, 10.7 KB)
Added: pear2/sandbox/pear2.php.net/trunk/www/css/package-list.css
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/css/package-list.css	                        (rev 0)
+++ pear2/sandbox/pear2.php.net/trunk/www/css/package-list.css	2010-06-24 22:42:26 UTC (rev 300738)
@@ -0,0 +1,43 @@
+/**
+ * Package List Styles
+ *
+ * @package   PEAR2Web
+ * @copyright 2010 PEAR Group
+ * @license   http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @author    Michael Gauthier <[email protected]>
+ */
+/* {{{ Package list */
+
+.package-list-package .package-title {
+	font-weight: bold;
+	font-size: 17px;
+}
+
+.package-list-package {
+	margin-bottom: 1em;
+	padding-bottom: 1em;
+	border-bottom: 1px solid #d8e7d0;
+}
+
+.package-list-package:last-child {
+	margin-bottom: 0;
+	padding-bottom: 0;
+	border-bottom: none;
+}
+
+.package-list-package .package-info {
+	float: left;
+	width: 415px;
+	padding-right: 10px;
+}
+
+.package-list-package .package-more-info {
+	margin-left: 425px;
+	padding-left: 10px;
+}
+
+.package-list-package .package-more-info table.package-details {
+	margin: 0;
+}
+
+/* }}} */

Added: pear2/sandbox/pear2.php.net/trunk/www/css/search.css
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/css/search.css	                        (rev 0)
+++ pear2/sandbox/pear2.php.net/trunk/www/css/search.css	2010-06-24 22:42:26 UTC (rev 300738)
@@ -0,0 +1,25 @@
+/**
+ * Package Search Styles
+ *
+ * @package   PEAR2Web
+ * @copyright 2010 PEAR Group
+ * @license   http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @author    Michael Gauthier <[email protected]>
+ */
+/* {{{ Layout */
+.view-search #search-packages {
+	margin-top: 0;
+}
+
+/* }}} */
+/* {{{ Keyword highlight */
+
+.search-keyword-highlight {
+	background: #fcf7b8;
+}
+
+a:hover .search-keyword-highlight {
+	text-decoration: underline;
+}
+
+/* }}} */

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Category.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Category.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Category.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -14,58 +14,7 @@
                 </h2>
             </div>
             <div class="pearbox-content clearfix">
-
-<?php
-
-foreach ($context as $key => $package) {
-
-    $package->figureOutBestVersion(
-        new \PEAR2\Pyrus\PackageFile\v2\Dependencies\Package(
-            'required',
-            'package',
-            null,
-            array(
-                'name'              => $package->name,
-                'channel'           => 'pear2.php.net',
-                'uri'               => null,
-                'min'               => null,
-                'max'               => null,
-                'recommended'       => null,
-                'exclude'           => null,
-                'providesextension' => null,
-                'conflicts'         => null
-            ),
-            0
-        )
-    );
-
-    $packageTitle = str_replace('PEAR2_', '', $package->name);
-    $packageHref  = PEAR2\SimpleChannelFrontend\Main::getURL()
-        . $package->name;
-
-    echo '<div class="package">';
-
-    echo '<div class="package-info">';
-
-    echo '<div class="package-title">';
-    echo '<a href="' . $packageHref . '">' . $packageTitle . '</a>';
-    echo '</div>';
-    echo '<div class="package-description">';
-    echo '<p>' . $package->summary . '</p>';
-    echo '</div>';
-
-    echo '</div>';
-    echo '<div class="package-more-info">';
-
-    echo $savant->render($package, 'PackageDetails.tpl.php');
-
-    echo '</div>';
-
-    echo '</div>';
-}
-
-?>
-
+                <?php echo $savant->render($context, 'PackageList.tpl.php'); ?>
             </div>
         </div>


Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Main.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Main.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Main.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -11,6 +11,8 @@
     <link rel="stylesheet" href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>css/categories.css" />
     <link rel="stylesheet" href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>css/category.css" />
     <link rel="stylesheet" href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>css/package.css" />
+    <link rel="stylesheet" href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>css/package-list.css" />
+    <link rel="stylesheet" href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>css/search.css" />

     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
     <script src="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>js/pearweb.js"></script>

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -56,7 +56,11 @@
             <td></td>
         </tr -->

-<?php if ($parent->parent->context->options['view'] === 'package') { ?>
+<?php
+if (   isset($parent->parent->context->options)
+    && $parent->parent->context->options['view'] === 'package'
+) {
+?>
         <tr>
             <th>Maintainers:</th>
             <td>

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageList.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageList.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageList.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -1,20 +1,61 @@
 <?php
-// Set the title for the main template
-$parent->context->page_title = 'Packages | '.PEAR2\SimpleChannelFrontend\Main::$channel->name;
+
+foreach ($context as $key => $package) {
+
+    $package->figureOutBestVersion(
+        new \PEAR2\Pyrus\PackageFile\v2\Dependencies\Package(
+            'required',
+            'package',
+            null,
+            array(
+                'name'              => $package->name,
+                'channel'           => 'pear2.php.net',
+                'uri'               => null,
+                'min'               => null,
+                'max'               => null,
+                'recommended'       => null,
+                'exclude'           => null,
+                'providesextension' => null,
+                'conflicts'         => null
+            ),
+            0
+        )
+    );
+
+    // filter PEAR2 from package name
+    $packageTitle = str_replace('PEAR2_', '', $package->name);
+
+    // highlight search keywords
+    if (isset($context->query)) {
+        $packageTitle = preg_replace(
+            '/(' . preg_quote($context->query, '/') . ')/i',
+            '<span class="search-keyword-highlight">\1</span>',
+            $packageTitle
+        );
+    }
+
+    $packageHref = PEAR2\SimpleChannelFrontend\Main::getURL()
+        . $package->name;
+
+    echo '<div class="package-list-package">';
+
+    echo '<div class="package-info">';
+
+    echo '<div class="package-title">';
+    echo '<a href="' . $packageHref . '">' . $packageTitle . '</a>';
+    echo '</div>';
+    echo '<div class="package-description">';
+    echo '<p>' . $package->summary . '</p>';
+    echo '</div>';
+
+    echo '</div>';
+    echo '<div class="package-more-info">';
+
+    echo $savant->render($package, 'PackageDetails.tpl.php');
+
+    echo '</div>';
+
+    echo '</div>';
+}
+
 ?>
-<div class="package-list pearbox">
-    <div class="pearbox-header">
-        <h2>Available Packages</h2>
-        <?php echo $savant->render(null, 'SearchForm.tpl.php'); ?>
-    </div>
-    <div class="pearbox-content">
-        <ul>
-        <?php
-        foreach ($context as $package) {
-            echo '<li><a href="'.PEAR2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
-        }
-        ?>
-        </ul>
-    </div>
-</div>
-<?php echo $savant->render(null, 'OtherChannelsNote.tpl.php'); ?>

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Search.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Search.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Search.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -1,20 +1,13 @@
 <?php
 // Set the title for the main template
-$parent->context->page_title = 'Search | '.PEAR2\SimpleChannelFrontend\Main::$channel->name;
+$parent->context->page_title = 'Search | ' . PEAR2\SimpleChannelFrontend\Main::$channel->name;
 ?>
-<div id="packages" class="packagelist pearbox">
+<div id="search-packages" class="package-list pearbox">
     <div class="pearbox-header">
         <h2>Package Search</h2>
         <?php echo $savant->render(null, 'SearchForm.tpl.php'); ?>
     </div>
     <div class="pearbox-content">
-        <h2>Results for <?php echo $context->query; ?></h2>
-        <ul>
-        <?php
-        foreach ($context as $package) {
-            echo '<li><a href="'.PEAR2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
-        }
-        ?>
-        </ul>
+        <?php echo $savant->render($context, 'PackageList.tpl.php'); ?>
     </div>
-</div>
\ No newline at end of file
+</div>

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/SearchForm.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/SearchForm.tpl.php	2010-06-24 22:32:42 UTC (rev 300737)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/SearchForm.tpl.php	2010-06-24 22:42:26 UTC (rev 300738)
@@ -3,7 +3,7 @@
 $keywords = (isset($parent->context->query)) ? $parent->context->query : null;

 ?>
-<form method="get" action="search" id="find-packages">
+<form method="get" action="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>search" id="find-packages">
     <div>
         <input type="search" placeholder="Package name or description …" size="30" name="q" value="<?php echo $keywords; ?>" /><input class="button" value="Search" type="submit" />
     </div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.