cvs diff: Diffing package
Index: package/project_package.info
===================================================================
RCS file: package/project_package.info
diff -N package/project_package.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/project_package.info	27 Nov 2009 00:05:42 -0000
@@ -0,0 +1,8 @@
+; $Id$
+name = Project package
+description = Provides support for packages made up of releases from separate projects.
+package = Project
+dependencies[] = project
+dependencies[] = project_release
+dependencies[] = views
+core = 6.x
Index: package/project_package.install
===================================================================
RCS file: package/project_package.install
diff -N package/project_package.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/project_package.install	27 Nov 2009 00:05:08 -0000
@@ -0,0 +1,51 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Database schema definition for the Project Package module.
+ */
+
+/**
+ * Implement hook_install().
+ */
+function project_package_install() {
+  // Create the database tables.
+  drupal_install_schema('project_package');
+}
+
+/**
+ * Implement hook_uninstall().
+ */
+function project_package_uninstall() {
+  // Drop database tables.
+  drupal_uninstall_schema('project_package');
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function project_package_schema() {
+  $schema['project_package_local_release_item'] = array(
+    'description' => 'Keeps track of what releases of local sub-projects are included in a release of a given package project.',
+    'fields' => array(
+      'package_nid' => array(
+        'description' => 'Primary Key: The {node}.nid of the package release node.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'item_nid' => array(
+        'description' => 'The {node}.nid of a local release node (from the same site) included as an item in the package.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('package_nid', 'item_nid'),
+  );
+  return $schema;
+}
+
Index: package/project_package.module
===================================================================
RCS file: package/project_package.module
diff -N package/project_package.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/project_package.module	27 Nov 2009 00:05:08 -0000
@@ -0,0 +1,18 @@
+<?php
+// $Id$
+
+/**
+ * @file project_package.module
+ * Provides packages made up of releases of other projects.
+ */
+
+/**
+ * Implement hook_views_api().
+ */
+function project_package_views_api() {
+  return array(
+    'api' => 2,
+    'path' => drupal_get_path('module', 'project_package') .'/views',
+  );
+}
+
cvs diff: Diffing package/views
Index: package/views/project_package.views.inc
===================================================================
RCS file: package/views/project_package.views.inc
diff -N package/views/project_package.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/views/project_package.views.inc	27 Nov 2009 00:05:08 -0000
@@ -0,0 +1,77 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Implement Views hooks to expose project_package data to views.
+ */
+
+/**
+ * Implement hook_views_data().
+ */
+function project_package_views_data() {
+  $data = array();
+
+  // Define the base group of this table. Fields that don't
+  // have a group defined will go into this group by default.
+  $data['project_package_local_release_item']['table']['group']  = t('Project package');
+
+  // package_nid
+  $data['project_package_local_release_item']['package_nid'] = array(
+    'title' => t('Package node'),
+    'help' => t('The node ID of the package release node.'),
+    'field' => array(
+      'handler' => 'views_handler_field_node',
+      'click sortable' => TRUE,
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_node_nid',
+      'name field' => 'title',
+      'numeric' => TRUE,
+      'validate type' => 'nid',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'relationship' => array(
+      'help' => t('Add a relationship to gain access to more node data for the package release.'),
+      'base' => 'node',
+      'handler' => 'views_handler_relationship',
+      'label' => t('Package release node'),
+    ),
+  );
+
+  // item_nid
+  $data['project_package_local_release_item']['item_nid'] = array(
+    'title' => t('Item node'),
+    'help' => t('The node ID of an item release node included in a package.'),
+    'field' => array(
+      'handler' => 'views_handler_field_node',
+      'click sortable' => TRUE,
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_node_nid',
+      'name field' => 'title',
+      'numeric' => TRUE,
+      'validate type' => 'nid',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'relationship' => array(
+      'help' => t('Add a relationship to gain access to more node data for the item releases.'),
+      'base' => 'node',
+      'handler' => 'views_handler_relationship',
+      'label' => t('Item release node'),
+    ),
+  );
+
+  return $data;
+}
+
Index: package/views/project_package.views_default.inc
===================================================================
RCS file: package/views/project_package.views_default.inc
diff -N package/views/project_package.views_default.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/views/project_package.views_default.inc	27 Nov 2009 00:05:08 -0000
@@ -0,0 +1,25 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Scan the 'default_views' subdirectory for default views by project_package.
+ */
+
+/**
+ * Implement hook_views_default_views().
+ */
+function project_package_views_default_views() {
+  // Search the "default_views" subdirectory for files ending in .view.php.
+  $files = file_scan_directory(drupal_get_path('module', 'project_package'). '/views/default_views', 'view\.php$');
+  foreach ($files as $absolute => $file) {
+    require_once $absolute;
+    if (isset($view)) {
+      // $file->name has the ".php" stripped off, but still has the ".view".
+      $view_name = substr($file->name, 0, strrpos($file->name, '.'));
+      $views[$view_name] = $view;
+    }
+  }
+  return $views;
+}
+
cvs diff: Diffing package/views/default_views
Index: package/views/default_views/project_package_items.view.php
===================================================================
RCS file: package/views/default_views/project_package_items.view.php
diff -N package/views/default_views/project_package_items.view.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package/views/default_views/project_package_items.view.php	27 Nov 2009 00:41:49 -0000
@@ -0,0 +1,301 @@
+<?php
+// $Id$
+
+$view = new view;
+$view->name = 'project_package_items';
+$view->description = 'View of all release items included in a given package release';
+$view->tag = 'Project package';
+$view->view_php = '';
+$view->base_table = 'node';
+$view->is_cacheable = FALSE;
+$view->api_version = 2;
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+$handler = $view->new_display('default', 'Defaults', 'default');
+$handler->override_option('relationships', array(
+  'package_nid' => array(
+    'label' => 'Package release node',
+    'required' => 1,
+    'id' => 'package_nid',
+    'table' => 'project_package_local_release_item',
+    'field' => 'package_nid',
+    'relationship' => 'none',
+  ),
+  'pid' => array(
+    'label' => 'Project node',
+    'required' => 1,
+    'id' => 'pid',
+    'table' => 'project_release_nodes',
+    'field' => 'pid',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('fields', array(
+  'title' => array(
+    'label' => 'Project',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'link_to_node' => 1,
+    'exclude' => 0,
+    'id' => 'title',
+    'table' => 'node',
+    'field' => 'title',
+    'relationship' => 'pid',
+  ),
+  'version' => array(
+    'label' => 'Release',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'link_to_node' => 1,
+    'exclude' => 0,
+    'id' => 'version',
+    'table' => 'project_release_nodes',
+    'field' => 'version',
+    'relationship' => 'none',
+  ),
+  'security_update' => array(
+    'label' => 'Security update',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'type' => 'yes-no',
+    'not' => 0,
+    'exclude' => 0,
+    'id' => 'security_update',
+    'table' => 'project_release_nodes',
+    'field' => 'security_update',
+    'relationship' => 'none',
+  ),
+  'update_status' => array(
+    'label' => 'Update status',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'update_status_icon' => 0,
+    'exclude' => 0,
+    'id' => 'update_status',
+    'table' => 'project_release_nodes',
+    'field' => 'update_status',
+    'relationship' => 'none',
+  ),
+  'update_status_1' => array(
+    'label' => '',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'update_status_icon' => 1,
+    'exclude' => 0,
+    'id' => 'update_status_1',
+    'table' => 'project_release_nodes',
+    'field' => 'update_status',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('arguments', array(
+  'nid' => array(
+    'default_action' => 'not found',
+    'style_plugin' => 'default_summary',
+    'style_options' => array(),
+    'wildcard' => 'all',
+    'wildcard_substitution' => 'All',
+    'title' => 'Releases contained in %1',
+    'breadcrumb' => '',
+    'default_argument_type' => 'fixed',
+    'default_argument' => '',
+    'validate_type' => 'node',
+    'validate_fail' => 'not found',
+    'break_phrase' => 0,
+    'not' => 0,
+    'id' => 'nid',
+    'table' => 'node',
+    'field' => 'nid',
+    'validate_user_argument_type' => 'uid',
+    'validate_user_roles' => array(),
+    'relationship' => 'package_nid',
+    'default_options_div_prefix' => '',
+    'default_argument_user' => 0,
+    'default_argument_fixed' => '',
+    'default_argument_php' => '',
+    'validate_argument_node_type' => array(
+      'project_release' => 'project_release',
+    ),
+    'validate_argument_node_access' => 0,
+    'validate_argument_nid_type' => 'nid',
+    'validate_argument_vocabulary' => array(),
+    'validate_argument_type' => 'tid',
+    'validate_argument_transform' => 0,
+    'validate_user_restrict_roles' => 0,
+    'validate_argument_project_term_vocabulary' => array(),
+    'validate_argument_project_term_argument_type' => 'tid',
+    'validate_argument_project_term_argument_action_top_without' => 'pass',
+    'validate_argument_project_term_argument_action_top_with' => 'pass',
+    'validate_argument_project_term_argument_action_child' => 'pass',
+    'validate_argument_php' => '',
+  ),
+));
+$handler->override_option('filters', array(
+  'status_extra' => array(
+    'operator' => '=',
+    'value' => '',
+    'group' => '0',
+    'exposed' => FALSE,
+    'expose' => array(
+      'operator' => FALSE,
+      'label' => '',
+    ),
+    'id' => 'status_extra',
+    'table' => 'node',
+    'field' => 'status_extra',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('access', array(
+  'type' => 'none',
+));
+$handler->override_option('cache', array(
+  'type' => 'none',
+));
+$handler->override_option('items_per_page', 0);
+$handler->override_option('style_plugin', 'table');
+$handler->override_option('style_options', array(
+  'grouping' => '',
+  'override' => 1,
+  'sticky' => 0,
+  'order' => 'asc',
+  'columns' => array(
+    'title' => 'title',
+    'version' => 'version',
+    'security_update' => 'security_update',
+    'update_status' => 'update_status',
+    'update_status_1' => 'update_status',
+  ),
+  'info' => array(
+    'title' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'version' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'security_update' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'update_status' => array(
+      'sortable' => 1,
+      'separator' => ' ',
+    ),
+    'update_status_1' => array(
+      'sortable' => 0,
+      'separator' => '',
+    ),
+  ),
+  'default' => 'title',
+));
+$handler = $view->new_display('page', 'Page', 'page_1');
+$handler->override_option('path', 'node/%/package-items');
+$handler->override_option('menu', array(
+  'type' => 'tab',
+  'title' => 'Package items',
+  'description' => '',
+  'weight' => '0',
+  'name' => 'navigation',
+));
+$handler->override_option('tab_options', array(
+  'type' => 'none',
+  'title' => '',
+  'description' => '',
+  'weight' => 0,
+));
