MidCOM svn: r23301 - in branches/ragnaroek/midcom/org.maemo.packages: . config handler/packageinstance handler/source style
xfade
midcom-commits at lists.midgard-project.org
Sat Sep 5 20:52:16 CEST 2009
Author: xfade
Date: Sat Sep 5 20:52:16 2009
New Revision: 23301
URL: http://trac.midgard-project.org/changeset/23301
Log:
Add source packages.
Added:
branches/ragnaroek/midcom/org.maemo.packages/config/schemadb_source_default.inc
branches/ragnaroek/midcom/org.maemo.packages/handler/source/
branches/ragnaroek/midcom/org.maemo.packages/handler/source/source.php
branches/ragnaroek/midcom/org.maemo.packages/source.php
branches/ragnaroek/midcom/org.maemo.packages/style/source_view.php
Modified:
branches/ragnaroek/midcom/org.maemo.packages/config/config.inc
branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml
branches/ragnaroek/midcom/org.maemo.packages/config/midcom_dba_classes.inc
branches/ragnaroek/midcom/org.maemo.packages/handler/packageinstance/packageinstance.php
branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php
branches/ragnaroek/midcom/org.maemo.packages/viewer.php
Modified: branches/ragnaroek/midcom/org.maemo.packages/config/config.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/config/config.inc (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/config/config.inc Sat Sep 5 20:52:16 2009
@@ -9,6 +9,7 @@
'schemadb_package' => 'file:/org/maemo/packages/config/schemadb_package_default.inc',
'schemadb_repository' => 'file:/org/maemo/packages/config/schemadb_repository_default.inc',
'schemadb_package_instance' => 'file:/org/maemo/packages/config/schemadb_package_instance_default.inc',
+'schemadb_source' => 'file:/org/maemo/packages/config/schemadb_source_default.inc',
/* The schema in the database to use to edit articles
* note the name here and in schemadb_default.inc
@@ -17,6 +18,7 @@
'schema_package' => 'default',
'schema_package_instance' => 'default',
'schema_repository' => 'default',
+'schema_source' => 'default',
'schemadb_config' => 'file:/org/maemo/packages/config/config_schemadb.inc',
Modified: branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/config/mgdschema.xml Sat Sep 5 20:52:16 2009
@@ -75,6 +75,7 @@
<property name="status" type="unsigned integer" />
<property name="uploader" type="guid" link="midgard_person:guid" />
<property name="versionscore" type="unsigned integer" />
+ <property name="source" type="unsigned integer" link="org_maemo_packages_source:id" />
</type>
<type name="org_maemo_packages_package_event" table="org_maemo_packages_package_event">
@@ -97,4 +98,24 @@
<property name="dist" type="string" />
</type>
+ <type name="org_maemo_packages_source" table="org_maemo_packages_source">
+ <property name="id" type="unsigned integer" primaryfield="id" index="yes">
+ <description>Local non-replication-safe database identifier</description>
+ </property>
+ <property name="name" type="string" index="yes" />
+ <property name="version" type="string" index="yes" />
+ <property name="repository" type="unsigned integer" link="org_maemo_packages_repository:id" parentfield="repository" />
+ <property name="tarsize" type="unsigned integer" />
+ <property name="tarmd5sum" type="string" />
+ <property name="tarlocation" type="string" />
+ <property name="dscsize" type="unsigned integer" />
+ <property name="dscmd5sum" type="string" />
+ <property name="dsclocation" type="string" />
+ <property name="diffsize" type="unsigned integer" />
+ <property name="diffmd5sum" type="string" />
+ <property name="difflocation" type="string" />
+ <property name="uploader" type="guid" link="midgard_person:guid" />
+ <property name="status" type="unsigned integer" />
+ </type>
+
</Schema>
\ No newline at end of file
Modified: branches/ragnaroek/midcom/org.maemo.packages/config/midcom_dba_classes.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/config/midcom_dba_classes.inc (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/config/midcom_dba_classes.inc Sat Sep 5 20:52:16 2009
@@ -7,6 +7,10 @@
'midcom_class_name' => 'org_maemo_packages_packageinstance_dba',
),
array(
+ 'mgdschema_class_name' => 'org_maemo_packages_source',
+ 'midcom_class_name' => 'org_maemo_packages_source_dba',
+),
+array(
'mgdschema_class_name' => 'org_maemo_packages_repository',
'midcom_class_name' => 'org_maemo_packages_repository_dba',
),
Added: branches/ragnaroek/midcom/org.maemo.packages/config/schemadb_source_default.inc
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.packages/config/schemadb_source_default.inc Sat Sep 5 20:52:16 2009
@@ -0,0 +1,210 @@
+// 2DO: Add l10n strings
+
+/* This is an example article, taken from the de.linkm.taviewer default
+ * schema.
+ *
+ * When overriding this schema database with component specific data using
+ * a snippet that is usually put into the snippetdir
+ * /sitegroup-config/org.maemo.packages/
+ * and configured using the configuration key "schemadb" all fields that are
+ * within the component required section must be copied verbatim (you may
+ * change the description field though).
+ */
+'default' => array
+(
+ 'description' => 'source',
+ 'fields' => array
+ (
+ 'name' => Array
+ (
+ // COMPONENT-REQUIRED
+ 'title' => 'name',
+ 'storage' => 'name',
+ 'required' => true,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'version' => Array
+ (
+ // COMPONENT-REQUIRED
+ 'title' => 'version',
+ 'storage' => 'version',
+ 'required' => true,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'repository' => Array
+ (
+ // COMPONENT-REQUIRED
+ 'title' => 'repository',
+ 'storage' => 'repository',
+ 'hidden' => true,
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'allow_multiple' => false,
+ 'allow_other' => false,
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'chooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_maemo_packages_repository_dba',
+ 'component' => 'org.maemo.packages',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'searchfields' => array
+ (
+ /* title is not actually used, extra is
+ 'title',
+ */
+ 'extra',
+ 'name',
+ ),
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'title',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'result_headers' => array
+ (
+ array
+ (
+ 'name' => 'title',
+ 'title' => $_MIDCOM->i18n->get_string('title', 'midcom'),
+ ),
+ array
+ (
+ 'name' => 'name',
+ 'title' => $_MIDCOM->i18n->get_string('name', 'midcom'),
+ ),
+ ),
+ 'orders' => array
+ (
+ array
+ (
+ 'title' => 'ASC',
+ ),
+ array
+ (
+ 'name' => 'ASC',
+ ),
+ ),
+ ),
+ ),
+ 'tarsize' => Array
+ (
+ 'title' => 'tarsize',
+ 'storage' => 'tarsize',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'tarmd5sum' => Array
+ (
+ 'title' => 'tarmd5sum',
+ 'storage' => 'tarmd5sum',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'tarlocation' => Array
+ (
+ 'title' => 'tarlocation',
+ 'storage' => 'tarlocation',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'dscsize' => Array
+ (
+ 'title' => 'dscsize',
+ 'storage' => 'dscsize',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'dscmd5sum' => Array
+ (
+ 'title' => 'dscmd5sum',
+ 'storage' => 'dscmd5sum',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'dsclocation' => Array
+ (
+ 'title' => 'dsclocation',
+ 'storage' => 'dsclocation',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'diffsize' => Array
+ (
+ 'title' => 'diffsize',
+ 'storage' => 'diffsize',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'diffmd5sum' => Array
+ (
+ 'title' => 'diffmd5sum',
+ 'storage' => 'diffmd5sum',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'difflocation' => Array
+ (
+ 'title' => 'difflocation',
+ 'storage' => 'difflocation',
+ 'required' => false,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'uploader' => Array
+ (
+ 'title' => 'Package uploaded by',
+ 'storage' => 'uploader',
+ 'required' => false,
+ 'hidden' => true,
+ 'type' => 'text',
+ 'widget' => 'text',
+ ),
+ 'status' => Array
+ (
+ 'title' => 'status',
+ 'storage' => 'status',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'options' => Array
+ (
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_BUILD_QUEUED => 'Build queued',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_BUILDING => 'Building',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_BUILDING_FAILED => 'Building failed',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_BUILDING_OK => 'Building succeeded',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_IMPORTED => 'Package imported',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTION_REQUESTED => 'Promotion requested',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTION_ACCEPTED => 'Promotion accepted',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTION_REJECTED => 'Promotion rejected',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTED => 'Package promoted',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_IN_TESTING => 'Package in testing',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_STABLE => 'Package is considered stable',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_PROMOTION_REJECTED => 'Promotion cancelled',
+ ORG_MAEMO_PACKAGES_PACKAGE_STATUS_REMOVED => 'Package has been removed',
+ ),
+ 'allow_other' => false,
+ 'allow_multiple' => false,
+ ),
+ 'widget' => 'select',
+ ),
+ ),
+),
Modified: branches/ragnaroek/midcom/org.maemo.packages/handler/packageinstance/packageinstance.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/handler/packageinstance/packageinstance.php (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/handler/packageinstance/packageinstance.php Sat Sep 5 20:52:16 2009
@@ -30,6 +30,9 @@
var $_repository = null;
+ var $_source = null;
+ var $_source_repository = null;
+
/**
* Simple default constructor.
*/
@@ -102,6 +105,13 @@
$qb->add_order('metadata.published', 'DESC');
$package_event = $qb->execute();
+ if ( isset($objects[0]->source)
+ && $objects[0]->source > 0)
+ {
+ $this->_source = new org_maemo_packages_source_dba($objects[0]->source);
+ $this->_source_repository = new org_maemo_packages_repository_dba($this->_source->repository);
+ }
+
$this->_object = new org_maemo_packages_packageinstance_dba($objects[0]->guid);
$this->_package_instance = $this->_object;
$this->_package = new org_maemo_packages_package_dba($package[0]->guid);
@@ -202,6 +212,8 @@
$this->_request_data['package_instance'] = &$this->_package_instance;
$this->_request_data['package'] = &$this->_package;
$this->_request_data['package_event'] = &$this->_package_event;
+ $this->_request_data['source'] = &$this->_source;
+ $this->_request_data['source_repository'] = &$this->_source_repository;
$this->_request_data['config'] = &$this->_config;
$this->_request_data['repository_object'] = &$this->_repository;
Added: branches/ragnaroek/midcom/org.maemo.packages/handler/source/source.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.packages/handler/source/source.php Sat Sep 5 20:52:16 2009
@@ -0,0 +1,235 @@
+<?php
+/**
+ * @repository org.maemo.packages
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+
+/**
+ * This is a URL handler class for org.maemo.packages
+ *
+ * The midcom_baseclasses_components_handler class defines a bunch of helper vars
+ *
+ * @see midcom_baseclasses_components_handler
+ * @see: http://www.midgard-project.org/api-docs/midcom/dev/midcom.baseclasses/midcom_baseclasses_components_handler/
+ *
+ * @repository org.maemo.packages
+ */
+class org_maemo_packages_handler_source_source extends midcom_baseclasses_components_handler_crud
+{
+ /**
+ * The source to display
+ *
+ * @var midcom_db_source
+ * @access private
+ */
+ var $_source = null;
+
+ var $_repository = null;
+
+ /**
+ * Simple default constructor.
+ */
+ function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * _on_initialize is called by midcom on creation of the handler.
+ */
+ function _on_initialize()
+ {
+ }
+
+ public function _load_object($handler_id, $args, &$data)
+ {
+ $qb = org_maemo_packages_repository_dba::new_query_builder();
+ $qb->add_constraint('name', '=', $args[0]);
+ $qb->set_limit(1);
+ $repository = $qb->execute();
+ if (!$repository)
+ {
+ $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND,
+ 'Failed to load repository, cannot continue.');
+ }
+
+ $qb = org_maemo_packages_source_dba::new_query_builder();
+ $qb->add_constraint('repository', '=', $repository[0]->id);
+ $qb->add_constraint('name', '=', $args[1]);
+ $qb->add_constraint('version', '=', $args[2]);
+ $qb->set_limit(1);
+ $objects = $qb->execute();
+
+ if ( is_array($objects)
+ && count($objects)>0)
+ {
+ /* $qb = org_maemo_packages_package_packageevent_dba::new_query_builder();
+ $qb->add_constraint('packageinstance', '=', $objects[0]->id);
+ $qb->add_order('metadata.published', 'DESC');
+ $package_event = $qb->execute(); */
+
+ $this->_object = new org_maemo_packages_source_dba($objects[0]->guid);
+ $this->_source = $this->_object;
+ $this->_repository = new org_maemo_packages_repository_dba($repository[0]->guid);
+ // $this->_package_event = $package_event;
+ }
+ else
+ {
+ debug_push_class(__CLASS__, __FUNCTION__);
+ debug_pop();
+ $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND,
+ 'Failed to load source, cannot continue.');
+ // This will exit.
+ }
+
+ return $this->_object;
+ }
+
+ public function _load_parent($handler_id, $args, &$data)
+ {
+ $this->_parent = $this->_repository;
+ return $this->_parent;
+ }
+
+ public function _load_schemadb()
+ {
+ $this->_request_data['schemadb_source'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_source'));
+ $this->_schemadb =& $this->_request_data['schemadb_source'];
+ }
+
+ public function _get_object_url()
+ {
+ $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+ $url = $prefix . 'source/view/' . '/' . $this->_repository->name . '/'. $this->_source->name . '/' . $this->_source->version . '/';
+ return $url;
+ }
+
+ public function _update_breadcrumb($handler_id)
+ {
+ $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+ $tmp = array();
+ if (!$this->_source)
+ {
+ return;
+ }
+
+ $tmp[] = Array
+ (
+ MIDCOM_NAV_URL => "/",
+ MIDCOM_NAV_NAME => $this->_source->name . ' ' . $this->_source->version . ' ('. $this->_repository->title . ')',
+ );
+
+ $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp);
+ }
+
+ public function _update_title($handler_id)
+ {
+ $title = $this->_l10n_midcom->get('source') . " " .$this->_source->name;
+ $_MIDCOM->set_pagetitle("{$title}");
+ return;
+ }
+
+ function &dm2_create_callback(&$controller)
+ {
+ $this->_source = new org_maemo_packages_source_dba();
+ $this->_source->topic = $this->_request_data['content_topic']->id;
+
+ if (! $this->_source->create())
+ {
+ debug_push_class(__CLASS__, __FUNCTION__);
+ debug_print_r('We operated on this object:', $this->_source);
+ debug_pop();
+ $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND,
+ 'Failed to create a new idea, cannot continue. Last Midgard error was: '. midcom_application::get_error_string());
+ // This will exit.
+ }
+
+ return $this->_source;
+ }
+
+ /**
+ * This function does the output.
+ *
+ * @param mixed $handler_id The ID of the handler.
+ * @param mixed &$data The local request data.
+ */
+
+ public function _show_read($handler_id, &$data)
+ {
+ $this->_request_data['view_source'] = $data['datamanager']->get_content_html();
+ $this->_request_data['source'] = &$this->_source;
+// $this->_request_data['package_event'] = &$this->_package_event;
+ $this->_request_data['config'] = &$this->_config;
+ $this->_request_data['repository_object'] = &$this->_repository;
+
+// $this->_request_data['view_repository'] = $this->_datamanager_repository->get_content_html();
+
+ midcom_show_style('source_view_header');
+ midcom_show_style('source_view');
+ midcom_show_style('source_view_footer');
+
+ midcom_show_style('source_comments');
+ }
+
+ public function _show_create($handler_id, &$data)
+ {
+ midcom_show_style('source_create');
+ }
+
+ public function _show_update($handler_id, &$data)
+ {
+ midcom_show_style('source_edit');
+ }
+
+ public function _show_delete($handler_id, &$data)
+ {
+ midcom_show_style('source_delete');
+ }
+
+ public function _populate_toolbar($handler_id)
+ {
+ if (!$this->_object)
+ {
+ return;
+ }
+ if ($this->_object->can_do('midgard:create'))
+ {
+ $this->_view_toolbar->add_item
+ (
+ array
+ (
+ MIDCOM_TOOLBAR_URL => "source/create/default/",
+ MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('Create source'),
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
+ )
+ );
+ }
+ if ($this->_object->can_do('org.maemo.packages:manage'))
+ {
+ $this->_view_toolbar->add_item
+ (
+ array
+ (
+ MIDCOM_TOOLBAR_URL => "source/edit/{$this->_repository->name}/{$this->_source->name}/{$this->_source->version}/",
+ MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('Edit source'),
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
+ )
+ );
+ }
+ if ($this->_object->can_do('midgard:delete'))
+ {
+ $this->_view_toolbar->add_item
+ (
+ array
+ (
+ MIDCOM_TOOLBAR_URL => "source/delete/{$this->_repository->name}/{$this->_source->name}/{$this->_source->version}/",
+ MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('Delete source'),
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png',
+ )
+ );
+ }
+ }
+}
+?>
Added: branches/ragnaroek/midcom/org.maemo.packages/source.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.packages/source.php Sat Sep 5 20:52:16 2009
@@ -0,0 +1,15 @@
+<?php
+/**
+ * @package org.maemo.packages
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+
+/**
+ * @package org.maemo.packages
+ */
+
+class org_maemo_packages_source_dba extends __org_maemo_packages_source_dba
+{
+}
\ No newline at end of file
Modified: branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/style/package_instance_view.php Sat Sep 5 20:52:16 2009
@@ -8,6 +8,8 @@
$repository_object = $data['repository_object'];
$package_event = $data['package_event'];
$status_const = $data['status_constants'];
+$source = $data['source'];
+$source_repository = $data['source_repository'];
$author_string = "";
@@ -293,6 +295,12 @@
?>
<div class="file"><div class="ft">File:</div><div class="ftt"><a href="<?php echo $repository["url"] . $package_instance["location"]; ?>"><?php echo $loc[count($loc) -1]; ?></a></div></div>
<?php
+ if (isset($source->name))
+ {
+ ?>
+ <div class="file"><div class="ft">Source:</div><div class="ftt"><a href="<?php echo $prefix.'source/view/'.$source_repository->name.'/'.$source->name.'/'.$source->version.'/'; ?>"><?php echo $source->name.' '.$source->version; ?></a></div></div>
+ <?php
+ }
}
?>
<div class="status"><div class="st">Status:</div><div class="stt"><?php echo $package_instance["status"]; ?></div></div>
Added: branches/ragnaroek/midcom/org.maemo.packages/style/source_view.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.packages/style/source_view.php Sat Sep 5 20:52:16 2009
@@ -0,0 +1,141 @@
+<?php
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+$repository = $data['repository_object'];
+//$package_event = $data['package_event'];
+$status_const = $data['status_constants'];
+$source = $data['source'];
+
+$author_string = "";
+
+$i_am_maintainer = false;
+if (isset($source->metadata->authors))
+{
+ $authors = explode('|', $source->metadata->authors);
+ $data['author_link_url'] = "http://maemo.org/profile/view/";
+ foreach ($authors as $author_guid)
+ {
+ if (empty($author_guid))
+ {
+ continue;
+ }
+ $author = new midcom_db_person($author_guid);
+
+ if ($author->id == 1)
+ {
+ continue;
+ }
+
+ if ( $data['author_link_url'] != ''
+ && $author->username != '')
+ {
+ $author_string .= '<a href="' . $data['author_link_url'] . $author->username .'">'. $author->name . '</a> ';
+ }
+ else
+ {
+ $author_string .= $author->name." ";
+ }
+
+ if ($_MIDGARD["user"])
+ {
+ if ($author->id == $_MIDGARD["user"])
+ {
+ $i_am_maintainer = true;
+ }
+ }
+ }
+}
+
+$uploader = new midcom_db_person($source->uploader);
+if (!empty($uploader->name))
+{
+ $uploader_string = '<a href="' . $data['author_link_url'] . $uploader->username .'">'. $uploader->name . '</a> ';
+}
+
+?>
+<h1>Source package: <?php echo $source->name . ' ' . $source->version; ?></h1>
+
+<div class="tm"><div class="bm"><div class="lm"><div class="rm">
+<div class="tl"><div class="tr"><div class="bl"><div class="br">
+
+<div class="release">
+
+ <div class="repository"><div class="rt">Repository:</div><div class="rtt"><a href="<?php echo $prefix . "repository/list/" . $repository->name; ?>"><?php echo $repository->title; ?></a></div></div>
+
+ <div class="authors"><div class="at">Maintainers:</div><div class="att"><?php echo $author_string; ?></div></div>
+<?php
+ if (isset($uploader_string))
+ {
+?>
+ <div class="uploader"><div class="ut">Uploaded by:</div><div class="utt"><?php echo $uploader_string; ?></div></div>
+<?php
+ }
+?>
+ <div class="status"><div class="st">Status:</div><div class="stt"><?php echo $status_const[$source->status]; ?></div></div>
+ <div class="depends"><div class="dt">Binaries:</div><div class="dtt"><?php
+ $qb = org_maemo_packages_packageinstance_dba::new_query_builder();
+ $qb->add_constraint('source', '=', $source->id);
+ $qb->add_order('package', 'ASC');
+ $pi = $qb->execute();
+ if ($pi)
+ {
+ $prev_package = -1;
+ foreach($pi as $p)
+ {
+ $package = new org_maemo_packages_package_dba($p->package);
+ $repository = new org_maemo_packages_repository_dba($p->repository);
+ if ($prev_package != $package->id)
+ {
+ echo $package->name.' '.$p->version.' ( <a href="'.$prefix.'package_instance/view/'.$repository->name.'/'.$package->name.'/'.$p->version.'/">'.$repository->arch.'</a>';
+ }
+ else
+ {
+ echo ' / <a href="'.$prefix.'package_instance/view/'.$repository->name.'/'.$package->name.'/'.$p->version.'/">'.$repository->arch.'</a> )<br />';
+ }
+ $prev_package = $package->id;
+ }
+ }
+
+ ?></div>
+<?php
+ if (!$repository->disabledownload)
+ {
+?>
+
+ <table class="source_files">
+ <thead>
+ <tr><td>MD5Sum</td><td>Size</td><td>File</td></tr>
+ </thead>
+ <tbody>
+ <?php
+ if ($source->dscsize > 0)
+ {
+ ?>
+ <tr><td><?php echo $source->dscmd5sum; ?></td><td><?php echo $source->dscsize; ?></td><td><a href="<?php echo $repository->url . $source->dsclocation; ?>"><?php echo substr($source->dsclocation,strrpos($source->dsclocation, '/',1)+1); ?></a></td></tr>
+ <?php
+ }
+ if ($source->tarsize > 0)
+ {
+ ?>
+ <tr><td><?php echo $source->tarmd5sum; ?></td><td><?php echo $source->tarsize; ?></td><td><a href="<?php echo $repository->url . $source->tarlocation; ?>"><?php echo substr($source->tarlocation,strrpos($source->tarlocation, '/',1)+1); ?></a></td></tr>
+ <?php
+ }
+ if ($source->diffsize > 0)
+ {
+ ?>
+ <tr><td><?php echo $source->diffmd5sum; ?></td><td><?php echo $source->diffsize; ?></td><td><a href="<?php echo $repository->url . $source->difflocation; ?>"><?php echo substr($source->difflocation,strrpos($source->difflocation, '/',1)+1); ?></a></td></tr>
+ <?php
+ }
+ ?>
+ </tbody>
+ </table>
+
+
+ <?php
+ }
+ ?>
+
+
+</div>
+
+</div></div></div></div>
+</div></div></div></div>
Modified: branches/ragnaroek/midcom/org.maemo.packages/viewer.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.packages/viewer.php (original)
+++ branches/ragnaroek/midcom/org.maemo.packages/viewer.php Sat Sep 5 20:52:16 2009
@@ -158,6 +158,41 @@
'variable_args' => 3,
);
+ // CRUD for source
+
+ // Handle /source/create/<package_schemaname>/
+ $this->_request_switch['source_create'] = array
+ (
+ 'handler' => array('org_maemo_packages_handler_source_source', 'create'),
+ 'fixed_args' => array('source','create'),
+ 'variable_args' => 1,
+ );
+
+ // Handle /source/view/<repositoryname>/<packagename>/<packageversion>/
+ $this->_request_switch['source_read'] = array
+ (
+ 'handler' => array('org_maemo_packages_handler_source_source', 'read'),
+ 'fixed_args' => array('source','view'),
+ 'variable_args' => 3,
+ );
+
+ // Handle /source/edit/<repositoryname>/<packagename>/<packageversion>/
+ $this->_request_switch['source_update'] = array
+ (
+ 'handler' => array('org_maemo_packages_handler_source_source', 'update'),
+ 'fixed_args' => array('source','edit'),
+ 'variable_args' => 3,
+ );
+
+ // Handle /source/delete/<repositoryname>/<packagename>/<packageversion>/
+ $this->_request_switch['source_delete'] = array
+ (
+ 'handler' => array('org_maemo_packages_handler_source_source', 'delete'),
+ 'fixed_args' => array('source','delete'),
+ 'variable_args' => 3,
+ );
+
+
// Handle /repoview/<packagename>/
$this->_request_switch['package_instance_repoview'] = array
(
More information about the midcom-commits
mailing list