ソースを参照

Renamed module from tripal_views_setup to tripal_views_integration. Completed coding for integration of the ahah_helper module. Added permissions. Unified the menu items to match that with the rest of Tripal. Add usage documentation to the main administrative link

spficklin 13 年 前
コミット
d79daee020

+ 311 - 0
base/tripal_views_integration/includes/tripal_views_integration.admin.inc

@@ -0,0 +1,311 @@
+<?php
+/**
+ * Purpose: Provide Guidance to new Tripal Admin
+ *
+ * @return 
+ *   HTML Formatted text
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_module_description_page() {
+
+  $text .= '<h3>Tripal Views Integration Administrative Tools Quick Links:</h3>';
+  $text .= "<ul>
+             <li><a href=\"".url("admin/tripal/tripal_views_integration/list") . "\">List of integrated views</a></li>
+             <li><a href=\"".url("admin/tripal/tripal_views_integration/new"). "\">Setup integration of a materialized view</a></li>
+           </ul>";
+#             <li><a href=\"".url("admin/tripal/tripal_feature/aggregate"). "\">Feature Relationship Aggegators</a></li> 
+
+  $text .= '<h3>Module Description:</h3>';
+  $text .= '<p>This module provides an interface for integrating <a href="http://drupal.org/project/views">Drupal Views</a>
+            with Tripal materialized views.  This will allow site administrators to create custom queries for the materialized views
+            and in turn provide custom content pages, custom blocks and custom search forms. The forms allow a site administrator
+            to select a materialized view and associate other Chado tables on which the view can join.  Usage of this module requires
+            a good understanding of foreign-key relationships in Chado.
+            </p>';
+
+  $text .= '<h3>Setup Instructions:</h3>';
+  $text .= '<p>After installation of the feature module.  The following tasks should be performed
+            <ol>
+              <li><b>Install Drupal Views</b>: The <a href="http://drupal.org/project/views">Drupal Views</a> module
+                must first be installed before this module can be used.  If you are reading this page then you must have
+                Drupal Views installed</li>
+              <li><b>Set Permissions</b>: To allow access to site administrators for this module, simply
+               <a href="'.url('admin/user/permissions').'">assign permissions</a> to the appropriate user roles for the
+               permission type "manage tripal_views_integration". </li>
+            </ol>
+            </p>';
+  $text .= '<h3>Usage Instructions:</h3>';
+  $text .= "<p>To use this module follow these steps:
+            <ol>
+               <li><b>Identify or create a materialized view:</b> Using the <a href=\"".url("admin/tripal/tripal_mviews") . "\">
+                 Tripal materialized View</a> interface, identify the view you would like to integrate or create a new one.</li>
+               <li><b>Setup the Views Integration</b>: Navigate to the <a href=\"".url("admin/tripal/tripal_views_integration/new") . "\">
+                 Tripal views integration setup page</a> to integrate the selected materialized view.  Provide a  user friendly name
+                 and description to help you remember the purpose for integrating the view.  Next, select the view you want to integrate
+                 from the provided select box.  If your materialized view has fields that can join with other Chado tables, you may 
+                 provide those relationships in the provided form.  Finally, if your fields require a special handler for display, you
+                 may select it from the drop down provided</li>
+               <li><b>Create custom pages/block/search form</b>:  After saving setup information from step 2 above, you will be redirected to the
+                 Drupal Views interface</a> where you can create a custom page, block or search form.</li>
+               <li><b>Review your integrated views</b>:  A page providing a  
+                 <a href=\"".url("admin/tripal/tripal_views_integration/list") . "\">list of all integrated views</a> is provided. You may
+                 view this page to see all integrated views, but also to remove any unwanted integrations.</li>
+            </ol>
+         
+            </p>";  
+  $text .= '<h3>Features of this Module:</h3>';
+  $text .= '<p>This module provides the following functionality
+            <ul>
+              <li>A dynamic form for integration of an existing materialized view with Drupal Views.  This form allows the site
+                  administrator to select an existing view and indicate Chado tables on which the fields may join.</li>
+            </ul> 
+            
+            </p>';
+  return $text;
+}
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_admin_form(){
+
+   $form = array();
+
+   $form['#theme'] = 'tripal';
+
+   $query_results = db_query('SELECT * FROM public.tripal_views_integration;');
+
+   $header = array('Setup ID', 'Name', 'Materialized View ID', 'Base Table Name', 'Description');
+   $rows = array();
+
+   $results = array();
+   while($result = db_fetch_object($query_results)){
+      $rows[] = array($result->setup_id, $result->name, $result->mview_id, $result->base_table_name, $result->description,);
+      $results[] = $result;
+   }
+
+   $options = array();
+   foreach ($results as $key => $value) {
+      if(!empty($value))
+      $options[] = $value->setup_id;// . ' | ' . $value->name . ' | ' . $value->mview_id . ' | ' . $value->base_table_name;
+   }
+
+   $form['existing_rows'] = array(
+    '#type' => 'select',
+    '#options' => $options,
+    '#description' => '<strong>Select a View Setup to delete from the database.</strong>',
+    '#prefix' => theme('table', $header, $rows),
+   );
+
+   $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Remove'),
+   );
+
+   $form['cancel'] = array(
+    '#type' => 'markup',
+    '#value' => l(t('Cancel '), 'admin/tripal/'),
+   );
+
+   $form['new'] = array(
+    '#type' => 'markup',
+    '#value' => l(t(' New'), 'admin/tripal/tripal_views_integration_new'),
+   );
+
+   return $form;
+}
+
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_admin_form_submit($form, &$form_state){
+   $value = $form['existing_rows']['#options'][$form_state['values']['existing_rows']];
+   db_query("DELETE FROM public.tripal_views_integration WHERE setup_id = $value;");
+   db_query("DELETE FROM public.tripal_views_handlers WHERE setup_id = $value;");
+   db_query("DELETE FROM public.tripal_mviews_join WHERE setup_id = $value;");
+}
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+
+function tripal_views_integration_new_setup_form(&$form_state){
+   $form = array();
+
+   $form['#cache'] = TRUE;
+
+   //ahah_helper requires this to register the form with it's module
+   ahah_helper_register($form, $form_state);
+
+   // field for the name of the 
+   $form['row_name'] = array(
+    '#title' => t('Name'),
+    '#type' => 'textfield',
+    '#size' => 60,
+    '#maxlength' => 128,
+    '#description' => 'Name of the Views Setup',
+    '#required' => TRUE,
+   );
+
+   $form['row_description'] = array(
+    '#title' => t('Description'),
+    '#type' => 'textfield',
+    '#size' => 60,
+    '#maxlength' => 255,
+    '#description' => 'Briefly describe in which view this will be used',
+    '#required' => TRUE,
+   );
+
+   $mview_query = db_query("SELECT mview_id,name FROM {tripal_mviews} ORDER BY name;");
+   $mview_options = array();
+   $mview_options['0'] = 'Select';
+   while ($mview_option = db_fetch_array($mview_query)){
+      $mview_options[$mview_option['mview_id']] = $mview_option['name'];
+   }
+
+   $form['mview_id'] = array(
+      '#title' => t('Materialized View'),
+      '#type' => 'select',
+      '#options' => $mview_options,
+      '#description' => 'Which materialized view to use.',
+      '#required' => TRUE,
+      '#default_value' => $mview_default_value,
+      '#ahah' => array(
+         'path' => ahah_helper_path(array('view_setup_table')),
+         'wrapper' => 'table-rows-div',
+         'effect' => 'fade',
+         'event' => 'change',
+         'method' => 'replace',
+      ),
+   );
+
+   // ignore this for now... we'll come back to it later -- spf
+   //   $form['row_base_table_name'] = array(
+   //      '#title' => t('Base Table Name'),
+   //      '#type' => 'select',
+   //      // '#options' => array('stub'),
+   //      '#options' => tripal_core_get_chado_tables(),
+   //      '#description' => 'Select which chado table to use for this view.',
+   //      '#required' => TRUE,
+   //   );
+
+   $form['view_setup_table'] = array(
+     '#type' => 'item',
+       '#prefix' => '<div id="table-rows-div">',
+       '#suffix' => '</div>',
+   );
+
+
+   if ($form_state['storage']['mview_id']){
+
+      $mview_id = $form_state['storage']['mview_id'];
+
+      $form['view_setup_table'] = array(
+         '#type' => 'fieldset',
+         '#title' => 'Join Selection',
+         '#prefix' => '<div id="fieldset-table-rows-wrapper">',
+         '#suffix' => '</div>',
+      );
+
+      // get the columns in this materialized view.  They are separated by commas
+      // where the first word is the column name and the rest is the type
+      $sql = "SELECT mv_specs FROM {tripal_mviews} WHERE mview_id = $mview_id";
+      $mview = db_fetch_object(db_query($sql));
+      $columns = explode(",",$mview->mv_specs);
+
+      $i=1;
+      $chado_tables = tripal_core_get_chado_tables();
+      $chado_tables = array_merge(array('',), $chado_tables);
+
+      $handlers = array();
+      $form['view_setup_table']["instructions"] = array(
+         '#type' => 'markup',
+         '#value' => "Select an optional table to which the fields of the materialized view can join.  If a field does not need to join you may leave the selection blank.",
+      );
+      $form['view_setup_table']["fields_headers"] = array(
+         '#type' => 'markup',
+         '#value' => "<div class=\"field-headers\">".
+              "<div class=\"column-id\">Field Name and Type</div>".
+              "<div class=\"fields-column-join\">Join Table</div>".
+              "<div class=\"fields-column-join-column\">Join Column</div>".
+              "<div class=\"fields-column-handler\">Handler</div></div>",
+      );
+
+      foreach ($columns as $column){
+         $column = trim($column);  // trim trailing and leading spaces
+         preg_match("/^(.*?)\ (.*?)$/",$column,$matches);
+         $column_name = $matches[1];
+         $column_type = $matches[2];
+
+         $form['view_setup_table']["fields_start_$mview_id-$i"] = array(
+           '#type' => 'markup',
+           '#value' => "<div class=\"fields-new-row\">",
+         );
+
+         $form['view_setup_table']["fields_name_$mview_id-$i"] = array(
+           '#type' => 'markup',
+           '#attributes' => array('class' => 'fields-column-name'),
+           '#value' => "<div class=\"column-id\"><span class=\"column-name\">$column_name</span>".
+                       "<br><span class=\"column-type\">$column_type</span></div>",
+         );
+
+         $table = $form_state['storage']["fields_join_$mview_id-$i"];
+         $form['view_setup_table']["fields_join_$mview_id-$i"] = array(
+            '#type' => 'select',
+            '#prefix' => "<div class=\"fields-column-join\">",
+            '#suffix' => "</div>",
+            '#options' => $chado_tables,
+            '#required' => FALSE,
+            '#default_value' => $table,
+            '#ahah' => array(
+               'path' => ahah_helper_path(array('view_setup_table',"fields_join_column_$mview_id-$i")),
+               'wrapper' => "fields-column-join-column-$mview_id-$i",
+               'effect' => 'fade',
+               'event' => 'change',
+               'method' => 'replace',
+            ),
+         );
+         if($table){
+            $table_desc = module_invoke_all('chado_'.$table.'_schema');
+            $columns = array_keys($table_desc['fields']);
+         } else {
+            $columns = array();
+         }
+         $form['view_setup_table']["fields_join_column_$mview_id-$i"] = array(
+            '#type' => 'select',
+            '#prefix' => "<div id=\"fields-column-join-column-$mview_id-$i\" class=\"fields-column-join-column\">",
+            '#suffix' => "</div>",
+            '#options' => $columns,
+            '#required' => FALSE,
+         );
+         $form['view_setup_table']["fields_handler_$mview_id-$i"] = array(
+            '#type' => 'select',
+            '#prefix' => "<div class=\"fields-column-handler\">",
+            '#suffix' => "</div>",
+            '#options' => $handlers,
+            '#required' => FALSE,
+         );
+         $form['view_setup_table']["fields_end_$i"] = array(
+            '#type' => 'markup',
+            '#value' => "</div>",
+         );
+         $i++;
+      }
+      $form['view_setup_table']['save'] = array(
+          '#type'  => 'submit',
+          '#value' => t('Save'),
+      );
+   }
+   return $form;
+}
+
+
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_new_setup_form_submit($form, &$form_state){
+
+}

+ 9 - 0
base/tripal_views_integration/tripal_views_integration.info

@@ -0,0 +1,9 @@
+name = Tripal Views Integration
+description = Tripal module that integrates materialized views with Drupal views to enable custom pages, queries and search forms.
+core = 6.x
+package = Tripal
+
+dependencies[] = tripal_core
+dependencies[] = ahah_helper
+dependencies[] = views
+

+ 8 - 8
base/tripal_views_setup/tripal_views_setup.install → base/tripal_views_integration/tripal_views_integration.install

@@ -1,7 +1,7 @@
 <?php
-function tripal_views_setup_schema(){
+function tripal_views_integration_schema(){
 	$schema = array();
-	$schema['tripal_views_setup'] = array(
+	$schema['tripal_views_integration'] = array(
 		'description' => 'contains the setupes, their materialized view id and base table name that was used.',
 		'fields' => array(
 			'setup_id' => array(
@@ -46,7 +46,7 @@ function tripal_views_setup_schema(){
 		'description' => 'which materialzed views and chado tables to join in a given setup',
 		'fields' => array(
 			'setup_id' => array(
-				'description' => 'tripal setup id from tripal_views_setup table',
+				'description' => 'tripal setup id from tripal_views_integration table',
 				'type' => 'serial',
 				'unsigned' => TRUE,
 				'not null'=> TRUE,
@@ -75,7 +75,7 @@ function tripal_views_setup_schema(){
 		'description' => 'in formation for views: column and views handler name',
 		'fields' => array(
 			'setup_id' => array(
-				'description' => 'which setup this is used by from tripal_views_setup table',
+				'description' => 'which setup this is used by from tripal_views_integration table',
 					'type' => 'serial',
 					'unsigned' => TRUE,
 					'not null'=> TRUE,
@@ -99,12 +99,12 @@ function tripal_views_setup_schema(){
 	return $schema;
 }
 
-function tripal_views_setup_install(){
-	drupal_install_schema('tripal_views_setup');
+function tripal_views_integration_install(){
+	drupal_install_schema('tripal_views_integration');
 }
 
-function tripal_views_setup_uninstall(){
-	drupal_uninstall_schema('tripal_views_setup');
+function tripal_views_integration_uninstall(){
+	drupal_uninstall_schema('tripal_views_integration');
 }
 
 

+ 66 - 0
base/tripal_views_integration/tripal_views_integration.module

@@ -0,0 +1,66 @@
+<?php
+
+require_once 'includes/tripal_views_integration.admin.inc';
+
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_menu(){
+	$items = array();
+
+   $items['admin/tripal/tripal_views_integration'] = array(
+     'title' => t('Views Integration'),
+     'description' => 'Basic Description of Tripal Views Integration Module',
+     'page callback' => 'tripal_views_integration_module_description_page',
+     'access arguments' => array('administer site configuration'),
+     'type' => MENU_NORMAL_ITEM,
+   );
+
+	$items['admin/tripal/tripal_views_integration/list'] = array(
+    'title' => t('List of Integrated Views'),
+    'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_views_integration_admin_form'),
+    'access arguments' => array('manage tripal_views_integration'),
+    'type' => MENU_NORMAL_ITEM,
+	);
+
+	//page to actually create setup->mview->chado table relationships
+	$items['admin/tripal/tripal_views_integration/new'] = array(
+     'title' => 'Views Integration',
+     'page callback' => 'drupal_get_form',
+     'page arguments' => array('tripal_views_integration_new_setup_form'),
+     'access arguments' => array('manage tripal_views_integration'), //TODO: figure out the proper permissions arguments
+     'type' => MENU_NORMAL_ITEM,
+	);
+
+	return $items;
+}
+/**
+ *  Set the permission types that the chado module uses.  Essentially we
+ *  want permissionis that protect creation, editing and deleting of chado
+ *  data objects
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_perm(){
+   return array(
+      'manage tripal_views_integration',
+   );
+}
+/**
+ *
+ * @ingroup tripal_views_integration
+ */
+function tripal_views_integration_theme(){
+	$theme = array();
+
+	$theme['tripal_views_integration_new_setup_form'] = array(
+      'arguments' => array('form' => NULL),
+      'template'  => 'tripal_views_integration_fields_form',
+	);
+
+	return $theme;
+}
+

+ 47 - 0
base/tripal_views_integration/tripal_views_integration_fields_form.tpl.php

@@ -0,0 +1,47 @@
+<style type="text/css">
+
+#tripal-views-integration-new-setup-form  .fields-new-row, .field-headers {
+   dislay: block;
+   margin: 0px;
+   border-bottom-style: solid;
+   border-bottom-width: 1px;
+}
+#tripal-views-integration-new-setup-form .form-item {
+   margin: 0px 0px 5px 0px;
+}
+#tripal-views-integration-new-setup-form .column-id,.fields-column-join,.fields-column-join-column, .fields-column-handler {
+   display: inline-block;
+   margin: 0px;
+   vertical-align: top;
+}
+#tripal-views-integration-new-setup-form  .field-headers {
+   font-weight: bold;  
+}
+#tripal-views-integration-new-setup-form  .field-headers div {
+   display: inline-block;
+   margin: 0px;
+   vertical-align: top;
+}
+#tripal-views-integration-new-setup-form .column-name {
+
+}
+#tripal-views-integration-new-setup-form .column-type {
+   font-style: italic;  
+}
+#tripal-views-integration-new-setup-form .column-id {
+   width: 25%;
+}
+#tripal-views-integration-new-setup-form .fields-column-join {
+   width: 25%;
+}
+#tripal-views-integration-new-setup-form .fields-column-join-column {
+   width: 25%;
+}
+#tripal-views-integration-new-setup-form .fields-column-handler {
+   width: 25%;
+}
+
+</style>
+
+<?php print drupal_render($form); ?>
+

+ 0 - 293
base/tripal_views_setup/includes/tripal_views_setup.admin.inc

@@ -1,293 +0,0 @@
-<?php
-/**
- *
- * @ingroup tripal_view_setup
- */
-function tripal_views_setup_admin_form(){
-
-	$form = array();
-
-	$form['#theme'] = 'tripal';
-
-	$query_results = db_query('SELECT * FROM public.tripal_views_setup;');
-
-	$header = array('Setup ID', 'Name', 'Materialized View ID', 'Base Table Name', 'Description');
-	$rows = array();
-
-	$results = array();
-	while($result = db_fetch_object($query_results)){
-		$rows[] = array($result->setup_id, $result->name, $result->mview_id, $result->base_table_name, $result->description,);
-		$results[] = $result;
-	}
-
-	$options = array();
-	foreach ($results as $key => $value) {
-		if(!empty($value))
-		$options[] = $value->setup_id;// . ' | ' . $value->name . ' | ' . $value->mview_id . ' | ' . $value->base_table_name;
-	}
-
-	$form['existing_rows'] = array(
-    '#type' => 'select',
-    '#options' => $options,
-    '#description' => '<strong>Select a View Setup to delete from the database.</strong>',
-    '#prefix' => theme('table', $header, $rows),
-	);
-
-	$form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Remove'),
-	);
-
-	$form['cancel'] = array(
-    '#type' => 'markup',
-    '#value' => l(t('Cancel '), 'admin/tripal/'),
-	);
-
-	$form['new'] = array(
-    '#type' => 'markup',
-    '#value' => l(t(' New'), 'admin/tripal/tripal_views_setup_new'),
-	);
-
-	return $form;
-}
-
-/**
- *
- * @ingroup tripal_view_setup
- */
-function tripal_views_setup_admin_form_submit($form, &$form_state){
-	$value = $form['existing_rows']['#options'][$form_state['values']['existing_rows']];
-	db_query("DELETE FROM public.tripal_views_setup WHERE setup_id = $value;");
-	db_query("DELETE FROM public.tripal_views_handlers WHERE setup_id = $value;");
-	db_query("DELETE FROM public.tripal_mviews_join WHERE setup_id = $value;");
-}
-/**
- *
- * @ingroup tripal_view_setup
- */
-
-function tripal_views_setup_new_setup_form(&$form_state){
-	$form = array();
-
-	$form['#cache'] = TRUE;
-
-	//ahah_helper requires this to register the form with it's module
-	ahah_helper_register($form, $form_state);
-
-	$form['row_name'] = array(
-    '#title' => t('Name'),
-    '#type' => 'textfield',
-    '#size' => 60,
-    '#maxlength' => 128,
-    '#description' => 'Name of the Views Setup',
-    '#required' => TRUE,
-	);
-
-	$form['row_description'] = array(
-    '#title' => t('Description'),
-    '#type' => 'textfield',
-    '#size' => 60,
-    '#maxlength' => 255,
-    '#description' => 'Briefly describe in which view this will be used',
-    '#required' => TRUE,
-	);
-
-	$mview_query = db_query("SELECT mview_id,name FROM {tripal_mviews} ORDER BY name;");
-	$mview_options = array();
-	$mview_options['0'] = 'Select';
-	while ($mview_option = db_fetch_array($mview_query)){
-		$mview_options[$mview_option['mview_id']] = $mview_option['name'];
-	}
-
-	if (!isset($form_state['storage']['mview_id'])){
-		$mview_default_value = '0';
-	}
-	else{
-		$mview_default_value = $form_state['storage']['mview_id'];
-	}
-
-	dpm($mview_default_value, 'mview default value');
-	dpm($mview_options, 'mview options');
-
-	$form['mview_id'] = array(
-	    '#type'   => 'fieldset',
-	    '#title'  => t('Which materialized view to use'),
-	    '#prefix' => '<div id="mview-id-wrapper">', // This is our wrapper div.
-	    '#suffix' => '</div>',
-	    '#tree'   => TRUE, // Don't forget to set #tree!
-	);
-	$form['mview_id']['usage'] = array(
-      '#title' => t('Materialized View'),
-      '#type' => 'select',
-      '#options' => $mview_options,
-      '#description' => 'Which materialized view to use.',
-      '#required' => TRUE,
-      '#default_value' => $mview_default_value,
-      '#ahah' => array(
-	      'path' => ahah_helper_path(array('mview')),
-  	     'wrapper' => 'mview-id-wrapper',
-         'effect' => 'fade',
-         'event' => 'change',
-         'method' => 'replace',
-	),
-	);
-	$form['mview_id']['update_usage'] = array(
-	    '#type'  => 'submit',
-	    '#value' => t('Update usage'),
-	// Note that we can simply use the generic submit callback provided by the
-	// ahah_helper module here!
-	// All it does, is set $form_state['rebuild'] = TRUE.
-	    '#submit' => array('ahah_helper_generic_submit'),
-	// We set the 'no-js' class, which means this submit button will be hidden
-	// automatically by Drupal if JS is enabled.
-	    '#attributes' => array('class' => 'no-js'),
-	);
-
-	// ignore this for now... we'll come back to it later -- spf
-	//	$form['row_base_table_name'] = array(
-	//		'#title' => t('Base Table Name'),
-	//		'#type' => 'select',
-	//		// '#options' => array('stub'),
-	//		'#options' => tripal_core_get_chado_tables(),
-	//		'#description' => 'Select which chado table to use for this view.',
-	//		'#required' => TRUE,
-	//	);
-
-
-	dpm(strcmp($mview_default_value['usage'], '0'), 'second mview');
-
-	if (strcmp($mview_default_value['usage'], '0') != 0){
-
-
-		$mview_id = $mview_default_value['usage'];
-
-		dpm($mview_id, 'mviewid is');
-
-		$form['mview_id'] = array(
-			'#type' => 'fieldset',
-			'#title' => 'Table Fields Setup',
-			'#prefix' => '<div id="fieldset-table-rows-wrapper">',
-		   '#suffix' => '</div>',
-		);
-
-		// get the columns in this materialized view.  They are separated by commas
-		// where the first word is the column name and the rest is the type
-		$sql = "SELECT mv_specs FROM {tripal_mviews} WHERE mview_id = $mview_id";
-		$mview = db_fetch_object(db_query($sql));
-		$columns = explode(",",$mview->mv_specs);
-
-		$i=1;
-		$chado_tables = tripal_core_get_chado_tables();
-		$chado_tables = array_merge(array('select or leave blank',), $chado_tables);
-		$handlers = array();
-		dpm($chado_tables, 'chado tables');
-		$form['mview_id']["fields_headers"] = array(
-         '#type' => 'markup',
-         '#value' => "<div class=\"field-headers\">".
-              "<div class=\"column-id\">Field Name and Type</div>".
-              "<div class=\"fields-column-join\">Join Table</div>".
-              "<div class=\"fields-column-join-column\">Join Column</div>".
-              "<div class=\"fields-column-handler\">Handler</div></div>",
-		);
-		dpm($form,'form here');
-		foreach ($columns as $column){
-			dpm($i, 'colmuns');
-
-			$column = trim($column);  // trim trailing and leading spaces
-			preg_match("/^(.*?)\ (.*?)$/",$column,$matches);
-			$column_name = $matches[1];
-			$column_type = $matches[2];
-
-			// first print the field name
-			$form['mview_id']["fields_start_$mview_id-$i"] = array(
-           '#type' => 'markup',
-           '#value' => "<div class=\"fields-new-row\">",
-			);
-
-			dpm($form,'form here 2');
-			$form['mview_id']["fields_column_name_$mview_id-$i"] = array(
-           '#type' => 'markup',
-           '#attributes' => array('class' => 'fields-column-name'),
-           '#value' => "<div class=\"column-id\"><span class=\"column-name\">$column_name</span>".
-                       "<br><span class=\"column-type\">$column_type</span></div>",
-			);
-
-			// second print the table join drop down
-// 			$table = $form_state['values']["fields_column_join_$mview_id_$i"];
-			$form['mview_id']["fields_column_join_$mview_id-$i"] = array(
-            '#type' => 'select',
-            '#prefix' => "<div class=\"fields-column-join\">",
-            '#suffix' => "</div>",
-            '#options' => $chado_tables,
-            '#required' => FALSE,
-            '#default_value' => $table,
-			//             '#ahah' => array(
-			//       	     'path' => "admin/tripal/tripal_views_setup/ajax/field_col_join_$i",
-			//       	     'wrapper' => "fields-column-join-column-$mview_id-$i",
-			//               'effect' => 'fade',
-			//               'event' => 'change',
-			//               'method' => 'replace',
-			// 			),
-			);
-			if($table){
-				$table_desc = module_invoke_all('chado_'.$table.'_schema');
-				$columns = array_keys($table_desc['fields']);
-			} else {
-				$columns = array();
-			}
-			$form['mview_id']["fields_column_join_column_$mview_id-$i"] = array(
-            '#type' => 'select',
-		      '#prefix' => "<div id=\"fields-column-join-column-$mview_id-$i\" class=\"fields-column-join-column\">",
-            '#suffix' => "</div>",
-            '#options' => $columns,
-            '#required' => FALSE,
-			);
-			$form['mview_id']["fields_column_handler_$mview_id-$i"] = array(
-            '#type' => 'select',
-            '#prefix' => "<div class=\"fields-column-handler\">",
-            '#suffix' => "</div>",
-            '#options' => $handlers,
-            '#required' => FALSE,
-			);
-			$form['mview_id']["fields_end_$i"] = array(
-            '#type' => 'markup',
-            '#value' => "</div>",
-			);
-			$i++;
-		}
-		
-
-// 		$form['submit'] = array(
-// 	      '#type' => 'submit',
-// 	      '#value' => 'Create',
-// 		);
-
-// 		$form['row_counter'] = array(
-// 		   '#type' => 'hidden',
-// 		   '#value' => $i,
-// 		);
-	} // end if($form_state['values']['mview_id'])
-// 	else{
-// 		$form = array(
-// 			     '#type' => 'item',
-// 			  	  '#prefix' => '<div id="table-rows-wrapper">',
-// 			  	  '#suffix' => '</div>',
-// 		);
-// 	}
-
-	$form['save'] = array(
-	    '#type'  => 'submit',
-	    '#value' => t('Save'),
-	);
-	return $form;
-}
-
-
-/**
- *
- * @ingroup tripal_view_setup
- */
-function tripal_views_setup_new_setup_form_submit($form, &$form_state){
-	dpm($form, 'form on submit');
-	dpm($form_state, 'forms_state on submit');
-}

+ 0 - 7
base/tripal_views_setup/tripal_views_setup.info

@@ -1,7 +0,0 @@
-name = Tripal Views Setup 
-description = Tripal suite module to perform setup as views, instead of the built in drupal setup 
-core = 6.x
-package = Tripal
-
-dependencies[] = tripal_core
-

+ 0 - 41
base/tripal_views_setup/tripal_views_setup.module

@@ -1,41 +0,0 @@
-<?php
-
-require_once 'includes/tripal_views_setup.admin.inc';
-
-function tripal_views_setup_menu(){
-	$items = array();
-
-	$items['admin/tripal/tripal_views_setup'] = array(
-    'title' => t('Tripal Views Setups'),
-    'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_views_setup_admin_form'),
-	// 'page callback' => 'tripal_views_setup_admin_form_page',
-    'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
-	);
-
-	//page to actually create setup->mview->chado table relationships
-	$items['admin/tripal/tripal_views_setup_new'] = array(
-     'title' => 'Create New Views Setup',
-     'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_views_setup_new_setup_form'),
-     'access arguments' => array('access administration pages'), //TODO: figure out the proper permissions arguments
-     'type' => MENU_NORMAL_ITEM,
-	);
-
-	return $items;
-}
-
-function tripal_views_setup_theme(){
-	$theme = array();
-
-	//   $theme['tripal_views_setup_fields_form'] = array(
-	$theme['tripal_views_setup_new_setup_form'] = array(
-    'arguments' => array('form' => NULL),
-      'template'  => 'tripal_views_setup_fields_form',
-	);
-
-	return $theme;
-}
-

+ 0 - 47
base/tripal_views_setup/tripal_views_setup_fields_form.tpl.php

@@ -1,47 +0,0 @@
-<style type="text/css">
-
-#tripal-views-setup-new-setup-form  .fields-new-row, .field-headers {
-   dislay: block;
-   margin: 0px;
-   border-bottom-style: solid;
-   border-bottom-width: 1px;
-}
-#tripal-views-setup-new-setup-form .form-item {
-   margin: 0px 0px 5px 0px;
-}
-#tripal-views-setup-new-setup-form .column-id,.fields-column-join,.fields-column-join-column, .fields-column-handler {
-   display: inline-block;
-   margin: 0px;
-   vertical-align: top;
-}
-#tripal-views-setup-new-setup-form  .field-headers {
-   font-weight: bold;  
-}
-#tripal-views-setup-new-setup-form  .field-headers div {
-   display: inline-block;
-   margin: 0px;
-   vertical-align: top;
-}
-#tripal-views-setup-new-setup-form .column-name {
-
-}
-#tripal-views-setup-new-setup-form .column-type {
-   font-style: italic;  
-}
-#tripal-views-setup-new-setup-form .column-id {
-   width: 25%;
-}
-#tripal-views-setup-new-setup-form .fields-column-join {
-   width: 25%;
-}
-#tripal-views-setup-new-setup-form .fields-column-join-column {
-   width: 25%;
-}
-#tripal-views-setup-new-setup-form .fields-column-handler {
-   width: 25%;
-}
-
-</style>
-
-<?php print drupal_render($form); ?>
-