Commit 74ea60f0 authored by merlinofchaos's avatar merlinofchaos

Checkpoint UI checkin

parent b9613702
This diff is collapsed.
......@@ -214,7 +214,7 @@ function views_object_cache_get($obj, $name, $skip_cache = FALSE) {
}
if (!array_key_exists($key, $cache)) {
$data = db_fetch_object(db_query("SELECT * FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = %d", session_id(), $obj, $name));
$data = db_fetch_object(db_query("SELECT * FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name));
if ($data) {
$cache[$key] = unserialize($data->data);
}
......@@ -248,7 +248,7 @@ function views_object_cache_set($obj, $name, $cache) {
* The name of the view (or other object) being stored.
*/
function views_object_cache_clear($obj, $name) {
db_query("DELETE FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = %d", session_id(), $obj, $name);
db_query("DELETE FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name);
}
/**
......
<?php
class views_tabset {
var $tabs = array();
var $extra = '';
function add($name, $title = '', $body = '') {
if (is_object($name) && is_subclass_of($name, 'views_tab')) {
$this->add_tab($name);
}
if (is_array($name)) {
foreach ($name as $real_tab) {
$this->add($real_tab);
}
return;
}
$this->add_tab(new views_tab($name, $title, $body));
}
function add_tab($tab) {
$this->tabs[$tab->name] = $tab;
}
function set($name, $title, $body = NULL) {
if (empty($this->tabs[$name])) {
return $this->add($name, $title, $body);
}
$this->tabs[$name]->title = $title;
if (isset($body)) {
$this->tabs[$name]->body = $body;
}
}
function set_body($name, $body) {
if (empty($this->tabs[$name])) {
return $this->add($name, '', $body);
}
$this->tabs[$name]->body = $body;
}
function add_extra($text) {
$this->extra .= $text;
}
function remove($tab) {
if (is_string($tab)) {
unset($this->tabs[$tab]);
}
else {
unset($this->tabs[$tab->name]);
}
}
function render() {
views_add_js('tabs');
views_add_css('tabs');
return theme('views_tabset', $this->tabs, $this->extra);
}
}
class views_tab {
var $title;
var $body;
var $name;
function views_tab($name, $title, $body = NULL) {
$this->name = $name;
$this->title = $title;
$this->body = $body;
}
function render() {
return theme('views_tab', $this->body);
}
}
function theme_views_tabset($tabs, $extra = NULL) {
$link_output = "<div class=\"views-tabs\"><ul>\n";
$tab_output = "<div class=\"views-tab-area\">\n";
$active_tab = 0;
foreach ($tabs as $tab) {
$link_output .= '<li' . (!$active_tab ? ' class="active"': '') . '><a href="#views-tab-' . $tab->name . '">' . $tab->title . '</a></li>' . "\n";
$tab_output .= '<div id="views-tab-' . $tab->name . '" class="views-tab">' . $tab->render() . "</div>\n";
$active_tab = 1;
}
$link_output .= "</ul>\n";
if ($extra) {
$link_output .= "<div class=\"extra\">$extra</div>\n";
}
$link_output .= "</div>\n";
$tab_output .= "</div>\n";
return '<div class="views-tabset clear-block">' . $link_output . $tab_output . '</div>';
}
function theme_views_tab($body) {
return $body;
}
function views_tabs_fieldsets($fieldsets = "") {
$tabset = new views_tabset;
foreach ($fieldsets as $fieldset) {
$title = $fieldset['#title'];
unset($fieldset['#title']);
$body = drupal_render($fieldset);
$name = preg_replace('/[^a-zA-Z0-9_]/', '_', $title);
$tabset->add(new views_tab($name, $title, $body));
}
return $tabset->render();
}
......@@ -247,6 +247,24 @@ function views_include($file) {
$used[$file] = TRUE;
}
/**
* Include views .css files.
*/
function views_add_css($file) {
drupal_add_css(drupal_get_path('module', 'views') . "/css/$file.css");
}
/**
* Include views .js files.
*/
function views_add_js($file) {
static $base = TRUE;
if ($base) {
drupal_add_js(drupal_get_path('module', 'views') . "/js/base.js");
}
drupal_add_js(drupal_get_path('module', 'views') . "/js/$file.js");
}
/**
* Prepare the specified string for use as a CSS identifier.
*/
......
......@@ -75,6 +75,23 @@ function views_ui_perm() {
return array('administer views');
}
function views_ui_theme() {
return array(
'views_ui_edit_view' => array(
'arguments' => array('form'),
'file' => '/includes/admin.inc',
),
'views_tabset' => array(
'arguments' => array('tabs'),
'file' => '/includes/tabs.inc',
),
'views_tab' => array(
'arguments' => array('body'),
'file' => '/includes/tabs.inc',
),
);
}
/**
* Specialized menu callback to load a view either out of the cache or just
* load it.
......@@ -83,6 +100,7 @@ function views_ui_cache_load($name) {
views_include('cache');
views_include('view');
$view = views_object_cache_get('view', $name);
if (empty($view)) {
$view = views_get_view($name);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment