⌈⌋ ⎇ branch:  freshcode


Artifact [c4b49acc05]

Artifact c4b49acc051f1829f915856bb4d88f3af39a1a8d:

  • File page_launchpadreleases.php — part of check-in [686e87487e] at 2015-03-24 18:23:10 on branch trunk — Updated stylesheet to use table-layout for #main/#sidebar split. Padding still needs work. (user: mario size: 3713)

<?php
/**
 * api: freshcode
 * title: launchpad-releases
 * description: dump releases feed
 * version: 0.1
 *
 * Launchpad is polled by a cron script.
 * This page just displays the latest project releases.
 *
 */

#-- switch database
db(new PDO("sqlite:launchpad.db"));

include("template/header.php");
?>
  <section id=main style="width:75%" class=container-width>
  <h2><img src="https://help.launchpad.net/moin_static192/lp20/img/logo.png" width=28 height=31> Launchpad Releases</h2>
  <article class=launchpad-releases>
  
<style>
    /** table **/
    .launchpad-releases {
       width: 100%;
    }
    #launchpadreleases {
       table-layout: fixed;
       width: 100%;
    }
    tr.release {
       padding: 4pt 1pt;
       font-size: 95%;
       box-shadow: none;
    }
    /** long fields **/
    td.lp-release-notes,
    td.proj-desc {
       color: #444;
       font-size: 75%;
    }
    tr.release td .max-height {
       max-height: 90pt;
       overflow: hidden;
       text-overflow: ellipsis;
    }
    /** title + version **/
    .proj-title a {
       font-size: 105%;
    }
    .prog-lang {
       font-size: 60%;
       padding: 0.5pt 1pt;
       border: dotted 1px #eef;
       background: #f1f3ff;
       color: #aae;
    }
    td.proj-version {
       color: #977;
    }
    td.proj-version .version {
       font-size: 120%;
       font-weight: 600;
    }
    /** urls **/
    td.proj-urls {
       font-size: 70%;
       color: #555;
    }
    td.proj-urls a {
       font-size: 95%;
       font-weight: normal;
    }
</style>

     <table id=launchpadreleases>
     <colgroup>
        <col width="15%">
        <col width="15%">
        <col width="30%">
        <col width="20%">
        <col width="20%">
     </colgroup>
     <?php

        // query latest     
        $q = db("
             SELECT r.name, r.title, r.version, r.release_notes, SUBSTR(r.date_created, 1, 10) AS date_created,
                    r.web_link,
                    p.web_link AS launchpad_url, p.programming_language, p.homepage_url, p.display_name,
                    p.summary, p.title AS proj_title, p.description, p.screenshots_url
               FROM releases AS r
          LEFT JOIN projects AS p
                 ON p.name = r.name
           ORDER BY date_created DESC
              LIMIT 100
        ");
        
        // print in table
        foreach ($q as $row) {
            $row = array_map("input::html", $row);
            print <<<HTML

       <tr class=release>
         <td class=proj-title title="$row[summary]">
            <a href="$row[launchpad_url]"> $row[proj_title] </a><br>
            <span class=prog-lang> $row[programming_language] </span>
         </td>
         <td class=proj-version>
            <a href="$row[web_link]"> →<em class=version> $row[version] </em> </a>
            <div class=release-date>$row[date_created]</div>
         </td>
         <td class=lp-release-notes>
           <div class=max-height>
              $row[release_notes]
           </div>
         </td>
         <td class=proj-urls>
           Url <a href="$row[homepage_url]"><b> $row[homepage_url] </b></a><br>
           LP <a href="$row[launchpad_url]"> $row[launchpad_url] </a><br>
           Img <a href="$row[screenshots_url]"> $row[screenshots_url] </a><br>
         </td>
         <td class=proj-desc>
           <div class=max-height>
              $row[description]
           </div>
         </td>
       </tr>

HTML;
        }
     
     ?>
     </table>

  </article>

  <p style="break: both; clear: all; background: #f3f5f7; padding: 20pt;">
    Polled via <a href="https://launchpad.net/+apidoc/">Launchpad API</a>.
  </p>

<?php
include("template/bottom.php");