Extracted text and test files from source code

This commit is contained in:
Manuel Cillero 2017-08-29 09:49:41 +02:00
parent 676a7ea81c
commit e7e66a9245
134 changed files with 0 additions and 14081 deletions

View file

@ -1,71 +0,0 @@
==================================================================================
Date API Installation instructions:
==================================================================================
1) If you have an earlier version of the Date module on your system, empty the
date folder out completely. The files in version 2 have different names and are
located in different places.
2) Download the whole package of files from http://drupal.org/project/date.
3) Upload the date files to the modules directory. The package includes files
needed by the Date API, and optional modules to to create CCK date fields.
4) Go to admin/build/modules and enable the needed modules from the Date/Time group.
You should end up with a structure like:
/drupal/modules/date/date_api.info
/drupal/modules/date/date_api.install
/drupal/modules/date/date_api.module
...
/drupal/modules/date/date/date.info
/drupal/modules/date/date/date.install
/drupal/modules/date/date/date.module
...
/drupal/modules/date/date_copy/date_copy.info
/drupal/modules/date/date_copy/date_copy.module
...
/drupal/modules/date/date_php4/date_php4.inc
/drupal/modules/date/date_php4/date_php4_lib.inc
...
==================================================================================
Older PHP versions
==================================================================================
If you are using PHP 4 or PHP 5.0 or 5.1, native date handling won't work right.
Install the Date_PHP4 module to enable wrapper functions so this code will work
in old PHP versions.
==================================================================================
Enable Date Timezone
==================================================================================
In most cases, you should enable the Date Timezone module any time you use the
Date API to be able to set the site and user timezone names. It is not enabled by
default in case another module is setting timezone names in the database.
Once you have enabled it, go to admin/settings/date-time and set the default
site timezone name. If you are using user timezones, go to your account settings
and set up your own timezone name.
==================================================================================
Install CCK Date Fields:
==================================================================================
1) The CCK date field is included in the Date files at http://drupal.org/project/date.
2) Go to admin/build/modules and enable the Date module. Be sure that the Date API module,
the Date Timezone module, and the Content module are also installed.
3) Go to admin/content/types to view cck content types and edit a content type.
4) Make sure the default timezone name has been set at admin/settings/date-time.
5) While viewing a content type, select the option to add a new field from the tabs at
the top of the page. Several options for date fields should be visible.
==================================================================================
More documentation is available at http://drupal.org/node/92460.
==================================================================================

View file

@ -1,282 +0,0 @@
<?php
/**
* @file
* Theme functions.
*/
/**
* @addtogroup themeable
* @{
*
* Formatter themes
*/
/**
* Theme from/to date combination in the view.
*
* Useful values:
*
* $node->date_id
* If set, this will show only an individual date on a field with
* multiple dates. The value should be a string that contains
* the following values, separated with periods:
* - module name of the module adding the item
* - node nid
* - field name
* - delta value of the field to be displayed
* - other information the module's custom theme might need
*
* Used by the calendar module and available for other uses.
* example: 'date.217.field_date.3.test'
*
* $node->date_repeat_show
* If true, tells the theme to show all the computed values
* of a repeating date. If not true or not set, only the
* start date and the repeat rule will be displayed.
*
* $dates['format'] - the format string used on these dates
* $dates['value']['local']['object'] - the local date object for the From date
* $dates['value2']['local']['object'] - the local date object for the To date
* $dates['value']['local']['datetime'] - the datetime value of the From date database (GMT) value
* $dates['value2']['local']['datetime'] - the datetime value of the To date database (GMT) value
* $dates['value']['formatted'] = formatted From date, i.e. 'February 15, 2007 2:00 pm';
* $dates['value']['formatted_date'] - only the date part of the formatted From date
* $dates['value']['formatted_time'] - only the time part of the formatted From date
* $dates['value2']['formatted'] = formatted To date, i.e. 'February 15, 2007 6:00 pm';
* $dates['value2']['formatted_date'] - only the date part of the formatted To date
* $dates['value2']['formatted_time'] - only the time part of the formatted To date
*/
function theme_date_display_combination($element) {
static $repeating_ids = array();
$node = $element['#node'];
$field_name = $element['#field_name'];
$context = !empty($node->content) && !empty($node->content[$field_name]) ? $node->content[$field_name]['#context'] : 'full';
$type_name = $element['#type_name'];
$fields = content_fields();
$field = $fields[$field_name];
$item = $element['#item'];
// Get the formatter settings, either the default settings for this node
// type or the View settings stored in $node->date_info.
$options = date_formatter_get_settings($field_name, $type_name, $context);
if (!empty($node->date_info) && !empty($node->date_info->formatter_settings)) {
$options = $node->date_info->formatter_settings;
}
$output = '';
// If date_id is set for this field and the delta doesn't match, don't display it.
if (!empty($node->date_id)) {
foreach ((array) $node->date_id as $key => $id) {
list($module, $nid, $field_name, $delta, $other) = explode('.', $id);
if ($field_name == $field['field_name'] && isset($item['#delta']) && $delta != $item['#delta']) {
return $output;
}
}
}
// Check the formatter settings to see if the repeat rule should be
// displayed. Show it only with the first multiple value date.
if (!in_array($node->nid, $repeating_ids) && module_exists('date_repeat')
&& !empty($item['rrule']) && $options['repeat']['show_repeat_rule'] == 'show') {
require_once('./'. drupal_get_path('module', 'date') .'/date_repeat.inc');
$output .= theme('date_repeat_display', $field, $item, $node);
$repeating_ids[] = $node->nid;
}
// If this is a full node or a pseudo node created by grouping
// multiple values, see exactly which values are supposed to be visible.
if (isset($node->$field_name)) {
$node = date_prepare_node($node, $field, $type_name, $context, $options);
// Did the current value get removed by formatter settings?
if (empty($node->{$field_name}[$item['#delta']])) {
return $output;
}
// Adjust the $element values to match the changes.
$element['#node'] = $node;
}
// Call the right theme for this formatter.
// Update the element with values that might have been altered by
// date_prepare_node() and figure out which values to display.
$dates = date_formatter_process($element);
switch ($options['fromto']['fromto']) {
case 'value':
$date1 = $dates['value']['formatted'];
$date2 = $date1;
break;
case 'value2':
$date2 = $dates['value2']['formatted'];
$date1 = $date2;
break;
default:
$date1 = $dates['value']['formatted'];
$date2 = $dates['value2']['formatted'];
break;
}
// Pull the timezone, if any, out of the formatted result and tack it
// back on at the end, if it is in the current formatted date.
$timezone = $dates['value']['formatted_timezone'];
if ($timezone) {
$timezone = ' ' . $timezone;
}
$date1 = str_replace($timezone, '', $date1);
$date2 = str_replace($timezone, '', $date2);
// No date values, display nothing.
if (empty($date1) && empty($date2)) {
$output .= '';
}
// From and To dates match or there is no To date, display a complete single date.
elseif ($date1 == $date2 || empty($date2)) {
$output .= theme('date_display_single', $date1, $timezone);
}
// Same day, different times, don't repeat the date but show both From and To times.
elseif (date_has_time($field['granularity']) && $dates['value']['formatted_date'] == $dates['value2']['formatted_date']) {
// Replace the original time with the from/to time in the formatted start date.
// Make sure that parentheses or brackets wrapping the time will be retained in the
// final result.
$time1 = preg_replace('`^([\(\[])`', '', $dates['value']['formatted_time']);
$time1 = preg_replace('([\)\]]$)', '', $time1);
$time2 = preg_replace('`^([\(\[])`', '', $dates['value2']['formatted_time']);
$time2 = preg_replace('([\)\]]$)', '', $time2);
$time = theme('date_display_range', $time1, $time2);
$replaced = str_replace($time1, $time, $date1);
$output .= theme('date_display_single', $replaced, $timezone);
}
// Different days, display both in their entirety.
else {
$output .= theme('date_display_range', $date1, $date2, $timezone);
}
return $output;
}
function theme_date_display_single($date, $timezone = NULL) {
return '<span class="date-display-single">'. $date . $timezone .'</span>';
}
function theme_date_display_range($date1, $date2, $timezone = NULL) {
return '<span class="date-display-start">'. $date1 .'</span>'.
'<span class="date-display-separator"> - </span>' .
'<span class="date-display-end">'. $date2 . $timezone. '</span>';
}
/**
* Theme a format interval for a date element
*
* @param $field = the field settings
* @param $node = node information, this is not always available and not
* always the full node, it depends on what value was provided to the formatter.
* Only the nid is always guaranteed to be available.
* @param $dates - an array of date information, see explanation for date_field_object for details.
* @return a formatted display
*
*/
function theme_date_format_interval($element) {
$node = $element['#node'];
$field_name = $element['#field_name'];
$context = !empty($node->content) ? $node->content[$field_name]['#context'] : 'full';
$type_name = $element['#type_name'];
$fields = content_fields();
$field = $fields[$field_name];
$item = $element['#item'];
// Get the formatter settings, either the default settings for this node
// type or the View settings stored in $node->date_info.
$options = date_formatter_get_settings($field_name, $type_name, $context);
if (!empty($node->date_info) && !empty($node->date_info->formatter_settings)) {
$options = $node->date_info->formatter_settings;
}
// If date_id is set for this field and the delta doesn't match, don't display it.
if (!empty($node->date_id)) {
foreach ((array) $node->date_id as $key => $id) {
list($module, $nid, $field_name, $delta, $other) = explode('.', $id);
if ($field_name == $field['field_name'] && isset($item['#delta']) && $delta != $item['#delta']) {
return;
}
}
}
// If this is not coming from Views, it is the full node.
// If we aren't retrieving a specific value, adjust the node values
// to match the formatter settings, removing values we should not see.
if (!empty($node->content) && empty($node->date_id)) {
$node = date_prepare_node($node, $field, $type_name, $context, $options);
// Did the current value get removed by formatter settings?
if (empty($node->{$field_name}[$item['#delta']])) {
return;
}
// Adjust the $element values to match the changes.
$element['#node'] = $node;
}
$dates = date_formatter_process($element);
return theme('date_time_ago', $dates['value']['local']['object'], $dates['value2']['local']['object']);
}
/**
* Theme the human-readable description for a Date Repeat rule.
*
* TODO -
* add in ways to store the description in the date so it isn't regenerated
* over and over and find a way to allow description to be shown or hidden.
*/
function theme_date_repeat_display($field, $item, $node = NULL) {
$output = '';
if (!empty($item['rrule'])) {
$output = date_repeat_rrule_description($item['rrule']);
$output = '<div>'. $output .'</div>';
}
return $output;
}
/**
* Adjust from/to date format to account for 'all day'.
*
* @param array $field, the field definition for this date field.
* @param string $which, which value to return, 'date1' or 'date2'.
* @param object $date1, a date/time object for the 'from' date.
* @param object $date2, a date/time object for the 'to' date.
* @param string $format
* @param object $node, the node this date comes from (may be incomplete, always contains nid).
* @param object $view, the view this node comes from, if applicable.
* @return formatted date.
*/
function theme_date_all_day($field, $which, $date1, $date2, $format, $node, $view = NULL) {
if (empty($date1) || !is_object($date1) || $format == 'format_interval') {
return;
}
if (empty($date2)) {
$date2 = $date1;
}
$suffix = '';
if (!date_has_time($field['granularity'])) {
$format = date_limit_format($format, array('year', 'month', 'day'));
}
else {
$format_granularity = date_format_order($format);
$format_has_time = FALSE;
if (in_array('hour', $format_granularity)) {
$format_has_time = TRUE;
}
$all_day = date_field_all_day($field, $date1, $date2);
if ($all_day && $format_has_time) {
$format = date_limit_format($format, array('year', 'month', 'day'));
$suffix = ' ' . theme('date_all_day_label');
}
}
return trim(date_format_date($$which, 'custom', $format) . $suffix);
}
/**
* Theme the way an 'all day' label will look.
*/
function theme_date_all_day_label() {
return '('. date_t('All day', 'datetime') .')';
}
/** @} End of addtogroup themeable */

View file

@ -1,281 +0,0 @@
<?php
/**
* @file
* Test FAQ functionality Base test class. All tests inherits this one.
* Hugely based on code from the test file block.test by boombatower
*/
/**
* Base class that is extended by test cases.
*/
class FaqTestCase extends DrupalWebTestCase {
protected $admin_user, $faq_user;
protected $taxonomy;
protected $term, $faq1, $faq2;
public static function getInfo() {
return array(
'name' => t('FAQ functionality'),
'description' => t('Base class. No tests here.'),
'group' => t('Frequently Asked Questions'),
);
}
function setUp() {
// Install FAQ Module.
parent::setUp('taxonomy', 'faq');
// Create and log in user with administer taxonomy permissions.
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer faq', 'administer faq order', 'administer blocks'));
$this->faq_user = $this->drupalCreateUser(array('create faq', 'edit faq', 'delete faq content', 'view faq page', 'access content'));
$this->view_faq_user = $this->drupalCreateUser(array('view faq page', 'access content'));
$this->drupalLogin($this->admin_user);
// Set up the vocab and terms.
$this->setupTaxonomy();
// Categorize questions.
$this->drupalPost('admin/settings/faq/categories', array('faq_use_categories' => '1'), t('Save configuration'));
// Set answer_user as default expert.
$roles = $this->faq_user->roles;
end($roles); // Set to last role (the unique one)
// Start all tests logged out.
$this->drupalLogout();
}
/**
* Tear the whole thing down again
*/
function tearDown() {
// Things to tidy up like vars and stuff
parent::tearDown();
}
/**
* Generates a random string of ASCII numeric characters (values 48 to 57).
*
* @param $length
* Length of random string to generate .
* @return
* Randomly generated string.
*/
protected static function randomNumber($length = 8) {
$str = '';
for ($i = 0; $i < $length; $i++) {
$str .= chr(mt_rand(48, 57));
}
return $str;
}
/**
* Verify that current user has no access to page.
*
* @param $url
* URL to verify.
*/
function faqVerifyNoAccess($url) {
// Test that page returns 403 Access Denied
$this->drupalGet($url);
$this->assertResponse(403);
}
/**
* Set up the taxonomy - all vocabularies and stuff
* Values also stored in protected variable $tax
*/
function setupTaxonomy() {
// Create vocabulary.
$this->taxonomy = array();
$this->taxonomy['name'] = $this->randomName(8); // Create taxonomy vocabulary name
$this->taxonomy['description'] = $this->randomName(64);
$this->taxonomy['nodes[faq]'] = '1'; // Assign vocab to FAQ node types
$this->taxonomy['tags'] = '1'; // Users may create tags
$this->taxonomy['multiple'] = '1'; // may have more than one tag
$this->taxonomy['required'] = '1'; // but minimum 1 tag
$this->drupalPost('admin/content/taxonomy/add/vocabulary', $this->taxonomy, t('Save'));
$this->assertText(t('Created new vocabulary @name', array('@name' => $this->taxonomy['name'])));
$this->assertText(t('FAQ'));
// Add term
// Click the last occurrence of the link.
$this->clickLink(t('add terms'), substr_count($this->drupalGetContent(), 'add terms') - 1);
$this->assertText(t('Add term to @name', array('@name' => $this->taxonomy['name']) ));
$url = parse_url($this->getUrl());
if ($url['query'] == '') {
$array = split('/', $url['path']);
$this->taxonomy['id'] = $array[4];
}
else {
$array = split('/', $url['query']);
$this->taxonomy['id'] = $array[3];
}
$this->pass(var_export($array, TRUE));
$url = $this->getUrl();
$this->term = array();
$this->term['name'] = $this->randomName(8); // Create taxonomy vocabulary name
$this->term['description'] = $this->randomName(64);
$this->drupalPost($url, $this->term, t('Save'));
$this->assertText(t('Created new term @name', array('@name' => $this->term['name'])));
}
}
class FaqAccessTestClass extends FaqTestCase {
public static function getInfo() {
return array(
'name' => t('Access to FAQ pages'),
'description' => t('Access to pages by anonymous user and logged in user with rights.'),
'group' => t('Frequently Asked Questions'),
);
}
function testFaqAccess() {
// Verify that anonymous user has no access to the faq page
$this->faqVerifyNoAccess('faq');
// Create and login user
$normal_user = $this->drupalCreateUser();
$this->drupalLogin($normal_user);
// Verify that logged in user has no access to the faq page
$this->faqVerifyNoAccess('faq');
$this->drupalLogout();
$this->drupalLogin($this->view_faq_user);
// Verify that the faq page is visible and available but empty
$this->drupalGet('faq');
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
}
}
class CRUDFaqTestCase extends FaqTestCase {
public static function getInfo() {
return array(
'name' => t('CRUD FAQ node'),
'description' => t('Create, Read, Update and Delete a FAQ node.'),
'group' => t('Frequently Asked Questions'),
);
}
/**
* Test creating a FAQ node
*/
function testFaqCreate() {
// Log in user with create FAQ permissions
$this->drupalLogin($this->faq_user);
// Fill in the Create FAQ node 1 form and post it
$this->faq1 = array();
$this->faq1['title'] = $this->randomName(8);
$this->faq1['taxonomy[tags][1]'] = $this->term['name']; // Add existing term
$this->faq1['detailed_question'] = $this->randomName(16);
$this->faq1['body'] = $this->randomName(16);
$this->drupalPost('node/add/faq', $this->faq1, t('Save'));
// Check that new FAQ node has actually been created
$this->assertText(t('FAQ @title has been created.', array('@title' => $this->faq1['title'])));
// Fill in the Create FAQ node 2 form and post it
$this->faq2 = array();
$this->faq2['title'] = $this->randomName(8);
$this->faq2['taxonomy[tags][1]'] = $this->randomName(8); // Add new term
$this->faq2['detailed_question'] = $this->randomName(16);
$this->faq2['body'] = $this->randomName(16);
$this->drupalPost('node/add/faq', $this->faq2, t('Save'));
// Check that new FAQ node has actually been created
$this->assertText(t('FAQ @title has been created.', array('@title' => $this->faq2['title'])));
$this->drupalLogout();
// Check that the FAQ page is available and that the correct term is listed as grouping for the new FAQ node
$this->drupalLogin($this->view_faq_user);
$this->drupalGet('faq');
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
$this->assertText($this->faq1['title'], t('Created FAQ node 1 available on FAQ page.'));
$this->assertText($this->faq1['taxonomy[tags][1]'], t('Term for node 1 available on FAQ page.'));
$this->assertText($this->faq2['title'], t('Created FAQ node 2 available on FAQ page.'));
$this->assertText($this->faq2['taxonomy[tags][1]'], t('Term for node 2 available on FAQ page.'));
// Navigate to FAQ node created on FAQ page
$this->clickLink(t($this->faq1['title']));
$this->assertText(t($this->faq1['body']));
// Log in user with administer FAQ settings.
$this->drupalLogin($this->admin_user);
// Enable categorisation of FAQ nodes
// faq_use_categories
$conf = array();
$conf['faq_use_categories'] = '1'; // Enable categorised FAQs
$this->drupalPost('admin/settings/faq/categories', $conf, t('Save configuration'));
$this->drupalLogout();
$this->drupalLogin($this->view_faq_user);
$this->drupalGet('faq');
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
$this->assertText($this->faq1['title'], t('Created FAQ node 1 available on FAQ page.'));
$this->assertText($this->faq1['taxonomy[tags][1]'], t('Term for node 1 not available on FAQ page.'));
$this->assertText($this->faq2['title'], t('Created FAQ node 2 available on FAQ page.'));
$this->assertText($this->faq2['taxonomy[tags][1]'], t('Term for node 2 not available on FAQ page.'));
}
/**
* Test editing and deleting of an FAQ node.
*/
public function testFaqEditDelete() {
// Log in user with create FAQ permissions
$this->drupalLogin($this->faq_user);
// Create a FAQ node.
$edit = array();
$edit['title'] = $this->randomName(8);
$edit['taxonomy[tags][' . $this->taxonomy['id'] . ']'] = $this->randomName(8);
$edit['detailed_question'] = $this->randomName(64);
$edit['body'] = $this->randomString(264);
$this->drupalPost('node/add/faq', $edit, t('Save'));
$this->assertText(t('FAQ @title has been created.', array('@title' => $edit['title'])));
// Check status for FAQ node - should be published
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertTrue($node->status);
// Update FAQ
$this->drupalGet('node/' . $node->nid . '/edit'); // Open edit page with node
$edit2['title'] = 'title-' . $this->randomName(8);
$edit2['body'] = 'body-' . $this->randomName(64);
$this->drupalPost('node/' . $node->nid . '/edit', array('title' => $edit2['title'], 'body' => $edit2['body']), t('Save'));
$this->assertText(t('FAQ @title has been updated.', array('@title' => $edit2['title'])));
$this->assertText($edit2['title'], 'Title has changed');
$this->assertText($edit2['body'], 'Body has changed');
// Delete FAQ
$this->drupalPost('node/' . $node->nid . '/edit', array(), t('Delete'));
$this->assertText(t('Are you sure you want to delete @title?', array('@title' => $edit2['title'])));
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertText(t('FAQ @title has been deleted.', array('@title' => $edit2['title'])));
}
}

View file

@ -1,553 +0,0 @@
<?php
/**
* @file
* Tests for the GeSHi filter module.
*/
// @todo: test the tag style widget, both on general settings form and format specific form: at least one tag style should be selected.
/**
* Funcional tests for the GeSHi filter administration.
*/
class GeshiFilterAdministrationTest extends DrupalWebTestCase {
/**
* A global filter adminstrator
*/
protected $filter_admin_user;
/**
* The id of the input format with only GeSHi filter in it
*/
protected $input_format_id;
/**
* Drupal SimpleTest method: return metadata about the test.
*/
function getInfo() {
return array(
'name' => t('GeSHi filter administration'),
'description' => t('Test the GeSHi filter administration.'),
'group' => t('GeSHi filter module'),
);
}
/**
* SimpleTest core method: code run before each and every test method.
*
* Optional. You only need this if you have setup tasks.
*/
function setUp() {
// Make sure the GeSHi filter module is enabled.
parent::setUp('geshifilter');
// And set the path to the geshi library.
variable_set('geshifilter_geshi_dir','libraries/geshi');
// Create a filter admin user
$permissions = array('administer filters', 'administer site configuration');
$this->filter_admin_user = $this->drupalCreateUser($permissions);
// log in with filter admin user
$this->drupalLogin($this->filter_admin_user);
// add an input format with only geshi filter
$edit = array(
'name' => $this->randomName(10, 'inputformat_'),
'filters[geshifilter/0]' => TRUE,
'roles[2]' => TRUE,
);
$this->drupalPost('admin/settings/filters/add', $edit, t('Save configuration'));
// store the format id of the created input format
$this->input_format_id = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $edit['name']));
$this->assertTrue($this->input_format_id, t('Input format id (%s)'));
// set some default GeSHi filter admin settings
variable_set('geshifilter_format_specific_options', FALSE);
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_ANGLE => GESHIFILTER_BRACKETS_ANGLE,
GESHIFILTER_BRACKETS_SQUARE => GESHIFILTER_BRACKETS_SQUARE,
));
variable_set('geshifilter_default_line_numbering', GESHIFILTER_LINE_NUMBERS_DEFAULT_NONE);
}
/**
* SimpleTest core method: code run after each and every test method.
*
* Optional. You only need this if you have setup tasks.
*/
function tearDown() {
// Remove input format.
$this->drupalPost('admin/settings/filters/delete/'. $this->input_format_id, array(), t('Delete'));
// Always call the tearDown() function from the parent class.
parent::tearDown();
}
/**
* Check tag unicity: tags should differ between languages and from generic tags
*/
function test_tag_unicity() {
// enable some languages first
variable_set('geshifilter_language_enabled_php', TRUE);
variable_set('geshifilter_language_enabled_python', TRUE);
// first round: without format specific tag options
variable_set('geshifilter_format_specific_options', FALSE);
variable_set('geshifilter_tags', 'code blockcode generictag');
// a language tag should differ from the generic tags
$form_values = array(
'geshifilter_language_tags_php' => 'php generictag',
);
$this->drupalPost('admin/settings/geshifilter/languages', $form_values, t('Save configuration'));
$this->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ from generic tags (with generic tag options)'));
// language tags should differ between languages
$form_values = array(
'geshifilter_language_tags_php' => 'php languagetag',
'geshifilter_language_tags_python' => 'languagetag python',
);
$this->drupalPost('admin/settings/geshifilter/languages/all', $form_values, t('Save configuration'));
$this->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ between languages (with generic tag options)'));
// second round: with format specific tag options
variable_set('geshifilter_format_specific_options', TRUE);
variable_set('geshifilter_tags_' . $this->input_format_id, 'code blockcode generictag');
// a language tag should differ from the generic tags
$form_values = array(
'geshifilter_language_tags_php_' . $this->input_format_id => 'php generictag',
);
$this->drupalPost('admin/settings/filters/' . $this->input_format_id . '/configure', $form_values, t('Save configuration'));
$this->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ from generic tags (with format specific tag options)'));
// language tags should differ between languages
$form_values = array(
'geshifilter_language_tags_php_' . $this->input_format_id => 'php languagetag',
'geshifilter_language_tags_python_' . $this->input_format_id => 'languagetag python',
);
$this->drupalPost('admin/settings/filters/' . $this->input_format_id . '/configure', $form_values, t('Save configuration'));
$this->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ between languages (with format specific tag options)'));
}
}
class GeshiFilterTest extends DrupalWebTestCase {
/**
* A global filter adminstrator
*/
protected $filter_admin_user;
/**
* A global user for adding pages
*/
protected $normal_user;
/**
* The id of the input format with only GeSHi filter in it
*/
protected $input_format_id;
/**
* Drupal SimpleTest method: return metadata about the test.
*/
function getInfo() {
return array(
'name' => t('GeSHi input filter'),
'description' => t('Test the input filter capabilities of the GeSHi filter.'),
'group' => t('GeSHi filter module'),
);
}
/**
* SimpleTest core method: code run before each and every test method.
*
* Optional. You only need this if you have setup tasks.
*/
function setUp() {
// Make sure that Geshi filter module is enabled.
parent::setUp('geshifilter');
// And set the path to the geshi library.
variable_set('geshifilter_geshi_dir','libraries/geshi');
// Create a filter admin user
$permissions = array(
'administer filters',
);
$this->filter_admin_user = $this->drupalCreateUser($permissions);
// Create a normal user for page creation
$permissions = array(
'edit own page content',
'create page content'
);
$this->normal_user = $this->drupalCreateUser($permissions);
// log in with filter admin user
$this->drupalLogin($this->filter_admin_user);
// add an input format with only geshi filter
$edit = array(
'name' => $this->randomName(10, 'inputformat_'),
'filters[geshifilter/0]' => TRUE,
'filters[filter/0]' => FALSE,
'filters[filter/1]' => FALSE,
'filters[filter/2]' => FALSE,
'filters[filter/3]' => FALSE,
'roles[2]' => TRUE,
);
$this->drupalPost('admin/settings/filters/add', $edit, t('Save configuration'));
// store the format id of the created input format
$this->input_format_id = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $edit['name']));
$this->assertTrue($this->input_format_id, t('Valid input format id'));
// set some default GeSHi filter admin settings
// Set default highlighting mode to "do nothing".
variable_set('geshifilter_default_highlighting', GESHIFILTER_DEFAULT_PLAINTEXT);
variable_set('geshifilter_format_specific_options', FALSE);
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_ANGLE => GESHIFILTER_BRACKETS_ANGLE,
GESHIFILTER_BRACKETS_SQUARE => GESHIFILTER_BRACKETS_SQUARE,
));
variable_set('geshifilter_default_line_numbering', GESHIFILTER_LINE_NUMBERS_DEFAULT_NONE);
// log out as filter admin
$this->drupalGet('logout');
// log in as the normal user for adding pages
$this->drupalLogin($this->normal_user);
// include GeSHi filtering functions
require_once(drupal_get_path('module', 'geshifilter') .'/geshifilter.pages.inc');
}
/**
* SimpleTest core method: code run after each and every test method.
*
* Optional. You only need this if you have setup tasks.
*/
function tearDown() {
// log in as filter admin
$this->drupalGet('logout');
$this->drupalLogin($this->filter_admin_user);
// remove input format
$this->drupalPost('admin/settings/filters/delete/'. $this->input_format_id, array(), t('Delete'));
// Always call the tearDown() function from the parent class.
parent::tearDown();
}
/**
* Assert function for testing if GeSHi highlighting works
* @param string $body the body text of the node
* @param array $check_list list of items that should be in rendered output (assertRaw)
* an item is something like array($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode)
* if $lang is set, GeSHifilter syntax highlighting is applied to $sourcecode
* if $lang is false, $sourcecode is directly looked for
* @param string $description description of the assertion
* @param boolean $invert if assertNoRaw should be used instead of assertRaw
*/
function assertGeshiFilterHighlighting($body, $check_list, $description, $invert=false) {
// Create content.
$edit = array(
'title' => $this->randomName(32, 'simpletest_pagetitle_'),
'body' => $body ."\n". $this->randomName(100),
'format' => $this->input_format_id,
);
// Post node
$this->drupalPost('node/add/page', $edit, t('Save'));
// check posted node
$node = node_load(array('title' => $edit['title']));
$this->assertTrue($node, 'Node found in database. %s');
// check if highlighting succeeded
foreach ($check_list as $fragment) {
list($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode) = $fragment;
if ($lang) {
// apply syntax highlighting
$source_code = geshifilter_geshi_process($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode);
}
if ($invert) {
$this->assertNoRaw($source_code, $description);
}
else {
$this->assertRaw($source_code, $description);
}
}
}
/**
* Test the standard functionality of the generic tags
*/
function testGenericTags() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_c', TRUE);
variable_set('geshifilter_language_enabled_cpp', TRUE);
variable_set('geshifilter_language_enabled_csharp', TRUE);
variable_set('geshifilter_language_enabled_java', TRUE);
// body material
$source_code = "//C++-ish source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// check language argument
$this->assertGeshiFilterHighlighting('<code type="cpp">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking type="..." argument'));
$this->assertGeshiFilterHighlighting('<code lang="cpp">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking lang="..." argument'));
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking language="..." argument'));
// check some languages
$languages = array('c', 'cpp', 'java');
foreach ($languages as $lang) {
$this->assertGeshiFilterHighlighting('<code language="'. $lang .'">'. $source_code .'</code>',
array(array($source_code, $lang, 0, 1, FALSE)),
t('Checking language="@lang"', array('@lang' => $lang)));
}
// check line_numbering argument
$this->assertGeshiFilterHighlighting('<code type="cpp" linenumbers="off">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking linenumbers="off" argument'));
$this->assertGeshiFilterHighlighting('<code type="cpp" linenumbers="normal">'. $source_code .'</code>',
array(array($source_code, 'cpp', 1, 1, FALSE)),
t('Checking linenumbers="normal" argument'));
$this->assertGeshiFilterHighlighting('<code type="cpp" start="27">'. $source_code .'</code>',
array(array($source_code, 'cpp', 1, 27, FALSE)),
t('Checking start="27" argument'));
$this->assertGeshiFilterHighlighting('<code type="cpp" linenumbers="fancy">'. $source_code .'</code>',
array(array($source_code, 'cpp', 5, 1, FALSE)),
t('Checking linenumbers="fancy" argument'));
$this->assertGeshiFilterHighlighting('<code type="cpp" fancy="3">'. $source_code .'</code>',
array(array($source_code, 'cpp', 3, 1, FALSE)),
t('Checking fancy="3" argument'));
}
function testBracketsOnlyAngle() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only angle brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_ANGLE => GESHIFILTER_BRACKETS_ANGLE,
));
// This should be filtered.
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking angle brackets style in GESHIFILTER_BRACKETS_ANGLE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('[code language="cpp"]'. $source_code .'[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_ANGLE mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]'. $source_code .'[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_ANGLE mode'));
$this->assertGeshiFilterHighlighting('<?php'. $source_code .'?>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking php code blocks in GESHIFILTER_BRACKETS_ANGLE mode'));
}
function testBracketsOnlySquare() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_SQUARE => GESHIFILTER_BRACKETS_SQUARE,
));
// This should be filtered.
$this->assertGeshiFilterHighlighting('[code language="cpp"]'. $source_code .'[/code]',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_SQUARE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking angle brackets style in GESHIFILTER_BRACKETS_SQUARE mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]'. $source_code .'[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_SQUARE mode'));
$this->assertGeshiFilterHighlighting('<?php'. $source_code .'?>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking php code blocks in GESHIFILTER_BRACKETS_SQUARE mode'));
}
function testBracketsOnlyDoubleSquare() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only double square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_DOUBLESQUARE => GESHIFILTER_BRACKETS_DOUBLESQUARE,
));
// This should be filtered.
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]'. $source_code .'[[/code]]',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking angle brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
$this->assertGeshiFilterHighlighting('[code language="cpp"]'. $source_code .'[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
$this->assertGeshiFilterHighlighting('<?php'. $source_code .'?>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking php code blocks in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
}
function testBracketsOnlyPhpCodeBlock() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only double square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_PHPBLOCK => GESHIFILTER_BRACKETS_PHPBLOCK,
));
// This should be filtered.
$this->assertGeshiFilterHighlighting('<?php'. $source_code .'?>',
array(array($source_code, 'php', 0, 1, FALSE)),
t('Checking php code blocks in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking angle brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
$this->assertGeshiFilterHighlighting('[code language="cpp"]'. $source_code .'[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]'. $source_code .'[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_PHPBLOCK mode'));
}
/**
* Check if tags like [c++] and [c#] work
* Problem described in http://drupal.org/node/208720
*/
function testSpecialTags() {
// Enabled the tags
variable_set('geshifilter_language_enabled_cpp', TRUE);
variable_set('geshifilter_language_tags_cpp', 'c++');
variable_set('geshifilter_language_enabled_csharp', TRUE);
variable_set('geshifilter_language_tags_csharp', 'c#');
// body material
$source_code = "//C++-ish source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Test the tags
$this->assertGeshiFilterHighlighting('<c++>'. $source_code .'</c++>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Checking <c++>..</c++>'));
$this->assertGeshiFilterHighlighting('<c#>'. $source_code .'</c#>',
array(array($source_code, 'csharp', 0, 1, FALSE)),
t('Checking <c#>..</c#>'));
}
/**
* Test if tags like [cpp], [css], [csharp] aren't highjacked by [c]
*/
function testPrefixTags() {
// enabled the tags
variable_set('geshifilter_language_enabled_c', TRUE);
variable_set('geshifilter_language_tags_c', 'c');
variable_set('geshifilter_language_enabled_cpp', TRUE);
variable_set('geshifilter_language_tags_cpp', 'cpp');
variable_set('geshifilter_language_enabled_csharp', TRUE);
variable_set('geshifilter_language_tags_csharp', 'csharp');
// body material
$source_code = "//C++-ish source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Test the tags
$this->assertGeshiFilterHighlighting('<cpp>'. $source_code .'</cpp>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Source code in <cpp>...</cpp> should work when <c>...</c> is also enabled'));
$this->assertGeshiFilterHighlighting('<csharp>'. $source_code .'</csharp>',
array(array($source_code, 'csharp', 0, 1, FALSE)),
t('Source code in <csharp>...</csharp> should work when <c>...</c> is also enabled'));
}
function testDoNothingMode() {
// Enable C++.
variable_set('geshifilter_language_enabled_cpp', TRUE);
variable_set('geshifilter_language_tags_cpp', 'cpp');
// Set default highlighting mode to "do nothing".
variable_set('geshifilter_default_highlighting', GESHIFILTER_DEFAULT_DONOTHING);
// Body material with some characters ('<' and '&') that would be escaped
// except in "do nothing" mode
$source_code = "//C++-ish source code\nfor (int i=0; i!=10; ++i) {\n fun(i);\n bar.foo(x, y);\n}";
// Tests
$this->assertGeshiFilterHighlighting('<code>'. $source_code .'</code>',
array(array('<code>'. $source_code .'</code>', FALSE, 0, 1, FALSE)),
t('Do nothing mode should not touch given source code')
);
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Highlighting with language="cpp" should work when default is "do nothing"')
);
$this->assertGeshiFilterHighlighting('<cpp>'. $source_code .'</cpp>',
array(array($source_code, 'cpp', 0, 1, FALSE)),
t('Highlighting with <cpp>...</cpp> should work when default is "do nothing"')
);
}
function testTitleAttributeOnCodeBlock(){
$source_code = "for (int i=0; i!=10; ++i) {\n fun(i);\n bar.foo(x, y);\n}";
// No title set
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array('geshifilter-title', False, 0, 0, 0)),
t('Setting the title attritbute on code block.'),
true
);
// Title set.
$this->assertGeshiFilterHighlighting('<code language="cpp" title="Foo the bar!">'. $source_code .'</code>',
array(array('<div class="geshifilter-title">Foo the bar!</div>', False, 0, 0, 0)),
t('Setting the title attritbute on code block.')
);
}
function testTitleAttributeOnInlineCode(){
$source_code = "for (int i=0; i!=10; ++i) { fun(i); }";
// No title set.
$this->assertGeshiFilterHighlighting('<code language="cpp">'. $source_code .'</code>',
array(array('<span class="geshifilter">', False, 0, 0, 0)),
t('Setting the title attritbute on inline code.')
);
// Title set.
$this->assertGeshiFilterHighlighting('<code language="cpp" title="Foo the bar!">'. $source_code .'</code>',
array(array('<span class="geshifilter" title="Foo the bar!">', False, 0, 0, 0)),
t('Setting the title attritbute on inline code.')
);
}
/**
* Issue http://drupal.org/node/1010216
*/
function testSquareBracketConfusion() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_ini', TRUE);
$source_code = "[section]\nserver=192.0.2.62 ; IP address\nport=12345";
// Enable square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_SQUARE => GESHIFILTER_BRACKETS_SQUARE,
));
// This should be filtered.
$this->assertGeshiFilterHighlighting('[code]'. $source_code .'[/code]',
array(array($source_code, 'text', 0, 1, FALSE)),
t('Checking if [code][section]...[/code] works'));
$this->assertGeshiFilterHighlighting('[code language="ini"]'. $source_code .'[/code]',
array(array($source_code, 'ini', 0, 1, FALSE)),
t('Checking if [code language="ini"][section]...[/code] works'));
}
}

View file

@ -1,53 +0,0 @@
PREREQUISITES: Make sure you check HTML Purifier and make sure that you
have fulfilled all of its requirements before running this. Specifically,
you'll need the PHP extension ctype (in almost all PHP distributions),
and it's nice to have dom and iconv.
* Place the htmlpurifier folder in your drupal modules directory.
* Download HTML Purifier from http://htmlpurifier.org/ You will need
4.0.0 or later.
* There are two possible ways to install the HTML Purifier library.
1. Module directory installation. This means installing the library
folder under the module directory. This way has the advantage of
not depending on other modules. The issue is that when you
upgrade the htmlpurifier module the HTML Purifier library gets
removed and you have to re-extract the archive in the newly
installed module directory.
2. The preferred way is making use of the libraries API,
http://drupal.org/project/libraries. This makes the library
available to all sites or to a specific site in a multisite
Drupal setup. You'll need to download the libraries API module
and enable it before enabling the htmlpurifier module so that in
the install phase it can find the library.
Extract the library folder to libraries directory.
The final setup should be, when making the library and module
available to all sites:
libraries/htmlpurifier/
HTMLPurifier
HTMLPurifier.autoload.php
HTMLPurifier.auto.php
HTMLPurifier.func.php
HTMLPurifier.includes.php
HTMLPurifier.kses.php
HTMLPurifier.path.php
HTMLPurifier.php
HTMLPurifier.safe-includes.php
Now you can safely upgrade your htmlpurifier module without
having to re-deploy the HTML Purifier library.
* Go to Administer > Site building > Modules and enable this module
* You can now create a new input format or add the HTML Purifier to an
existing input format. It is recommended that you place HTML Purifier as
the last filter in the input format. Reorder the filters if necessary.
WARNING: Due to HTML Purifier's caching mechanism, dynamic filters MUST NOT
be placed before HTML Purifier.

View file

@ -1,20 +0,0 @@
TODO List
Non-code
- Add better documentation about what's different about configuring
the PHP and what's configuring the web interface
- Make distinction between module and library clearer
- Link to WYSIWYG editors, research integration prospects, and how
they're handling security
- http://drupal.org/project/htmlarea
- http://drupal.org/project/fckeditor
- http://drupal.org/project/tinymce
- Competitors
- http://drupal.org/project/safehtml
1.3
- Improve help text (this might be a good addition to the HTML Purifier
core). This would be for filter tips as well as for the form.
- Compatibility
- Paging comments

View file

@ -1,50 +0,0 @@
<?php
/**
* @file
* This file is a sample advanced PHP configuration file for the HTML Purifier
* filter module. In reality, this file would be named N.php, where N is the
* integer identifying the filter this is configuring. The configure page
* for HTML Purifier (advanced) will tell you what file to copy this to.
*
* See this URI:
*
* http://htmlpurifier.org/live/configdoc/plain.html
*
* For full information about permitted directives. The most interesting ones
* for custom configuration are ones with the 'mixed' type, as they cannot
* be configured using the webform.
*
* @note
* A number of directives have been predefined for you in order to better
* work with Drupal. You can see what these defaults in the
* _htmlpurifier_get_config() function in htmlpurifier.module.php.
*
* @warning
* Please be mindful of the version of HTML Purifier you have installed!
* All of the docs linked to are for the latest version of HTML Purifier;
* your installation may or may not be up-to-date.
*/
/**
* Accepts an HTMLPurifier_Config configuration object and configures it.
*
* @param $config
* Instance of HTMLPurifier_Config to modify. See
* http://htmlpurifier.org/doxygen/html/classHTMLPurifier__Config.html
* for a full API.
*
* @note
* No return value is needed, as PHP objects are passed by reference.
*/
function htmlpurifier_config_N($config) {
// Set your configuration here:
$config->set('Core', 'Lexer', 'DirectLex');
// $config->set('Namespace', 'Directive', $value);
// Advanced users:
// $def = $config->getDefinition('HTML');
// For more information about this, see:
// http://htmlpurifier.org/docs/enduser-customize.html
}

View file

@ -1,39 +0,0 @@
********************************************************************
D R U P A L M O D U L E
********************************************************************
Name: i18n module and translation module
Author: Jose A. Reyero
********************************************************************
This is the 6.x version of i18n module, and works with Drupal 6.x
********************************************************************
********************************************************************
Updated documentation will be kept on-line at http://drupal.org/node/133977
********************************************************************
INSTALLATION:
============
1. Create folder 'modules/i18n' and copy all the modules files, keeping directory structure, to this folder.
2. If updating, run the update.php script following the standard procedure for Drupal updates.
POST-INSTALLATION/CONFIGURATION:
============
- First of all review Drupal language settings and make sure you have chosen the right default language.
- Enable the needed modules grouped under "Internationalization" package
- Read the on-line handbook on
IMPORTANT:
==========
- This module requires a complex set up, make sure you read the handbook and understand the different options
- Before creating a support request, do read the handbook: http://drupal.org/node/133977
Additional Support
==================
For support, please create a support request for this module's project: http://drupal.org/project/i18n
Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
====================================================================
Jose A. Reyero, freelance at reyero dot net, http://www.reyero.net

View file

@ -1,25 +0,0 @@
For ImageCache to work properly it needs to be able to make use fou clean URLs.
This requires some webserver specific setup.
Apache2 + mod_rewrite
Works out of the box.
LightHTTPD pre-1.4.24:
http://nordisch.org/2007/2/6/drupal-on-lighttpd-with-clean-urls
LightHTTPD 1.4.24 and later:
https://veracium.com/content/imagecache-lighttpd-witho
IIS 6:
add an error404.asp that passed everything to drupal.
<%
Response.Expires=0
strQString=Request.ServerVariables("QUERY_STRING")
If (InStr(strQString,"/d5/")) Then
pos=Instr(strQString,"/d5/")+3
Id=Right(strQString,Len(strQString)-pos)
Response.Redirect("/d5/index.php?q=" & Id)
End If
Response.Redirect("index.htm")
%>

View file

@ -1,156 +0,0 @@
This document explains how to provide "Pathauto integration" in a
module. You need this if you would like to provide additional tokens
or if your module has paths and you wish to have them automatically
aliased. The simplest integration is just to provide tokens so we
cover that first. More advanced integration requires an
implementation of hook_pathauto to provide a settings form.
It may be helpful to review some examples of integration from the
pathauto_node.inc, pathauto_taxonomy.inc, and pathauto_user.inc files.
==================
1 - Providing additional tokens
==================
If all you want is to enable tokens for your module you will simply
need to implement two functions:
hook_token_values
hook_token_list
See the token.module and it's API.txt for more information about this
process.
If the token is intended to generate a path expected to contain slashes,
the token name must end in 'path', 'path-raw' or 'alias'. This indicates to
Pathauto that the slashes should not be removed from the replacement value.
When an object is created (whether it is a node or a user or a
taxonomy term) the data that Pathauto hands to the token_values in the
$object is in a specific format. This is the format that most people
write code to handle. However, during edits and bulk updates the data
may be in a totally different format. So, if you are writing a
hook_token_values implementation to add special tokens, be sure to
test creation, edit, and bulk update cases to make sure your code will
handle it.
==================
2 - Settings hook - To create aliases for your module
==================
You must implement hook_pathauto($op), where $op is always (at this
time) 'settings'. Return an object (NOT an array) containing the
following members, which will be used by pathauto to build a group
of settings for your module and define the variables for saving your
settings:
module - The name of your module (e.g., 'node')
groupheader - The translated label for the settings group (e.g.,
t('Node path settings')
patterndescr - The translated label for the default pattern (e.g.,
t('Default path pattern (applies to all node types with blank patterns below)')
patterndefault - A translated default pattern (e.g., t('[cat]/[title].html'))
placeholders - An array whose keys consist of the translated placeholders
which will appear in patterns (e.g., t('[title]')) and values are
the translated description of the placeholders (e.g.,
t('The title of the node, with spaces and punctuation.')
patternitems - For modules which need to express multiple patterns
(for example, the node module supports a separate pattern for each
node type), an array whose keys consist of identifiers for each
pattern (e.g., the node type name) and values consist of the
translated label for the pattern
supportsfeeds - Modules which support RSS feeds should set this to the
string that's appended to a path for its feed (usually 'feed') , so
when administrators enable "Create feed aliases" an alias for this
content type's feed will be generated in addition to the base alias.
bulkname - For modules which support a bulk update operation, the
translated label for the action (e.g., t('Bulk update node paths'))
bulkdescr - For modules which support a bulk update operation, a
translated, more thorough description of what the operation will do
(e.g., t('Generate aliases for all existing nodes which do not already have aliases.'))
==================
2 - $alias = pathauto_create_alias($module, $op, $placeholders, $src, $type=NULL)
==================
At the appropriate time (usually when a new item is being created for
which a generated alias is desired), call pathauto_create_alias() to
generate and create the alias. See the user, taxonomy, and nodeapi hook
implementations in pathauto.module for examples.
$module - The name of your module (e.g., 'node')
$op - Operation being performed on the item ('insert', 'update', or
'bulkupdate')
$placeholders - An array whose keys consist of the translated placeholders
which appear in patterns and values are the "clean" values to be
substituted into the pattern. Call pathauto_cleanstring() on any
values which you do not know to be purely alphanumeric, to substitute
any non-alphanumerics with the user's designated separator. Note that
if the pattern has multiple slash-separated components (e.g., [catpath]),
pathauto_cleanstring() should be called for each component, not the
complete string.
Example: $placeholders[t('[title]')] = pathauto_cleanstring($node->title);
$src - The "real" URI of the content to be aliased (e.g., "node/$node->nid")
$type - For modules which provided patternitems in hook_autopath(),
the relevant identifier for the specific item to be aliased (e.g.,
$node->type)
pathauto_create_alias() returns the alias that was created.
==================
3 - Bulk update function
==================
If a module supports bulk updating of aliases, it must provide a
function of this form, to be called by pathauto when the corresponding
checkbox is selected and the settings page submitted:
function <module>_pathauto_bulkupdate()
The function should iterate over the content items controlled by the
module, calling pathauto_create_alias() for each one. It is
recommended that the function report on its success (e.g., with a
count of created aliases) via drupal_set_message().
==================
4 - Bulk delete hook_path_alias_types()
==================
For modules that create new types of pages that can be aliased with pathauto, a
hook implementation is needed to allow the user to delete them all at once.
function hook_path_alias_types()
This hook returns an array whose keys match the beginning of the source paths
(e.g.: "node/", "user/", etc.) and whose values describe the type of page (e.g.:
"content", "users"). Like all displayed strings, these descriptionsshould be
localized with t(). Use % to match interior pieces of a path; "user/%/track". This
is a database wildcard, so be careful.
==================
Modules that extend node and/or taxonomy
==================
NOTE: this is basically not true any more. If you feel you need this file an issue.
Many contributed Drupal modules extend the core node and taxonomy
modules. To extend pathauto patterns to support their extensions, they
may implement the pathauto_node and pathauto_taxonomy hooks.
To do so, implement the function <modulename>_pathauto_node (or _taxonomy),
accepting the arguments $op and $node (or $term). Two operations are
supported:
$op = 'placeholders' - return an array keyed on placeholder strings
(e.g., t('[eventyyyy]')) valued with descriptions (e.g. t('The year the
event starts.')).
$op = 'values' - return an array keyed on placeholder strings, valued
with the "clean" actual value for the passed node or category (e.g.,
pathauto_cleanstring(date('M', $eventstart)));
See contrib/pathauto_node_event.inc for an example of extending node
patterns.

View file

@ -1,48 +0,0 @@
**Installation:
Pathauto is an extension to the path module, which must be enabled.
Pathauto also relies on the Token module, which must be downloaded and
enabled separately.
1. Unpack the Pathauto folder and contents in the appropriate modules
directory of your Drupal installation.
2. Enable the Pathauto module in the administration tools.
3. If you're not using Drupal's default administrative account, make
sure "administer pathauto" is enabled through access control administration.
4. Visit the Pathauto settings page and make appropriate configurations
For 5.x: Administer > Site configuration > Pathauto
For 6.x: Administer > Site building > URL alias > Automated alias settings
**Transliteration support:
If you desire transliteration support in the creation of URLs (e.g. the
replacement of À with A) then you will need to rename the file
i18n-ascii.example.txt to i18n-ascii.txt
You can then freely edit the i18n-ascii.txt without worrying that your changes
will be over-written by upgrades of Pathauto.
For details on how to transliterate any UTF8 character, please see the full
i18n-ascii-fill.txt file information at http://drupal.org/node/185664
**Upgrading from previous versions:
If you are upgrading from Pathauto 5.x-1.x to 5.x-2.x (or 6.x-2.x) then you
will probably need to change your patterns.
For content patterns:
[user] is now [author-name]
[cat] is now [term]
There may be other changes as well. Please review the pattern examples on
Administration > Site Configuration > Pathauto
If you upgraded from Pathauto 5.x-1.x directly without enabling Token
first then you will need to
1) download/install the Token module
2) disable the Pathauto module
3) re-enable the Pathauto module
Upgrade to 6.x:
Note that the settings page has moved so that it is more logically grouped with
other URL alias related items under
Administer > Site building > URL alias > Automated alias settings

View file

@ -1,564 +0,0 @@
; global transliteration
[default]
À = "A"
Á = "A"
 = "A"
à = "A"
Ä = "Ae"
Å = "A"
Æ = "A"
Ā = "A"
Ą = "A"
Ă = "A"
Ç = "C"
Ć = "C"
Č = "C"
Ĉ = "C"
Ċ = "C"
Ď = "D"
Đ = "D"
È = "E"
É = "E"
Ê = "E"
Ë = "E"
Ē = "E"
Ę = "E"
Ě = "E"
Ĕ = "E"
Ė = "E"
Ĝ = "G"
Ğ = "G"
Ġ = "G"
Ģ = "G"
Ĥ = "H"
Ħ = "H"
Ì = "I"
Í = "I"
Î = "I"
Ï = "I"
Ī = "I"
Ĩ = "I"
Ĭ = "I"
Į = "I"
İ = "I"
IJ = "IJ"
Ĵ = "J"
Ķ = "K"
Ľ = "L"
Ĺ = "L"
Ļ = "L"
Ŀ = "L"
Ł = "L"
Ñ = "N"
Ń = "N"
Ň = "N"
Ņ = "N"
Ŋ = "N"
Ò = "O"
Ó = "O"
Ô = "O"
Õ = "O"
Ö = "Oe"
Ø = "O"
Ō = "O"
Ő = "O"
Ŏ = "O"
Œ = "OE"
Ŕ = "R"
Ř = "R"
Ŗ = "R"
Ś = "S"
Ş = "S"
Ŝ = "S"
Ș = "S"
Š = "S"
Ť = "T"
Ţ = "T"
Ŧ = "T"
Ț = "T"
Ù = "U"
Ú = "U"
Û = "U"
Ü = "Ue"
Ū = "U"
Ů = "U"
Ű = "U"
Ŭ = "U"
Ũ = "U"
Ų = "U"
Ŵ = "W"
Ŷ = "Y"
Ÿ = "Y"
Ý = "Y"
Ź = "Z"
Ż = "Z"
Ž = "Z"
à = "a"
á = "a"
â = "a"
ã = "a"
ä = "ae"
ā = "a"
ą = "a"
ă = "a"
å = "a"
æ = "ae"
ç = "c"
ć = "c"
č = "c"
ĉ = "c"
ċ = "c"
ď = "d"
đ = "d"
è = "e"
é = "e"
ê = "e"
ë = "e"
ē = "e"
ę = "e"
ě = "e"
ĕ = "e"
ė = "e"
ƒ = "f"
ĝ = "g"
ğ = "g"
ġ = "g"
ģ = "g"
ĥ = "h"
ħ = "h"
ì = "i"
í = "i"
î = "i"
ï = "i"
ī = "i"
ĩ = "i"
ĭ = "i"
į = "i"
ı = "i"
ij = "ij"
ĵ = "j"
ķ = "k"
ĸ = "k"
ł = "l"
ľ = "l"
ĺ = "l"
ļ = "l"
ŀ = "l"
ñ = "n"
ń = "n"
ň = "n"
ņ = "n"
ʼn = "n"
ŋ = "n"
ò = "o"
ó = "o"
ô = "o"
õ = "o"
ö = "oe"
ø = "o"
ō = "o"
ő = "o"
ŏ = "o"
œ = "oe"
ŕ = "r"
ř = "r"
ŗ = "r"
ś = "s"
š = "s"
ş = "s"
ť = "t"
ţ = "t"
ù = "u"
ú = "u"
û = "u"
ü = "ue"
ū = "u"
ů = "u"
ű = "u"
ŭ = "u"
ũ = "u"
ų = "u"
ŵ = "w"
ÿ = "y"
ý = "y"
ŷ = "y"
ż = "z"
ź = "z"
ž = "z"
ß = "ss"
ſ = "ss"
Α = "A"
Ά = "A"
Ἀ = "A"
Ἁ = "A"
Ἂ = "A"
Ἃ = "A"
Ἄ = "A"
Ἅ = "A"
Ἆ = "A"
Ἇ = "A"
ᾈ = "A"
ᾉ = "A"
ᾊ = "A"
ᾋ = "A"
ᾌ = "A"
ᾍ = "A"
ᾎ = "A"
ᾏ = "A"
Ᾰ = "A"
Ᾱ = "A"
Ὰ = "A"
Ά = "A"
ᾼ = "A"
Β = "B"
Γ = "G"
Δ = "D"
Ε = "E"
Έ = "E"
Ἐ = "E"
Ἑ = "E"
Ἒ = "E"
Ἓ = "E"
Ἔ = "E"
Ἕ = "E"
Έ = "E"
Ὲ = "E"
Ζ = "Z"
Η = "I"
Ή = "I"
Ἠ = "I"
Ἡ = "I"
Ἢ = "I"
Ἣ = "I"
Ἤ = "I"
Ἥ = "I"
Ἦ = "I"
Ἧ = "I"
ᾘ = "I"
ᾙ = "I"
ᾚ = "I"
ᾛ = "I"
ᾜ = "I"
ᾝ = "I"
ᾞ = "I"
ᾟ = "I"
Ὴ = "I"
Ή = "I"
ῌ = "I"
Θ = "TH"
Ι = "I"
Ί = "I"
Ϊ = "I"
Ἰ = "I"
Ἱ = "I"
Ἲ = "I"
Ἳ = "I"
Ἴ = "I"
Ἵ = "I"
Ἶ = "I"
Ἷ = "I"
Ῐ = "I"
Ῑ = "I"
Ὶ = "I"
Ί = "I"
Κ = "K"
Λ = "L"
Μ = "M"
Ν = "N"
Ξ = "KS"
Ο = "O"
Ό = "O"
Ὀ = "O"
Ὁ = "O"
Ὂ = "O"
Ὃ = "O"
Ὄ = "O"
Ὅ = "O"
Ὸ = "O"
Ό = "O"
Π = "P"
Ρ = "R"
Ῥ = "R"
Σ = "S"
Τ = "T"
Υ = "Y"
Ύ = "Y"
Ϋ = "Y"
Ὑ = "Y"
Ὓ = "Y"
Ὕ = "Y"
Ὗ = "Y"
Ῠ = "Y"
Ῡ = "Y"
Ὺ = "Y"
Ύ = "Y"
Φ = "F"
Χ = "X"
Ψ = "PS"
Ω = "O"
Ώ = "O"
Ὠ = "O"
Ὡ = "O"
Ὢ = "O"
Ὣ = "O"
Ὤ = "O"
Ὥ = "O"
Ὦ = "O"
Ὧ = "O"
ᾨ = "O"
ᾩ = "O"
ᾪ = "O"
ᾫ = "O"
ᾬ = "O"
ᾭ = "O"
ᾮ = "O"
ᾯ = "O"
Ὼ = "O"
Ώ = "O"
ῼ = "O"
α = "a"
ά = "a"
ἀ = "a"
ἁ = "a"
ἂ = "a"
ἃ = "a"
ἄ = "a"
ἅ = "a"
ἆ = "a"
ἇ = "a"
ᾀ = "a"
ᾁ = "a"
ᾂ = "a"
ᾃ = "a"
ᾄ = "a"
ᾅ = "a"
ᾆ = "a"
ᾇ = "a"
ὰ = "a"
ά = "a"
ᾰ = "a"
ᾱ = "a"
ᾲ = "a"
ᾳ = "a"
ᾴ = "a"
ᾶ = "a"
ᾷ = "a"
β = "b"
γ = "g"
δ = "d"
ε = "e"
έ = "e"
ἐ = "e"
ἑ = "e"
ἒ = "e"
ἓ = "e"
ἔ = "e"
ἕ = "e"
ὲ = "e"
έ = "e"
ζ = "z"
η = "i"
ή = "i"
ἠ = "i"
ἡ = "i"
ἢ = "i"
ἣ = "i"
ἤ = "i"
ἥ = "i"
ἦ = "i"
ἧ = "i"
ᾐ = "i"
ᾑ = "i"
ᾒ = "i"
ᾓ = "i"
ᾔ = "i"
ᾕ = "i"
ᾖ = "i"
ᾗ = "i"
ὴ = "i"
ή = "i"
ῂ = "i"
ῃ = "i"
ῄ = "i"
ῆ = "i"
ῇ = "i"
θ = "th"
ι = "i"
ί = "i"
ϊ = "i"
ΐ = "i"
ἰ = "i"
ἱ = "i"
ἲ = "i"
ἳ = "i"
ἴ = "i"
ἵ = "i"
ἶ = "i"
ἷ = "i"
ὶ = "i"
ί = "i"
ῐ = "i"
ῑ = "i"
ῒ = "i"
ΐ = "i"
ῖ = "i"
ῗ = "i"
κ = "k"
λ = "l"
μ = "m"
ν = "n"
ξ = "ks"
ο = "o"
ό = "o"
ὀ = "o"
ὁ = "o"
ὂ = "o"
ὃ = "o"
ὄ = "o"
ὅ = "o"
ὸ = "o"
ό = "o"
π = "p"
ρ = "r"
ῤ = "r"
ῥ = "r"
σ = "s"
ς = "s"
τ = "t"
υ = "y"
ύ = "y"
ϋ = "y"
ΰ = "y"
ὐ = "y"
ὑ = "y"
ὒ = "y"
ὓ = "y"
ὔ = "y"
ὕ = "y"
ὖ = "y"
ὗ = "y"
ὺ = "y"
ύ = "y"
ῠ = "y"
ῡ = "y"
ῢ = "y"
ΰ = "y"
ῦ = "y"
ῧ = "y"
φ = "f"
χ = "x"
ψ = "ps"
ω = "o"
ώ = "o"
ὠ = "o"
ὡ = "o"
ὢ = "o"
ὣ = "o"
ὤ = "o"
ὥ = "o"
ὦ = "o"
ὧ = "o"
ᾠ = "o"
ᾡ = "o"
ᾢ = "o"
ᾣ = "o"
ᾤ = "o"
ᾥ = "o"
ᾦ = "o"
ᾧ = "o"
ὼ = "o"
ώ = "o"
ῲ = "o"
ῳ = "o"
ῴ = "o"
ῶ = "o"
ῷ = "o"
¨ = ""
΅ = ""
᾿ = ""
= ""
῍ = ""
῝ = ""
῎ = ""
῞ = ""
῏ = ""
῟ = ""
= ""
῁ = ""
΄ = ""
΅ = ""
= ""
῭ = ""
ͺ = ""
= ""
А = "A"
Б = "B"
В = "V"
Г = "G"
Д = "D"
Е = "E"
Ё = "E"
Ж = "ZH"
З = "Z"
И = "I"
Й = "I"
К = "K"
Л = "L"
М = "M"
Н = "N"
О = "O"
П = "P"
Р = "R"
С = "S"
Т = "T"
У = "U"
Ф = "F"
Х = "KH"
Ц = "TS"
Ч = "CH"
Ш = "SH"
Щ = "SHCH"
Ы = "Y"
Э = "E"
Ю = "YU"
Я = "YA"
а = "A"
б = "B"
в = "V"
г = "G"
д = "D"
е = "E"
ё = "E"
ж = "ZH"
з = "Z"
и = "I"
й = "I"
к = "K"
л = "L"
м = "M"
н = "N"
о = "O"
п = "P"
р = "R"
с = "S"
т = "T"
у = "U"
ф = "F"
х = "KH"
ц = "TS"
ч = "CH"
ш = "SH"
щ = "SHCH"
ы = "Y"
э = "E"
ю = "YU"
я = "YA"
Ъ = ""
ъ = ""
Ь = ""
ь = ""
ð = "d"
Ð = "D"
þ = "th"
Þ = "TH"

View file

@ -1,830 +0,0 @@
<?php
/**
* @file
* Functionality tests for Pathauto.
*
* @ingroup pathauto
*/
/**
* Helper test class with some added functions for testing.
*/
class PathautoTestHelper extends DrupalWebTestCase {
function setUp(array $modules = array()) {
$modules[] = 'path';
$modules[] = 'token';
$modules[] = 'pathauto';
$modules[] = 'taxonomy';
parent::setUp($modules);
}
function assertToken($type, $object, $token, $expected) {
$this->assertTokens($type, $object, array($token => $expected));
}
function assertTokens($type, $object, array $tokens) {
$values = pathauto_get_placeholders($type, $object);
$values = $values['values'];
foreach ($tokens as $token => $expected) {
$this->assertIdentical($values[$token], $expected, t("Token value for [@token] was '@actual', expected value '@expected'.", array('@token' => $token, '@actual' => $values[$token], '@expected' => $expected)));
}
}
function saveAlias($source, $alias, $language = '') {
path_set_alias($source, $alias, NULL, $language);
return db_fetch_array(db_query_range("SELECT * FROM {url_alias} WHERE src = '%s' AND dst = '%s' AND language = '%s' ORDER BY pid DESC", $source, $alias, $language, 0, 1));
}
function saveEntityAlias($entity_type, $entity, $alias, $language = '') {
$uri = $this->entity_uri($entity_type, $entity);
return $this->saveAlias($uri['path'], $alias, $language);
}
function assertEntityAlias($entity_type, $entity, $expected_alias, $language = '') {
$uri = $this->entity_uri($entity_type, $entity);
$this->assertAlias($uri['path'], $expected_alias, $language);
}
function assertEntityAliasExists($entity_type, $entity) {
$uri = $this->entity_uri($entity_type, $entity);
return $this->assertAliasExists(array('source' => $uri['path']));
}
function assertNoEntityAlias($entity_type, $entity, $language = '') {
$uri = $this->entity_uri($entity_type, $entity);
$this->assertEntityAlias($entity_type, $entity, $uri['path'], $language);
}
function assertNoEntityAliasExists($entity_type, $entity) {
$uri = $this->entity_uri($entity_type, $entity);
$this->assertNoAliasExists(array('source' => $uri['path']));
}
function assertAlias($source, $expected_alias, $language = '') {
drupal_clear_path_cache();
$alias = drupal_get_path_alias($source, $language);
$this->assertIdentical($alias, $expected_alias, t("Alias for %source with language '@language' was %actual, expected %expected.", array('%source' => $source, '%actual' => $alias, '%expected' => $expected_alias, '@language' => $language)));
}
function assertAliasExists($conditions) {
$path = $this->path_load($conditions);
$this->assertTrue($path, t('Alias with conditions @conditions found.', array('@conditions' => var_export($conditions, TRUE))));
return $path;
}
function assertNoAliasExists($conditions) {
$alias = $this->path_load($conditions);
$this->assertFalse($alias, t('Alias with conditions @conditions not found.', array('@conditions' => var_export($conditions, TRUE))));
}
/**
* Backport of Drupal 7's entity_uri() function.
*/
protected function entity_uri($entity_type, $entity) {
$uri = array();
switch ($entity_type) {
case 'node':
$uri['path'] = 'node/' . $entity->nid;
break;
case 'taxonomy_term':
$uri['path'] = taxonomy_term_path($entity);
break;
case 'user':
$uri['path'] = 'user/' . $entity->uid;
break;
default:
return $this->fail(t('Unknown entity @type.', array('@type' => $entity_type)));
}
return $uri;
}
/**
* Backport of Drupal 7's path_load() function.
*/
protected function path_load($conditions) {
if (is_numeric($conditions)) {
$conditions = array('pid' => $conditions);
}
elseif (is_string($conditions)) {
$conditions = array('src' => $conditions);
}
// Adjust for some D7 {url_alias} column name changes so we can keep
// the test files in sync.
if (isset($conditions['source'])) {
$conditions['src'] = $conditions['source'];
unset($conditions['source']);
}
if (isset($conditions['alias'])) {
$conditions['dst'] = $conditions['alias'];
unset($conditions['alias']);
}
$args = array();
$schema = drupal_get_schema_unprocessed('system', 'url_alias');
foreach ($conditions as $field => $value) {
$field_type = $schema['fields'][$field]['type'];
if (is_array($value)) {
$conditions[$field] = "$field = " . db_placeholders($value, $field_type);
$args = array_merge($args, $value);
}
else {
$placeholder = db_type_placeholder($field_type);
$conditions[$field] = "$field = $placeholder";
$args[] = $value;
}
}
$sql = "SELECT * FROM {url_alias} WHERE " . implode(' AND ', $conditions);
return db_fetch_array(db_query_range($sql, $args, 0, 1));
}
function deleteAllAliases() {
db_query("DELETE FROM {url_alias}");
drupal_clear_path_cache();
}
function addVocabulary(array $vocabulary = array()) {
$vocabulary += array(
'name' => drupal_strtolower($this->randomName(5)),
'nodes' => array('story' => 'story'),
);
taxonomy_save_vocabulary($vocabulary);
return (object) $vocabulary;
}
function addTerm(stdClass $vocabulary, array $term = array()) {
$term += array(
'name' => drupal_strtolower($this->randomName(5)),
'vid' => $vocabulary->vid,
);
taxonomy_save_term($term);
return (object) $term;
}
function addNodeType(array $type) {
if (!isset($type['name'])) {
$type['name'] = $this->randomName(8);
}
$type += array(
'type' => drupal_strtolower($type['name']),
'module' => 'node',
'description' => $this->randomName(40),
'custom' => TRUE,
'modified' => TRUE,
'locked' => FALSE,
'help' => '',
'min_word_count' => '',
);
$type = (object) _node_type_set_defaults($type);
node_type_save($type);
node_types_rebuild();
return $type;
}
function assertEntityPattern($entity_type, $bundle, $language = '', $expected) {
$this->refreshVariables();
$variables = array(
"pathauto_{$entity_type}_{$bundle}_{$language}_pattern",
"pathauto_{$entity_type}_{$bundle}_pattern",
"pathauto_{$entity_type}_pattern",
);
$pattern = '';
foreach ($variables as $variable) {
if ($pattern = variable_get($variable, '')) {
break;
}
}
$this->assertIdentical($expected, $pattern);
}
}
/**
* Unit tests for Pathauto functions.
*/
class PathautoUnitTestCase extends PathautoTestHelper {
public static function getInfo() {
return array(
'name' => 'Pathauto unit tests',
'description' => 'Unit tests for Pathauto functions.',
'group' => 'Pathauto',
'dependencies' => array('token'),
);
}
function setUp(array $modules = array()) {
parent::setUp($modules);
module_load_include('inc', 'pathauto');
}
/**
* Test _pathauto_get_schema_alias_maxlength().
*/
function testGetSchemaAliasMaxLength() {
$this->assertIdentical(_pathauto_get_schema_alias_maxlength(), 128);
}
/**
* Test pathauto_cleanstring().
*/
function testCleanString() {
$tests = array();
variable_set('pathauto_ignore_words', ', in, is,that, the , this, with, ');
variable_set('pathauto_max_component_length', 35);
// Test the 'ignored words' removal.
$tests['this'] = 'this';
$tests['this with that'] = 'this-with-that';
$tests['this thing with that thing'] = 'thing-thing';
// Test length truncation and duplicate separator removal.
$tests[' - Pathauto is the greatest - module ever in Drupal history - '] = 'pathauto-greatest-module-ever-drupa';
// Test that HTML tags are removed.
$tests['This <span class="text">text</span> has <br /><a href="http://example.com"><strong>HTML tags</strong></a>.'] = 'text-has-html-tags';
$tests[check_plain('This <span class="text">text</span> has <br /><a href="http://example.com"><strong>HTML tags</strong></a>.')] = 'text-has-html-tags';
foreach ($tests as $input => $expected) {
$output = pathauto_cleanstring($input);
$this->assertEqual($output, $expected, t("pathauto_cleanstring('@input') expected '@expected', actual '@output'", array('@input' => $input, '@expected' => $expected, '@output' => $output)));
}
}
/**
* Test the feed alias functionality of pathauto_create_alias().
*/
function testFeedAliases() {
variable_set('pathauto_node_pattern', '[title-raw]');
variable_set('pathauto_node_applytofeeds', '');
// Create a node with an empty title, which should not create an alias.
$node = $this->drupalCreateNode(array('title' => ''));
$this->assertNoAliasExists(array('source' => "node/{$node->nid}"));
$this->assertNoAliasExists(array('source' => "node/{$node->nid}/feed"));
// Add a title to the node. This should still not generate a feed alias.
$node->title = 'Node title';
pathauto_nodeapi($node, 'update');
$this->assertAliasExists(array('source' => "node/{$node->nid}", 'alias' => 'node-title'));
$this->assertNoAliasExists(array('source' => "node/{$node->nid}/feed"));
// Enable feeds for nodes. A feed alias should now be generated.
variable_set('pathauto_node_applytofeeds', ' feed ');
pathauto_nodeapi($node, 'update');
$this->assertAliasExists(array('source' => "node/{$node->nid}/feed", 'alias' => 'node-title/feed'));
}
/**
* Test _pathauto_get_raw_tokens().
*/
function testGetRawTokens() {
$raw_tokens = _pathauto_get_raw_tokens();
$this->assertFalse(in_array('node-path', $raw_tokens), 'Non-raw tokens not included.');
$this->assertTrue(in_array('node-path-raw', $raw_tokens), 'Token [catpath] has a matching raw token.');
$this->assertFalse(in_array('node-url-raw', $raw_tokens), 'Token [catalias] does not have a matching raw token.');
}
/**
* Test the different update actions in pathauto_create_alias().
*/
function testUpdateActions() {
// Test PATHAUTO_UPDATE_ACTION_NO_NEW with unaliased node and 'insert'.
variable_set('pathauto_update_action', 0);
$node = $this->drupalCreateNode(array('title' => 'First title'));
$this->assertEntityAlias('node', $node, 'content/first-title');
// Default action is PATHAUTO_UPDATE_ACTION_DELETE.
variable_set('pathauto_update_action', 2);
$node->title = 'Second title';
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/second-title');
$this->assertNoAliasExists(array('alias' => 'content/first-title'));
// Test PATHAUTO_UPDATE_ACTION_LEAVE.
variable_set('pathauto_update_action', 1);
$node->title = 'Third title';
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/third-title');
$this->assertAliasExists(array('source' => "node/{$node->nid}", 'alias' => 'content/second-title'));
variable_set('pathauto_update_action', 2);
$node->title = 'Fourth title';
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/fourth-title');
$this->assertNoAliasExists(array('alias' => 'content/third-title'));
// The older second alias is not deleted yet.
$older_path = $this->assertAliasExists(array('source' => "node/{$node->nid}", 'alias' => 'content/second-title'));
path_set_alias(NULL, NULL, $older_path['pid']);
variable_set('pathauto_update_action', 0);
$node->title = 'Fifth title';
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/fourth-title');
$this->assertNoAliasExists(array('alias' => 'content/fith-title'));
// Test PATHAUTO_UPDATE_ACTION_NO_NEW with unaliased node and 'update'.
$this->deleteAllAliases();
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/fifth-title');
// Test PATHAUTO_UPDATE_ACTION_NO_NEW with unaliased node and 'bulkupdate'.
$this->deleteAllAliases();
$node->title = 'Sixth title';
pathauto_node_update_alias($node, 'bulkupdate');
$this->assertEntityAlias('node', $node, 'content/sixth-title');
}
/**
* Test that pathauto_create_alias() will not create an alias for a pattern
* that does not get any tokens replaced.
*/
function testNoTokensNoAlias() {
$node = $this->drupalCreateNode(array('title' => ''));
$this->assertNoEntityAlias('node', $node);
$node->title = 'hello';
pathauto_nodeapi($node, 'update');
$this->assertEntityAlias('node', $node, 'content/hello');
}
/**
* Test the handling of path vs non-path tokens in pathauto_clean_token_values().
*
* @see PathautoBookTokenTestCase::testBookPathAlias()
*/
//function testPathTokens() {
//}
function testEntityBundleRenamingDeleting() {
// Create a vocabulary type.
$vocabulary = $this->addVocabulary();
variable_set('pathauto_taxonomy_pattern', 'base');
variable_set('pathauto_taxonomy_' . $vocabulary->vid . '_pattern', 'bundle');
$this->assertEntityPattern('taxonomy', $vocabulary->vid, '', 'bundle');
// Delete the vocabulary, which should cause its pattern variable to also
// be deleted.
taxonomy_del_vocabulary($vocabulary->vid);
$this->assertEntityPattern('taxonomy', $vocabulary->vid, '', 'base');
// Create a node type and test that it's pattern variable works.
$type = $this->addNodeType(array('type' => 'old_name'));
variable_set('pathauto_node_pattern', 'base');
variable_set("pathauto_node_old_name_pattern", 'bundle');
$this->assertEntityPattern('node', 'old_name', '', 'bundle');
// Rename the node type's machine name, which should cause its pattern
// variable to also be renamed.
$type->type = 'new_name';
$type->old_type = 'old_name';
node_type_save($type);
node_types_rebuild();
$this->assertEntityPattern('node', 'new_name', '', 'bundle');
$this->assertEntityPattern('node', 'old_name', '', 'base');
// Delete the node type, which should cause its pattern variable to also
// be deleted.
node_type_delete($type->type);
$this->assertEntityPattern('node', 'new_name', '', 'base');
}
function testNoExistingPathAliases() {
variable_set('pathauto_node_page_pattern', '[title-raw]');
variable_set('pathauto_punctuation_period', 2); // Do not replace periods.
// Check that Pathauto does not create an alias of '/admin'.
$node = $this->drupalCreateNode(array('title' => 'Admin', 'type' => 'page'));
$this->assertNoEntityAlias('node', $node);
// Check that Pathauto does not create an alias of '/modules'.
$node->title = 'Modules';
node_save($node);
$this->assertNoEntityAlias('node', $node);
// Check that Pathauto does not create an alias of '/index.php'.
$node->title = 'index.php';
node_save($node);
$this->assertNoEntityAlias('node', $node);
// Check that a safe value gets an automatic alias. This is also a control
// to ensure the above tests work properly.
$node->title = 'Safe value';
node_save($node);
$this->assertEntityAlias('node', $node, 'safe-value');
}
}
/**
* Helper test class with some added functions for testing.
*/
class PathautoFunctionalTestHelper extends PathautoTestHelper {
protected $admin_user;
function setUp(array $modules = array()) {
parent::setUp($modules);
// Set pathauto settings we assume to be as-is in this test.
variable_set('pathauto_node_page_pattern', 'content/[title-raw]');
// Allow other modules to add additional permissions for the admin user.
$permissions = array(
'administer pathauto',
'administer url aliases',
'create url aliases',
'administer nodes',
'administer users',
);
$args = func_get_args();
if (isset($args[1]) && is_array($args[1])) {
$permissions = array_merge($permissions, $args[1]);
}
$this->admin_user = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->admin_user);
}
}
/**
* Test basic pathauto functionality.
*/
class PathautoFunctionalTestCase extends PathautoFunctionalTestHelper {
public static function getInfo() {
return array(
'name' => 'Pathauto basic tests',
'description' => 'Test basic pathauto functionality.',
'group' => 'Pathauto',
'dependencies' => array('token'),
);
}
/**
* Basic functional testing of Pathauto.
*/
function testNodeEditing() {
// Create node for testing.
$random_title = $this->randomName(10);
$title = ' Simpletest title ' . $random_title . ' [';
$automatic_alias = 'content/simpletest-title-' . strtolower($random_title);
$node = $this->drupalCreateNode(array('title' => $title, 'type' => 'page'));
// Look for alias generated in the form.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertFieldChecked('edit-pathauto-perform-alias');
$this->assertFieldByName('path', $automatic_alias, 'Proper automated alias generated.');
// Check whether the alias actually works.
$this->drupalGet($automatic_alias);
$this->assertText($title, 'Node accessible through automatic alias.');
// Manually set the node's alias.
$manual_alias = 'content/' . $node->nid;
$edit = array(
'pathauto_perform_alias' => FALSE,
'path' => $manual_alias,
);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->assertText(t('@type @title has been updated', array('@type' => 'Page', '@title' => $title)));
// Check that the automatic alias checkbox is now unchecked by default.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertNoFieldChecked('edit-pathauto-perform-alias');
$this->assertFieldByName('path', $manual_alias);
// Submit the node form with the default values.
$this->drupalPost(NULL, array(), t('Save'));
$this->assertText(t('@type @title has been updated', array('@type' => 'Page', '@title' => $title)));
// Test that the old (automatic) alias has been deleted and only accessible
// through the new (manual) alias.
$this->drupalGet($automatic_alias);
$this->assertResponse(404, 'Node not accessible through automatic alias.');
$this->drupalGet($manual_alias);
$this->assertText($title, 'Node accessible through manual alias.');
}
/**
* Test node operations.
*/
function testNodeOperations() {
$node1 = $this->drupalCreateNode(array('title' => 'node1'));
$node2 = $this->drupalCreateNode(array('title' => 'node2'));
// Delete all current URL aliases.
$this->deleteAllAliases();
$edit = array(
'operation' => 'pathauto_update_alias',
"nodes[{$node1->nid}]" => TRUE,
);
$this->drupalPost('admin/content/node', $edit, t('Update'));
$this->assertText('Updated URL alias for 1 node.');
$this->assertEntityAlias('node', $node1, 'content/' . $node1->title);
$this->assertEntityAlias('node', $node2, 'node/' . $node2->nid);
}
/**
* Test user operations.
*/
function testUserOperations() {
$account = $this->drupalCreateUser();
// Delete all current URL aliases.
$this->deleteAllAliases();
$edit = array(
'operation' => 'pathauto_update_alias',
"accounts[{$account->uid}]" => TRUE,
);
$this->drupalPost('admin/user/user', $edit, t('Update'));
$this->assertText('Updated URL alias for 1 user account.');
$this->assertEntityAlias('user', $account, 'users/' . drupal_strtolower($account->name));
$this->assertEntityAlias('user', $this->admin_user, 'user/' . $this->admin_user->uid);
}
function testSettingsValidation() {
$edit = array();
$edit['pathauto_max_length'] = 'abc';
$edit['pathauto_max_component_length'] = 'abc';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The field Maximum alias length is not a valid number.');
$this->assertText('The field Maximum component length is not a valid number.');
$this->assertNoText('The configuration options have been saved.');
$edit['pathauto_max_length'] = '0';
$edit['pathauto_max_component_length'] = '0';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The field Maximum alias length cannot be less than 1.');
$this->assertText('The field Maximum component length cannot be less than 1.');
$this->assertNoText('The configuration options have been saved.');
$edit['pathauto_max_length'] = '999';
$edit['pathauto_max_component_length'] = '999';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The field Maximum alias length cannot be greater than 128.');
$this->assertText('The field Maximum component length cannot be greater than 128.');
$this->assertNoText('The configuration options have been saved.');
$edit['pathauto_max_length'] = '50';
$edit['pathauto_max_component_length'] = '50';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The configuration options have been saved.');
}
function testPatternsValidation() {
$edit = array();
$edit['pathauto_node_pattern'] = '[title-raw]/[user-created-small]/[cat]/[term]';
$edit['pathauto_node_page_pattern'] = 'page';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The Default path pattern (applies to all node types with blank patterns below) is using the following invalid tokens: [user-created-small], [cat].');
$this->assertText('The Pattern for all Page paths should contain at least one token to ensure unique URL aliases are created.');
$this->assertNoText('The configuration options have been saved.');
$edit['pathauto_node_pattern'] = '[title-raw]';
$edit['pathauto_node_page_pattern'] = 'page/[title-raw]';
$edit['pathauto_node_story_pattern'] = '';
$this->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
$this->assertText('The configuration options have been saved.');
}
}
class PathautoLocaleTestCase extends PathautoFunctionalTestHelper {
public static function getInfo() {
return array(
'name' => 'Pathauto localization tests',
'description' => 'Test pathauto functionality with localization and translation.',
'group' => 'Pathauto',
'dependencies' => array('token'),
);
}
function setUp(array $modules = array()) {
$modules[] = 'locale';
$modules[] = 'translation';
parent::setUp($modules, array('administer languages'));
// Add predefined French language and reset the locale cache.
require_once './includes/locale.inc';
locale_add_language('fr', NULL, NULL, LANGUAGE_LTR, '', 'fr');
language_list('language', TRUE);
drupal_init_language();
}
/**
* Test that when an English node is updated, its old English alias is
* updated and its newer French alias is left intact.
*/
function testLanguageAliases() {
$node = array(
'title' => 'English node',
'language' => 'en',
'path' => 'english-node',
'pathauto_perform_alias' => FALSE,
);
$node = $this->drupalCreateNode($node);
$english_alias = $this->path_load(array('alias' => 'english-node'));
$this->assertTrue($english_alias, 'Alias created with proper language.');
// Also save a French alias that should not be left alone, even though
// it is the newer alias.
$this->saveEntityAlias('node', $node, 'french-node', 'fr');
// Add an alias with the soon-to-be generated alias, causing the upcoming
// alias update to generate a unique alias with the '-0' suffix.
$this->saveAlias('node/invalid', 'content/english-node', '');
// Update the node, triggering a change in the English alias.
$node->pathauto_perform_alias = TRUE;
pathauto_nodeapi($node, 'update');
// Check that the new English alias replaced the old one.
$this->assertEntityAlias('node', $node, 'content/english-node-0', 'en');
$this->assertEntityAlias('node', $node, 'french-node', 'fr');
$this->assertAliasExists(array('pid' => $english_alias['pid'], 'alias' => 'content/english-node-0'));
}
}
/*
* Unit tests for the book tokens provided by Pathauto.
*/
class PathautoBookTokenTestCase extends PathautoTestHelper {
public static function getInfo() {
return array(
'name' => 'Pathauto book tokens',
'description' => 'Unit tests for the book tokens provided by Pathauto.',
'group' => 'Pathauto',
'dependencies' => array('token'),
);
}
function setUp(array $modules = array()) {
$modules[] = 'book';
parent::setUp($modules);
variable_set('book_allowed_types', array('book', 'page'));
variable_set('pathauto_node_book_pattern', '[bookpathalias]/[title-raw]');
}
function testBookPathAlias() {
// Add a non-book node.
$non_book_node = $this->drupalCreateNode(array('type' => 'book'));
$this->assertToken('node', $non_book_node, 'bookpathalias', '');
// Add a root book page.
$parent_node = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Root',
'book' => array('bid' => 'new') + _book_link_defaults('new'),
));
$tokens = array(
'bookpathalias' => '',
);
$this->assertTokens('node', $parent_node, $tokens);
// Add a first child page.
$child_node1 = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Sub page1',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $parent_node->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'bookpathalias' => 'root',
);
$this->assertTokens('node', $child_node1, $tokens);
// Add a second child page.
$child_node2 = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Sub page2',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $parent_node->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'bookpathalias' => 'root',
);
$this->assertTokens('node', $child_node2, $tokens);
// Add a child page on an existing child page.
$sub_child_node1 = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Sub-sub Page1',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $child_node1->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'bookpathalias' => 'root/sub-page1',
);
$this->assertTokens('node', $sub_child_node1, $tokens);
// Test that path tokens should not be altered.
$this->saveEntityAlias('node', $child_node1, 'My Crazy/Alias/');
pathauto_nodeapi($sub_child_node1, 'update');
$this->assertEntityAlias('node', $sub_child_node1, 'My Crazy/Alias/sub-sub-page1');
}
}
/*
* Unit tests for the taxonomy tokens provided by Pathauto.
*/
class PathautoTaxonomyTokenTestCase extends PathautoFunctionalTestHelper {
protected $vocab;
public static function getInfo() {
return array(
'name' => 'Pathauto taxonomy tokens',
'description' => 'Unit tests for the taxonomy tokens provided by Pathauto.',
'group' => 'Pathauto',
'dependencies' => array('token'),
);
}
function setUp(array $modules = array()) {
$modules[] = 'taxonomy';
parent::setUp($modules);
variable_set('pathauto_taxonomy_pattern', 'category/[vocab-raw]/[cat-raw]');
// Reset the static taxonomy.module caches.
taxonomy_vocabulary_load(0, TRUE);
taxonomy_get_term(0, TRUE);
$this->vocab = $this->addVocabulary();
}
/**
* Test the [catpath] and [catalias] tokens.
*/
function testCatTokens() {
$term1 = $this->addTerm($this->vocab);
$tokens = array(
'catpath' => $term1->name,
'catalias' => "category/{$this->vocab->name}/{$term1->name}",
);
$this->assertTokens('taxonomy', $term1, $tokens);
// Change the term name to check that the alias is also changed.
// Regression test for http://drupal.org/node/822174.
$term1->oldname = $term1->name;
$term1->name = drupal_strtolower($this->randomName());
$form_values = (array) $term1;
taxonomy_save_term($form_values);
$tokens = array(
'catpath' => $term1->name,
);
$this->assertTokens('taxonomy', $term1, $tokens);
$term2 = $this->addTerm($this->vocab, array('parent' => $term1->tid));
$tokens = array(
'catpath' => "{$term1->name}/{$term2->name}",
'catalias' => "category/{$this->vocab->name}/{$term2->name}",
);
$this->assertTokens('taxonomy', $term2, $tokens);
$term3 = $this->addTerm($this->vocab, array('parent' => $term2->tid, 'name' => ' foo/bar fer|zle '));
$tokens = array(
'catpath' => "{$term1->name}/{$term2->name}/foobar-ferzle",
'catalias' => "category/{$this->vocab->name}/foobar-ferzle",
);
$this->assertTokens('taxonomy', $term3, $tokens);
}
/**
* Test the [termpath] token.
*/
function testTermTokens() {
$term1 = $this->addTerm($this->vocab, array('weight' => 5));
$term2 = $this->addTerm($this->vocab, array('weight' => -5));
$term3 = $this->addTerm($this->vocab, array('weight' => 0));
$node = $this->drupalCreateNode(array(
'type' => 'story',
'taxonomy' => array($term1->tid, $term2->tid, $term3->tid),
));
$tokens = array(
'termpath' => $term2->name,
'termalias' => "category/{$this->vocab->name}/{$term2->name}",
);
$this->assertTokens('node', $node, $tokens);
$this->assertToken('node', $node, 'termpath', $term2->name);
$this->assertToken('node', $node, 'termalias', "category/{$this->vocab->name}/{$term2->name}");
$non_term_node = $this->drupalCreateNode(array('type' => 'story'));
$tokens = array(
'termpath' => '',
'termalias' => '',
);
$this->assertTokens('node', $non_term_node, $tokens);
}
}

View file

@ -1,28 +0,0 @@
All necessary code is included with the module. The hashing functionality is
backported as the include file from Drupal 7 with minor changes.
This module requires PHP 5.2.4 as a minimum version (the same as Drupal 7).
During installation all existing user passwords will be converted to the
more secure form. This is a lengthy process. Using drush expect a
conversion time on the order of 3-5 minutes per 10,000 users. Using
the modules page, a batch process will run and will take at least as long.
Once you have installed this module, all password hashes will be converted.
You will not be able to disable or uninstall it except via upgrading to
Drupal 7. Test this on your developent copy of your site first. You have
been warned.
Note the enable hook tries to convert all existing user passwords. If you have more
than a thousand users a batch job will start when the module is enabled if enabled
via the modules page. If enabled via drush or with <= 1000 users, no batching
wiil be performed. You may need to increase the allowed PHP memory if enabling
via drush for very large numbers of users.
Please test everything on your development copy of the site first!
A core patch is also included with the module as user_load.D6.patch
This patch is not needed for typical sites, but may be required for
certain contrib modules that perform user registration with an external
service or manipulate the user registration flow.

View file

@ -1,5 +0,0 @@
This module was created by Matt Westgate <drupal at asitis dot org>
Maintained up to version 4.6 by Karsten Mueller <kmue at mac dot com>
Maintained up to version 4.7 by Peter John Hartman <peterjohnhartman at gmail.com>
Some bug fixes by David Kent Norman on Dec 20, 2005 <deekayen at: deekayen {dot} net>
and is currently maintained by Joao Ventura <joao at venturas dot org>.

View file

@ -1,94 +0,0 @@
INSTALLATION
------------
Decompress the print-n.x-n.n.tar.gz file into your Drupal modules
directory.
Enable the print module: Administer > Site building > Modules
(admin/build/modules)
PDF TOOL
--------
The print_pdf module requires the use of an external PDF generation tool.
The currently supported tools are dompdf, TCPDF and wkhtmltopdf. Please
note that any errors/bugs in those tools need to be reported and fixed by
their maintainers. DO NOT report bugs in those tools in the print module's
issue queue at Drupal.org.
supported paths:
* print module lib directory (usually modules/print/lib)
* libraries directory (libraries)
dompdf support:
The dompdf tool produces results that are more faithful to the HTML
printer-friendly page. Unicode is not supported (only ISO-8859-1).
This tool is not supported and there are several known bugs that result
from its incomplete implementation.
1. Download dompdf from http://code.google.com/p/dompdf/downloads/list
2. Extract the contents of the downloaded package into one of the
supported paths.
3. Check if dompdf_config.inc.php fits your installation. In 99% of cases,
no changes are necessary, so just try to use it and only edit anything if
the PDF generation fails.
4. Grant write access to the lib/fonts directory to your webserver user.
5. If you're using dompdf-0.5.1, delete the dompdf.php file as it contains
a security vulnerability
6. If you're using dompdf-0.6 or later, you can try to enable the Unicode
support, but you'll need to add some Unicode fonts. See
http://groups.google.com/group/dompdf/browse_thread/thread/9f7bc0162b04d5cf
for further info on this.
7. Check http://code.google.com/p/dompdf/ for further information.
TCPDF support:
TCPDF seems to be more actively developed than dompdf, but it's support
for CSS is considerably worse. Unicode is supported (use of Unicode fonts
result in HUGE files). Page header and footer are supported. This module
requires TCPDF >= 4.0.000.
1. Download TCPDF from http://sourceforge.net/projects/tcpdf/
2. Extract the contents of the downloaded package into one of the
supported paths. There is no need to modify the config/tcpdf_config.php
file, as the module self-configures TCPDF.
3. Grant write access to the cache and images directories to your
webserver user.
4. Check http://tcpdf.sourceforge.net/ for further information.
wkhtmltopdf support:
1. Download wkhtmltopdf from
http://code.google.com/p/wkhtmltopdf/downloads/list. You can choose to
download the source and compile it or simply download the static binary,
which doesn't require you to compile anything. Note that the compiled
version may require a running X server (static uses patched libs that can
work without one).
2. Place the wkhtmltopdf executable into one of the supported paths.
(usually libraries). You can also place a symbolic link to the executable.
3. Check http://code.google.com/p/wkhtmltopdf/ for further information.
UPDATE
------
When updating from a previous version, just remove the print directory and
follow the instructions above. Make sure that you backup any costumization
to the print.tpl.php and print.css files.
ROBOTS
------
Even though it is possible to set per-page robots settings, the following
can be placed in your robots.txt file after the User-agent line to prevent
search engines from even asking for the page:
Disallow: /print/
Also, for updates from older versions (<=4.7.x-1.0 and <=5.x-1.2) which used
node/nnn/print instead of print/nnn, the following lines can prevent
requests from Google for the obsolete print URLs:
Disallow: /*/print$
Note that pattern matching in robots.txt is a Google extension (see
http://www.google.com/support/webmasters/bin/answer.py?answer=40367 for more
information).

View file

@ -1,3 +0,0 @@
PRINT MODULE
M: Joao Ventura <joao at venturas dot org>
S: maintained

View file

@ -1,5 +0,0 @@
Instead of placing the downloaded external libs (such as TCPDF, dompdf,
etc.) used by the print module here, you should place them in libraries.
This directory is still a valid location for them, however. The Libraries
API module library path is also valid.

View file

@ -1,22 +0,0 @@
1. Running secure pages on the Nginx web server. See http://drupal.org/node/390450#comment-1420518
The text from this reference below.
----8<----
If you are on Nginx, Then add the little code in your Nginx conf file.
fastcgi_param HTTPS on;
Here is all the code in my host conf at the php section.
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
fastcgi_param HTTPS on;
}
Reload your nginx server, then you may get the enable box active.
----8<----

View file

@ -1,386 +0,0 @@
<?php
/**
* @file
* Provides SimpleTests for Secure Pages module.
*/
class SecurePagesTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Secure Pages',
'description' => 'Test Secure Pages redirects.',
'group' => 'Secure Pages',
);
}
function setUp() {
parent::setUp('securepages', 'comment', 'path', 'locale');
variable_set('https', TRUE);
variable_set('securepages_enable', TRUE);
variable_set('comment_form_location_story', COMMENT_FORM_BELOW);
variable_set('comment_preview_story', COMMENT_PREVIEW_OPTIONAL);
}
/**
* Runs all the test functions. These are run from a single outer function to avoid
* multiple re-installs by simpletest.
*/
function testSecurePages() {
$this->_testSettingsForm();
$this->_testMatch();
$this->_testLocale();
$this->_testAnonymous();
$this->_testFormAlter();
$this->_testCachedResponse();
$this->_testPathAlias();
$this->_testOpenRedirect();
$this->_testXHR();
$this->_testRoles();
$this->_testPathNorms();
}
/**
* Test submitting the settings form
*/
function _testSettingsForm() {
// Undo the setUp() function.
variable_del('securepages_enable');
// Enable securepages.
$this->web_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages'));
$this->loginHTTPS($this->web_user);
$edit = array('securepages_enable' => 1);
$this->drupalPost($this->_toHTTPS(url('admin/build/securepages', array('absolute' => TRUE))), $edit, t('Save configuration'));
$this->assertRaw(t('The configuration options have been saved.'));
$this->drupalLogout();
}
/**
* Tests the securepages_match() function.
*/
function _testMatch() {
variable_set('securepages_ignore', '*/autocomplete/*');
$this->assertTrue(securepages_match('user'), 'path user matches.');
$this->assertTrue(securepages_match('user/login'), 'path user/login matches.');
$this->assertTrue(securepages_match('admin/modules'), 'path admin/modules matches.');
$this->assertFalse(securepages_match('node'), 'path node does not match.');
$this->assertTrue(securepages_match('user/autocomplete/alice') == securepages_is_secure() ? 1 : 0, 'autocomplete path is ignored.');
// Clean up
variable_del('securepages_ignore');
}
/**
* Tests correct operation with locale module.
*/
function _testLocale() {
// Enable "Switch back to http pages when there are no matches".
variable_set('securepages_switch', TRUE);
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
$this->drupalLogin($admin_user);
// Add predefined language.
$edit = array(
'langcode' => 'fr',
);
$this->drupalPost('admin/settings/language/add', $edit, t('Add language'));
$this->assertText('fr', t('has been created and can now be used'));
// Enable URL language detection and selection.
$edit = array('language_negotiation' => '1');
$this->drupalPost('admin/settings/language/configure', $edit, t('Save settings'));
$languages = language_list('language');
$lang = $languages['fr'];
$this->drupalGet('user', array('language' => $lang));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('user', array('absolute' => TRUE, 'language' => $lang))));
$this->assertTrue(strstr($this->url, '/fr/'), t('URL contains language prefix.'));
$this->drupalGet($this->_toHTTPS(url('', array('absolute' => TRUE, 'language' => $lang))));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTP(url('', array('absolute' => TRUE, 'language' => $lang))));
// Clean up
variable_del('securepages_switch');
$this->drupalLogout();
}
/**
* Tests for anonymous browsing with securepages.
*/
function _testAnonymous() {
// Visit the home page and /node with plain HTTP.
$this->drupalGet('');
$this->assertResponse(200);
$this->assertUrl(url('', array('absolute' => TRUE)));
$this->drupalGet('node');
$this->assertResponse(200);
$this->assertUrl(url('node', array('absolute' => TRUE)));
// Visit the login page and confirm that browser is redirected to HTTPS.
$this->drupalGet('user');
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('user', array('absolute' => TRUE))));
// Visit the home page and /node with HTTPS and confirm that no redirection happens.
$this->drupalGet($this->_toHTTPS(url('', array('absolute' => TRUE))));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('', array('absolute' => TRUE))));
$this->drupalGet($this->_toHTTPS(url('node', array('absolute' => TRUE))));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('node', array('absolute' => TRUE))));
// Enable "Switch back to http pages when there are no matches".
variable_set('securepages_switch', TRUE);
// Visit the home page and /node with HTTPS and confirm that switch-back happens.
$this->drupalGet($this->_toHTTPS(url('', array('absolute' => TRUE))));
$this->assertResponse(200);
$this->assertUrl(url('', array('absolute' => TRUE)));
$this->drupalGet($this->_toHTTPS(url('node', array('absolute' => TRUE))));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTP(url('', array('absolute' => TRUE))));
// Clean up
variable_del('securepages_pages');
}
/**
* Tests the ability to alter form actions.
*
* Uses the comment form, since it has an #action set.
*/
function _testFormAlter() {
variable_set('securepages_switch', TRUE);
// Enable anonymous user comments.
db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", 'access comments, access content, post comments, post comments without approval', DRUPAL_ANONYMOUS_RID);
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'post comments without approval'));
$node = $this->drupalCreateNode(array('type' => 'story', 'promote' => 1));
foreach (array('anonymous', 'authenticated') as $mode) {
if ($mode == 'authenticated') {
$this->drupalLogin($this->web_user);
}
// Test plain HTTP posting to HTTPS.
variable_set('securepages_pages', "comment/reply/*\nuser*");
$this->drupalGet('node/' . $node->nid);
$this->assertFieldByXPath('//form[@id="comment-form" and starts-with(@action, "https:")]', NULL, "The $mode comment form action is https.");
$comment_body = $this->randomName(8);
$this->drupalPost(NULL, array('comment' => $comment_body), t('Save'));
$this->assertRaw($comment_body);
// Test HTTPS posting to plain HTTP.
variable_set('securepages_pages', "node/*\nuser*");
$this->drupalGet($this->_toHTTPS(url('node/' . $node->nid), array('absolute' => TRUE)));
$this->assertUrl($this->_toHTTPS(url('node/' . $node->nid, array('absolute' => TRUE))));
$this->assertFieldByXPath('//form[@id="comment-form" and starts-with(@action, "http:")]', NULL, "The $mode comment form action is http.");
$comment_body = $this->randomName(8);
$this->drupalPost(NULL, array('comment' => $comment_body), t('Save'));
$this->assertRaw($comment_body);
}
$this->drupalLogout();
// Test the user login block.
$this->drupalGet('');
$edit = array(
'name' => $this->web_user->name,
'pass' => $this->web_user->pass_raw,
);
$this->drupalPost(NULL, $edit, t('Log in'));
$this->drupalGet('user/' . $this->web_user->uid . '/edit');
$this->assertResponse(200);
// Clean up
$this->drupalLogout();
variable_del('securepages_pages');
variable_del('securepages_switch');
}
function _testCachedResponse() {
// Enable the page cache and fetch the login page.
variable_set('cache', TRUE);
$url = url('user/login', array('absolute' => TRUE));
$this->drupalGet($url);
// Short-circuit redirects within the simpletest browser.
variable_set('simpletest_maximum_redirects', 0);
$this->drupalGet($url);
$this->assertResponse(302);
$this->assertEqual($this->drupalGetHeader('Location'), $this->_toHTTPS(url('user/login', array('absolute' => TRUE))));
// $this->assertEqual($this->drupalGetHeader('X-Securepages-Cache'), 'HIT', 'Page was cached.'); @FIXME
// Clean up
variable_del('cache');
variable_del('simpletest_maximum_redirects');
}
/**
* Test redirection on aliased paths.
*/
function _testPathAlias() {
variable_set('securepages_pages', "node/*\nuser*");
// Create test user and login.
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases'));
$this->drupalLogin($web_user);
// Create test node.
$node = $this->drupalCreateNode();
// Create alias.
$edit = array();
$edit['src'] = 'node/' . $node->nid;
$edit['dst'] = $this->randomName(8);
$this->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
// Short-circuit redirects within the simpletest browser.
variable_set('simpletest_maximum_redirects', 0);
$this->drupalGet($edit['dst'], array('absolute' => TRUE));
$this->assertResponse(302);
$this->assertEqual($this->drupalGetHeader('Location'), $this->_toHTTPS(url($edit['dst'], array('absolute' => TRUE))));
// Clean up
variable_del('simpletest_maximum_redirects');
$this->drupalLogout();
variable_del('securepages_pages');
}
/**
* Verifies that securepages is not an open redirect.
*/
function _testOpenRedirect() {
// Short-circuit redirects within the simpletest browser.
variable_set('simpletest_maximum_redirects', 0);
variable_set('securepages_switch', TRUE);
global $base_url, $base_path;
$secure_base_url = str_replace('http', 'https', $base_url);
$this->drupalGet($secure_base_url . $base_path . '?q=http://example.com/', array('external' => TRUE));
$this->assertResponse(302);
$this->assertTrue(strstr($this->drupalGetHeader('Location'), $base_url), t('Open redirect test passed.'));
variable_del('simpletest_maximum_redirects');
$this->drupalGet($secure_base_url . $base_path . '?q=' . urlencode('http://example.com/'), array('external' => TRUE));
$this->assertResponse(404);
// Clean up
variable_del('securepages_switch');
}
/**
* Test detection of XHR requests.
*/
function _testXHR() {
$admin_user = $this->drupalCreateUser(array('access user profiles', 'administer users', 'access administration pages'));
$this->drupalLogin($admin_user);
// Without XHR header
$this->drupalGet($this->_toHTTP(url('user/autocomplete/a', array('absolute' => TRUE))));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('user/autocomplete/a', array('absolute' => TRUE))));
// With XHR header
$this->drupalGet($this->_toHTTP(url('user/autocomplete/a', array('absolute' => TRUE))), array(), array('X-Requested-With: XMLHttpRequest'));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTP(url('user/autocomplete/a', array('absolute' => TRUE))));
// Clean up
$this->drupalLogout();
}
/**
* Test role-based switching.
*/
function _testRoles() {
// Enable securepages.
$this->web_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access comments', 'post comments'));
// Extract the role that was just generated.
$role = $this->web_user->roles;
unset($role[DRUPAL_AUTHENTICATED_RID]);
$role = current(array_keys($role));
$this->loginHTTPS($this->web_user);
$edit = array('securepages_enable' => 1, 'securepages_switch' => 1, "securepages_roles[$role]" => 1);
$this->drupalPost('admin/build/securepages', $edit, t('Save configuration'), array('https' => TRUE));
$this->assertRaw(t('The configuration options have been saved.'));
// Visit the home page and /node with HTTPS and confirm that redirection happens.
$this->drupalGet('', array('https' => FALSE));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('', array('absolute' => TRUE))));
$this->drupalGet($this->_toHTTP(url('node')));
$this->assertResponse(200);
$this->assertUrl($this->_toHTTPS(url('', array('absolute' => TRUE))));
// Test that forms actions aren't switched back to http.
$node = $this->drupalCreateNode(array('type' => 'story', 'promote' => 1));
$this->drupalGet($this->_toHTTPS(url('node/' . $node->nid, array('absolute' => TRUE))));
$this->assertFieldByXPath('//form[@id="comment-form" and starts-with(@action, "/")]', NULL, "The comment form action is https.");
// Clean up
variable_del('securepages_switch');
variable_del('securepages_roles');
$this->drupalLogout();
}
/**
* Test path normalization checks.
*/
function _testPathNorms() {
variable_set('securepages_switch', TRUE);
variable_set('securepages_pages', 'user');
// Test mixed-case path.
$this->drupalGet('UsEr');
$this->assertUrl($this->_toHTTPS(url('UsEr', array('absolute' => TRUE))));
$this->assertFieldByXPath('//form[@id="user-login" and starts-with(@action, "/")]', NULL, 'The user login form action is https.');
// Test that a trailing slash will not force a protected form's action to
// http.
$https_path = $this->_toHTTPS(url('user/', array('absolute' => TRUE)));
// A http based 'user/' path will become 'user' when doing the redirect, so
// best to ensure that the test gets the right conditions the path should be
// https based.
$this->drupalGet($https_path);
$this->assertUrl($https_path);
$this->assertFieldByXPath('//form[@id="user-login" and starts-with(@action, "/")]', NULL, 'The user login form action is https.');
// Clean up.
variable_del('securepages_switch');
variable_del('securepages_pages');
}
/**
* Logs in a user using HTTPS.
*/
function loginHTTPS($user) {
$edit = array(
'name' => $user->name,
'pass' => $user->pass_raw,
);
$this->drupalPost($this->_toHTTPS(url('user', array('absolute' => TRUE))), $edit, t('Log in'));
}
/**
* Helper function, because url() in D6 lacks 'https' => TRUE
*/
function _toHTTPS($url) {
return str_replace('http://', 'https://', $url);
}
/**
* Helper function, because url() in D6 lacks 'https' => FALSE
*/
function _toHTTP($url) {
return str_replace('https://', 'http://', $url);
}
}

View file

@ -1,89 +0,0 @@
<?php
/**
* @file
* Simpletests for securepages_prevent_hijack.
*/
class SecurepagesPreventHijackTestCase extends DrupalWebTestCase {
/**
* Implementation of getInfo().
*/
public static function getInfo() {
return array(
'name' => t('Securepages Hijack Prevention'),
'description' => t('Functional tests for Securepages Hijack Prevention.'),
'group' => t('Securepages Hijack Prevention'),
);
}
/**
* Implementation of setUp().
*/
function setUp() {
parent::setUp('securepages', 'securepages_prevent_hijack');
variable_set('securepages_enable', TRUE);
}
/**
* Make sure the login forms are using an SSL action.
*/
function testSecurepagesPreventHijackLoginAction() {
// Test that form_alter() is disabled when securepages is off.
variable_set('securepages_enable', FALSE);
$this->drupalGet('user/login');
$this->assertNoPattern('/action="https.*id="user-login"/',
t('Make sure login page action is secured.'));
$this->drupalGet('');
$this->assertNoPattern('/action="https.*id="user-login-form"/',
t('Make sure login page action is secured.'));
// Enable securepages and re-test.
variable_set('securepages_enable', TRUE);
$this->drupalGet('user/login');
$this->assertPattern('/action="https.*id="user-login"/',
t('Make sure login page action is secured.'));
$this->drupalGet('');
$this->assertPattern('/action="https.*id="user-login-form"/',
t('Make sure login page action is secured.'));
}
/**
* Test the ability to detect hijacked sessions.
*/
function testSecurepagesPreventHijackDetection() {
$user = $this->drupalCreateUser(array('access content', 'administer nodes'));
$this->drupalLogin($user);
// Check that SSL pages work normally. node/add/* is protected by default in securepages.
$this->drupalGet('node/add/page');
$this->assertResponse(200);
$this->assertIdentical(strpos($this->getUrl(), 'https'), 0, t('Verify node/add/page is secure.'));
// Force the private key to regenerate. This is a sneaky hack to invalidate the secure cookie.
variable_set('drupal_private_key', 0);
$this->drupalGet('node/add/page');
$this->assertResponse(403, t('Make sure hijacked requests are denied.'));
}
/**
* Verify that secure cookie is re-sent after a password change
*/
function testSecurepagesPreventHijackPasswordReset() {
$user = $this->drupalCreateUser(array('access content', 'administer nodes'));
$this->drupalLogin($user);
$url = 'user/'. $user->uid . '/edit';
$edit = array(
'pass[pass1]' => 'secret',
'pass[pass2]' => 'secret',
);
$this->drupalPost($url, $edit, t('Save'));
$this->drupalGet('node/add/page');
// @FIXME - this assertion fails because of this bug: http://drupal.org/node/471970
// $this->assertResponse(200);
}
}

View file

@ -1,48 +0,0 @@
Storm module for Drupal 6.x
INSTALLATION:
1) Copy this 'storm' directory into the modules directory of your Drupal installation.
(Multisite installations may wish to use a different directory - see http://drupal.org/node/53705)
2) Enable Storm (and whatever submodules of Storm that you wish), by visiting http://example.com/admin/build/modules. You will (almost) always need 'Storm', 'Storm Attribute' and 'Storm Organization'.
3) To enable the pdf invoice feature, you must separately install the tcpdf library (http://www.tcpdf.org). The install directory can be set at /admin/settings/storm/invoice. If you do not install the tcpdf library, Storm will still work, but you will not be able to view pdf versions of invoices.
CONFIGURATION:
- Set up permissions: Initially, it is recommended that you allow full access for your administrative role, and allow more once you are familiar with the system.
- There are a number of settings forms linked from http://example.com/admin/settings/storm. After installation, you should visit these pages and
- Storm Attribute: This module gives additional settings for allowed field values, and values you can search for on the lists. In later versions of Storm, this may become part of the standard settings forms.
DISABLING / UNINSTALL:
1) Visit http://example.com/admin/build/modules in your web-browser and deselect the modules that you wish to disable. To uninstall, select the uninstall tab and follow the on screen instructions.
2) Warnings may appear on disabling stating that nodes have not been deleted. This is because several of the Storm modules use the existing Drupal node system to store information. Therefore, on disabling the module, these nodes are not deleted. It is suggested that you may wish to delete these manually by visiting http://example.com/admin/content/node and filtering by the stated content type.
HELP:
- It is understandable that Storm may appear intimidating at first glance due to the number of modules in the package. Do not be afraid!
- You may find this blog entry useful: http://cocoate.com/2009/06/29/project-management-drupal-and-storm
- For general support, you can ask questions on the issues queue on Drupal.org: http://drupal.org/project/issues/storm
FEEDBACK:
- Please feedback on your experiences to make Storm better. This can be done by creating an issue at http://drupal.org/project/issues/storm.
- Were you just trying Storm?
- Did you end up using Storm?
- What did you find difficult?
- What was the make or break factor for you?
- Another way to help others is to blog about how your installation went. This will allow you to post screenshots too.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,75 +0,0 @@
<?php
/**
* @file
* Tests for the SuiteDesk module
*/
class StormTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'SuiteDesk functionality',
'description' => 'Test the functionality of the SuiteDesk base module',
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('dashboard');
}
public function testStormAccess() {
$this->drupalGet('dashboard');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk dashboard for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('dashboard');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk dashboard for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm: access dashboard'));
$this->drupalLogin($privileged_user);
$this->drupalGet('dashboard');
$this->assertText(t('SuiteDesk dashboard'), t('Make sure the correct page has been displayed by checking that the title is "SuiteDesk dashboard".'));
}
public function testStormAccessSettings() {
$this->drupalGet('admin/settings/storm');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for anonymous user'));
$this->drupalGet('admin/settings/suitedesk/suitedesk');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('admin/settings/storm');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for basic user'));
$this->drupalGet('admin/settings/suitedesk/suitedesk');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm: access administration pages'));
$this->drupalLogin($privileged_user);
$this->drupalGet('admin/settings/storm');
$this->assertText(t('SuiteDesk'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "SuiteDesk".'));
$this->drupalGet('admin/settings/suitedesk/suitedesk');
$this->assertText(t('SuiteDesk'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "SuiteDesk".'));
}
public function testStormAttributesAccess() {
$this->drupalGet('attributes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes list for anonymous user'));
$this->drupalGet('attributes/add');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes form for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('attributes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes list for basic user'));
$this->drupalGet('attributes/add');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes form for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm: access administration pages'));
$this->drupalLogin($privileged_user);
$this->drupalGet('attributes');
$this->assertText(t('Attributes'), t('Make sure the correct page has been displayed by checking that the title is "Attributes".'));
$this->drupalGet('attributes/add');
$this->assertText(t('Add a new attribute'), t('Make sure the correct page has been displayed by checking that the title is "Add a new attribute".'));
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk dok module
*/
class StormdokTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Dok Functionality'),
'description' => t('Test the functionality of the SuiteDesk Dok module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormdok', 'stormperson');
}
public function testStormdokAccess() {
$this->drupalGet('doks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Doks list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('doks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Doks list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm dok: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('doks');
$this->assertText(t('Doks'), t('Make sure the correct page has been displayed by checking that the title is "Doks".'));
}
public function testStormdokCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm dok: add', 'Storm dok: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$dok = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormdok', $dok, t('Save'));
$this->assertText(t('Dok @title has been created.', array('@title' => $dok['title'])));;
}
public function testStormdokList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view all', 'Storm dok: edit all', 'Storm dok: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view of user organization', 'Storm dok: edit of user organization', 'Storm dok: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view own', 'Storm dok: edit own', 'Storm dok: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view all', 'Storm dok: edit own', 'Storm dok: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create doks
$dok1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormdok', $dok1, t('Save'));
$dok1 = node_load(array('title' => $dok1['title']));
$this->drupalLogin($userOwn);
$dok2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormdok', $dok2, t('Save'));
$dok2 = node_load(array('title' => $dok2['title']));
$this->drupalLogin($userViewAllEditOwn);
$dok3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormdok', $dok3, t('Save'));
$dok3 = node_load(array('title' => $dok3['title']));
// Test for 'Storm dok: view all'
$this->drupalLogin($userAll);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok3->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon appears on the list');
// Test for 'Storm dok: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertNoLink($dok3->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon does not appear on the list');
// Test for 'Storm dok: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('doks');
$this->assertNoLink($dok1->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon does not appear on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertNoLink($dok3->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon does not appear on the list');
// Test for 'Storm dok: view all', 'Storm dok: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/delete', 'The Dok edit icon does not appear on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertNoRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon does not appear on the list');
$this->assertLink($dok3->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon appears on the list');
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk event module
*/
class StormeventTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk event Functionality'),
'description' => t('Test the functionality of the SuiteDesk event module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormevent', 'stormperson');
}
public function testStormeventAccess() {
$this->drupalGet('events');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk events list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('events');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk events list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm event: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('events');
$this->assertText(t('events'), t('Make sure the correct page has been displayed by checking that the title is "events".'));
}
public function testStormeventCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm event: add', 'Storm event: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$event = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormevent', $event, t('Save'));
$this->assertText(t('event @title has been created.', array('@title' => $event['title'])));;
}
public function testStormeventList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view all', 'Storm event: edit all', 'Storm event: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view of user organization', 'Storm event: edit of user organization', 'Storm event: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view own', 'Storm event: edit own', 'Storm event: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view all', 'Storm event: edit own', 'Storm event: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create events
$event1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormevent', $event1, t('Save'));
$event1 = node_load(array('title' => $event1['title']));
$this->drupalLogin($userOwn);
$event2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormevent', $event2, t('Save'));
$event2 = node_load(array('title' => $event2['title']));
$this->drupalLogin($userViewAllEditOwn);
$event3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormevent', $event3, t('Save'));
$event3 = node_load(array('title' => $event3['title']));
// Test for 'Storm event: view all'
$this->drupalLogin($userAll);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event1->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event1->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event3->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event3->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event3->nid .'/delete', 'The event delete icon appears on the list');
// Test for 'Storm event: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event1->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event1->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertNoLink($event3->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/delete', 'The event delete icon does not appear on the list');
// Test for 'Storm event: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('events');
$this->assertNoLink($event1->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/delete', 'The event delete icon does not appear on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertNoLink($event3->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/delete', 'The event delete icon does not appear on the list');
// Test for 'Storm event: view all', 'Storm event: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertNoRaw('node/'. $event1->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/delete', 'The event edit icon does not appear on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertNoRaw('node/'. $event2->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event2->nid .'/delete', 'The event delete icon does not appear on the list');
$this->assertLink($event3->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event3->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event3->nid .'/delete', 'The event delete icon appears on the list');
}
}

View file

@ -1,191 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk expense module
*/
class StormexpenseTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Expense Functionality'),
'description' => t('Test the functionality of the SuiteDesk Expense module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormexpense', 'stormperson');
}
public function testStormexpenseAccess() {
$this->drupalGet('expenses');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Expense list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('expenses');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Expense list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm expense: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('expenses');
$this->assertText(t('Expenses'), t('Make sure the correct page has been displayed by checking that the title is "Expenses".'));
}
public function testStormexpenseCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: add', 'Storm expense: view all', 'Storm project: view all', 'Storm task: view all'));
$this->drupalLogin($user);
// Create a team
$org = array(
'title' => $this->randomName(32),
);
$expense = array(
'organization_nid' => '1',
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormexpense', $expense, t('Save'));
$this->assertText(t('Expense @title has been created.', array('@title' => $expense['title'])));
}
public function testStormexpenseReports() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm expense: access'));
$this->drupalLogin($user);
// Create a team
$this->drupalGet('expenses/report/std/en');
}
public function testStormexpenseList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit all', 'Storm expense: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view of user organization', 'Storm expense: edit of user organization', 'Storm expense: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view own', 'Storm expense: edit own', 'Storm expense: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit own', 'Storm expense: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create expenses
$exp1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormexpense', $exp1, t('Save'));
$exp1 = node_load(array('title' => $exp1['title']));
$this->drupalLogin($userOwn);
$exp2 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormexpense', $exp2, t('Save'));
$exp2 = node_load(array('title' => $exp2['title']));
$this->drupalLogin($userViewAllEditOwn);
$exp3 = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormexpense', $exp3, t('Save'));
$exp3 = node_load(array('title' => $exp3['title']));
// Test for 'Storm expense: view all'
$this->drupalLogin($userAll);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp3->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon appears on the list');
// Test for 'Storm expense: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertNoLink($exp3->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon does not appear on the list');
// Test for 'Storm expense: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('expenses');
$this->assertNoLink($exp1->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertNoLink($exp3->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon does not appear on the list');
// Test for 'Storm expense: view all', 'Storm expense: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertNoRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp3->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon appears on the list');
}
}

View file

@ -1,225 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Invoice module.
*/
class StorminvoiceTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Invoice Functionality'),
'description' => t('Test the functionality of the SuiteDesk Invoice module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'storminvoice', 'stormperson');
}
public function testStorminvoiceAccess() {
$this->drupalGet('invoices');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Invoices list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('invoices');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Invoices list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm invoice: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('invoices');
$this->assertText(t('Invoices'), t('Make sure the correct page has been displayed by checking that the title is "Invoices".'));
}
public function testStorminvoiceCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: add', 'Storm invoice: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$inv = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
'items_0_description' => $this->randomName(32),
'items_0_amount' => '.28',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '5',
'items_0_tax2app' => '2',
'items_0_tax2percent' => '7.5',
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/storminvoice', $inv, t('Save'));
$this->assertText(t('Invoice @title has been created.', array('@title' => $inv['title'])));
}
public function testStorminvoiceList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit all', 'Storm invoice: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view of user organization', 'Storm invoice: edit of user organization', 'Storm invoice: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view own', 'Storm invoice: edit own', 'Storm invoice: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit own', 'Storm invoice: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create invoices
$inv1 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '100.0',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '20',
'items_0_tax2app' => '2',
'items_0_tax2percent' => '10',
);
// tax1: 20; tax2: 12; total: 132
$this->drupalPost('node/add/storminvoice', $inv1, t('Save'));
$inv1 = node_load(array('title' => $inv1['title']));
$this->drupalLogin($userOwn);
$inv2 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '200',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '20',
'items_0_tax2app' => '0',
'items_0_tax2percent' => '10',
);
// tax1: 40; tax2: 0; total: 240
$this->drupalPost('node/add/storminvoice', $inv2, t('Save'));
$inv2 = node_load(array('title' => $inv2['title']));
$this->drupalLogin($userViewAllEditOwn);
$inv3 = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '42,42',
'items_0_tax1app' => '0',
'items_0_tax1percent' => '5',
'items_0_tax2app' => '0',
'items_0_tax2percent' => '7.5',
);
// tax1: 0, tax2: 0; total: 42.42
$this->drupalPost('node/add/storminvoice', $inv3, t('Save'));
$inv3 = node_load(array('title' => $inv3['title']));
// Test for 'Storm invoice: view all'
$this->drupalLogin($userAll);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertRaw('342.42', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('414.42', 'Total sum correct.');
// Test for 'Storm invoice: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertNoLink($inv3->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertRaw('300.00', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('372.00', 'Total sum correct.');
// Test for 'Storm invoice: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('invoices');
$this->assertNoLink($inv1->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertNoLink($inv3->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertRaw('200.00', 'Total amount is correct.');
$this->assertRaw('40.00', 'Total Tax1 is correct.');
$this->assertRaw('0.00', 'Total Tax2 is correct.');
$this->assertRaw('240.00', 'Total sum correct.');
// Test for 'Storm invoice: view all', 'Storm invoice: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertNoRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertRaw('342.42', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('414.42', 'Total sum correct.');
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk note module
*/
class StormnoteTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Note Functionality'),
'description' => t('Test the functionality of the SuiteDesk Note module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormnote', 'stormperson');
}
public function testStormnoteAccess() {
$this->drupalGet('notes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Notes list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('notes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Notes list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm note: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('notes');
$this->assertText(t('Notes'), t('Make sure the correct page has been displayed by checking that the title is "Notes".'));
}
public function testStormnoteCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm note: add', 'Storm note: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$note = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormnote', $note, t('Save'));
$this->assertText(t('Note @title has been created.', array('@title' => $note['title'])));;
}
public function testStormnoteList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit all', 'Storm note: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view of user organization', 'Storm note: edit of user organization', 'Storm note: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view own', 'Storm note: edit own', 'Storm note: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit own', 'Storm note: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create notes
$note1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormnote', $note1, t('Save'));
$note1 = node_load(array('title' => $note1['title']));
$this->drupalLogin($userOwn);
$note2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormnote', $note2, t('Save'));
$note2 = node_load(array('title' => $note2['title']));
$this->drupalLogin($userViewAllEditOwn);
$note3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormnote', $note3, t('Save'));
$note3 = node_load(array('title' => $note3['title']));
// Test for 'Storm note: view all'
$this->drupalLogin($userAll);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note1->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note1->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note3->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note3->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note3->nid .'/delete', 'The Note delete icon appears on the list');
// Test for 'Storm note: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note1->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note1->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertNoLink($note3->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/delete', 'The Note delete icon does not appear on the list');
// Test for 'Storm note: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('notes');
$this->assertNoLink($note1->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/delete', 'The Note delete icon does not appear on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertNoLink($note3->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/delete', 'The Note delete icon does not appear on the list');
// Test for 'Storm note: view all', 'Storm note: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertNoRaw('node/'. $note1->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/delete', 'The Note edit icon does not appear on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertNoRaw('node/'. $note2->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note2->nid .'/delete', 'The Note delete icon does not appear on the list');
$this->assertLink($note3->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note3->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note3->nid .'/delete', 'The Note delete icon appears on the list');
}
}

View file

@ -1,156 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk organization module
*/
class StormorganizationTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'SuiteDesk Organization functionality',
'description' => 'Test the functionality of the SuiteDesk Organization module',
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson');
$privileged_user = $this->drupalCreateUser(array('Storm organization: add'));
$this->drupalLogin($privileged_user);
}
public function testStormorganizationAccess() {
$this->drupalGet('organizations');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Organizations list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('organizations');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Organizations list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm organization: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('organizations');
$this->assertText(t('Organizations'), t('Make sure the correct page has been displayed by checking that the title is "Organizations".'));
}
public function testStormorganizationCreate() {
$edit = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $edit, t('Save'));
$this->assertText(t('Organization @title has been created.', array('@title' => $edit['title'])));
}
public function testStormorganizationList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit all', 'Storm organization: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view belonged', 'Storm organization: edit belonged'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view own', 'Storm organization: edit own', 'Storm organization: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit own', 'Storm organization: delete own'));
$this->drupalLogin($userAll);
// Create organization
$organization1 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization1, t('Save'));
$organization1 = node_load(array('title' => $organization1['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $organization1->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create organization
$this->drupalLogin($userOwn);
$organization2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization2, t('Save'));
$organization2 = node_load(array('title' => $organization2['title']));
$this->drupalLogin($userViewAllEditOwn);
$organization3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization3, t('Save'));
$organization3 = node_load(array('title' => $organization3['title']));
// Test for 'Storm organization: view all'
$this->drupalLogin($userAll);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertLink($organization3->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon appears on the list');
// Test for 'Storm organization: view belonged'
$this->drupalLogin($userOrg);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertNoLink($organization2->title, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertNoLink($organization3->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon does not appear on the list');
// Test for 'Storm organization: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('organizations');
$this->assertNoLink($organization1->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertNoLink($organization3->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon does not appear on the list');
// Test for 'Storm organization: view all', 'Storm organization: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization3->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon appears on the list');
}
}

View file

@ -1,224 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Person module.
*/
class StormpersonTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'SuiteDesk Person functionality',
'description' => 'Test the functionality of the SuiteDesk Person module',
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson');
$privileged_user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: add'));
$this->drupalLogin($privileged_user);
}
public function testStormpersonAccess() {
$this->drupalGet('people');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk People list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('people');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk People list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm person: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('people');
$this->assertText(t('People'), t('Make sure the correct page has been displayed by checking that the title is "People".'));
}
public function testStormpersonCreate() {
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$person = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormperson', $person, t('Save'));
$this->assertText(t('Person @title has been created.', array('@title' => $person['title'])));
}
public function testStormpersonList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit all', 'Storm person: delete all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view of user organization', 'Storm person: edit of user organization', 'Storm person: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view own', 'Storm person: edit own', 'Storm person: delete own'));
$userLinked = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view when linked to own user account', 'Storm person: edit when linked to own user account', 'Storm person: delete when linked to own user account'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit own', 'Storm person: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create persons
$person1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormperson', $person1, t('Save'));
$person1 = node_load(array('title' => $person1['title']));
$person4 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'user_name' => $userLinked->name,
);
$this->drupalPost('node/add/stormperson', $person4, t('Save'));
$person4 = node_load(array('title' => $person4['title']));
$this->drupalLogin($userOwn);
$person2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormperson', $person2, t('Save'));
$person2 = node_load(array('title' => $person2['title']));
$this->drupalLogin($userViewAllEditOwn);
$person3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormperson', $person3, t('Save'));
$person3 = node_load(array('title' => $person3['title']));
// Test for 'Storm person: view all'
$this->drupalLogin($userAll);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person1->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person1->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person3->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person3->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person3->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon appears on the list');
// Test for 'Storm person: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person1->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person1->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon appears on the list');
// Test for 'Storm person: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('people');
$this->assertNoLink($person1->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person4->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
// Test for 'Storm person: view all', 'Storm invoice: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person2->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person3->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person3->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person3->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
// Test for 'Storm person: view when linked to own user account'
$this->drupalLogin($userLinked);
$this->drupalGet('people');
$this->assertNoLink($person1->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person2->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
}
}

View file

@ -1,376 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Project module
*/
class StormprojectTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Project Functionality'),
'description' => t('Test the functionality of the SuiteDesk Project module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormperson', 'stormteam');
}
public function testStormprojectAccess() {
$this->drupalGet('projects');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('projects');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm project: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('projects');
$this->assertText(t('Projects'), t('Make sure the correct page has been displayed by checking that the title is "Projects".'));
}
public function testStormprojectCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->assertText(t('Project @title has been created.', array('@title' => $prj['title'])));;
}
public function testStormprojectList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit all', 'Storm project: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view of user organization', 'Storm project: edit of user organization', 'Storm project: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view own', 'Storm project: edit own', 'Storm project: delete own'));
$userManager = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if project manager', 'Storm project: edit if project manager', 'Storm project: delete if project manager'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit own', 'Storm project: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userManager->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$manager = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project
$project1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormproject', $project1, t('Save'));
$project1 = node_load(array('title' => $project1['title']));
$projectManager = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'manager_nid' => $manager->nid,
);
$this->drupalPost('node/add/stormproject', $projectManager, t('Save'));
$projectManager = node_load(array('title' => $projectManager['title']));
$projectAssigned = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormproject', $projectAssigned, t('Save'));
$projectAssigned = node_load(array('title' => $projectAssigned['title']));
$projectAssignedTeam = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $projectAssignedTeam, t('Save'));
$projectAssignedTeam = node_load(array('title' => $projectAssignedTeam['title']));
$this->drupalLogin($userOwn);
$project2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $project2, t('Save'));
$project2 = node_load(array('title' => $project2['title']));
$this->drupalLogin($userViewAllEditOwn);
$project3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormproject', $project3, t('Save'));
$project3 = node_load(array('title' => $project3['title']));
// Test for 'Storm project: view all'
$this->drupalLogin($userAll);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project3->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
// Test for 'Storm project: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($project3->title, 0, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
// Test for 'Storm project: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view all', 'Storm project: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project3->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if project manager'
$this->drupalLogin($userManager);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if assigned to project'
$this->drupalLogin($userAssigned);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if assigned to project' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
}
}

View file

@ -1,338 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Task module
*/
class StormtaskTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Task Functionality'),
'description' => t('Test the functionality of the SuiteDesk Task module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormperson', 'stormteam');
}
public function testStormtaskAccess() {
$this->drupalGet('tasks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tasks list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('tasks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tasks list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm task: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('tasks');
$this->assertText(t('Tasks'), t('Make sure the correct page has been displayed by checking that the title is "Tasks".'));
}
public function testStormtaskCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->assertText(t('Task @title has been created.', array('@title' => $task['title'])));;
}
public function testStormtaskList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit all', 'Storm task: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view of user organization', 'Storm task: edit of user organization', 'Storm task: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view own', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project foreach organization
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectTeam = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg2 = node_load(array('title' => $prj['title']));
// Create tasks
$task1 = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormtask', $task1, t('Save'), array('query' => 'organization_nid='.$org->nid));
$task1 = node_load(array('title' => $task1['title']));
$taskAssigned = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormtask', $taskAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
$taskAssigned = node_load(array('title' => $taskAssigned['title']));
$taskAssignedTeam = array(
'organization_nid' => $org->nid,
'project_nid' => $projectTeam->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormtask', $taskAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
$taskAssignedTeam = node_load(array('title' => $taskAssignedTeam['title']));
$this->drupalLogin($userOwn);
$task2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
);
$this->drupalPost('node/add/stormtask', $task2, t('Save'), array('query' => 'organization_nid='.$org->nid));
$task2 = node_load(array('title' => $task2['title']));
$this->drupalLogin($userViewAllEditOwn);
$task3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
'project_nid' => $projectOrg2->nid,
);
$this->drupalPost('node/add/stormtask', $task3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
$task3 = node_load(array('title' => $task3['title']));
// Test for 'Storm task: view all'
$this->drupalLogin($userAll);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task1->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task1->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task3->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task3->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task3->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
// Test for 'Storm task: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task1->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task1->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
// Test for 'Storm task: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssigned->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssignedTeam->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view all', 'Storm task: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task edit icon does not appear on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($task3->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task3->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task3->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view if assigned to task'
$this->drupalLogin($userAssigned);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task2->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($taskAssignedTeam->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view if assigned to task' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task2->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssigned->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
}
}

View file

@ -1,157 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Team module.
*/
class StormteamTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Team Functionality'),
'description' => t('Test the functionality of the SuiteDesk Team module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson', 'stormteam');
}
public function testStormteamCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm team: add', 'Storm team: view all', 'Storm person: add', 'Storm person: view all'));
$this->drupalLogin($user);
// Create a team
$team = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$this->assertText(t('Team @title has been created.', array('@title' => $team['title'])));;
}
public function testStormteamList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit all', 'Storm team: delete all', 'Storm person: add', 'Storm person: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view belonged', 'Storm team: edit belonged', 'Storm team: delete belonged'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view own', 'Storm team: edit own', 'Storm team: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit own', 'Storm team: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$person = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $person, t('Save'));
$person = node_load(array('title' => $person['title']));
// Create teams
$team1 = array(
'title' => $this->randomName(32),
'members_array_1' => $person->nid,
);
$this->drupalPost('node/add/stormteam', $team1, t('Save'));
$team1 = node_load(array('title' => $team1['title']));
$this->drupalLogin($userOwn);
$team2 = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team2, t('Save'));
$team2 = node_load(array('title' => $team2['title']));
$this->drupalLogin($userViewAllEditOwn);
$team3 = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team3, t('Save'));
$team3 = node_load(array('title' => $team3['title']));
// Test for 'Storm team: view all'
$this->drupalLogin($userAll);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team1->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team1->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team2->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team2->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertLink($team3->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team3->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team3->nid .'/delete', 'The Team delete icon appears on the list');
// Test for 'Storm team: view belonged'
$this->drupalLogin($userOrg);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team1->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team1->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertNoLink($team2->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertNoLink($team3->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/delete', 'The Team delete icon does not appear on the list');
// Test for 'Storm team: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('teams');
$this->assertNoLink($team1->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team2->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team2->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertNoLink($team3->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/delete', 'The Team delete icon does not appear on the list');
// Test for 'Storm team: view all', 'Storm team: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertNoRaw('node/'. $team1->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/delete', 'The Team edit icon does not appear on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertNoRaw('node/'. $team2->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertLink($team3->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team3->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team3->nid .'/delete', 'The Team delete icon appears on the list');
}
}

View file

@ -1,344 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Ticket module.
*/
class StormticketTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Ticket Functionality'),
'description' => t('Test the functionality of the SuiteDesk Ticket module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormperson', 'stormteam');
}
public function testStormticketAccess() {
$this->drupalGet('tickets');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tickets list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('tickets');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tickets list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm ticket: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('tickets');
$this->assertText(t('Tickets'), t('Make sure the correct page has been displayed by checking that the title is "Tickets".'));
}
public function testStormticketCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm ticket: add', 'Storm ticket: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$ticket = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormticket', $ticket, t('Save'));
$this->assertText(t('Ticket @title has been created.', array('@title' => $ticket['title'])));;
}
public function testStormticketList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit all', 'Storm ticket: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view of user organization', 'Storm ticket: edit of user organization', 'Storm ticket: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view own', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project foreach organization
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectTeam = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg2 = node_load(array('title' => $prj['title']));
// Create tickets
$ticket1 = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormticket', $ticket1, t('Save'), array('query' => 'organization_nid='.$org->nid));
$ticket1 = node_load(array('title' => $ticket1['title']));
$ticketAssigned = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormticket', $ticketAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
$ticketAssigned = node_load(array('title' => $ticketAssigned['title']));
$ticketAssignedTeam = array(
'organization_nid' => $org->nid,
'project_nid' => $projectTeam->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormticket', $ticketAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
$ticketAssignedTeam = node_load(array('title' => $ticketAssignedTeam['title']));
$this->drupalLogin($userOwn);
$ticket2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
);
$this->drupalPost('node/add/stormticket', $ticket2, t('Save'), array('query' => 'organization_nid='.$org->nid));
$ticket2 = node_load(array('title' => $ticket2['title']));
$this->drupalLogin($userViewAllEditOwn);
$ticket3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
'project_nid' => $projectOrg2->nid,
);
$this->drupalPost('node/add/stormticket', $ticket3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
$ticket3 = node_load(array('title' => $ticket3['title']));
// Test for 'Storm ticket: view all'
$this->drupalLogin($userAll);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
// Test for 'Storm ticket: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
// Test for 'Storm ticket: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssigned->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssignedTeam->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view all', 'Storm ticket: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket edit icon does not appear on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view if assigned to ticket'
$this->drupalLogin($userAssigned);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket2->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticketAssignedTeam->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view if assigned to ticket' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket2->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssigned->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
}
}

View file

@ -1,182 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Timetracking module.
*/
class StormtimetrackingTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Timetracking Functionality'),
'description' => t('Test the functionality of the SuiteDesk Timetracking module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormtimetracking', 'stormperson');
}
public function testStormtimetrackingCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm ticket: add', 'Storm ticket: view all', 'Storm timetracking: add', 'Storm timetracking: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$ticket = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$timetracking = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormticket', $ticket, t('Save'));
$this->drupalPost('node/add/stormtimetracking', $timetracking, t('Save'));
$this->assertText(t('Timetracking @title has been created.', array('@title' => $timetracking['title'])));;
}
public function testStormtimetrackingList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit all', 'Storm timetracking: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view of user organization', 'Storm timetracking: edit of user organization', 'Storm timetracking: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view own', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create timetrackings
$timetracking1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormtimetracking', $timetracking1, t('Save'));
$timetracking1 = node_load(array('title' => $timetracking1['title']));
$this->drupalLogin($userOwn);
$timetracking2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormtimetracking', $timetracking2, t('Save'));
$timetracking2 = node_load(array('title' => $timetracking2['title']));
$this->drupalLogin($userViewAllEditOwn);
$timetracking3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormtimetracking', $timetracking3, t('Save'));
$timetracking3 = node_load(array('title' => $timetracking3['title']));
// Test for 'Storm timetracking: view all'
$this->drupalLogin($userAll);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon appears on the list');
// Test for 'Storm timetracking: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertNoLink($timetracking3->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
// Test for 'Storm timetracking: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('timetrackings');
$this->assertNoLink($timetracking1->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertNoLink($timetracking3->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
// Test for 'Storm timetracking: view all', 'Storm timetracking: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking edit icon does not appear on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertNoRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
$this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon appears on the list');
}
}

View file

@ -1,132 +0,0 @@
Overview
========
In many cases, it's useful to allow users to define patterns or large
chunks of text that contain programmatically derived values. For example,
form email messages addressed to a given user, or url path aliases
containing the title of a given node. Both examples require bits of data
that vary each time the text is generated -- node titles, user ids, and
so on. Rather than forcing users to embed ugly snippets of PHP, or creating
elaborate and bizarre UIs for configuring the patterns via the browser,
it's most useful to give users a set of 'placeholder' tokens to place in
their text.
Token.module provides a shared API for exposing and using placeholder
tokens and their appropriate replacement values. It does nothing *by
itself* -- other modules can use it to avoid reinventing the wheel.
Using Token Replacement
=======================
To apply token replacement to a chunk of text, you have two options. The
first, and simplest, is:
token_replace($original, $type = 'global', $object = NULL,
$leading = '[', $trailing = ']')
$original is the source text to perform substitutions on: it can be either
a simple string, or an array of multiple strings.
$type and $object are to be used when performing substitution based on a
particular Drupal object. Replacing tokens in an email with values from
a particular user account, or replacing tokens in a path alias pattern with
values from the node being aliased, are two examples.
$type should contain the general object type (node, comment, user, etc.)
while $object should contain the object itself.
$leading and $trailing can be used to override the default token style.
For example, to replace tokens using %this style, pass in '%' and '' for
the $leading and $trailing values. Note that passing in a leading but NOT
trailing value can lead to false positives if two tokens are named in a
similar fashion (%node_term and %node_term_id, for example).
Altering The Replacement Values
===============================
If your module needs to perform additional cleanup work on the replacement
values before doing the actual substitutions (cleaning replacement values
to make them appropriate for path aliasing, truncating them to a particular
length, etc.) you can manually retrieve the list of tokens and replacement
values, then call str_replace() yourself.
token_get_values($type = 'global', $object = NULL)
Pass in the $type and $object as you would with the simpler token_replace()
function. The return value will be an object containing one array of tokens
and one array of values as in this example:
stdClass Object {
[tokens] => array(
[0] => mytoken1,
[1] => mytoken2
),
[values] => array(
[0] => value1,
[1] => value2,
)
}
Providing Placeholder Tokens
============================
Token.module provides a small set of default placeholders for global values
like the name of the currently logged in user, the site's URL, and so on.
Any module can provide additional tokens by implementing two hooks.
Security note: For tokens which include user input, users and modules
expect to see both a ['token-name'] and a ['token-name-raw'] value.
hook_token_values($type, $object = NULL)
========================================
This function should return a keyed array of placeholders, and their
replacement values. $type contains the current context -- 'node', 'user',
'global', etc. $object contains the specific node, user, etc. that
should be used as the basis for the replacements. *Only* generate and
return replacement tokens when $type is something that your module can
really deal with. That helps keep things speedy and avoid needlessly
searching for jillions of replacement tokens. The $options array can
contain additional options (exact use is dynamic and not easily documented).
For example:
function my_user_token_values($type, $object = NULL, $options = array()) {
if ($type == 'user') {
$user = $object;
$tokens['name'] = $user->name;
$tokens['mail'] = $user->mail;
return $tokens;
}
}
hook_token_list($type = 'all')
==============================
This function is used to provide help and inline documentation for all
of the possible replacement tokens.
As with hook_token_values, $type indicates the context that token help
is being generated for. Unlike hook_token_values however, you should
show ALL tokens at the same time if $type is 'all'. As such, the help
text should be keyed by the $type context your module will use when
doing the actual replacements. For example:
function my_user_token_list($type = 'all') {
if ($type == 'user' || $type == 'all') {
$tokens['user']['name'] = t("The user's name");
$tokens['user']['mail'] = t("The user's email address");
return $tokens;
}
}
Examples of more elaborate token replacement setups can be found in the
token_node.inc file that's bundled with token.module.
Security Note
========
If use any of the tokens in the ['raw'] sub-array then please note that these
are unfiltered values which could conceivably contain XSS attacks or other
malicious data. Your module should then provide it's own filtering to ensure the
safety of site users.

View file

@ -1,690 +0,0 @@
<?php
/**
* @file
* Tests for the token module.
*/
/**
* Helper test class with some added functions for testing.
*/
class TokenTestHelper extends DrupalWebTestCase {
function setUp(array $modules = array()) {
$modules[] = 'path';
$modules[] = 'token';
$modules[] = 'token_test';
parent::setUp($modules);
// Clear the token static cache.
token_get_values('reset');
}
function assertToken($type, $object, $token, $expected, array $options = array()) {
$this->assertTokens($type, $object, array($token => $expected), $options);
}
function assertTokens($type, $object, array $tokens, array $options = array()) {
$values = token_get_values($type, $object, FALSE, $options);
$values = array_combine($values->tokens, $values->values);
foreach ($tokens as $token => $expected) {
if (!isset($expected)) {
$this->assertTrue(!isset($values[$token]), t("Token value for [@token] was not generated.", array('@token' => $token)));
}
elseif (!isset($values[$token])) {
$this->fail(t("Token value for [@token] was not generated.", array('@token' => $token)));
}
else {
$this->assertIdentical($values[$token], $expected, t("Token value for [@token] was '@actual', expected value '@expected'.", array('@token' => $token, '@actual' => $values[$token], '@expected' => $expected)));
}
}
}
/**
* Make a page request and test for token generation.
*/
function assertPageTokens($url, array $tokens, array $data = array('global' => NULL), array $options = array()) {
if (empty($tokens)) {
return TRUE;
}
$token_page_tokens = array(
'tokens' => $tokens,
'data' => $data,
'options' => $options,
);
variable_set('token_page_tokens', $token_page_tokens);
$options += array('url_options' => array());
$this->drupalGet($url, $options['url_options']);
$this->refreshVariables();
$result = variable_get('token_page_tokens', array());
if (!isset($result['values']) || !is_array($result['values'])) {
return $this->fail('Failed to generate tokens.');
}
foreach ($tokens as $token => $expected) {
if (!isset($expected)) {
$this->assertTrue(!isset($result['values'][$token]) || $result['values'][$token] === $token, t("Token value for @token was not generated.", array('@token' => $token)));
}
elseif (!isset($result['values'][$token])) {
$this->fail(t('Failed to generate token @token.', array('@token' => $token)));
}
else {
$this->assertIdentical($result['values'][$token], (string) $expected, t("Token value for @token was '@actual', expected value '@expected'.", array('@token' => $token, '@actual' => $result['values'][$token], '@expected' => $expected)));
}
}
}
}
class TokenUnitTestCase extends TokenTestHelper {
public static function getInfo() {
return array(
'name' => 'Token unit tests',
'description' => 'Test basic, low-level token functions.',
'group' => 'Token',
);
}
/**
* Test token_get_invalid_tokens() and token_get_invalid_tokens_by_context().
*/
public function testGetInvalidTokens() {
$tests = array();
$tests[] = array(
'valid tokens' => array(
'[title-raw]',
'[yyyy]',
'[mod-yyyy]',
'[site-name]',
'[site-slogan]',
'[user-id]',
),
'invalid tokens' => array(
'[title-invalid]',
'[invalid]',
'[mod-invalid]',
'[invalid-title]',
'[site-invalid]',
'[uid]',
'[comment-cid]',
),
'types' => array('node'),
);
$tests[] = array(
'valid tokens' => array(
'[title-raw]',
'[yyyy]',
'[mod-yyyy]',
'[site-name]',
'[site-slogan]',
'[user-id]',
'[uid]',
'[comment-cid]',
),
'invalid tokens' => array(
'[title-invalid]',
'[invalid]',
'[mod-invalid]',
'[invalid-title]',
'[site-invalid]',
),
'types' => array('all'),
);
$tests[] = array(
'valid tokens' => array(
'[alpha]',
'[beta-1]',
'[beta-2]',
'[gamma_A]',
'[delta-extra]',
'[epsilon-zeta-A]',
),
'invalid tokens' => array(
'[alpha-plus]',
'[beta]',
'[beta-]',
'[beta_]',
'[beta_1]',
'[beta-A]',
'[gamma]',
'[gamma_]',
'[gamma-A]',
'[delta]',
'[epsilon-zeta-]',
),
'types' => array('all'),
);
foreach ($tests as $test) {
$tokens = array_merge($test['valid tokens'], $test['invalid tokens']);
shuffle($tokens);
$invalid_tokens = token_get_invalid_tokens_by_context(implode(' ', $tokens), $test['types']);
sort($invalid_tokens);
sort($test['invalid tokens']);
$this->assertEqual($invalid_tokens, $test['invalid tokens'], 'Invalid tokens detected properly: ' . implode(', ', $invalid_tokens));
}
}
/**
* Test the $options['clear'] parameter for token_replace().
*/
public function testClearOption() {
$tests[] = array(
'input' => 'Foo [site-name][invalid-token] bar [another-invalid-token] [invalid-token]',
'output' => 'Foo Drupal bar ',
'options' => array('clear' => TRUE),
);
$tests[] = array(
'input' => 'Foo [site-name][invalid-token] bar [another-invalid-token] [invalid-token]',
'output' => 'Foo Drupal[invalid-token] bar [another-invalid-token] [invalid-token]',
'options' => array(),
);
foreach ($tests as $test) {
$output = token_replace($test['input'], 'global', NULL, TOKEN_PREFIX, TOKEN_SUFFIX, $test['options']);
$this->assertIdentical($output, $test['output']);
}
}
/**
* Test whether token-replacement works in various contexts.
*
* @see http://drupal.org/node/733192
*/
function testSystemTokenRecognition() {
global $language;
// Generate prefixes and suffixes for the token context.
$tests = array(
array('prefix' => 'this is the ', 'suffix' => ' site'),
array('prefix' => 'this is the', 'suffix' => 'site'),
array('prefix' => '[', 'suffix' => ']'),
array('prefix' => '', 'suffix' => ']]]'),
array('prefix' => '[[[', 'suffix' => ''),
array('prefix' => ':[:', 'suffix' => '--]'),
array('prefix' => '-[-', 'suffix' => ':]:'),
array('prefix' => '[:', 'suffix' => ']'),
array('prefix' => '[site:', 'suffix' => ':name]'),
array('prefix' => '[site:', 'suffix' => ']'),
);
// Check if the token is recognized in each of the contexts.
foreach ($tests as $test) {
$input = $test['prefix'] . '[site-name]' . $test['suffix'];
$expected = $test['prefix'] . 'Drupal' . $test['suffix'];
$output = token_replace($input);
$this->assertEqual($output, $expected);
}
}
/**
* Test token caching.
*/
function testTokenCaching() {
// Run global tokens once so that the cache is primed.
$tokens = array(
'option-foo' => '',
);
$this->assertTokens('global', NULL, $tokens);
// Run global tokens again with different options. This should return a
// different value for the [option-foo] token.
$tokens = array(
'option-foo' => 'bar',
);
$this->assertTokens('global', NULL, $tokens, array('foo' => 'bar'));
}
/**
* Test the token_scan() function.
*/
function testTokenScan() {
$tests = array(
array('text' => 'Test [foo] [[bar]] test.', 'tokens' => array('foo', 'bar')),
array('text' => 'Test [foo] [] test.', 'tokens' => array('foo')),
array('text' => 'Test [foo][] test.', 'tokens' => array('foo')),
array('text' => 'Test [foo][bar] test.', 'tokens' => array('foo', 'bar')),
// Test the e-mail token syntax.
array('text' => 'Test %foo %%bar test.', 'tokens' => array('foo', 'bar'), 'leading' => '%', 'trailing' => ''),
array('text' => 'Test %foo % test.', 'tokens' => array('foo'), 'leading' => '%', 'trailing' => ''),
array('text' => 'Test %foo% test.', 'tokens' => array('foo'), 'leading' => '%', 'trailing' => ''),
array('text' => 'Test %foo%%bar test.', 'tokens' => array('foo', 'bar'), 'leading' => '%', 'trailing' => ''),
// Test the rules token syntax.
array('text' => 'Test [global:foo] [global:bar] test.', 'tokens' => array('foo', 'bar'), 'leading' => '[global:'),
array('text' => 'Test [node:foo] [node:] test.', 'tokens' => array('foo'), 'leading' => '[node:'),
array('text' => 'Test [node:foo][node:] test.', 'tokens' => array('foo'), 'leading' => '[node:'),
array('text' => 'Test [node:foo][node:bar] test.', 'tokens' => array('foo', 'bar'), 'leading' => '[node:'),
);
foreach ($tests as $test) {
$test += array('leading' => TOKEN_PREFIX, 'trailing' => TOKEN_SUFFIX);
$this->assertEqual(token_scan($test['text'], $test['leading'], $test['trailing']), $test['tokens']);
}
}
}
class TokenNodeTestCase extends TokenTestHelper {
public static function getInfo() {
return array(
'name' => 'Node token tests',
'description' => 'Test the node tokens.',
'group' => 'Token',
);
}
function testNodeTokens() {
$time = time();
$created = gmmktime(0, 0, 0, 11, 19, 1978);
$changed = gmmktime(0, 0, 0, 7, 4, 1984);
$node = $this->drupalCreateNode(array(
'type' => 'page',
'language' => 'und',
'created' => $created,
'log' => '<blink>' . $this->randomName() . '</blink>',
));
$node->changed = $changed;
path_set_alias('node/' . $node->nid, 'content/first-node');
$tokens = array(
'nid' => $node->nid,
'type' => 'page',
'type-name' => 'Page',
'language' => 'und',
'node-path' => 'content/first-node',
'node-url' => url('node/' . $node->nid, array('absolute' => TRUE)),
'small' => '11/19/1978 - 00:00',
'yyyy' => '1978',
'yy' => '78',
'month' => 'November',
'mon' => 'Nov',
'mm' => '11',
'm' => '11',
'ww' => '46',
'date' => '7',
'day' => 'Sunday',
'ddd' => 'Sun',
'dd' => '19',
'd' => '19',
'raw' => 280281600,
'since' => format_interval($time - 280281600),
'mod-small' => '07/04/1984 - 00:00',
'mod-yyyy' => '1984',
'mod-yy' => '84',
'mod-month' => 'July',
'mod-mon' => 'Jul',
'mod-mm' => '07',
'mod-m' => '7',
'mod-ww' => '27',
'mod-date' => '3',
'mod-day' => 'Wednesday',
'mod-ddd' => 'Wed',
'mod-dd' => '04',
'mod-d' => '4',
'mod-raw' => 457747200,
'mod-since' => format_interval($time - 457747200),
'log' => filter_xss($node->log),
'log-raw' => $node->log,
);
$this->assertTokens('node', $node, $tokens);
// Check that a new revision of a node returns different tokens.
$node->revision = TRUE;
$node->title = 'New revision';
node_save($node);
$this->assertTokens('node', $node, array('title' => 'New revision'));
}
}
class TokenCommentTestCase extends TokenTestHelper {
protected $node;
public static function getInfo() {
return array(
'name' => 'Comment token tests',
'description' => 'Test the comment tokens.',
'group' => 'Token',
);
}
function setUp(array $modules = array()) {
$modules[] = 'comment';
parent::setUp($modules);
$this->node = $this->drupalCreateNode(array('comment' => 2));
}
function loadComment($cid) {
return db_fetch_object(db_query('SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d', $cid));
}
function createComment(array $comment) {
$comment += array(
'cid' => 0,
'nid' => $this->node->nid,
'pid' => 0,
'uid' => 0,
'subject' => $this->randomName(),
'comment' => $this->randomName(64),
'format' => 1,
'timestamp' => gmmktime(0, 0, 0, 7, 4, 1984),
'status' => COMMENT_PUBLISHED,
);
$cid = comment_save($comment);
return $this->loadComment($cid);
}
function testCommentTokens() {
$time = time();
$comment = $this->createComment(array(
'timestamp' => gmmktime(0, 0, 0, 7, 4, 1984),
));
$tokens = array(
'comment-cid' => $comment->cid,
'comment-nid' => $this->node->nid,
'comment-yyyy' => '1984',
'comment-yy' => '84',
'comment-month' => 'July',
'comment-mon' => 'Jul',
'comment-mm' => '07',
'comment-m' => '7',
'comment-ww' => '27',
'comment-date' => '3',
'comment-day' => 'Wednesday',
'comment-ddd' => 'Wed',
'comment-dd' => '04',
'comment-d' => '4',
'comment-raw' => '457747200',
'comment-since' => format_interval($time - 457747200),
'comment-node-title' => check_plain($this->node->title),
'comment-node-title-raw' => $this->node->title,
);
$this->assertTokens('comment', $comment, $tokens);
}
}
class TokenTaxonomyTestCase extends TokenTestHelper {
protected $vocabulary;
public static function getInfo() {
return array(
'name' => 'Taxonomy and vocabulary token tests',
'description' => 'Test the taxonomy tokens.',
'group' => 'Token',
);
}
function setUp(array $modules = array()) {
$modules[] = 'taxonomy';
parent::setUp($modules);
// Reset the static taxonomy.module caches.
taxonomy_vocabulary_load(0, TRUE);
taxonomy_get_term(0, TRUE);
}
function addVocabulary(array $vocabulary = array()) {
$vocabulary += array(
'name' => drupal_strtolower($this->randomName(5)),
'nodes' => array('story' => 'story'),
);
taxonomy_save_vocabulary($vocabulary);
return (object) $vocabulary;
}
function addTerm(stdClass $vocabulary, array $term = array()) {
$term += array(
'name' => drupal_strtolower($this->randomName(5)),
'vid' => $vocabulary->vid,
);
taxonomy_save_term($term);
return (object) $term;
}
function testTaxonomyTokens() {
$vocabulary = $this->addVocabulary(array(
'name' => '<blink>Vocab Name</blink>',
'description' => '<blink>Vocab Description</blink>',
));
$term = $this->addTerm($vocabulary, array(
'name' => '<blink>Term Name</blink>',
'description' => '<blink>Term Description</blink>',
));
$tokens = array(
'tid' => $term->tid,
'cat' => check_plain($term->name),
'cat-raw' => $term->name,
'cat-description' => 'Term Description',
'vid' => $vocabulary->vid,
'vocab' => check_plain($vocabulary->name),
'vocab-raw' => $vocabulary->name,
'vocab-description' => 'Vocab Description',
'vocab-description-raw' => $vocabulary->description,
);
$this->assertTokens('taxonomy', $term, $tokens);
$tokens = array(
'vocabulary-vid' => $vocabulary->vid,
'vocabulary-name' => check_plain($vocabulary->name),
'vocabulary-name-raw' => $vocabulary->name,
'vocabulary-description' => 'Vocab Description',
'vocabulary-description-raw' => $vocabulary->description,
);
$this->assertTokens('vocabulary', $vocabulary, $tokens);
}
}
class TokenMenuTestCase extends TokenTestHelper {
public static function getInfo() {
return array(
'name' => 'Menu token tests',
'description' => 'Test the menu tokens.',
'group' => 'Token',
);
}
function setUp(array $modules = array()) {
$modules[] = 'menu';
parent::setUp($modules);
}
function testMenuTokens() {
$root_link = array(
'link_path' => 'root',
'link_title' => 'Root link',
'menu_name' => 'primary-links',
);
menu_link_save($root_link);
// Add another link with the root link as the parent
$parent_link = array(
'link_path' => 'root/parent',
'link_title' => 'Parent link',
'menu_name' => 'primary-links',
'plid' => $root_link['mlid'],
);
menu_link_save($parent_link);
$node_link = array(
'enabled' => TRUE,
'link_title' => 'Node link',
'plid' => $parent_link['mlid'],
'customized' => 0,
);
$node = $this->drupalCreateNode(array('menu' => $node_link));
// Test [node:menu] tokens.
$tokens = array(
'menu' => 'Primary links',
'menu-raw' => 'Primary links',
'menupath' => 'Root link/Parent link/Node link',
'menupath-raw' => 'Root link/Parent link/Node link',
'menu-link-title' => 'Node link',
'menu-link-title-raw' => 'Node link',
'menu-link-mlid' => $node->menu['mlid'],
'menu-link-plid' => $node->menu['plid'],
'menu-link-plid' => $parent_link['mlid'],
'menu-link-parent-path' => 'root/parent',
'menu-link-parent-path-raw' => 'root/parent',
);
$this->assertTokens('node', $node, $tokens);
// Reload the node which will not have $node->menu defined and re-test.
$loaded_node = node_load($node->nid);
// We have to reset the token static cache because tokens are cached by
// node ID only and not if the node object has changed.
$this->assertTokens('node', $loaded_node, $tokens, array('reset' => TRUE));
// Regression test for http://drupal.org/node/1317926 to ensure the
// original node object is not changed when calling menu_node_prepare().
$this->assertTrue(!isset($loaded_node->menu), t('The $node->menu property was not modified during token replacement.'), 'Regression');
}
}
/*
* Unit tests for the book tokens provided by Pathauto.
*/
class TokenBookTestCase extends TokenTestHelper {
public static function getInfo() {
return array(
'name' => 'Book tokens',
'description' => 'Tests the book tokens.',
'group' => 'Token',
);
}
function setUp(array $modules = array()) {
$modules[] = 'book';
$modules[] = 'menu';
parent::setUp($modules);
variable_set('book_allowed_types', array('book', 'page'));
}
function testBookTokens() {
// Add a non-book node.
$non_book_node = $this->drupalCreateNode(array('type' => 'book'));
$tokens = array(
'book' => '',
'book-raw' => '',
'book_id' => '',
'bookpath' => '',
'bookpath-raw' => '',
);
$this->assertTokens('node', $non_book_node, $tokens);
// Add a root book page.
$parent_node = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Root',
'book' => array('bid' => 'new') + _book_link_defaults('new'),
));
$tokens = array(
'book' => 'Root',
'book-raw' => 'Root',
'book_id' => $parent_node->book['bid'],
'bookpath' => '',
'bookpath-raw' => '',
// Check that even those book menu links have been created for this node,
// that the menu links still return nothing.
'menu' => '',
'menupath' => '',
'menu-link-title' => '',
'menu-link-title-raw' => '',
'menu-link-mlid' => '',
'menu-link-plid' => '',
'menu-link-parent-path' => '',
);
$this->assertTokens('node', $parent_node, $tokens);
// Add a first child page.
$child_node1 = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Sub page1',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $parent_node->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'book' => 'Root',
'book-raw' => 'Root',
'book_id' => $parent_node->book['bid'],
'bookpath' => 'Root',
'bookpath-raw' => 'Root',
);
$this->assertTokens('node', $child_node1, $tokens);
// Add a second child page.
$child_node2 = $this->drupalCreateNode(array(
'type' => 'book',
'title' => 'Sub page2',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $parent_node->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'book' => 'Root',
'book-raw' => 'Root',
'book_id' => $parent_node->book['bid'],
'bookpath' => 'Root',
'bookpath-raw' => 'Root',
);
$this->assertTokens('node', $child_node2, $tokens);
// Add a child page on an existing child page.
$sub_child_node1 = $this->drupalCreateNode(array(
'type' => 'page',
'title' => 'Sub-sub Page1',
'book' => array(
'bid' => $parent_node->book['bid'],
'plid' => $child_node1->book['mlid'],
) + _book_link_defaults('new'),
));
$tokens = array(
'book' => 'Root',
'book-raw' => 'Root',
'book_id' => $parent_node->book['bid'],
'bookpath' => 'Root/Sub page1',
'bookpath-raw' => 'Root/Sub page1',
);
$this->assertTokens('node', $sub_child_node1, $tokens);
}
}
/**
* Test the current page tokens.
*/
class TokenCurrentPageTestCase extends TokenTestHelper {
public static function getInfo() {
return array(
'name' => 'Current page token tests',
'description' => 'Test the current page tokens.',
'group' => 'Token',
);
}
function testCurrentPageTokens() {
$tokens = array(
'[current-page-title]' => '',
'[current-page-path]' => 'node',
'[current-page-url]' => url('node', array('absolute' => TRUE)),
'[current-page-number]' => 1,
);
$this->assertPageTokens('', $tokens);
$node = $this->drupalCreateNode(array('title' => 'Node title', 'path' => 'node-alias'));
$tokens = array(
'[current-page-title]' => 'Node title',
'[current-page-path]' => 'node-alias',
'[current-page-url]' => url("node/{$node->nid}", array('absolute' => TRUE)),
'[current-page-number]' => 1,
);
$this->assertPageTokens("node/{$node->nid}", $tokens);
}
}

View file

@ -1,11 +0,0 @@
name = TokenSTARTER
description = Provides additional tokens and a base on which to build your own tokens.
package = Core - extended
dependencies[] = token
core = 6.x
; Information added by drupal.org packaging script on 2012-09-12
version = "6.x-1.19"
core = "6.x"
project = "token"
datestamp = "1347470077"

View file

@ -1,68 +0,0 @@
<?php
/**
* @file
* The Token API module.
*
* The Token module provides an API for providing tokens to other modules.
* Tokens are small bits of text that can be placed into larger documents
* via simple placeholders, like %site-name or [user].
*
* @ingroup token
*/
/**
* Implementation of hook_token_list().
*/
function tokenSTARTER_token_list($type = 'all') {
$tokens = array();
if ($type == 'global' || $type == 'all') {
$tokens['global']['random-sha1'] = t("A randomly generated SHA1 hash.");
$tokens['global']['site-date-timestamp'] = t('The current timestamp in seconds past January 1, 1970.');
$tokens['global']['random-num-1'] = t('A randomly generated single-digit number.');
$tokens['global']['random-num-3'] = t('A randomly generated three-digit number.');
$tokens['global']['random-num-10'] = t('A randomly generated ten-digit number.');
$tokens['global']['random-alpha-1'] = t('Randomly generated single-digit letter.');
$tokens['global']['random-alpha-3'] = t('Randomly generated three-digit letters.');
$tokens['global']['random-alpha-10'] = t('Randomly generated ten-digit letters.');
}
if ($type == 'node' || $type == 'all') {
// Node tokens here.
}
return $tokens;
}
/**
* Implementation of hook_token_values().
*/
function tokenSTARTER_token_values($type, $object = NULL, $options = array()) {
$values = array();
switch ($type) {
case 'global':
$values['random-sha1'] = sha1(rand());
// Create random numbers.
$values['random-num-1'] = mt_rand(0, 9);
$values['random-num-3'] = mt_rand(100, 999);
$values['random-num-10'] = mt_rand(10000, 99999) . mt_rand(10000, 99999);
// Create random letters.
$letters = range('a', 'z');
$values['random-alpha-1'] = $letters[array_rand($letters, 1)];
shuffle($letters);
$values['random-alpha-3'] = implode('', array_slice($letters, 0, 3));
shuffle($letters);
$values['random-alpha-10'] = implode('', array_slice($letters, 0, 10));
// Create a UNIX timestamp token.
$time = time();
$tz = variable_get('date_default_timezone', 0);
$values['site-date-timestamp'] = format_date($time, 'custom', 'Y', $tz);
break;
case 'node':
// Node tokens here.
break;
}
return $values;
}

View file

@ -1,79 +0,0 @@
<?php
/**
* @file
* Tests for the token_actions module.
*/
class TokenActionsTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Token action tests'),
'description' => t('Test some of the token actions and tokens.'),
'group' => t('Token'),
);
}
function setUp() {
parent::setUp('token', 'token_actions', 'trigger');
$user = $this->drupalCreateUser(array('administer actions', 'administer site configuration', 'administer users'));
$this->drupalLogin($user);
}
/**
* Test user actions and triggers.
*/
function testUserActions() {
$insert_action = $this->createAction('token_actions_message_action', array(
'message' => 'Yay [site-name] has a new user [user] with an ID of [uid] and e-mail address of [mail]!',
));
$this->assignTriggerAction('user', 'insert', $insert_action);
// Create a user to trigger the action.
$edit = array();
$edit['name'] = $this->randomName();
$edit['mail'] = $edit['name'] .'@example.com';
$edit['pass[pass1]'] = $this->randomName();
$edit['pass[pass2]'] = $edit['pass[pass1]'];
$this->drupalPost('admin/user/user/create', $edit, t('Create new account'));
$account = user_load(array('name' => $edit['name']));
$this->assertText("Yay Drupal has a new user {$account->name} with an ID of {$account->uid} and e-mail address of {$account->mail}!", 'Tokenized message displays');
}
/**
* Create an action.
*
* @param $action
* The machine name of the action.
* @param $edit
* An optional array to pass onto drupalPost() for configuring the action.
*
* @return
* The created action object.
*/
function createAction($action, $edit = array()) {
$edit += array(
'actions_description' => $this->randomName(),
);
$this->drupalPost('admin/settings/actions/configure/'. md5($action), $edit, t('Save'));
$this->assertText('The action has been successfully saved.');
return db_fetch_object(db_query("SELECT * FROM {actions} WHERE type = 'system' AND callback = '%s' AND description = '%s'", $action, $edit['actions_description']));
}
/**
* Assign an action to a trigger.
*
* @param $type
* The trigger type.
* @param $trigger
* The trigger.
* @param $action
* The action object.
*/
function assignTriggerAction($type, $trigger, $action) {
$edit['aid'] = md5($action->aid);
$this->drupalPost("admin/build/trigger/{$type}", $edit, 'Assign', array(), array(), "trigger-{$type}-{$trigger}-assign-form");
return $this->assertLinkByHref("admin/build/trigger/unassign/{$type}/{$trigger}/{$edit['aid']}", 0, t('Action assigned to @type @trigger trigger.', array('@type' => $type, '@trigger' => $trigger)));
}
}

View file

@ -1,6 +0,0 @@
- If the interface text is *bolded*, it got strong tags.
- If it's a button they need to click, that's *bold* too.
- If the text is not bolded (ex: links to click, options to check), it
got /italicized/.
- If it's user-entered text it got 'single quotes'.

View file

@ -1,390 +0,0 @@
Zen 6.x-2.1, 2011-04-05
-----------------------
- #774836 by hefox: Check if node $title is set before outputting
- #705264 by JohnAlbin, Jehu, mlncn and zenic: Allow Zen (and subthemes) to be used without a database
- #1046090 by daniels and JohnAlbin: $styles is destroyed by rare bug with APC
- #1083700: Add $submitted variable back into node.tpl
- #1086820 by tacituseu: Views classes redundant since Views 6.x-2.9
- #1017062 by adrinux: Block edit links span entire block on RTL pages
- #774838 by bangpound, hefox and JohnAlbin: Add default case for build_mode
- #919838 by saem, rgbivens and JohnAlbin: Theme description links to wrong docs
- #992616 by JohnAlbin and adrinux: Comments in layout RTL stylesheets are incorrect
- #822570 by JohnAlbin and AaronCollier: Add focus styling to tabs
- #1072268: Zen theme doesn't load RTL styles
- #929630 by juan_g and akalata: URL for overriding stylesheets documentation has changed
- #742208: Conflict with domain theme module
- #1063226 by tacituseu, danillonunes and barraponto: Unpublished comment style is not applied
- #962356: Convert region template suggestions into theme hook suggestions
- #978640 by marcvangend: Whitespace before comment causes jQuery error
- #1046394 by n8tron and JohnAlbin: Add first and last classes to blocks
- #870080 by mverbaar: Correction to README.TXT for STARTERKIT
- #707410 by AdrianB: improve detection of Panels pages
- #634552 by JohnAlbin and tim.plunkett: Conflict with context module
- #941714: Modules setting $classes in preprocess functions breaks expected Zen classes
- #932826: mytheme_links__system_main_menu() doesn't work as expected
- Fix PHP warning on maintenance page
- #690026: Cannot override region.tpl.php
Zen 6.x-2.0, 2010-06-26
-----------------------
- #791056 by meatsack and JohnAlbin: Zen clobbers Views 3 classes
- #838338: element-invisible class doesn't fully hide elements
- #723514 by kmonty: Link in STARTERKIT description incorrect
- Skip navigation's ID changed from #skip-to-nav to #skip-link
- Added $block_html_id to block.tpl.php
- #772488 by andreiashu: Fatal error: Call to undefined function
ctools_menu_primary_local_tasks()
- #707410 by agentrickard and JohnAlbin: Add page-views and page-panels body classes
- #691426: Add D7-style named implementations of theme_links in page.tpl
- #683904: SUBTHEME_process functions do not work
- #552156: broken clearfix class causes overlapping containers in IE7
- #593290 by sfyn and JohnAlbin: Chaos Tools/Panels edit tab not working with Zen
- #661628 by Jacine and JohnAlbin: Integration with Skinr module
- by Jacine: Added views-view.tpl.php with support for $classes variables
- by caroltron, gleroux02, _natron, and JohnAlbin: Add panels 3 layouts using
Zen layout method
Zen 6.x-2.0-beta1, 2009-11-10
-----------------------------
- #478134 by mithrill: Improve docs about sites/all/themes and sites/default/themes folders
- #628070 by Aren Cambre: Change "jquery" to "JavaScript" in STARTERKIT.info.txt
- #626868 by alefteris: Replace Bitstream Vera with DejaVu fonts
- #624818 by Aren Cambre and Garrett Albright: Tahoma shouldn't be first font pick
- #600344 by mgifford: Use of absolute font size in block editing links breaks WCAG 2.0
- #546904 by Jennifer_M: List $node as available variable in page.tpl.php
- #583716 by droidenator: Empty title can cause breadcrumbs to display incorrectly
- #600920 by kto.3decb: Fix incorrect comment block class name
- #624046: Replace zen_id_safe() with drupal_html_class() and drupal_html_id()
- Renamed $closure_region region to $page_closure
- #622324: Update page.tpl to use ideas from D7
- Renamed #page and #page-inner to #page-wrapper and #page
- Added <span> around site name
- Moved #skip-to-nav styling to pages.css
- Removed #navigation link anchor
- Renamed div#header-inner to div.section which can be themed with #header .section
- Renamed #main and #main-inner to #main-wrapper and #main
- Renamed div#content-inner to div.section which can be themed with #content .section
- Removed #content-header div
- Added $highlight region
- Renamed #navbar div to #navigation
- Renamed $navbar region to $navigation
- Renamed .with-navbar class to .with-navigation
- Added #navigation .section div
- Removed #sidebar-first, #sidebar-first-inner, #sidebar-second, #sidebar-second-inner and moved styles to .region-sidebar-first, .region-sidebar-first .section, .region-sidebar-second, .region-sidebar-second .section
- Added #footer .section div
- Added region-sidebar.tpl.php template suggestion
- #308254: Make "skip to nav" styling more useful and less intrusive
- #621798: Change sidebar variables to be RTL friendly and $shows_blocks compatible
- #547696: Update node.tpl to use ideas from D7
- Renamed $picture to $user_picture in node.tpl.php
- Renamed .sticky class to .node-sticky in node.tpl.php
- Removed #node-inner div
- Added $display_submitted variable and deprecated $submitted variable
- Renamed the .node-mine class to .node-by-viewer
- #620794: Update block.tpl to use ideas from D7
- Removed .block-inner div
- Renamed $block->subject variable to $title
- Renamed $block->content variable to $content
- #548994: Update comment.tpl and comment-wrapper.tpl to use ideas from D7
- Renamed comment-wrapper's h2#comments-title to #comments h2.title
- Added $created to comment.tpl and deprecated $submitted
- Removed #comment-inner div
- comment div classes changed:
- .comment-by-anon changed to .comment-by-anonymous
- .comment-by-author changed to .comment-by-node-author
- .comment-mine changed to .comment-by-viewer
- .comment-published was removed
- #311458: Search box gets disabled after arbitrary amount of time
- Added $classes and $classes_array to all templates, not just Zen's templates
- Renamed page.tpl's $body_classes and $body_classes_array to $classes and $classes_array
- #564068: Views classes are missing from $classes variable
- Simplified header, content_top, content_bottom, navbar, and footer region markup
- Add region.tpl.php template
- Render $edit_links_array in zen_process_block
- #546858: Add THEME_process_HOOK functions to Zen
- #317417 by JohnAlbin and quicksketch: Fix off-line maintenance page since drupal_get_path('theme', 'zen') won't work
- #549798 by caroltron: page-backgrounds.css missing from .info file
- Remove ie5.css from STARTERKIT and deprecate support for IE5
- #547696: Update node.tpl to use ideas from D7
- Renamed $picture to $user_picture in node.tpl.php
- Renamed sticky class to node-sticky in node.tpl.php
- Added $build_mode variable to node.tpl.php
- #445814: Change primary/secondary link rendering and move secondary menu to footer
- #445822: Simplify wrapper divs around logo, site name, slogan
- #546862: Add D7's element-hidden and element-invisible for accessibility features
- #547382: Rename Zen's reset stylesheet to html-reset.css from html-elements.css
- #527494: Follow Drupal's proposed CSS coding standards
- #480610 by kdebaas: css class .field-type-image does not exist anymore in 6.x version of the module
- #545320 by Deslack: Use of split() generate E_DEPRECATED warnings on PHP 5.3.0
- #542818: Using alternate layout method causes .clearfix class to disappear
- #546828: Move tpl.php files to a templates folder in the root zen directory
- #546792: Remove box.tpl.php
- #513926: Sub-themes cannot reorder the stylesheets of the base theme
- #456136: Move zen stylesheets into STARTERKIT/css
- #544750 by kdebaas: Wrong sidebar class naming in maintenance-page.tpl.php
- #529796: Make block edit links easier to edit/turn off individually
- Added $classes_array variable to node, block and comment templates
- Add layout.css in Zen's .info file to properly position sub-theme's layout.css
- #379902: Make all stylesheets RTL compatible
- #472694: Drupal 6.11 broke Zen's OpenID overrides
- #375976 by JohnAlbin and Amitaibu: Flip sidebar positioning on RTL
- #375953 by Amitaibu and JohnAlbin: Change sidebar names to be RTL friendly
- Updated screenshot.png to use Zen logo since an actual screenshot is boring
- Changed "or" back to "||" in node.tpl.php since themers do need to learn a little PHP
- #254821: Sub-theme's .info file triggers incorrect "out of date" flag in update module
- Added blockquote indent stlying
- Removed navigation-top named anchor from page templates
- #382598: .node div.links ruleset doesn't match html in node template
- #452118: Removed redundant wrapper div around comment links
- #382480 by Ognyan Kulev: #block-menu-2 should be #block-menu-primary-links
- #374349: breadcrumb often broken when zen_breadcrumb_title is on
- #426750: Removed Zen Classic sub theme
- #445830: Rename clear-block CSS class to clearfix
- #445790: Move search box to header
- #445562: q0rban and JohnAlbin: Allow modules to declare their own block edit links
- Added optional node-type-specific preprocess functions
- Added notes about mobile stylesheets to STARTERKIT.info
- #200495 by JohnAlbin, caroltron, and Toe: Split up monolithic zen.css into smaller, logical stylesheets
- #328221 by kmonty and JohnAlbin: Split up ie.css to remove CSS hacks
Zen 6.x-1.2, 2011-02-26
-----------------------
- #593290 by sfyn and JohnAlbin: Chaos Tools/Panels edit tab not working with Zen
Zen 6.x-1.1, 2009-11-10
-----------------------
- #478134 by mithrill: Improve docs about sites/all/themes and sites/default/themes folders
- #600758 by mattyoung: Secondary links run together in one line with primary links
- #600344 by mgifford: Use of absolute font size in block editing links breaks WCAG 2.0
- #546904 by Jennifer_M: List $node as available variable in page.tpl.php
- #583716 by droidenator: Empty title can cause breadcrumbs to display incorrectly
- #600920 by kto.3decb: Fix incorrect comment block class name
- #297084: Remove ctype_lower() from zen_id_safe() to prevent WSOD/Fatal error on some systems
- #317417 by JohnAlbin and quicksketch: Fix off-line maintenance page since drupal_get_path('theme', 'zen') won't work
- #545320 by Deslack: Use of split() generate E_DEPRECATED warnings on PHP 5.3.0
- #472694: Drupal 6.11 broke Zen's OpenID overrides
- Updated screenshot.png to use Zen logo since an actual screenshot is boring
- Changed "or" back to "||" in node.tpl.php since themers do need to learn a little PHP
- #254821: Sub-theme's .info file triggers incorrect "out of date" flag in update module
- #327455 by grendzy and erifneerg: name and id mismatch in named anchor causing validation error
- #382598: .node div.links ruleset doesn't match html in node template
- #382480 by Ognyan Kulev: #block-menu-2 should be #block-menu-primary-links
- #374349: breadcrumb often broken when zen_breadcrumb_title is on
- #426750: Removed Zen Classic sub theme
- #445562: q0rban and JohnAlbin: Allow modules to declare their own block edit links
Zen 6.x-1.0, 2009-02-14
-----------------------
- #342004 by Amitaibu: Add css hint to prevent cramped-looking tables
- #290657: Liquid layout does not have min-width enforced
- #329769 by kmonty: Update zen_id_safe to remove underscores
- #275832: hook_theme implementation breaks maintenance page when database is down
- #362104: layout breaks on Zen-themed maintenance page
- Changed "or" back to "||" in template files since themers do need to learn a little PHP
- #346867 by debonator: navbar-inner is missing the "clear-block" class
- #325610 by Garrett Albright: Site name and logo don't link to frontpage on multilingual site
- #281106: Erroneous whitespace when div.clear-block touches bottom edge of viewport
- #365631: Zen's table-styling-fix breaks update module's styling
- #322480 by grendzy, mr.baileys, Bevan, and JohnAlbin: Make registry rebuild warning less obtrusive
- #325630: Broken link in "Theme registry rebuilt" warning when Clean URLs is off
- #324104 by JohnAlbin and dalin: Broken block editing link for Views 2
- #365205: block editing link doesn't work with Menu Block 6.x-2.1 and later
- #308251 by Garrett Albright: Improve icon placement on status, warning, and error messages
- Added $body_classes_array variable to page template
- #343945: Fix zen_breadcrumb_title setting to use proper menu_get_active_item()
- #279896 by lutegrass: Help prevent double H1 tags on homepage that is not /node
- #310507 by MikeyLikesIt: Footer region not output in Zen Classic
- #347195: Remove theme registry fix that was needed for broken Drupal 6.0 - 6.6
- #346706 by jsaints: Content clipped after page one when printing in Firefox
- #311529: Remove core's page-ARG0 body class, leaving zen's page-PATH
- Simplified body class generation code
- #334956 by hansrossel: Remove no-longer-needed fix for "Flash of Unstyled Content in IE"
- Fixed theme settings CSS for IE6 users
- Added Photoshop file for STARTERKIT screenshot
- Added Photoshop file for messages
- Allow easier CSS rule overriding by including THEMENAME.css file last
- Fixed message styling in Zen Classic
- #308957: html-elements.css not enabled in STARTERKIT
- #288213 by budda: Tabs in IE have a text select cursor rather than hand pointer
- #310818: Auto theme-registry rebuild warns themer multiple times
Zen 6.x-1.0-beta3, 2008-09-15
-----------------------------
- #308251: Add useful styling for status, warning, and error messages
- #307309: Add feature to rebuild theme registry during theme development
- Removed path_to_zentheme() since we're not conditionally including wireframes.css or block-editing.css
- #245832: Add IE conditional stylesheets to .info file
- #263228: Allow sub-themes to override wireframes.css
- #260605: Can't override block-editing.css
- #308266: Don't display footer if no footer message or footer blocks
- Changed $block_classes to $classes and $comment_classes to $classes and $node_classes to $classes
- #290838 by thehong: Only display comments block when comments content is not empty
- Don't display comment wrapper title on forums
- #299397: Synchronize Zen's tpl files with core's tpl files
- #281106 by kmonty: Erroneous whitespace when div.clear-block touches bottom edge of viewport
- Changed "||" to "or" in template files since its more intuitive to PHP newbies
- #279896: Help prevent double H1 tags on homepage that is not /node
- #279896: Moved styles to zen.css that should never have been in layout.css
- #255265 by kmonty: Don't "skip to nav" if there's no nav
- Re-arranged sidebar classes so they are in no-sidebars -> two-sidebars order in the layout CSS files
- #306856: Optimize code by adding conditional includes
- Moved some comments from zen to STARTERKIT where they belong
- Optimized zen_breadcrumb()
- Folded template-menus.php back into template.php since its not conditionally included
- Removed theme_username from STARTERKIT and zen_classic since it was fixed in Drupal 6.3
- Optimized zen_menu_item_link()
- #305311: CSS files makes reference to to drupal5-reference.css
- #299419: Remove empty zen.css in sub-themes
- #284798: PHP warning when settings section of .info file is missing
- #272655: Make STARTERKIT_theme easier to extend
Zen 6.x-1.0-beta2, 2008-05-20
-----------------------------
- #260016: PHP 4 Parse error: syntax error, unexpected '&'
Zen 6.x-1.0-beta1, 2008-05-15
-----------------------------
- #253609 by jjeff: Add 'region' class to regions
- #258123 by jjeff: Rearrange placement of #site-name strong
- #248103: Allow themes to set defaults for settings in their .info files
- #249532: Allow subthemes to have preprocess hooks without tpl files
- #223518: Option to show page title in breadcrumbs
- #253249: zen_id_safe fails when first character is extended latin
- #251632: Make the closure region more useful
- #199682: 'Submitted by' text is shown for content even if setting is disabled
- #222339: Blocks in Zen Classic header and closure lack padding
- #248780: admin table styles override update_status styling
- #232840: OpenID login block displaying incorrectly
- #246110 by jjeff: zen.css breaks .container-inline
- #229661: Search Box doesn't return any results or warnings
- #244023 by jjeff: Make block editing links go to actual menu edit pages
- #245968 by jjeff: Put the word "Comments" above comments
- #238387: Update README on how to edit the .info file
- #227297 by Aragorn450: CSS Include for wireframes broken
- Prevented "notice: Undefined variable: edit_links" for anonymous users
- Made block-editing.css a "theme"-type CSS file
- #224416 by sykora: <span> displaying on mouse over on block heading
- Added complete Drupal 6 CSS for easy reference by theme developers
- Added Photoshop file for tabs
- #222299: Block editing link in Zen Classic footer is white on white
Zen 5.x-1.2, 2009-02-15
-----------------------
- #342004 by Amitaibu: Add css hint to prevent cramped-looking tables
- #290657: Liquid layout does not have min-width enforced
- #279896 by lutegrass: Help prevent double H1 tags on homepage that is not /node
- #346706 by jsaints: Content clipped after page one when printing in Firefox
- Added $body_classes_array variable to page template
- Simplified body class generation code
- Fixed theme settings CSS for IE6 users
- #288213 by budda: Tabs in IE have a text select cursor rather than hand pointer
- #249823: Add options to toggle display of primary and secondary links
- #281106 by kmonty: Erroneous whitespace when div.clear-block touches bottom edge of viewport
- #279896: Help prevent double H1 tags on homepage that is not /node
- #279896: Moved styles to zen.css that should never have been in layout.css
- #255265 by kmonty: Don't "skip to nav" if there's no nav
- #263228: Allow sub-themes to override wireframes.css
- Added sample override template file for search block's form
- Fixed _zen_hook() to look in sub-theme directory when $hook is not valid PHP function name
- #223518: Option to show page title in breadcrumbs
- #255263: Don't call preprocess functions twice when Zen is active theme
- #253249: zen_id_safe fails when first character is extended latin
Zen 5.x-1.1, 2008-04-21
-----------------------
- #246109: Add MODULE_preprocess_HOOK functions to Zen
- #199682: 'Submitted by' text is shown for content even if setting is disabled
- #247960: Add THEME_preprocess() hook to Zen
- #222339: Blocks in Zen Classic header and closure lack padding
- #248720 by matt@antinomia: Only UPDATE {system} table WHERE type = 'theme'
- #248780: admin table styles override update_status styling
- #246110 by jjeff: zen.css breaks .container-inline
- Prevented "notice: Undefined variable: edit_links" for anonymous users
- Made block-editing.css a "theme"-type CSS file
- Added Photoshop file for tabs
- #222299: Block editing link in Zen Classic footer is white on white
Zen 5.x-1.0, 2008-02-14
-----------------------
- #220161: Change SUBTHEME to STARTERKIT to prevent accidental WSOD
- #221545 by jjeff: Add theme_comment_wrapper() and theme_username() from Zengine
- #220551: IE6: sidebars disappear when resizing window
- Added body classes: section-node-add, section-node-edit, section-node-delete
- Prevented display of empty help from node_help()
- #219401: Add theme override examples for all functions used in Zen core
Zen 5.x-1.0-beta2, 2008-01-29
-----------------------------
- #214777: sub-theme's search-theme-form.tpl is ignored
- #206707: tr.even/odd border-bottom is missing in IE
- #207743 by jjeff: Added translatable "Unpublished" text as background
- #207743 by jjeff: Added block editing links on hover
- Added extended block classes (zebra class by jjeff)
- #207743 by jjeff: Allow a sub-theme to add/alter block variables
- #110897: oversize content causes IE6 layout breakage (now fixed in Zen Classic)
- #211156 by jjeff: $subtheme_directory variable in page.tpl.php never gets populated
- #206060: changed inline styling method for navbar links from inline to float
Zen 5.x-1.0-beta1, 2008-01-06
-----------------------------
- Removed named anchors from doc flow to prevent any styles from appearing
- #203213 by kdebaas: Add node-teaser class to nodes displayed as teasers
- #203112 by kdebaas: Un-localizable string in search-theme-form.tpl.php
- #201793: Fixed fatal error when no settings are added to a sub-theme's settings
- #196181: _phptemplate_callback doesn't look in sub-theme folder for .tpl.php files
- Added sample override template file for drupal search form
- Added SUBTHEME directory as a starter sub-theme for developers
- #199036 by joachim: Make padding on #squeeze conditional
- #199578: Fatal error on Zen Classic theme settings when using admin theme
- #200380 by psynaptic: missing semi-colon in layout-fixed.css
- #196230: Tabs broken in IE5 and IE6
- #199682: 'Submitted by' text is shown even if setting is disabled
- #171201: Remove un-localizable date/time format from base theme
- Added theme settings to control layout method and wireframes inclusion
- Added fixed layout stylesheet
Zen 5.x-0.8, 2007-11-29
-----------------------
- #196223: IE5 always loads @import print stylesheet
- #184232: Add README documentation
- #121991: Source rendering order needs adjustment
- #110897: oversize content causes IE6 layout breakage
- Added unique classes for each page and website section
- Added customizable breadcrumb settings
- Split template.php into multiple files to ease theme developer overload
- Add prettier tab styling
- #141784: Add conditional IE stylesheets
- Merge zen-fixed with zen_classic
- Add optional Theme Settings API integration
- #169359: Base CSS and tpl files don't get loaded (sub-theme with page.tpl.php)
- #171464: Create starter theme; migrate current style to a sub-theme
- Add ability to change regions in a sub-theme
- Add complete Drupal 5 CSS for easy reference by theme developers
- #183936: Backport Drupal 6 $body_classes
Zen 5.x-0.7, 2007-10-15
-----------------------
- #100894: For SEO, H1#site-name should be div#site-name strong
- #118467 by leandrosiow: Screen redraw errors with resizable textareas in Firefox
- #154937 by msonnabaum: add skip navigation for screen readers/mobility impaired
- #122592: Ability to theme each primary link
- #178560 by incognito: Shifting avatars in the comment blocks
- #110553 by rport: Use png instead of gif for images
- #120052: Add linux fonts
- #183360: Empty H2 appears on blocks with no titles
- #121101: zen.css does not validate
- #110902: IE6: text falls outside and to the left of content area
- #183354: Add a div around the feed icons
- #120341: Sidebar has unwanted 5em bottom margin
- #122938: Enabling CSS aggregation messes up the CSS in Safari
- #110897: oversize content causes IE6 layout breakage
- #119270: profile pictures indenting
- #118170 by mr700: blockquote css border has two widths
- #110810: change .submitted span to div
- #100899: don't use sidebar class for widths
- #182130 by joachim: links in h2 and h3 different sizes
- #182556: Added CHANGELOG
Zen 5.x-0.6, 2007-01-17
-----------------------
- Initial pre-release

View file

@ -1,274 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public License is
intended to guarantee your freedom to share and change free software--to
make sure the software is free for all its users. This General Public License
applies to most of the Free Software Foundation's software and to any other
program whose authors commit to using it. (Some other Free Software
Foundation software is covered by the GNU Library General Public License
instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the
freedom to distribute copies of free software (and charge for this service if
you wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must make
sure that they, too, receive or can get the source code. And you must show
them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, so that any problems
introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such
program or work, and a "work based on the Program" means either the
Program or any derivative work under copyright law: that is to say, a work
containing the Program or a portion of it, either verbatim or with
modifications and/or translated into another language. (Hereinafter, translation
is included without limitation in the term "modification".) Each licensee is
addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made
by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it,
thus forming a work based on the Program, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that you
also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in
part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print such
an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be
reasonably considered independent and separate works in themselves, then
this License, and its terms, do not apply to those sections when you distribute
them as separate works. But when you distribute the same sections as part
of a whole which is a work based on the Program, the distribution of the
whole must be on the terms of this License, whose permissions for other
licensees extend to the entire whole, and thus to each and every part
regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to
work written entirely by you; rather, the intent is to exercise the right to
control the distribution of derivative or collective works based on the
Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of a
storage or distribution medium does not bring the other work under the scope
of this License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1
and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for
noncommercial distribution and only if you received the program in object
code or executable form with such an offer, in accord with Subsection b
above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source code
means all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation and
installation of the executable. However, as a special exception, the source
code distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
If distribution of executable or object code is made by offering access to
copy from a designated place, then offering equivalent access to copy the
source code from the same place counts as distribution of the source code,
even though third parties are not compelled to copy the source along with the
object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy,
modify, sublicense or distribute the Program is void, and will automatically
terminate your rights under this License. However, parties who have received
copies, or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the
Program (or any work based on the Program), you indicate your acceptance
of this License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these terms and
conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In such
case, this License incorporates the limitation as if written in the body of this
License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that
version or of any later version published by the Free Software Foundation. If
the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make
exceptions for this. Our decision will be guided by the two goals of
preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View file

@ -1,79 +0,0 @@
WHERE TO START
--------------
Yay! You opened the correct file first. The first thing that people notice when
they download the Zen theme is that there are A LOT of files -- way more than
other themes.
Don't worry! You don't need to learn everything all at once in order to make a
drupal theme. Zen will do the bits you haven't learned and patiently wait for
you to discover the documentation and inline comments about them.
SUGGESTED READING
-----------------
Installation
If you don't know how to install a Drupal theme, there is a quick primer later
in this document.
Building a sub-theme
See the STARTERKIT/README.txt file for full instructions.
Theme .info file
Your sub-theme's .info file holds the basic information about your theme that
Drupal needs to know: its name, description, features, template regions, CSS
files, and JavaScript. Don't worry about all these lines just yet.
CSS
Once you have created your sub-theme, look at the README.txt in your
sub-theme's css folder.
Templates
Now take a look at the README.txt in your sub-theme's templates folder.
ONLINE READING
--------------
Full documentation on the Zen theme can be found in Drupal's Handbook:
http://drupal.org/node/193318
Excellent documentation on Drupal theming can be found in the Theme Guide:
http://drupal.org/theme-guide
INSTALLATION
------------
1. Download Zen from http://drupal.org/project/zen
2. Unpack the downloaded file, take the entire zen folder and place it in your
Drupal installation under one of the following locations:
sites/all/themes
making it available to the default Drupal site and to all Drupal sites
in a multi-site configuration
sites/default/themes
making it available to only the default Drupal site
sites/example.com/themes
making it available to only the example.com site if there is a
sites/example.com/settings.php configuration file
Please note: you will need to create the "theme" folder under "sites/all/"
or "sites/default/".
For more information about acceptable theme installation directories, read
the sites/default/default.settings.php file in your Drupal installation.
3. Log in as an administrator on your Drupal site and go to Administer > Site
building > Themes (admin/build/themes). You will see the Zen theme there
with links on how to create your own sub-theme. You can optionally make Zen
the default theme.
4. Now build your own sub-theme by reading the STARTERKIT/README.txt file.
5. Internet explorer has a nasty bug that limits you to 31 stylsheets total. To
get around this limitation during theme development, download, install and
configure the "IE CSS Optimizer" module.
http://drupal.org/project/ie_css_optimizer

View file

@ -1,127 +0,0 @@
BUILD YOUR OWN SUB-THEME
------------------------
*** IMPORTANT ***
* In Drupal 6, the theme system caches template files and which theme functions
should be called. What that means is if you add a new theme or preprocess
function to your template.php file or add a new template (.tpl.php) file to
your sub-theme, you will need to rebuild the "theme registry." See
http://drupal.org/node/173880#theme-registry
* Drupal 6 also stores a cache of the data in .info files. If you modify any
lines in your sub-theme's .info file, you MUST refresh Drupal 6's cache by
simply visiting the admin/build/themes page.
The base Zen theme is designed to be easily extended by its sub-themes. You
shouldn't modify any of the CSS or PHP files in the zen/ folder; but instead you
should create a sub-theme of zen which is located in a folder outside of the
root zen/ folder. The examples below assume zen and your sub-theme will be
installed in sites/all/themes/, but any valid theme directory is acceptable
(read the sites/default/default.settings.php for more info.)
Why? To learn why you shouldn't modify any of the files in the zen/ folder,
see http://drupal.org/node/245802
1. Copy the STARTERKIT folder out of the zen/ folder and rename it to be your
new sub-theme. IMPORTANT: The name of your sub-theme must start with an
alphabetic character and can only contain lowercase letters, numbers and
underscores.
For example, copy the sites/all/themes/zen/STARTERKIT folder and rename it
as sites/all/themes/foo.
Why? Each theme should reside in its own folder. To make it easier to
upgrade Zen, sub-themes should reside in a folder separate from their base
theme.
2. In your new sub-theme folder, rename the STARTERKIT.info.txt file to include
the name of your new sub-theme and remove the ".txt" extension. Then edit
the .info file by editing the name and description field.
For example, rename the foo/STARTERKIT.info.txt file to foo/foo.info. Edit
the foo.info file and change "name = Zen Sub-theme Starter Kit" to
"name = Foo" and "description = Read..." to "description = A Zen sub-theme".
Why? The .info file describes the basic things about your theme: its
name, description, features, template regions, CSS files, and JavaScript
files. See the Drupal 6 Theme Guide for more info:
http://drupal.org/node/171205
Then, visit your site's admin/build/themes to refresh Drupal 6's cache of
.info file data.
3. By default your new sub-theme is using a fixed-width layout. If you want a
liquid layout for your theme, delete the unneeded layout-fixed.css and
layout-fixed-rtl.css files and edit your sub-theme's .info file and replace
the reference to layout-fixed.css with layout-liquid.css.
For example, edit foo/foo.info and change this line:
stylesheets[all][] = css/layout-fixed.css
to:
stylesheets[all][] = css/layout-liquid.css
Why? The "stylesheets" lines in your .info file describe the media type
and path to the CSS file you want to include. The format for these lines
is: stylesheets[MEDIA][] = path/to/file.css
Then, visit your site's admin/build/themes to refresh Drupal 6's cache of
.info file data.
Alternatively, if you are more familiar with a different CSS layout method,
such as Blueprint or 960.gs, you can replace the "css/layout-fixed.css" line
in your .info file with a line pointing at your choice of layout CSS file.
4. Edit the template.php and theme-settings.php files in your sub-theme's
folder; replace ALL occurrences of "STARTERKIT" with the name of your
sub-theme.
For example, edit foo/template.php and foo/theme-settings.php and replace
every occurrence of "STARTERKIT" with "foo".
It is recommended to use a text editing application with search and
"replace all" functionality.
5. Log in as an administrator on your Drupal site and go to Administer > Site
building > Themes (admin/build/themes) and enable your new sub-theme.
6. Internet explorer has a nasty bug that limits you to 31 stylsheets total. To
get around this limitation during theme development, download, install and
configure the "IE CSS Optimizer" module.
http://drupal.org/project/ie_css_optimizer
On a production server, you should enable full optimization of the "Optimize
CSS files" option on the Admin Performance page at
admin/settings/performance.
Optional:
7. MODIFYING ZEN CORE TEMPLATE FILES:
If you decide you want to modify any of the .tpl.php template files in the
zen folder, copy them to your sub-theme's folder before making any changes.
And then rebuild the theme registry.
For example, copy zen/templates/page.tpl.php to foo/templates/page.tpl.php.
8. THEMEING DRUPAL'S SEARCH FORM:
Copy the search-theme-form.tpl.php template file from the modules/search/
folder and place it in your sub-theme's folder. And then rebuild the theme
registry.
You can find a full list of Drupal templates that you can override in the
templates/README.txt file or http://drupal.org/node/190815
Why? In Drupal 6 theming, if you want to modify a template included by a
module, you should copy the template file from the module's directory to
your sub-theme's directory and then rebuild the theme registry. See the
Drupal 6 Theme Guide for more info: http://drupal.org/node/173880
9. FURTHER EXTENSIONS OF YOUR SUB-THEME:
Discover further ways to extend your sub-theme by reading Zen's
documentation online at:
http://drupal.org/node/193318
and Drupal 6's Theme Guide online at:
http://drupal.org/theme-guide

View file

@ -1,96 +0,0 @@
; The name and description of the theme used on the admin/build/themes page.
name = Zen Sub-theme Starter Kit
description = Read the <a href="http://drupal.org/node/629510">online docs</a> or the included README.txt on how to create a Zen sub-theme.
; The screenshot used on the admin/build/themes page.
screenshot = screenshot.png
; "core" specifies the version of Drupal that this theme is compatible with.
; "base theme" specifies that this is a theme that uses the "zen" theme as its
; base theme. Its unlikely you will ever need to change these, but they are
; required fields for a Zen sub-theme. The "engine" field is not used in a
; sub-theme since the engine is inherited from its base theme.
core = 6.x
base theme = zen
; This section adds CSS files to your theme. The media type is specified in
; the brackets. Typical CSS media types include "all", "screen", "print", and
; "handheld". See http://www.w3.org/TR/CSS21/media.html#media-types for a full
; list of stylesheet media types in CSS 2.1. The iPhone's preferred media type
; is based on the CSS3 Media queries. http://www.w3.org/TR/css3-mediaqueries/
;
; You can also override any of Zen's stylesheets or any module's stylesheets,
; an /extremely/ useful feature. See the excellent Drupal 6 Theme Guide at
; http://drupal.org/node/263967 for more details.
stylesheets[all][] = css/html-reset.css
stylesheets[all][] = css/wireframes.css
stylesheets[all][] = css/layout-fixed.css
stylesheets[all][] = css/page-backgrounds.css
stylesheets[all][] = css/tabs.css
stylesheets[all][] = css/messages.css
stylesheets[all][] = css/pages.css
stylesheets[all][] = css/block-editing.css
stylesheets[all][] = css/blocks.css
stylesheets[all][] = css/navigation.css
stylesheets[all][] = css/panels-styles.css
stylesheets[all][] = css/views-styles.css
stylesheets[all][] = css/nodes.css
stylesheets[all][] = css/comments.css
stylesheets[all][] = css/forms.css
stylesheets[all][] = css/fields.css
stylesheets[print][] = css/print.css
; stylesheets[handheld][] = css/mobile.css
; stylesheets[only screen and (max-device-width: 480px)][] = css/iphone.css
; Set the conditional stylesheets that are processed by IE.
conditional-stylesheets[if IE][all][] = css/ie.css
conditional-stylesheets[if lte IE 6][all][] = css/ie6.css
; Optionally add some JavaScripts to your theme.
; scripts[] = js/script.js
; The regions defined in Zen's default page.tpl.php file. The name in
; brackets is the name of the variable in the page.tpl.php file, (e.g.
; "[content_top]" in the .info file means there should be a $content_top
; variable in the page.tpl.php file.) The text after the equals sign is a
; descriptive text used on the admin/build/blocks page.
;
; To add a new region, copy Zen's page.tpl.php to your sub-theme's directory,
; add a line line to this file, and then add the new variable to your
; page.tpl.php template.
regions[sidebar_first] = First sidebar
regions[sidebar_second] = Second sidebar
regions[navigation] = Navigation bar
regions[highlight] = Highlighted content
regions[content_top] = Content top
regions[content_bottom] = Content bottom
regions[header] = Header
regions[footer] = Footer
regions[page_closure] = Page closure
; Various page elements output by the theme can be toggled on and off. The
; "features" control which of these check boxes display on the
; admin/build/themes config page. This is useful for suppressing check boxes
; for elements not used by your sub-theme. To suppress a check box, omit the
; entry for it below. See the Drupal 6 Theme Guide for more info:
; http://drupal.org/node/171205#features
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture
features[] = comment_user_picture
features[] = search
features[] = favicon
features[] = primary_links
features[] = secondary_links
; Set the default settings to be used in theme-settings.php
settings[zen_block_editing] = 1
settings[zen_breadcrumb] = yes
settings[zen_breadcrumb_separator] = ' '
settings[zen_breadcrumb_home] = 1
settings[zen_breadcrumb_trailing] = 1
settings[zen_breadcrumb_title] = 0
settings[zen_rebuild_registry] = 1
settings[zen_wireframes] = 0

View file

@ -1,134 +0,0 @@
ZEN'S STYLESHEETS
-----------------
Don't panic!
There are 28 CSS files in this sub-theme, but its not as bad as it first seems:
- The drupal6-reference.css is just a reference file and isn't used directly by
your sub-theme. See below.
- There are 9 CSS files whose names end in "-rtl.css". Those are CSS files
needed to style content written in Right-to-Left languages, such as Arabic and
Hebrew. If your website doesn't use such languages, you can safely delete all
of those CSS files.
- If you aren't using this theme while doing wireframes of the functionality of
your sub-theme, you can remove wireframes.css from your sub-theme's .info file
and delete the file as well.
That leaves just 17 CSS files. (Okay, still quite a few, but better than 28.)
- Instead of one monolithic stylesheet, your sub-theme's CSS files are organized
into several smaller stylesheets that are grouped to allow cascading across
common Drupal template files.
- The order of the stylesheets is designed to allow CSS authors to use the
lowest specificity possible to achieve the required styling.
ORDER AND PURPOSE OF DEFAULT STYLESHEETS
----------------------------------------
First off, if you find you don't like this organization of stylesheets, you are
free to change it; simply edit the stylesheet declarations in your sub-theme's
.info file. This structure was crafted based on several years of experience
theming Drupal websites.
- html-reset.css:
This is the place where you should set the default styling for all HTML
elements and standardize the styling across browsers. If you prefer a specific
reset method, feel free to add it.
- layout-fixed.css:
- layout-liquid.css:
Zen's default layout is based on the Zen Columns layout method. The
layout-fixed.css file is used by default and can be swapped with the
layout-liquid.css file. These files are designed to be easily replaced. If you
are more familiar with a different CSS layout method, such as Blueprint or
960.gs, you can replace these files with your choice of layout CSS file.
- page-backgrounds.css:
Layered backgrounds across scattered divs can be easier to manage if they are
centralized in one location.
- tabs.css:
- messages.css:
While most of the CSS rulesets in your sub-theme are guidelines without any
actual properties, the tabs and messages stylesheets contain actual styling
for Drupal tabs and Drupal status messages; two common Drupal elements that
are often neglected by site desiners. Zen provides some basic styling which
you are free to use or to rip out and replace.
- pages.css:
Page styling for the markup in the page.tpl.php template.
- blocks.css:
Block styling for the markup in the block.tpl.php template.
- navigation.css:
The styling for your site's menus can get quite bulky and its easier to see
all the styles if they are grouped together rather then across the
header/footer sections of pages.css and in blocks.css.
- views-styles.css:
Views styling for the markup in various views templates. You'll notice this
stylesheet isn't called "views.css" as that would override (remove) the Views
module's stylesheet.
- nodes.css:
Node styling for the markkup in the node.tpl.php template.
- comments.css:
Comment styling for the markup in the comment-wrapper.tpl.php and
comments.tpl.php templates.
- forms.css:
Form styling for the markup in various Drupal forms.
- fields.css:
Field styling for the markup produced by theme_field().
- print.css:
The print styles for all markup.
- ie.css:
- ie6.css:
The Internet Explorer stylesheets are added via conditional comments. Many CSS
authors find using IE "conditional stylesheets" much easier then writing
rulesets with CSS hacks that are known to only apply to various versions of
IE. An alternative method presented by Paul Irish can be found at
http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
In these stylesheets, we have included all of the classes and IDs from this
theme's tpl.php files. We have also included many of the useful Drupal core
styles to make it easier for theme developers to see them.
DRUPAL CORE'S STYLESHEETS
-------------------------
Many of these styles are over-riding Drupal's core stylesheets, so if you remove
a declaration from them, the styles may still not be what you want since
Drupal's core stylesheets are still styling the element. See the
drupal6-reference.css file for a complete list of all Drupal 6.x core styles.
In addition to the style declarations in these stylesheets, other Drupal styles
that you might want to override or augment are those for:
Book Navigation See line 74 of drupal6-reference.css file
Forum See line 197 of drupal6-reference.css file
Menus See line 667 of drupal6-reference.css file
News Aggregator See line 20 of drupal6-reference.css file
Polls See line 287 of drupal6-reference.css file
Search See line 320 of drupal6-reference.css file
User Profiles See line 945 of drupal6-reference.css file
INTERNET EXLORER HATES YOU
--------------------------
All versions of IE limit you to 31 stylesheets total. What that means is that
only the first 31 stylesheets will load, ignoring the others. So you'll have
missing styles in IE7 and later and a broken layout in IE6.
This is a known bug in IE: http://support.microsoft.com/kb/262161
Please read http://john.albin.net/css/ie-stylesheets-not-loading for the gory
details.

View file

@ -1,10 +0,0 @@
/**
* @file
* RTL companion for the block-editing.css file.
*/
div.block.with-block-editing div.edit {
left: 0;
right: auto;
}

View file

@ -1,25 +0,0 @@
/**
* @file
* Zen's rollover edit links for blocks.
*/
div.block.with-block-editing {
position: relative;
}
div.block.with-block-editing div.edit {
display: none;
position: absolute;
right: 0; /* LTR */
top: 0;
z-index: 40;
border: 1px solid #eee;
padding: 0 2px;
font-size: 0.75em;
background-color: #fff;
}
div.block.with-block-editing:hover div.edit {
display: block;
}

View file

@ -1,96 +0,0 @@
/**
* @file
* Block Styling
*/
.block /* Block wrapper */ {
margin-bottom: 1em;
}
.block.first /* The first block in the region */ {
}
.block.last /* The last block in the region */ {
}
.block.region-odd /* Zebra striping for each block in the region */ {
}
.block.region-even /* Zebra striping for each block in the region */ {
}
.block.odd /* Zebra striping independent of each region */ {
}
.block.even /* Zebra striping independent of each region */ {
}
.region-count-1 /* Incremental count for each block in the region */ {
}
.count-1 /* Incremental count independent of each region */ {
}
.block h2.title /* Block title */ {
}
.block .content /* Block's content wrapper */ {
}
#block-aggregator-category-1 /* Block for the latest news items in the first category */ {
}
#block-aggregator-feed-1 /* Block for the latest news items in the first feed */ {
}
#block-block-1 /* First administrator-defined block */ {
}
#block-blog-0 /* "Recent blog posts" block */ {
}
#block-book-0 /* "Book navigation" block for the current book's table of contents */ {
}
#block-comment-0 /* "Recent comments" block */ {
}
#block-forum-0 /* "Active forum topics" block */ {
}
#block-forum-1 /* "New forum topics" block */ {
}
#block-menu-primary-links /* "Primary links" block */ {
}
#block-menu-secondary-links /* "Secondary links" block */ {
}
#block-node-0 /* "Syndicate" block for primary RSS feed */ {
}
#block-poll-0 /* "Most recent poll" block */ {
}
#block-profile-0 /* "Author information" block for the profile of the page's author */ {
}
#block-search-0 /* "Search form" block */ {
}
#block-statistics-0 /* "Popular content" block */ {
}
#block-user-0 /* "User login form" block */ {
}
#block-user-1 /* "Navigation" block for Drupal navigation menu */ {
}
#block-user-2 /* "Who's new" block for a list of the newest users */ {
}
#block-user-3 /* "Who's online" block for a list of the online users */ {
}

View file

@ -1,79 +0,0 @@
/**
* @file
* Comment Styling
*/
#comments /* Wrapper for the list of comments and its title */ {
margin: 1em 0;
}
#comments h2.title /* Heading for the list of comments */ {
}
.comment /* Wrapper for a single comment */ {
}
.comment-preview /* Preview of the comment before submitting new or updated comment */ {
}
.comment.new /* A new comment since the user last viewed the page. */ {
}
.comment.first /* The first comment in the list of comments */ {
}
.comment.last /* The last comment in the list of comments */ {
}
.comment.odd /* An odd-numbered comment in the list of comments */ {
}
.comment.even /* An even-numbered comment in the list of comments */ {
}
.comment-unpublished /* Unpublished comments */ {
/* background-color: #fff4f4; */ /* Drupal core uses a #fff4f4 background */
}
.comment-unpublished div.unpublished /* The word "Unpublished" displayed underneath the content. See also the div.unpublished declaration in the nodes.css. */ {
}
.comment-by-anonymous /* A comment created by an anonymous user */ {
}
.comment-by-node-author /* A comment created by the node's author */ {
}
.comment-by-viewer /* A comment created by the current user */ {
}
.comment h3.title /* Comment title */ {
}
.new /* "New" marker for comments that are new for the current user */ {
color: #c00;
}
.comment .picture /* The picture of the comment author */ {
}
.comment .submitted /* The "posted by" information */ {
}
.comment .content /* Comment's content wrapper */ {
}
.comment .user-signature /* The user's signature */ {
}
.comment ul.links /* Comment links. See also the ul.links declaration in the pages.css. */ {
}
.indented /* Nested comments are indented */ {
/* margin-left: 25px; */ /* Drupal core uses a 25px left margin */
}
.preview .comment /* Preview of the comment before submitting new or updated comment */ {
/* background-color: #ffffea; */ /* Drupal core uses a #ffffea background */
}

File diff suppressed because it is too large Load diff

View file

@ -1,44 +0,0 @@
/**
* @file
* Field Styling
*/
/*
* Field types
*/
.field /* Wrapper for any CCK field. */ {
}
.field-type-datetime /* Always use "datetime" when creating new CCK date fields. "date" and "datestamp" are legacy types. */ {
}
.field-type-filefield /* Field from filefield module */ {
}
.field-type-nodereference {
}
.field-type-number-decimal {
}
.field-type-number-float {
}
.field-type-number-integer {
}
.field-type-text {
}
.field-type-userreference {
}
/*
* Named fields
*/
.field-field-FIELDNAME /* Underscores in field name are replaced with dashes. */ {
}

View file

@ -1,46 +0,0 @@
/**
* @file
* RTL companion for the forms.css file.
*/
/*
* Drupal's default login form block
*/
#user-login-form {
text-align: right;
}
/*
* OpenID
*
* The default styling for the OpenID login link seems to assume Garland's
* styling of list items.
*/
#user-login-form li.openid-link /* The "Log in using OpenID" link. */ {
margin-left: 0;
margin-right: -20px; /* Un-do some of the padding on the ul list. */
}
#user-login li.openid-link,
#user-login li.user-link /* The OpenID links on the /user form. */ {
margin-left: 0;
margin-right: -2em; /* Un-do all of the padding on the ul list. */
}
/*
* Drupal admin tables
*
* We overrode these styles in html-elements.css, but restore them for the admin
* section of the site.
*/
form th,
form thead th {
text-align: right;
padding-left: 1em;
padding-right: 0;
}

View file

@ -1,134 +0,0 @@
/**
* @file
* Form Styling
*/
.form-item,
.form-checkboxes,
.form-radios /* Wrapper for a form element (or group of form elements) and its label */ {
margin: 1em 0;
}
.form-item input.error,
.form-item textarea.error,
.form-item select.error /* Highlight the form elements that caused a form submission error */ {
border: 2px solid #c00;
}
.form-item label /* The label for a form element */ {
display: block;
font-weight: bold;
}
.form-item label.option /* The label for a radio button or checkbox */ {
display: inline;
font-weight: normal;
}
.form-required /* The part of the label that indicates a required field */ {
color: #c00;
}
.form-item .description /* The descriptive help text (separate from the label) */ {
font-size: 0.85em;
}
.form-checkboxes .form-item,
.form-radios .form-item /* Pack groups of checkboxes and radio buttons closer together */ {
margin: 0.4em 0;
}
.form-submit /* The submit button */ {
}
.container-inline div,
.container-inline label /* Inline labels and form divs */ {
display: inline;
}
.tips /* Tips for Drupal's input formats */ {
}
/*
* Search (search-theme-form.tpl.php)
*/
#search-box /* Wrapper for the search form */ {
}
#edit-search-theme-form-1-wrapper label /* Label that says "Search this site:" */ {
display: none;
}
/*
* Search (search-block-form.tpl.php)
*/
#search-block-form /* Wrapper for the search form */ {
}
#edit-search-block-form-1-wrapper label /* Label that says "Search this site:" */ {
display: none;
}
/*
* Drupal's default login form block
*/
#user-login-form {
text-align: left; /* LTR */
}
/*
* OpenID
*
* The default styling for the OpenID login link seems to assume Garland's
* styling of list items.
*/
#user-login-form ul /* OpenID creates a new ul above the login form's links. */ {
margin-bottom: 0; /* Position OpenID's ul next to the rest of the links. */
}
#user-login-form li.openid-link /* The "Log in using OpenID" link. */ {
margin-top: 1em;
margin-left: -20px; /* LTR */ /* Un-do some of the padding on the ul list. */
}
#user-login-form li.user-link /* The "Cancel OpenID login" link. */ {
margin-top: 1em;
}
#user-login ul {
margin: 1em 0;
}
#user-login li.openid-link,
#user-login li.user-link /* The OpenID links on the /user form. */ {
margin-left: -2em; /* LTR */ /* Un-do all of the padding on the ul list. */
}
/*
* Drupal admin tables
*
* We overrode these styles in html-elements.css, but restore them for the admin
* section of the site.
*/
form tbody {
border-top: 1px solid #ccc;
}
form th,
form thead th {
text-align: left; /* LTR */
padding-right: 1em; /* LTR */
border-bottom: 3px solid #ccc;
}
form tbody th {
border-bottom: 1px solid #ccc;
}

View file

@ -1,37 +0,0 @@
/**
* @file
* RTL companion for the html-reset.css file.
*/
/*
* Lists
*
* We need to standardize the list item indentation.
*/
ul,
ol {
padding-left: 0;
padding-right: 2em;
}
.block ul,
.item-list ul /* Drupal overrides */ {
padding: 0 2em 0 0;
}
dd {
margin: 0 2em 0 0;
}
/*
* Tables
*
* Drupal provides table styling which is only useful for its admin section
* forms, so we override this default CSS. (We set it back in forms.css.)
*/
th,
thead th,
tbody th {
text-align: right;
}

View file

@ -1,291 +0,0 @@
/**
* @file
* HTML Element Styling
*
* Ok, I admit it. I fooled you. This isn't a "reset" stylesheet. Instead this
* is the place where you should set (not reset) the default styling for all
* HTML elements.
*
* @see http://meiert.com/en/blog/20080419/reset-style-sheets-are-bad/
* @see http://snook.ca/archives/html_and_css/no_css_reset/
*/
/*
* Fonts
*
* Our font size and line height declarations are based on the following ALA
* article:
* http://www.alistapart.com/articles/howtosizetextincss
*
* All modern browsrs use a 16px default font size. Specifying the font-size
* and line-height in ems (relative to the 16px default font) allows the user
* to resize the font in the browser and produces the most consistent results
* across different browsers.
*/
body {
font-size: 100%; /* Fixes exaggerated text resizing in IE6 and IE7 */
}
#skip-link,
#page {
/*
* To use a 12px font size on the page, delete the 14px declarations.
* to use a 14px font size on the page, delete the 12px declarations.
*/
/* Use a 12px base font size with a 16px line height */
font-size: 0.75em; /* 16px x .75 = 12px */
line-height: 1.333em; /* 12px x 1.333 = 16px */
/* Use a 14px base font size with a 18px line height */
font-size: 0.875em; /* 16px x .875 = 14px */
line-height: 1.286em; /* 14px x 1.286 = 18px */
}
body,
caption,
th,
td,
input,
textarea,
select,
option,
legend,
fieldset {
/* The following font family declarations are based on the Microsoft core web
* fonts which are common fonts available on most computer systems. The DejaVu
* fonts are commonly available on Linux systems where the MS fonts are less
* common. Tahoma and Helvetica are also widely available.
*
* A user's web browser will look at the comma-separated list and will
* attempt to use each font in turn until it finds one that is available
* on the user's computer. The final "generic" font (sans-serif or serif)
* hints at what type of font to use if the web browser doesn't find any
* of the fonts in the list.
font-family: "Times New Roman", Times, Georgia, "DejaVu Serif", serif;
font-family: Times, "Times New Roman", Georgia, "DejaVu Serif", serif;
font-family: Georgia, "Times New Roman", "DejaVu Serif", serif;
font-family: Verdana, Tahoma, "DejaVu Sans", sans-serif;
font-family: Tahoma, Verdana, "DejaVu Sans", sans-serif;
font-family: Helvetica, Arial, "Nimbus Sans L", sans-serif;
font-family: Arial, Helvetica, "Nimbus Sans L", sans-serif;
font-family: "Courier New", "DejaVu Sans Mono", monospace;
*/
font-family: Verdana, Tahoma, "DejaVu Sans", sans-serif;
}
pre,
code {
font-size: 1.1em; /* Monospace fonts can be hard to read */
font-family: "Courier New", "DejaVu Sans Mono", monospace;
}
/*
* Headings
*/
h1 {
font-size: 2em;
line-height: 1.3em;
margin-top: 0;
margin-bottom: 0.5em; /* 0.5em is equavalent to 1em in the page's base font.
Remember, a margin specified in ems is relative to
the element's font-size, not to the pages' base
font size. So, for example, if we want a 1em margin
(relative to the base font), we have to divide that
length by the element's font-size:
1em / 2em = 0.5em */
}
h2 {
font-size: 1.5em;
line-height: 1.3em;
margin-top: 0.667em; /* Equivalent to 1em in the page's base font: 1 / 1.5 = 0.667em */
margin-bottom: 0.667em;
}
h3 {
font-size: 1.3em;
line-height: 1.3em;
margin-top: 0.769em; /* Equivalent to 1em in the page's base font: 1 / 1.3 = 0.769 */
margin-bottom: 0.769em;
}
h4,
h5,
h6 {
font-size: 1.1em;
line-height: 1.3em;
margin-top: 0.909em; /* Equivalent to 1em in the page's base font: 1 / 1.1 = 0.909 */
margin-bottom: 0.909em;
}
/*
* Block-level elements
*/
p,
ul,
ol,
dl,
pre,
table,
fieldset {
margin: 1em 0;
}
blockquote {
margin: 1em 2em;
}
/*
* Lists
*
* We need to standardize the list item indentation.
*/
ul,
ol {
margin-left: 0;
padding-left: 2em; /* LTR */
}
.block ul,
.item-list ul /* Drupal overrides */ {
margin: 1em 0;
padding: 0 0 0 2em; /* LTR */
}
ul ul, ul ol,
ol ol, ol ul,
.block ul ul, .block ul ol,
.block ol ol, .block ol ul,
.item-list ul ul, .item-list ul ol,
.item-list ol ol, .item-list ol ul {
margin: 0;
}
li {
margin: 0;
padding: 0;
}
.item-list ul li /* Drupal override */ {
margin: 0;
padding: 0;
list-style: inherit;
}
ul.menu li,
li.expanded,
li.collapsed,
li.leaf /* Drupal override */ {
margin: 0;
padding: 0;
}
ul { list-style-type: disc; }
ul ul { list-style-type: circle; }
ul ul ul { list-style-type: square; }
ul ul ul ul { list-style-type: circle; }
ol { list-style-type: decimal; }
ol ol { list-style-type: lower-alpha; }
ol ol ol { list-style-type: decimal; }
dt {
margin: 0;
padding: 0;
}
dd {
margin: 0 0 0 2em;
padding: 0;
}
/*
* Links
*
* The order of link states are based on Eric Meyer's article:
* http://meyerweb.com/eric/thoughts/2007/06/11/who-ordered-the-link-states
*/
a:link {
}
a:visited {
}
a:hover,
a:focus {
}
a:active {
}
/*
* Tables
*
* Drupal provides table styling which is only useful for its admin section
* forms, so we override this default CSS. (We set it back in forms.css.)
*/
table {
border-collapse: collapse;
/* width: 100%; */ /* Prevent cramped-looking tables */
}
th,
thead th,
tbody th {
text-align: left; /* LTR */
padding: 0;
border-bottom: none;
}
tbody {
border-top: none;
}
/*
* Abbreviations
*/
abbr {
border-bottom: 1px dotted #666;
cursor: help;
white-space: nowrap;
}
abbr.created /* Date-based "abbreviations" show computer-friendly timestamps which are not human-friendly. */ {
border: none;
cursor: auto;
white-space: normal;
}
/*
* Images
*/
img {
border: 0;
}
/*
* Horizontal rules
*/
hr {
height: 1px;
border: 1px solid #666;
}
/*
* Forms
*/
form {
margin: 0;
padding: 0;
}
fieldset {
margin: 1em 0;
padding: 0.5em;
}

View file

@ -1,47 +0,0 @@
/**
* @file
* CSS targeted specifically for Internet Explorer for Windows.
*
* Any CSS in this file will apply to all versions of IE. You can target
* specific versions of IE by using conditional comments. See your sub-theme's
* .info file for an easy way to use them.
*
* While building your theme, you should be aware that IE limits Drupal to 31
* stylesheets total. The work-around for the bug is to enable CSS aggregation
* under: admin / settings / performance.
*/
/*
* Tabs
*/
ul.primary li a,
ul.primary li a .tab,
ul.secondary li a,
ul.secondary li a .tab {
cursor: pointer;
}
/*
* Drupal nodes
*/
.node-unpublished .node-inner>* {
position: relative; /* Otherwise these elements will appear below the "Unpublished" text. */
}
/*
* Drupal admin tables
*/
tr.even th,
tr.even td,
tr.odd th,
tr.odd td {
border-bottom: 1px solid #ccc; /* IE doesn't display borders on table rows */
}
/*
* Markup free clearing
*/
.clearfix {
zoom: 1;
}

View file

@ -1,12 +0,0 @@
/**
* @file
* RTL companion for the ie6.css file.
*/
/*
* Layout CSS
*/
#page {
text-align: right; /* 2nd part of IE5/IE6quirks centering hack */
}

View file

@ -1,105 +0,0 @@
/**
* @file
* CSS targeted specifically for Internet Explorer 5 and 6 for Windows.
*
* Any CSS in this file will override the rules specified in the ie.css file.
*/
/*
* Layout CSS
*/
body {
text-align: center; /* 1st part of IE5/IE6quirks centering hack */
}
#page {
text-align: left; /* LTR */ /* 2nd part of IE5/IE6quirks centering hack */
}
#main-wrapper {
zoom: 1; /* Otherwise with a liquid layout, sidebars disappear when resizing the windows in IE6 */
}
#content,
#navigation,
.region-sidebar-first,
.region-sidebar-second /* Floating divs */ {
display: inline; /* display inline or double your floated margin! [1] */
overflow: hidden; /* in ie6, overflow auto is broken [2] and so is overflow visible [3] */
overflow-y: visible;
}
/*
* Tabs - IE 5 and 6 don't support PNGs with alpha transparency.
*/
ul.primary li a,
ul.primary li a .tab,
ul.secondary li a,
ul.secondary li a .tab {
display: inline-block; /* Otherwise the blocks mistakenly get 100% width in IE6 */
}
ul.primary li a {
background: url(../images/tab-left-ie6.png) no-repeat left -38px;
}
ul.primary li a .tab {
background: url(../images/tab-right-ie6.png) no-repeat right -38px;
}
ul.primary li a:hover,
ul.primary li a:focus {
background: url(../images/tab-left-ie6.png) no-repeat left -76px;
}
ul.primary li a:hover .tab,
ul.primary li a:focus .tab {
background: url(../images/tab-right-ie6.png) no-repeat right -76px;
}
ul.primary li.active a,
ul.primary li.active a:hover,
ul.primary li.active a:focus {
background: url(../images/tab-left-ie6.png) no-repeat left 0;
}
ul.primary li.active a .tab,
ul.primary li.active a:hover .tab,
ul.primary li.active a:focus .tab {
background: url(../images/tab-right-ie6.png) no-repeat right 0;
}
/*
* Messages - IE 5 and 6 don't support PNGs with alpha transparency.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
background-image: url(../images/messages-status-ie6.png);
}
div.warning /* Medium priority messages */ {
background-image: url(../images/messages-warning-ie6.png);
}
div.error /* High priority messages. See also the .error declaration below. */ {
background-image: url(../images/messages-error-ie6.png);
}
/*
* REFERENCES
*
1. http://www.positioniseverything.net/explorer/doubled-margin.html
2. http://browservulsel.blogspot.com/2005/04/ie-overflow-auto-scrollbar-overlap.html
3. http://www.howtocreate.co.uk/wrongWithIE/?chapter=overflow%3Avisible%3B
4. http://www.ryanbrill.com/archives/multiple-classes-in-ie
*
*/

View file

@ -1,74 +0,0 @@
/**
* @file
* RTL companion for the layout-fixed.css file.
*/
/*
* Content
*/
#content,
.no-sidebars #content {
float: right;
margin-left: -960px; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.sidebar-first #content {
margin-left: -960px; /* Negative value of #content's width + right margin. */
margin-right: 200px; /* The width of .region-sidebar-first. */
}
.sidebar-second #content {
margin-left: -760px; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.two-sidebars #content {
margin-left: -760px; /* Negative value of #content's width + right margin. */
margin-right: 200px; /* The width of .region-sidebar-first */
}
/*
* Navigation
*/
#navigation {
float: right;
margin-left: -100%; /* Negative value of #navigation's width + right margin. */
margin-right: 0;
}
#navigation ul /* Primary and secondary links */ {
text-align: right;
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: right;
padding: 0 0 0 10px;
}
/*
* First sidebar
*/
.region-sidebar-first {
float: right;
margin-left: -200px; /* Negative value of .region-sidebar-first's width + right margin. */
margin-right: 0;
}
.region-sidebar-first .section {
margin: 0 0 0 20px;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: right;
margin-left: -960px; /* Negative value of .region-sidebar-second's width + right margin. */
margin-right: 760px; /* Width of content + sidebar-first. */
}
.region-sidebar-second .section {
margin: 0 20px 0 0;
}

View file

@ -1,212 +0,0 @@
/**
* @file
* Layout Styling (DIV Positioning)
*
* Define CSS classes to create a table-free, 3-column, 2-column, or single
* column layout depending on whether blocks are enabled in the left or right
* columns.
*
* This layout is based on the Zen Columns layout method.
* http://drupal.org/node/201428
*
* Only CSS that affects the layout (positioning) of major elements should be
* listed here. Such as:
* display, position, float, clear, width, height, min-width, min-height
* margin, border, padding, overflow
*/
/*
* Body
*/
body {
}
#page-wrapper,
.region-page-closure {
/*
* If you want to make the page a fixed width and centered in the viewport,
* this is the standards-compliant way to do that. See also the ie6.css file
* for the necessary IE5/IE6quirks hack to center a div.
*/
margin-left: auto;
margin-right: auto;
width: 960px;
}
#page {
}
/*
* Header
*/
#header {
}
#header .section {
}
#search-box {
}
.region-header {
clear: both; /* Clear the logo */
}
/*
* Main (container for everything else)
*/
#main-wrapper {
position: relative;
}
#main {
}
/*
* Content
*/
#content,
.no-sidebars #content {
float: left; /* LTR */
width: 960px;
margin-left: 0; /* LTR */
margin-right: -960px; /* LTR */ /* Negative value of #content's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to #content .section. */
}
.sidebar-first #content {
width: 760px;
margin-left: 200px; /* LTR */ /* The width of .region-sidebar-first. */
margin-right: -960px; /* LTR */ /* Negative value of #content's width + left margin. */
}
.sidebar-second #content {
width: 760px;
margin-left: 0; /* LTR */
margin-right: -760px; /* LTR */ /* Negative value of #content's width + left margin. */
}
.two-sidebars #content {
width: 560px;
margin-left: 200px; /* LTR */ /* The width of .region-sidebar-first */
margin-right: -760px; /* LTR */ /* Negative value of #content's width + left margin. */
}
#content .section {
margin: 0;
padding: 0;
}
/*
* Navigation
*/
#navigation {
float: left; /* LTR */
width: 100%;
margin-left: 0; /* LTR */
margin-right: -100%; /* LTR */ /* Negative value of #navigation's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to #navigation .section. */
height: 2.3em; /* The navigation can have any arbritrary height. We picked one
that is the line-height plus 1em: 1.3 + 1 = 2.3
Set this to the same value as the margin-top below. */
}
.with-navigation #content,
.with-navigation .region-sidebar-first,
.with-navigation .region-sidebar-second {
margin-top: 2.3em; /* Set this to the same value as the navigation height above. */
}
#navigation .section {
}
#navigation ul /* Primary and secondary links */ {
margin: 0;
padding: 0;
text-align: left; /* LTR */
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: left; /* LTR */
padding: 0 10px 0 0; /* LTR */
}
/*
* First sidebar
*/
.region-sidebar-first {
float: left; /* LTR */
width: 200px;
margin-left: 0; /* LTR */
margin-right: -200px; /* LTR */ /* Negative value of .region-sidebar-first's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to .region-sidebar-first .section. */
}
.region-sidebar-first .section {
margin: 0 20px 0 0; /* LTR */
padding: 0;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: left; /* LTR */
width: 200px;
margin-left: 760px; /* LTR */ /* Width of content + sidebar-first. */
margin-right: -960px; /* LTR */ /* Negative value of .region-sidebar-second's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to .region-sidebar-second .section. */
}
.region-sidebar-second .section {
margin: 0 0 0 20px; /* LTR */
padding: 0;
}
/*
* Footer
*/
#footer {
}
#footer .section {
}
/*
* Closure
*/
.region-page-closure /* See also the #page-wrapper declaration above that this div shares. */ {
}
/*
* Prevent overflowing content
*/
#header,
#content,
#navigation,
.region-sidebar-first,
.region-sidebar-second,
#footer,
.region-page-closure {
overflow: visible;
word-wrap: break-word; /* A very nice CSS3 property */
}
#navigation {
overflow: hidden; /* May need to be removed if using a dynamic drop-down menu */
}
/*
* If a div.clearfix doesn't have any content after it and its bottom edge
* touches the bottom of the viewport, Firefox and Safari will mistakenly
* place several pixels worth of space between the bottom of the div and the
* bottom of the viewport. Uncomment this CSS property to fix this.
* Note: with some over-large content, this property might cause scrollbars
* to appear on the #page-wrapper div.
*/
/*
#page-wrapper {
overflow-y: hidden;
}
*/

View file

@ -1,68 +0,0 @@
/**
* @file
* RTL companion for the layout-liquid.css file.
*/
/*
* Content
*/
#content {
float: right;
margin-left: -100%; /* Negative value of #content's width + right margin. */
margin-right: 0;
}
.sidebar-first #content .section {
padding-left: 0;
padding-right: 200px; /* The width + right margin of .region-sidebar-first. */
}
.sidebar-second #content .section {
padding-left: 200px; /* The width + left margin of .region-sidebar-second. */
padding-right: 0;
}
/*
* Navigation
*/
#navigation {
float: right;
margin-left: -100%; /* Negative value of #navigation's width + right margin. */
margin-right: 0;
}
#navigation ul /* Primary and secondary links */ {
text-align: right;
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: right;
padding: 0 0 0 10px;
}
/*
* First sidebar
*/
.region-sidebar-first {
float: right;
margin-left: -200px; /* Negative value of .region-sidebar-first's width + right margin. */
margin-right: 0;
}
.region-sidebar-first .section {
margin: 0 0 0 20px;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: left;
margin-left: 0;
margin-right: -200px; /* Negative value of .region-sidebar-second's width + left margin. */
}
.region-sidebar-second .section {
margin: 0 20px 0 0;
}

View file

@ -1,202 +0,0 @@
/**
* @file
* Layout Styling (DIV Positioning)
*
* Define CSS classes to create a table-free, 3-column, 2-column, or single
* column layout depending on whether blocks are enabled in the left or right
* columns.
*
* This layout is based on the Zen Columns layout method.
* http://drupal.org/node/201428
*
* Only CSS that affects the layout (positioning) of major elements should be
* listed here. Such as:
* display, position, float, clear, width, height, min-width, min-height
* margin, border, padding, overflow
*/
/*
* Body
*/
body {
}
#page-wrapper,
.region-page-closure {
min-width: 960px; /* Don't allow the browser to make the site unreadable. */
}
#page {
}
/*
* Header
*/
#header {
}
#header .section {
}
#search-box {
}
.region-header {
clear: both; /* Clear the logo */
}
/*
* Main (container for everything else)
*/
#main-wrapper {
position: relative;
}
#main {
}
/*
* Content
*/
#content {
float: left; /* LTR */
width: 100%;
margin-left: 0; /* LTR */
margin-right: -100%; /* LTR */ /* Negative value of #content's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to #content .section. */
}
#content .section,
.no-sidebars #content .section {
margin: 0;
padding: 0;
}
.sidebar-first #content .section {
padding-left: 200px; /* LTR */ /* The width + left margin of .region-sidebar-first. */
padding-right: 0; /* LTR */
}
.sidebar-second #content .section {
padding-left: 0; /* LTR */
padding-right: 200px; /* LTR */ /* The width + right margin of .region-sidebar-second. */
}
.two-sidebars #content .section {
padding-left: 200px; /* The width + left margin of .region-sidebar-first. */
padding-right: 200px; /* The width + right margin of .region-sidebar-second. */
}
/*
* Navigation
*/
#navigation {
float: left; /* LTR */
width: 100%;
margin-left: 0; /* LTR */
margin-right: -100%; /* LTR */ /* Negative value of #navigation's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to #navigation .section. */
height: 2.3em; /* The navigation can have any arbritrary height. We picked one
that is the line-height plus 1em: 1.3 + 1 = 2.3
Set this to the same value as the margin-top below. */
}
.with-navigation #content,
.with-navigation .region-sidebar-first,
.with-navigation .region-sidebar-second {
margin-top: 2.3em; /* Set this to the same value as the navigation height above. */
}
#navigation .section {
}
#navigation ul /* Primary and secondary links */ {
margin: 0;
padding: 0;
text-align: left; /* LTR */
}
#navigation li /* A simple method to get navigation links to appear in one line. */ {
float: left; /* LTR */
padding: 0 10px 0 0; /* LTR */
}
/*
* First sidebar
*/
.region-sidebar-first {
float: left; /* LTR */
width: 200px;
margin-left: 0; /* LTR */
margin-right: -200px; /* LTR */ /* Negative value of .region-sidebar-first's width + left margin. */
padding: 0; /* DO NOT CHANGE. Add padding or margin to .region-sidebar-first .section. */
}
.region-sidebar-first .section {
margin: 0 20px 0 0; /* LTR */
padding: 0;
}
/*
* Second sidebar
*/
.region-sidebar-second {
float: right; /* LTR */
width: 200px;
margin-left: -200px; /* LTR */ /* Negative value of .region-sidebar-second's width + right margin. */
margin-right: 0; /* LTR */
padding: 0; /* DO NOT CHANGE. Add padding or margin to .region-sidebar-second .section. */
}
.region-sidebar-second .section {
margin: 0 0 0 20px; /* LTR */
padding: 0;
}
/*
* Footer
*/
#footer {
}
#footer .section {
}
/*
* Closure
*/
.region-page-closure /* See also the #page-wrapper declaration above that this div shares. */ {
}
/*
* Prevent overflowing content
*/
#header,
#content,
#navigation,
.region-sidebar-first,
.region-sidebar-second,
#footer,
.region-page-closure {
overflow: visible;
word-wrap: break-word; /* A very nice CSS3 property */
}
#navigation {
overflow: hidden; /* May need to be removed if using a dynamic drop-down menu */
}
/*
* If a div.clearfix doesn't have any content after it and its bottom edge
* touches the bottom of the viewport, Firefox and Safari will mistakenly
* place several pixels worth of space between the bottom of the div and the
* bottom of the viewport. Uncomment this CSS property to fix this.
* Note: with some over-large content, this property might cause scrollbars
* to appear on the #page-wrapper div.
*/
/*
#page-wrapper {
overflow-y: hidden;
}
*/

View file

@ -1,13 +0,0 @@
/**
* @file
* RTL companion for the messages.css file.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
padding: 5px 35px 5px 5px;
background-position: 99.5% 5px;
}

View file

@ -1,53 +0,0 @@
/**
* @file
* Message Styling
*
* Sensible styling for Drupal's error/warning/status messages.
*/
div.messages,
div.status,
div.warning,
div.error /* Important messages (status, warning, and error) for the user */ {
min-height: 21px;
margin: 0 1em 5px 1em;
border: 2px solid #ff7;
padding: 5px 5px 5px 35px; /* LTR */
color: #000;
background-color: #ffc;
background-image: url(../images/messages-status.png);
background-repeat: no-repeat;
background-position: 5px 5px; /* LTR */
}
div.status /* Normal priority messages */ {
}
div.warning /* Medium priority messages */ {
border-color: #fc0;
background-image: url(../images/messages-warning.png);
}
div.warning,
tr.warning {
color: #000; /* Drupal core uses #220 */
background-color: #ffc;
}
div.error /* High priority messages. See also the .error declaration in pages.css. */ {
/* border: 1px solid #d77; */ /* Drupal core uses: 1px solid #d77 */
border-color: #c00;
background-image: url(../images/messages-error.png);
}
div.error,
tr.error {
color: #900; /* Drupal core uses #200 */
background-color: #fee;
}
div.messages ul {
margin-top: 0;
margin-bottom: 0;
}

View file

@ -1,44 +0,0 @@
/**
* @file
* Navigation Styling
*
* Default menu styling (ul.menu) is defined in system-menus.css.
*/
/*
* The active item in a Drupal menu
*/
li a.active {
color: #000;
}
/*
* Navigation bar
*/
#navigation {
}
.region-navigation {
}
/*
* Primary and Secondary menu links
*/
#main-menu {
}
#secondary-menu {
}
/*
* Menu blocks
*/
.block-menu {
}
/*
* "Menu block" blocks. See http://drupal.org/project/menu_block
*/
.block-menu_block {
}

View file

@ -1,81 +0,0 @@
/**
* @file
* Node Styling
*
* Style anything that isn't in the $content variable.
*/
.node /* Node wrapper */ {
}
.node-sticky /* A sticky node (displayed before others in a list) */ {
}
.node-unpublished /* Unpublished nodes */ {
/* background-color: #fff4f4; */ /* Drupal core uses a #fff4f4 background */
}
.node-unpublished div.unpublished,
.comment-unpublished div.unpublished /* The word "Unpublished" displayed underneath the content. */ {
height: 0;
overflow: visible;
color: #d8d8d8;
font-size: 75px;
line-height: 1;
font-family: Impact, "Arial Narrow", Helvetica, sans-serif;
font-weight: bold;
text-transform: uppercase;
text-align: center;
word-wrap: break-word; /* A very nice CSS3 property */
}
.node-by-viewer /* A node created by the current user */ {
}
.node-teaser /* A node displayed as teaser */ {
}
/* All nodes are given a node-type-FOO class that describes the type of
* content that it is. If you create a new content type called
* "my-custom-type", it will receive a "node-type-my-custom-type" class.
*/
.node-type-page /* Page content node */ {
}
.node-type-story /* Story content node */ {
}
.node h2.title /* Node title */ {
}
.marker /* "New" or "Updated" marker for content that is new or updated for the current user */ {
color: #c00;
}
.node .picture /* The picture of the node author */ {
}
.node.node-unpublished .picture,
.comment.comment-unpublished .picture {
position: relative; /* Otherwise floated pictures will appear below the "Unpublished" text. */
}
.node .meta /* Wrapper for submitted and terms data */ {
}
.node .submitted /* The "posted by" information */ {
}
.node .terms /* Node terms (taxonomy) */ {
}
.node .content /* Node's content wrapper */ {
}
.node ul.links /* Node links. See also the ul.links declaration in the pages.css. */ {
}
.preview .node /* Preview of the content before submitting new or updated content */ {
/* background-color: #ffffea; */ /* Drupal core uses a #ffffea background */
}

View file

@ -1,38 +0,0 @@
/**
* @file
* Page Background Styling
*
* The default layout method of Zen doesn't give themers equal-height columns.
* However, equal-height columns are difficult to achieve and totally
* unnecessary. Instead, use the Faux Columns method described in the following
* ALA article:
* http://www.alistapart.com/articles/fauxcolumns/
*/
body {
}
#page-wrapper {
}
#page {
}
#header {
}
#header .section {
}
#main-wrapper {
}
#main {
}
#footer {
}
#footer .section {
}

View file

@ -1,19 +0,0 @@
/**
* @file
* RTL companion for the pages.css file.
*/
/*
* Header
*/
#logo /* Wrapping link for logo */ {
float: right;
}
/*
* Content
*/
.more-link /* Aggregator, blog, and forum more link */ {
text-align: left;
}

View file

@ -1,314 +0,0 @@
/**
* @file
* Page Styling
*
* Style the markup found in page.tpl.php. Also includes some styling of
* miscellaneous Drupal elements that appear in the $content variable, such as
* ul.links, .pager, .more-link, etc.
*/
/*
* Body
*/
body {
margin: 0;
padding: 0;
}
#page-wrapper {
}
#page {
}
/*
* The skip navigation link will be completely hidden until a user tabs to the
* link. See http://www.webaim.org/techniques/skipnav/
*/
#skip-link a,
#skip-link a:visited {
position: absolute;
display: block;
left: 0;
top: -500px;
width: 1px;
height: 1px;
overflow: hidden;
text-align: center;
background-color: #666;
color: #fff;
}
#skip-link a:hover,
#skip-link a:active,
#skip-link a:focus {
position: static;
width: 100%;
height: auto;
padding: 2px 0 3px 0;
}
/*
* Header
*/
#header {
}
#header .section {
}
#logo /* Wrapping link for logo */ {
float: left; /* LTR */
margin: 0;
padding: 0;
}
#logo img {
vertical-align: bottom;
}
#name-and-slogan /* Wrapper for website name and slogan */ {
}
h1#site-name,
div#site-name /* The name of the website */ {
margin: 0;
font-size: 2em;
line-height: 1.3em;
}
#site-name a:link,
#site-name a:visited {
color: #000;
text-decoration: none;
}
#site-name a:hover,
#site-name a:focus {
text-decoration: underline;
}
#site-slogan /* The slogan (or tagline) of a website */ {
}
.region-header /* Wrapper for any blocks placed in the header region */ {
}
/*
* Main (container for everything else)
*/
#main-wrapper {
}
#main {
}
/*
* Content
*/
#content {
}
#content .section {
}
#mission /* The mission statement of the site (displayed on homepage) */ {
}
.region-content-top /* Wrapper for any blocks placed in the "content top" region */ {
}
.breadcrumb /* The path to the current page in the form of a list of links */ {
padding-bottom: 0; /* Undo system.css */
}
h1.title, /* The title of the page */
h2.title, /* Block title or the title of a piece of content when it is given in a list of content */
h3.title /* Comment title */ {
margin: 0;
}
tr.even /* Some tables have rows marked even or odd. */ {
/* background-color: #eee; */ /* Drupal core uses a #eee background */
}
tr.odd {
/* background-color: #eee; */ /* Drupal core uses a #eee background */
}
div.messages /* Important messages (status, warning, and error) for the user. See also the declarations in messages.css. */ {
}
div.status /* Normal priority messages */ {
}
div.warning,
tr.warning /* Medium priority messages */ {
/* border: 1px solid #f0c020; */ /* Drupal core uses: 1px solid #f0c020 */
}
div.error,
tr.error /* High priority messages. See also the .error declaration below. */ {
}
.error /* Errors that are separate from div.messages status messages. */ {
/* color: #e55; */ /* Drupal core uses a #e55 background */
}
.warning /* Warnings that are separate from div.messages status messages. */ {
/* color: #e09010; */ /* Drupal core uses a #e09010 background */
}
div.tabs /* See also the tabs.css file. */ {
}
.help /* Help text on a page */ {
margin: 1em 0;
}
.more-help-link /* Link to more help */ {
font-size: 0.85em;
text-align: right;
}
#content-area /* Wrapper for the actual page content */ {
}
ul.links /* List of links */ {
margin: 1em 0;
padding: 0;
}
ul.links.inline {
margin: 0;
display: inline;
}
ul.links li {
display: inline;
list-style-type: none;
padding: 0 0.5em;
}
.pager /* A list of page numbers when more than 1 page of content is available */ {
clear: both;
margin: 1em 0;
text-align: center;
}
.pager a,
.pager strong.pager-current /* Each page number in the pager list */ {
padding: 0.5em;
}
.feed-icons /* The links to the RSS or Atom feeds for the current list of content */ {
margin: 1em 0;
}
.more-link /* Aggregator, blog, and forum more link */ {
text-align: right; /* LTR */
}
.region-content-bottom /* Wrapper for any blocks placed in the "content bottom" region */ {
}
/*
* First sidebar (on left in LTR languages, on right in RTL)
*
* Remember to NOT add padding or margin to your .region-sidebar-first
* (see the layout.css file.)
*/
.region-sidebar-first {
}
.region-sidebar-first .section {
}
/*
* Second sidebar (on right in LTR languages, on left in RTL)
*
* Remember to NOT add padding or margin to your .region-sidebar-second
* (see the layout.css file.)
*/
.region-sidebar-second {
}
.region-sidebar-second .section {
}
/*
* Footer
*/
#footer {
}
#footer .section {
}
#footer-message /* Wrapper for the footer message from Drupal's "Site information"
and for any blocks placed in the footer region */ {
}
.region-footer {
}
/*
* Closure
*/
.region-page-closure /* Wrapper for any blocks placed in the closure region */ {
}
/*
* Drupal boxes
*
* Wrapper for Comment form, Comment viewing options, Menu admin, and
* Search results.
*/
.box /* Wrapper for box */ {
}
.box h2 /* Box title */ {
}
.box .content /* Box's content wrapper */ {
}
/*
* Markup free clearing (See: http://www.positioniseverything.net/easyclearing.html )
*/
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/**
* Hide elements from all users.
*
* Used for elements which should not be immediately displayed to any user. An
* example would be a collapsible fieldset that will be expanded with a click
* from a user. The effect of this class can be toggled with the jQuery show()
* and hide() functions.
*/
.element-hidden {
display: none;
}
/**
* Hide elements visually, but keep them available for screen-readers.
*
* Used for information required for screen-reader users to understand and use
* the site where visual display is undesirable. Information provided in this
* manner should be kept concise, to avoid unnecessary burden on the user. Must
* not be used for focusable elements (such as links and form elements) as this
* causes issues for keyboard only or voice recognition users. "!important" is
* used to prevent unintentional overrides.
*/
.element-invisible {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}

View file

@ -1,6 +0,0 @@
/**
* @file
* Panels Styling
*/

View file

@ -1,73 +0,0 @@
/**
* @file
* Print styling
*
* We provide some sane print styling for Drupal using Zen's layout method.
*/
/* underline all links */
a:link,
a:visited {
text-decoration: underline !important;
}
/* Don't underline header */
#site-name a:link,
#site-name a:visited {
text-decoration: none !important;
}
/* CSS2 selector to add visible href after links */
#content a:link:after,
#content a:visited:after {
content: " (" attr(href) ") ";
font-size: 0.8em;
font-weight: normal;
}
/* Un-float the content */
#content,
#content .section {
float: none;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
/* Turn off any background colors or images */
body,
#page-wrapper,
#page,
#main-wrapper,
#main,
#content,
#content .section {
color: #000;
background-color: transparent !important;
background-image: none !important;
}
/* Hide sidebars and nav elements */
#skip-link,
#navigation,
.region-sidebar-first,
.region-sidebar-second,
#footer,
.breadcrumb,
div.tabs,
.links,
.taxonomy,
.book-navigation,
.forum-topic-navigation,
.pager,
.feed-icons {
visibility: hidden;
display: none;
}
/* If you un-comment the "page { overflow-y: hidden; }" ruleset, Firefox clips
the content after the first page. */
#page-wrapper {
overflow-y: visible;
}

View file

@ -1,22 +0,0 @@
/**
* @file
* RTL companion for the tabs.css file.
*/
ul.primary {
padding: 0 10px 0 0;
}
ul.primary li {
float: right;
}
ul.secondary {
padding: 0 5px 0 0;
}
ul.secondary li {
float: right;
border-left: none;
}

View file

@ -1,128 +0,0 @@
/**
* @file
* Tabs Styling
*
* Adds styles for the primary and secondary tabs.
*
* Compare this with default CSS found in the system module's stylesheet (a copy
* of which is in drupal6-reference.css, line 510.)
*/
div.tabs {
margin: 0 0 5px 0;
}
ul.primary {
margin: 0;
padding: 0 0 0 10px; /* LTR */
border-width: 0;
list-style: none;
white-space: nowrap;
line-height: normal;
background: url(../images/tab-bar.png) repeat-x left bottom;
}
ul.primary li {
float: left; /* LTR */
margin: 0;
padding: 0;
}
ul.primary li a {
display: block;
height: 24px;
margin: 0;
padding: 0 0 0 5px; /* width of tab-left.png */
border-width: 0;
font-weight: bold;
text-decoration: none;
color: #777;
background-color: transparent;
background: url(../images/tab-left.png) no-repeat left -38px;
}
ul.primary li a .tab {
display: block;
height: 20px; /* 24px (parent) - 4px (padding) */
margin: 0;
padding: 4px 13px 0 6px;
border-width: 0;
line-height: 20px;
background: url(../images/tab-right.png) no-repeat right -38px;
}
ul.primary li a:hover,
ul.primary li a:focus {
border-width: 0;
background-color: transparent;
background: url(../images/tab-left.png) no-repeat left -76px;
}
ul.primary li a:hover .tab,
ul.primary li a:focus .tab {
background: url(../images/tab-right.png) no-repeat right -76px;
}
ul.primary li.active a,
ul.primary li.active a:hover,
ul.primary li.active a:focus {
border-width: 0;
color: #000;
background-color: transparent;
background: url(../images/tab-left.png) no-repeat left 0;
}
ul.primary li.active a .tab,
ul.primary li.active a:hover .tab,
ul.primary li.active a:focus .tab {
background: url(../images/tab-right.png) no-repeat right 0;
}
ul.secondary {
margin: 0;
padding: 0 0 0 5px; /* LTR */
border-bottom: 1px solid #c0c0c0;
list-style: none;
white-space: nowrap;
background: url(../images/tab-secondary-bg.png) repeat-x left bottom;
}
ul.secondary li {
float: left; /* LTR */
margin: 0 5px 0 0;
padding: 5px 0;
border-right: none; /* LTR */
}
ul.secondary a {
display: block;
height: 24px;
margin: 0;
padding: 0;
border: 1px solid #c0c0c0;
text-decoration: none;
color: #777;
background: url(../images/tab-secondary.png) repeat-x left -56px;
}
ul.secondary a .tab {
display: block;
height: 18px; /* 24px (parent) - 6px (padding) */
margin: 0;
padding: 3px 8px;
line-height: 18px;
}
ul.secondary a:hover,
ul.secondary a:focus {
background: url(../images/tab-secondary.png) repeat-x left bottom;
}
ul.secondary a.active,
ul.secondary a.active:hover,
ul.secondary a.active:focus {
border: 1px solid #c0c0c0;
color: #000;
background: url(../images/tab-secondary.png) repeat-x left top;
}

View file

@ -1,6 +0,0 @@
/**
* @file
* Views Styling
*/

View file

@ -1,24 +0,0 @@
/**
* @file
* Wireframes Styling
*
* Add wireframes to the basic layout elements.
*/
.with-wireframes #header .section,
.with-wireframes #content .section,
.with-wireframes #navigation .section,
.with-wireframes .region-sidebar-first .section,
.with-wireframes .region-sidebar-second .section,
.with-wireframes #footer .section {
margin: 1px;
padding: 2px;
border: 1px solid #ccc;
}
.with-wireframes .region-page-closure {
margin-top: 1px;
padding: 2px;
border: 1px solid #ccc;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

View file

@ -1,14 +0,0 @@
Your theme can add JavaScript files in two ways:
1. To add a JavaScript file to all pages on your website, edit your sub-theme's
.info file and add a line like this one:
scripts[] = js/my-jquery-script.js
2. To add a JavaScript file depending on a certain condition, you can add it
using some PHP code in a preprocess function:
drupal_add_js('js/my-jquery-script.js', 'theme');
For the full documentation of drupal_add_js(), see:
http://api.drupal.org/api/function/drupal_add_js

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,155 +0,0 @@
<?php
/**
* @file
* Contains theme override functions and preprocess functions for the theme.
*
* ABOUT THE TEMPLATE.PHP FILE
*
* The template.php file is one of the most useful files when creating or
* modifying Drupal themes. You can add new regions for block content, modify
* or override Drupal's theme functions, intercept or make additional
* variables available to your theme, and create custom PHP logic. For more
* information, please visit the Theme Developer's Guide on Drupal.org:
* http://drupal.org/theme-guide
*
* OVERRIDING THEME FUNCTIONS
*
* The Drupal theme system uses special theme functions to generate HTML
* output automatically. Often we wish to customize this HTML output. To do
* this, we have to override the theme function. You have to first find the
* theme function that generates the output, and then "catch" it and modify it
* here. The easiest way to do it is to copy the original function in its
* entirety and paste it here, changing the prefix from theme_ to STARTERKIT_.
* For example:
*
* original: theme_breadcrumb()
* theme override: STARTERKIT_breadcrumb()
*
* where STARTERKIT is the name of your sub-theme. For example, the
* zen_classic theme would define a zen_classic_breadcrumb() function.
*
* If you would like to override any of the theme functions used in Zen core,
* you should first look at how Zen core implements those functions:
* theme_breadcrumbs() in zen/template.php
* theme_menu_item_link() in zen/template.php
* theme_menu_local_tasks() in zen/template.php
*
* For more information, please visit the Theme Developer's Guide on
* Drupal.org: http://drupal.org/node/173880
*
* CREATE OR MODIFY VARIABLES FOR YOUR THEME
*
* Each tpl.php template file has several variables which hold various pieces
* of content. You can modify those variables (or add new ones) before they
* are used in the template files by using preprocess functions.
*
* This makes THEME_preprocess_HOOK() functions the most powerful functions
* available to themers.
*
* It works by having one preprocess function for each template file or its
* derivatives (called template suggestions). For example:
* THEME_preprocess_page alters the variables for page.tpl.php
* THEME_preprocess_node alters the variables for node.tpl.php or
* for node-forum.tpl.php
* THEME_preprocess_comment alters the variables for comment.tpl.php
* THEME_preprocess_block alters the variables for block.tpl.php
*
* For more information on preprocess functions and template suggestions,
* please visit the Theme Developer's Guide on Drupal.org:
* http://drupal.org/node/223440
* and http://drupal.org/node/190815#template-suggestions
*/
/**
* Implementation of HOOK_theme().
*/
function STARTERKIT_theme(&$existing, $type, $theme, $path) {
$hooks = zen_theme($existing, $type, $theme, $path);
// Add your theme hooks like this:
/*
$hooks['hook_name_here'] = array( // Details go here );
*/
// @TODO: Needs detailed comments. Patches welcome!
return $hooks;
}
/**
* Override or insert variables into all templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered (name of the .tpl.php file.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the page templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("page" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_page(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
// To remove a class from $classes_array, use array_diff().
//$vars['classes_array'] = array_diff($vars['classes_array'], array('class-to-remove'));
}
// */
/**
* Override or insert variables into the node templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("node" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_node(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
// Optionally, run node-type-specific preprocess functions, like
// STARTERKIT_preprocess_node_page() or STARTERKIT_preprocess_node_story().
$function = __FUNCTION__ . '_' . $vars['node']->type;
if (function_exists($function)) {
$function($vars, $hook);
}
}
// */
/**
* Override or insert variables into the comment templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("comment" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_comment(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the block templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
/* -- Delete this line if you want to use this function
function STARTERKIT_preprocess_block(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */

Some files were not shown because too many files have changed in this diff Show more