I updated function _views_view_fields() to return the column names automatically. I needed it because I added a field to the view_view table and couldn't use it via hook_form_alter(). This code fixes it all but I didn't test it with pgsql.

function _views_view_fields() {
//  return array('vid', 'name', 'description', 'access', 'page', 'page_title', 'page_header', 'page_header_format', 'page_footer', 'page_footer_format', 'page_empty', 'page_empty_format', 'page_type', 'use_pager', 'nodes_per_page', 'url', 'menu', 'menu_tab', 'menu_tab_default', 'menu_tab_weight', 'menu_title', 'block', 'block_title', 'block_use_page_header', 'block_header', 'block_header_format', 'block_use_page_footer', 'block_footer', 'block_footer_format', 'block_use_page_empty', 'block_empty', 'block_empty_format', 'block_type', 'nodes_per_block', 'block_more', 'url', 'breadcrumb_no_home', 'changed', 'query', 'countquery', 'view_args_php');
// Modification: ericdes Tela Web http://telaweb.fr
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $result = db_query('SHOW COLUMNS FROM {view_view} ;');
      break;
    case 'pgsql':
      $result = db_query("SELECT column_name AS Field FROM information_schema.columns WHERE table_name = '{view_view}' ORDER BY ordinal_position ;");
      break;
  } 
  $columns = array();   
  while ($column = db_fetch_object($result)) {
    $columns[] = $column->Field; 
  }
  return $columns;
}

Comments

merlinofchaos’s picture

Status: Needs review » Needs work

This is not actually a patch, to start with.

And I'm not completely convinced Views should have this. Explain to me the value of this.

ericdes’s picture

I just want to avoid a modification needed for the Click2bookmark module. I added a checkbox to 'Allow users to bookmark this view'. Please let me know if you can think of a better way that wouldn't need an unwanted modification.

/**
 * Implementation of hook_form_alter().
 * 
 * We want to add the click2bookmark feature for views
 */
function click2bookmark_views_form_alter($form_id, &$form) {
  
  if ($form_id == "views_edit_view") { 
    
    $view = views_load_view($form['vid']['#value']);    
    
    $form['page-info']['click2bookmark'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#title' => t('Click2bookmark Configuration'),
    );
    $form['page-info']['click2bookmark']['click2bookmark_enabled'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Click2bookmark for this view'),
      '#return_value' => 1,
      '#default_value' => (isset($view->click2bookmark_enabled)? $view->click2bookmark_enabled : ''),
      '#description' => t('Allow users to bookmark this view.'),
    );
   
  }
  
}

merlinofchaos’s picture

Status: Needs work » Closed (won't fix)

I took a brief look at your module. I don't feel like your module needs to do what it is doing the way it is doing it; adding random checkboxes to the already cluttered views UI seems like a very poor approach.