You are here

panels_page.install in Panels 6.2

Same filename and directory in other branches
  1. 5.2 panels_page/panels_page.install

File

panels_page/panels_page.install
View source
<?php

/**
 * Install the panels tables
 */
function panels_page_schema() {
  return panels_page_schema_1();
}

/**
 * Schema version 1 for Panels in D6.
 */
function panels_page_schema_1() {
  $schema = array();
  $schema['panels_page'] = array(
    'description' => t('Holds the configuration data for panels pages.'),
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'did' => array(
        'type' => 'int',
        'default' => NULL,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'access' => array(
        'type' => 'varchar',
        'length' => 128,
        'storage_type' => 'implode',
      ),
      'path' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'load_flags' => array(
        'description' => t('Bitval-as-integer metadata used in determining panel_page behavior at runtime.'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'css_id' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'css' => array(
        'type' => 'text',
        'size' => 'big',
      ),
      'arguments' => array(
        'type' => 'text',
        'size' => 'big',
        'storage_type' => 'serialize',
      ),
      'displays' => array(
        'type' => 'text',
        'size' => 'big',
        'storage_type' => 'serialize',
      ),
      'contexts' => array(
        'type' => 'text',
        'size' => 'big',
        'storage_type' => 'serialize',
      ),
      'relationships' => array(
        'type' => 'text',
        'size' => 'big',
        'storage_type' => 'serialize',
      ),
      'no_blocks' => array(
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
      'switcher_options' => array(
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
        'storage_type' => 'serialize',
      ),
      'switcher_name' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
      ),
      'switcher_type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
      ),
      'menu' => array(
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
      'menu_tab' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => FALSE,
      ),
      'menu_tab_weight' => array(
        'type' => 'int',
        'size' => 'tiny',
      ),
      'menu_title' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'menu_tab_default' => array(
        'type' => 'int',
        'size' => 'small',
      ),
      'menu_tab_default_parent_type' => array(
        'type' => 'varchar',
        'length' => 10,
      ),
      'menu_parent_title' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'menu_parent_tab_weight' => array(
        'type' => 'int',
        'size' => 'tiny',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'indexes' => array(
      'path_idx' => array(
        'path',
      ),
      'did_idx' => array(
        'did',
      ),
    ),
  );

  // Straight copy from the menu schema; duping it for storage purposes.
  $schema['panels_page_router_store'] = array(
    'description' => t('Maps paths to various callbacks (access, page and title)'),
    'fields' => array(
      'path' => array(
        'description' => t('The Drupal path this entry describes.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'load_functions' => array(
        'description' => t('A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'to_arg_functions' => array(
        'description' => t('A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'access_callback' => array(
        'description' => t('The callback which determines the access to this router path. Defaults to user_access.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'access_arguments' => array(
        'description' => t('A serialized array of arguments for the access callback.'),
        'type' => 'text',
        'not null' => FALSE,
      ),
      'page_callback' => array(
        'description' => t('The name of the function that renders the page.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'page_arguments' => array(
        'description' => t('A serialized array of arguments for the page callback.'),
        'type' => 'text',
        'not null' => FALSE,
      ),
      'fit' => array(
        'description' => t('A numeric representation of how specific the path is.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'number_parts' => array(
        'description' => t('Number of parts in this router path.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'small',
      ),
      'tab_parent' => array(
        'description' => t('Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'tab_root' => array(
        'description' => t('Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => t('The title for the current page, or the title for the tab if this is a local task.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'title_callback' => array(
        'description' => t('A function which will alter the title. Defaults to t()'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'title_arguments' => array(
        'description' => t('A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'type' => array(
        'description' => t('Numeric representation of the type of the menu item, like MENU_LOCAL_TASK.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'block_callback' => array(
        'description' => t('Name of a function used to render the block on the system administration page for this item.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => t('A description of this item.'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'position' => array(
        'description' => t('The position of the block (left or right) on the system administration page for this item.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => t('Weight of the element. Lighter weights are higher up, heavier weights go down.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'file' => array(
        'description' => t('The file to include for this element, usually the page callback function lives in this file.'),
        'type' => 'text',
        'size' => 'medium',
      ),
    ),
    'indexes' => array(
      'fit_idx' => array(
        'fit',
      ),
      'number_parts_idx' => array(
        'number_parts',
      ),
    ),
    'primary key' => array(
      'path',
    ),
  );
  return $schema;
}

/**
 * Ensures the presence of appropriate whitespace in access strings.
 *
 * Due to some developer oversight, the delimiter used in {panels_page}.access
 * was changed from ', ' to ',' in earlier versions of the Panels 2.x branch.
 * This function makes absolutely sure that any such malformed entries are
 * properly formed, but does not harm any entries that were already properly
 * delimited.
 */
function panels_page_update_6001() {
  $result = db_query('SELECT pid, access from {panels_page}');
  while ($row = db_fetch_object($result)) {
    $access = str_replace(' ', '', $row->access);
    $row->access = implode(', ', explode(',', $access));
    db_query("UPDATE {panels_page} SET access = '%s' WHERE pid = %d", $row->access, $row->pid);
  }
  return array();
}
function panels_page_install() {
  db_query("UPDATE {system} SET weight = 15 WHERE name = 'panels_page'");
  drupal_install_schema('panels_page');
}
function panels_page_uninstall() {
  drupal_uninstall_schema('panels_page');
}

Functions

Namesort descending Description
panels_page_install
panels_page_schema Install the panels tables
panels_page_schema_1 Schema version 1 for Panels in D6.
panels_page_uninstall
panels_page_update_6001 Ensures the presence of appropriate whitespace in access strings.