You are here

asset_wizard.themes.inc in Asset 6

File

inc/asset_wizard.themes.inc
View source
<?php

/**
 * Much trimmed down version of theme_page();
 */
function theme_asset_popup($content) {
  $title = drupal_get_title();

  // build $styles to not include theme styles
  $styles = '';
  $css = drupal_add_css();
  foreach ($css as $media => $types) {
    foreach ($types as $type => $files) {
      if ($type != 'theme') {
        foreach ($types[$type] as $file => $preprocess) {
          $styles .= '<style type="text/css" media="' . $media . '">@import "' . base_path() . $file . '";</style>' . "\n";
        }
      }
    }
  }
  $scripts = drupal_get_js();
  $head = drupal_get_html_head();
  $messages = theme('status_messages');
  return <<<POPUP
\t<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\t<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print {<span class="php-variable">$language</span>} ?>" xml:lang="<?php print {<span class="php-variable">$language</span>} ?>">
\t<head>
\t<title>{<span class="php-variable">$title</span>}</title>
\t{<span class="php-variable">$head</span>}
\t{<span class="php-variable">$styles</span>}
\t{<span class="php-variable">$scripts</span>}
\t</head>
\t<body id="asset-popup">
\t<h1>{<span class="php-variable">$title</span>}</h1>
\t{<span class="php-variable">$messages</span>}
\t<div class="content">{<span class="php-variable">$content</span>}</div>
</body>
</html>
POPUP;
}

/**
 * Main theme function for asset_wizard_form.
 */
function theme_asset_wizard_form($form, $main_class = NULL) {
  $footer = '<div id="asset-popup-footer" class="clear-block">' . drupal_render($form['footer']) . '</div>';
  $help = $form['help'] ? '<div class="help">' . drupal_render($form['help']) . '</div>' : '';
  $toolbar = '<div class="toolbar">' . asset_wizard_toolbar($form['parent']['#value']) . '</div>';

  //$location = '<div class="location">' . asset_wizard_location_bar($form['parent']['#value']) .'</div>';
  $messages = theme('status_messages');
  $main = '<div id="asset-popup-main" class="' . $main_class . '">' . $messages . $help . drupal_render($form) . '</div>';
  return $toolbar . $main . $footer;
}

/**
 * Theme function for the selection step of the wizard.
 */
function theme_asset_wizard_selection_form($form) {

  //  $output .= '<div class="toolbar">' . drupal_render($form['toolbar']) . '</div>';
  $output .= '<div class="crumb-left"><div class="crumb-right">' . drupal_render($form['dir_crumb']) . '</div></div>';
  $output .= '<div class="asset-tree-widget clear-block">' . drupal_render($form['folder_list']) . drupal_render($form['aid']) . drupal_render($form['asset_preview']) . '</div>';
  $form[] = array(
    '#value' => $output,
    '#weight' => -10,
  );
  return theme('asset_wizard_form', $form, 'asset-selection-form');
}

/**
 * Simple <input type="image"> function
 */
function theme_asset_image_button($element) {

  // Make sure not to overwrite classes.
  $element['#button_type'] = 'image';
  if (isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class'];
  }
  else {
    $element['#attributes']['class'] = 'form-' . $element['#button_type'];
  }
  return '<input type="image" ' . (empty($element['#name']) ? '' : 'name="' . $element['#name'] . '" ') . 'id="' . $element['#id'] . '" value="' . check_plain($element['#value']) . '" ' . drupal_attributes($element['#attributes']) . " />\n";
}

/**
 * Theme function for the permissions field.
 */
function theme_asset_upload_permissions($element) {
  $roles = db_query("SELECT rid, status FROM {asset_role} WHERE aid=%d", $element['status']['#post']['aid']);
  while ($role = db_fetch_object($roles)) {
    if ($role->status) {
      $element['roles'][$role->rid]['#value'] = $role->rid;
    }
  }
  $roles = drupal_render($element['roles']);
  $element['status'][ASSET_PRIVATE]['#suffix'] = '<div class="roles">' . $roles . '</div>';
  $element['status'][ASSET_PRIVATE]['#id'] = 'permissions-private';
  $element['status'][ASSET_PUBLIC]['#id'] = 'permissions-public';
  return drupal_render($element);
}

Functions

Namesort descending Description
theme_asset_image_button Simple <input type="image"> function
theme_asset_popup Much trimmed down version of theme_page();
theme_asset_upload_permissions Theme function for the permissions field.
theme_asset_wizard_form Main theme function for asset_wizard_form.
theme_asset_wizard_selection_form Theme function for the selection step of the wizard.