svn: /pear2/sandbox/pear2.php.net/trunk/ src/PEAR2Web/License.php www/css/package-details.css www/index.php www/templates/pear2/html/Package.tpl.php www/templates/pear2/html/PackageDetails.tpl.php
[email protected] (Michael Gauthier)
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
gauthierm Wed, 16 Jun 2010 00:09:45 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=300487
Log:
Work on the package details page for PEAR2.
Changed paths:
A pear2/sandbox/pear2.php.net/trunk/src/PEAR2Web/License.php
U pear2/sandbox/pear2.php.net/trunk/www/css/package-details.css
U pear2/sandbox/pear2.php.net/trunk/www/index.php
U pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php
A pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php
svn-diffs-300487.txt
(text/x-diff, 19 KB)
Added: pear2/sandbox/pear2.php.net/trunk/src/PEAR2Web/License.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/src/PEAR2Web/License.php (rev 0)
+++ pear2/sandbox/pear2.php.net/trunk/src/PEAR2Web/License.php 2010-06-16 00:09:45 UTC (rev 300487)
@@ -0,0 +1,187 @@
+<?php
+
+namespace PEAR2Web;
+
+class License
+{
+ public static $data = array(
+
+ 'apache' => array(
+ 'title' => 'Apache 2.0',
+ 'synonyms' => array(
+ 'apache',
+ 'apache 2.0',
+ 'apache license',
+ 'apache license 2.0',
+ 'apache license, version 2.0',
+ 'the apcahe 2.0 license',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.opensource.org/licenses/apache2.0.php',
+ ),
+
+ 'bsd' => array(
+ 'title' => 'BSD',
+ 'synonyms' => array(
+ 'bsd',
+ 'bsd (3 clause)',
+ 'new bsd',
+ 'new bsd license',
+ 'the bsd license',
+ 'bsd license',
+ 'modified bsd license',
+ 'bsd style',
+ 'bsd-style',
+ 'bsd, revised',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.opensource.org/licenses/bsd-license.php',
+ ),
+
+ 'gpl' => array(
+ 'title' => 'GPL',
+ 'synonyms' => array(
+ 'gpl',
+ ),
+ 'valid' => false,
+ 'link' => 'http://www.gnu.org/copyleft/gpl.html',
+ ),
+
+ 'lgpl' => array(
+ 'title' => 'LGPL',
+ 'synonyms' => array(
+ 'lgpl',
+ 'lgpl license',
+ 'gnu lgpl',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.gnu.org/copyleft/lesser.html',
+ ),
+
+ 'lgpl-2' => array(
+ 'title' => 'LGPL 2.1',
+ 'synonyms' => array(
+ 'lgpl2',
+ 'lgpl 2.1',
+ 'lgplv2.1',
+ 'lgpl version 2.1',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
+ ),
+
+ 'lgpl-3' => array(
+ 'title' => 'LGPL 3.0',
+ 'synonyms' => array(
+ 'lgpl3',
+ 'lgpl 3.0',
+ 'lgplv3 license',
+ 'lgpl version 3.0',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
+ ),
+
+ 'mit' => array(
+ 'title' => 'MIT',
+ 'synonyms' => array(
+ 'mit',
+ 'mit license',
+ 'mit / beerware',
+ ),
+ 'valid' => true,
+ 'link' => 'http://www.opensource.org/licenses/mit-license.php',
+ ),
+
+ 'php' => array(
+ 'title' => 'PHP',
+ 'synonyms' => array(
+ 'php',
+ 'php license',
+ 'php license 4.0',
+ ),
+ 'valid' => false,
+ 'link' => 'http://www.php.net/license',
+ ),
+
+ 'php-2' => array(
+ 'title' => 'PHP 2.02',
+ 'synonyms' => array(
+ 'php 2.02',
+ 'php license 2.02',
+ ),
+ 'valid' => false,
+ 'link' => 'http://www.php.net/license/2_02.txt',
+ ),
+
+ 'php-3' => array(
+ 'title' => 'PHP 3.01',
+ 'synonyms' => array(
+ 'php 3.0',
+ 'php 3.01',
+ 'php license v3.0',
+ 'php license 3.0',
+ 'php license 3.01',
+ ),
+ 'valid' => false,
+ 'link' => 'http://www.php.net/license/3_01.txt',
+ ),
+
+ 'w3c' => array(
+ 'title' => 'W3C',
+ 'synonyms' => array(
+ 'w3c',
+ ),
+ 'valid' => false,
+ 'link' => 'http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231',
+ ),
+
+ );
+
+ public static function getLink($license)
+ {
+ $link = null;
+ $info = self::find($license);
+
+ if ($info !== null) {
+ $link = $info['link'];
+ }
+
+ return $link;
+ }
+
+ public static function isValid($license)
+ {
+ $valid = false;
+ $info = self::find($license);
+
+ if ($info !== null) {
+ $valid = $info['valid'];
+ }
+
+ return $valid;
+ }
+
+ protected static function find($license)
+ {
+ static $map = null;
+
+ if ($map === null) {
+ $map = array();
+ foreach (self::$data as $key => $info) {
+ foreach ($info['synonyms'] as $synonym) {
+ $map[$synonym] = $key;
+ }
+ }
+ }
+
+ $info = null;
+ $key = strtolower($license);
+
+ if (isset($map[$key])) {
+ $info = self::$data[$map[$key]];
+ }
+
+ return $info;
+ }
+}
Property changes on: pear2/sandbox/pear2.php.net/trunk/src/PEAR2Web/License.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: pear2/sandbox/pear2.php.net/trunk/www/css/package-details.css
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/css/package-details.css 2010-06-15 22:29:42 UTC (rev 300486)
+++ pear2/sandbox/pear2.php.net/trunk/www/css/package-details.css 2010-06-16 00:09:45 UTC (rev 300487)
@@ -1,44 +1,217 @@
+#package-details {
+ margin-top: 10px;
+}
+
h3 {
- margin: 20px 0 10px 0;
+ margin: 20px 0 5px 0;
}
.left {
- width: 440px;
+ width: 528px;
float: left;
margin-right: 20px;
}
.right {
- width: 440px;
+ width: 352px;
float: left;
}
-.description p {
- margin: 0.5em 0 0 0;
+.signin {
+ margin-top: 0;
+ display: none;
}
-table.details {
+
+/* Package Description */
+
+.package-description {
+ margin-top: 0;
+}
+
+.package-description p {
+ margin: 0 0 0.5em;
+}
+
+.package-description .code {
+ font-size: 11px;
+ overflow-x: auto;
+ overflow-y: hidden;
+}
+
+.package-description .code code {
+ font-family: "Consolas", "Monaco", "DejaVu Sans Mono", "Lucida Console", monospace;
+}
+
+.package-description h3 {
+ margin: 1em 0 0;
+}
+
+.package-description .package-categories li {
+ font-size: 11px;
+}
+
+.package-description .package-categories li a {
+ display: block;
+ background: #d0e2c6;
+ float: left;
+ padding: 2px 8px 2px 8px;
+ margin: 0 4px 2px 0;
+ color: #323232;
+ border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+}
+.package-description .package-categories li a:hover {
+ background: #649f43; /* IE fallback */
+ background: rgba(100, 159, 67, 0.9);
+ text-decoration: none;
+ color: #fff;
+}
+
+.package-description .package-categories ul::after {
+ clear: left;
+ display: block;
+ content: '.';
+ height: 1px;
+ visibility: hidden;
+}
+
+
+/* Package Details */
+
+table.package-details {
margin: 1em;
}
-table.details th {
+table.package-details tbody {
+ font-size: 12px;
+}
+
+table.package-details td {
+ padding-bottom: 0.25em;
+}
+
+table.package-details th {
font-weight: bold;
text-align: right;
- padding-right: 1em;
+ padding-right: 0.5em;
+ padding-bottom: 0.25em;
+ vertical-align: top;
}
+table.package-details li {
+ list-style-type: none;
+ margin: 0;
+}
+
+.package-unmaintained {
+ color: #af351a;
+}
+
+.package-alpha {
+ color: #af351a;
+}
+
+.package-beta {
+ color: #da2;
+}
+
+.package-stable {
+}
+
.maintainers li {
list-style-type: disc;
margin-left: 2em;
}
+.package-details .package-bugs-new {
+ margin-left: 0.5em;
+}
+
+
+/* Package Dependencies */
+
+#content .package-dependencies ul li {
+ margin: 0 0 0 2em;
+ list-style-type: disc;
+}
+
+
+/* Package Documentation */
+
+.package-documentation h3 {
+ margin-top: 0;
+}
+
+#content .package-documentation ol li {
+ margin: 0 0 0 2em;
+}
+
+li.package-documentation-api {
+ font-weight: bold;
+}
+
+
+/* Package Releases */
+
+.package-releases table {
+ margin: 0;
+ width: 100%;
+}
+
+.package-releases td.package-releases-release {
+ padding-left: 2em;
+}
+
+.package-releases td.package-releases-date {
+ text-align: right;
+ padding-right: 2em;
+}
+
+
+/* Package Installation */
+
+.package-install {
+ margin: 0;
+}
+
+.package-install-instructions {
+ text-indent: -16px;
+ font-family: "Consolas", "Monaco", "DejaVu Sans Mono", "Lucida Console", monospace;
+ color: #eee;
+ background: #333;
+ border-color: #111;
+ padding: 10px;
+ border-radius: 8px;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+}
+
+.package-install-instructions div {
+ margin-left: 16px;
+}
+
+.package-install .package-install-prompt {
+ font-weight: bold;
+}
+
+.package-install .package-install-package {
+ font-weight: bold;
+ white-space: nowrap;
+}
+
+
+/* Package Comments */
+
.comments .comment {
- margin: 0 0 1em 0;
+ margin: 0 0 1.5em 0;
}
.comments .comment-title {
font-size: 12px;
}
.comments .comment-content {
+ margin-top: 0.5em;
font-size: 12px;
}
.comments .comment-content p {
@@ -53,25 +226,77 @@
width: 97%;
}
-.releases .download {
- float: right;
- margin-right: 5px;
+
+/* Package Rating Widget */
+
+.package-rating {
+ margin: 0 0 1em;
}
-.package .releases .instructions .pearbox-content {
- background-color:rgba(0, 0, 0, 0.8);
- border-color:rgba(0, 0, 0, 0.8);
- color:#FFF;
- font-family:"andale mono", monaco, "courier new", courier;
+.package-rating h3 {
+ margin: 0 0 5px 0;
}
-.package .instructions ol, .package .instructions ol li {
- list-style: none !important;
- margin:0 !important;
- padding:0 !important;
+.package-rating-bar {
+ position: relative;
+ font-size: 11px;
+ font-weight: bold;
+ border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -webkit-box-shadow: rgba(0, 0, 0, 0.0975) 1px 2px 3px inset;
+ -moz-box-shadow: rgba(0, 0, 0, 0.0975) 1px 2px 3px inset;
}
-.instructions a,
-.instructions a:link {
- color:#FFF;
+.package-rating-fill {
+ padding: 2px 0;
+ border-top-left-radius: 2px;
+ border-bottom-left-radius: 2px;
+ -webkit-border-top-left-radius: 2px;
+ -webkit-border-bottom-left-radius: 2px;
+ -moz-border-radius-topleft: 2px;
+ -moz-border-radius-bottomleft: 2px;
}
+
+.package-rating .package-rating-description {
+ padding: 2px 0px;
+ display: block;
+ position: absolute;
+ top: 0;
+ width: 100%;
+}
+
+.package-rating .package-rating-description span {
+ padding: 0 4px;
+}
+
+.package-rating-good .package-rating-bar {
+ border: 1px solid #507f35;
+}
+
+.package-rating-bad .package-rating-bar {
+ border: 1px solid #992e17;
+}
+
+.package-rating-good .package-rating-fill {
+ background: #649f43;
+}
+
+.package-rating-bad .package-rating-fill {
+ background: #af351a;
+}
+
+.package-rating-good .package-rating-description {
+ color: #fff;
+ text-align: left;
+}
+
+.package-rating-bad .package-rating-description {
+ color: #992e17;
+ text-align: right;
+}
+
+.package-rating-controls {
+ float: right;
+ padding: 0 0;
+}
Modified: pear2/sandbox/pear2.php.net/trunk/www/index.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/index.php 2010-06-15 22:29:42 UTC (rev 300486)
+++ pear2/sandbox/pear2.php.net/trunk/www/index.php 2010-06-16 00:09:45 UTC (rev 300487)
@@ -2,6 +2,7 @@
require_once dirname(__FILE__).'/../config.inc.php';
require_once dirname(__FILE__).'/../src/PEAR2Web/Router.php';
+require_once dirname(__FILE__).'/../src/PEAR2Web/License.php';
require_once dirname(__FILE__).'/../src/PEAR2Web/Menu.php';
require_once dirname(__FILE__).'/../src/PEAR2Web/MenuDisplayer.php';
Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php 2010-06-15 22:29:42 UTC (rev 300486)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php 2010-06-16 00:09:45 UTC (rev 300487)
@@ -2,36 +2,134 @@
// Set the title for the main template
$parent->context->page_title = $context->name.' | pear2.php.net';
?>
-<div class="package">
- <div class="left">
- <h2><?php echo $context->name; ?></h2>
- <p><em><?php echo $context->summary; ?></em></p>
- <p>
- <?php
- $description = preg_replace("|\<\;\?php(.*)\?\>\;|Use", "highlight_string('<?php'.html_entity_decode('\\1').'?>', true)", $context->description);
- echo nl2br($description);
- ?>
- </p>
- </div>
- <div class="right releases">
- <?php echo $savant->render($context->name . '-' . $context->version['release'], 'InstallInstructions.tpl.php'); ?>
- <div class="pearbox">
- <div class="pearbox-header">
- <h2>Releases</h2>
+
+<div class="left">
+
+ <div class="pearbox package-description">
+
+ <div class="pearbox-header navbar">
+ <h2><?php echo $context->name; ?></h2>
+ </div>
+
+ <div class="pearbox-content">
+ <p>
+ <?php
+ $description = preg_replace("|\<\;\?php(.*)\?\>\;|Use", "highlight_string('<?php'.html_entity_decode('\\1').'?>', true)", $context->description);
+ echo nl2br(trim($description));
+ ?>
+ </p>
+
+ <div class="package-release-notes">
+ <h3>Release Notes - <?php echo $context->version['release']; ?></h3>
+ <p>
+ <?php echo nl2br(trim($context->notes)); ?>
+ </p>
</div>
- <div class="pearbox-content">
- <ul>
- <?php
- foreach ($context as $version => $release): ?>
- <li>
- <a href="<?php echo pear2\SimpleChannelFrontend\Main::getURL() . $context->name . '-' . $version; ?>"><?php echo $version; ?></a>
- <span class="stability"><?php echo $release['stability']; ?></span>
- <abbr class="releasedate" title="<?php echo $context->date.' '.$context->time; ?>"><?php echo $context->date; ?></abbr>
- <a class="download" href="<?php echo $context->getDownloadURL('.tgz'); ?>">Download</a>
- </li>
- <?php endforeach; ?>
- </ul>
+
+ <div class="package-categories">
+ <h3>Categories</h3>
</div>
</div>
</div>
+
</div>
+
+<div class="right">
+
+<?php
+
+echo $savant->render(
+ $context->name . '-' . $context->version['release'],
+ 'InstallInstructions.tpl.php'
+);
+
+?>
+
+<?php
+
+echo $savant->render(
+ $context,
+ 'PackageDetails.tpl.php'
+);
+
+?>
+
+ <div class="package-releases">
+ <h3>Release History</h3>
+ <table>
+ <tbody>
+
+<?php
+
+$count = 0;
+
+foreach ($context as $version => $release) {
+
+ $releaseURL = pear2\SimpleChannelFrontend\Main::getURL()
+ . $context->name . '-' . $version;
+
+ $class = ($count % 2 === 0) ? 'odd' : 'even';
+
+ switch ($release['stability']) {
+ case 'alpha':
+ $statusClass = 'package-alpha';
+ break;
+ case 'beta':
+ $statusClass = 'package-beta';
+ break;
+ default:
+ $statusClass = 'package-stable';
+ break;
+ }
+
+ $releaseDateISO = $context->date . 'T' . $context->time;
+ $releaseDate = date('F j, Y', strtotime($releaseDateISO));
+
+ echo ' ';
+ echo '<tr id="release-' . $version . '" class="' . $class . '">' ." \n";
+ echo ' ';
+ echo '<td class="package-releases-release">';
+ echo '<a href="' . $releaseURL . '">' . $version . '</a>';
+ echo '</td>' . "\n";
+ echo ' ';
+ echo '<td class="package-releases-status">';
+ echo '<span class="' . $statusClass . '">' . $release['stability'] . '</span>';
+ echo '</td>' . "\n";
+ echo ' ';
+ echo '<td class="package-releases-date">';
+ echo '<abbr class="date" title="' . $releaseDateISO . '">' . $releaseDate . '</abbr>';
+ echo '</td>' . "\n";
+ echo ' ';
+ echo '</tr>' . "\n";
+
+ $count++;
+}
+
+?>
+ </tbody>
+ </table>
+ </div>
+
+<?php
+$dependencies = $context->dependencies['required']->package;
+if (count($dependencies) > 0):
+?>
+ <div class="package-dependencies">
+ <h3>Dependencies for <?php echo $context->name; ?></h3>
+ <ul>
+
+<?php
+
+foreach ($dependencies as $name => $package) {
+ echo '<li>' . $name . '</li>';
+}
+
+?>
+ </ul>
+ </div>
+
+<?php endif; ?>
+
+</div>
+
+<div class="clearfix"></div>
Added: 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 (rev 0)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php 2010-06-16 00:09:45 UTC (rev 300487)
@@ -0,0 +1,60 @@
+<?php
+
+switch ($context->stability['release']) {
+case 'alpha':
+ $statusClass = 'package-alpha';
+ break;
+case 'beta':
+ $statusClass = 'package-beta';
+ break;
+default:
+ $statusClass = 'package-stable';
+ break;
+}
+
+$releaseDateISO = $context->date . 'T' . $context->time;
+$releaseDate = date('F j, Y', strtotime($releaseDateISO));
+
+$licenseName = htmlspecialchars($context->license['name']);
+$licenseURI = \PEAR2Web\License::getLink($context->license['name']);
+$licenseClass = \PEAR2Web\License::isValid($context->license['name']) ?
+ 'package-license-good' : 'package-license-bad';
+
+?>
+
+<table class="package-details">
+ <tbody>
+ <tr>
+ <th>Status:</th>
+ <td>
+ <?php echo $context->version['release']; ?>
+ <span class="<?php echo $statusClass; ?>"><?php echo $context->stability['release']; ?></span>,
+ released on <abbr class="date" title="<?php echo $releaseDateISO; ?>"><?php echo $releaseDate; ?></abbr>
+ </td>
+ </tr>
+ <tr>
+ <th>License:</th>
+ <td>
+<?php
+
+if ($licenseURI) {
+ echo '<a href="' . $licenseURI . '" class="' . $licenseClass . '">';
+}
+echo $licenseName;
+if ($licenseURI) {
+ echo '</a>';
+}
+
+?>
+ </td>
+ </tr>
+ <!-- tr>
+ <th>Bugs:</th>
+ <td></td>
+ </tr -->
+ <!-- tr>
+ <th>Maintainers:</th>
+ <td></td>
+ </tr -->
+ </tbody>
+</table>
Property changes on: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/PackageDetails.tpl.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native