first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/* Feeds admin overview form. */
table.feeds-admin-importers thead th {
border: none;
}
table.feeds-admin-importers td.disabled {
color: #aaa;
}
table.feeds-admin-importers tr.disabled.odd,
table.feeds-admin-importers tr.disabled.even {
border-color: #eee;
}
table.feeds-admin-importers tr.disabled.odd {
background-color: #f5f5f5;
}
/* Feeds edit form layout. */
div.feeds-settings {
}
div.left-bar {
float: left;
position: relative;
width: 240px;
border-right: 1px solid #DDD;
padding: 10px 10px 0 0;
}
div.configuration {
padding: 10px 0 0 250px;
margin-left: -240px;
}
div.configuration-squeeze {
margin-left: 250px;
}
/* Container theming. */
div.feeds-container {
}
div.feeds-container h4 {
font-size: 1.2em;
font-weight: bold;
}
div.feeds-container.plain {
background-color: #EEE;
border-bottom: 1px solid #DDD;
border-top: 2px solid #DDD;
padding: 5px;
margin: 10px 0;
}
div.feeds-container.plain h4 {
font-size: 1.0em;
margin: 0;
padding: 0;
}
div.feeds-container-body p {
padding: 5px 0;
margin: 0;
}
div.feeds-container-body div.item-list ul {
margin: 0;
}
div.feeds-container-body div.item-list ul li {
list-style-type: none;
margin: 0;
padding: 0;
background-image: none;
}
ul.container-actions {
font-family: Arial, Helvetica;
float: right;
margin: 0;
}
ul.container-actions li {
list-style-type: none;
text-align: right;
background-image: none;
margin: 0;
padding: 0;
}
ul.container-actions .form-item,
ul.container-actions li form,
ul.container-actions li form input {
padding: 0;
margin: 0;
display: inline;
}
/* Mapping form. */
#center table form {
margin: 0;
}

View File

@@ -0,0 +1,15 @@
name = Feeds Admin UI
description = Administrative UI for Feeds module.
package = Feeds
core = 7.x
dependencies[] = feeds
configure = admin/structure/feeds
files[] = feeds_ui.test
; Information added by drupal.org packaging script on 2012-10-24
version = "7.x-2.0-alpha7"
core = "7.x"
project = "feeds"
datestamp = "1351111319"

View File

@@ -0,0 +1,13 @@
<?php
/**
* @file
* Install, uninstall, and update functions for the feeds_ui module.
*/
/**
* Empty update function to trigger a menu rebuild.
*/
function feeds_ui_update_7000() {
// Do nothing.
}

View File

@@ -0,0 +1,62 @@
Drupal.behaviors.feeds = function() {
// Hide text in specific input fields.
$('.hide-text-on-focus').focus(function() {
$(this).val('');
});
// Hide submit buttons of .feeds-ui-hidden-submit class.
$('input.form-submit.feeds-ui-hidden-submit').hide();
/**
* Tune checkboxes on mapping forms.
* @see feeds_ui_mapping_form() in feeds_ui.admin.inc
*/
// Attach submit behavior to elements with feeds-ui-trigger-submit class.
$('.feeds-ui-trigger-submit').click(function() {
// Use click, not form.submit() - submit() would use the wrong submission
// handler.
$('input.form-submit.feeds-ui-hidden-submit').click();
});
// Replace checkbox with .feeds-ui-checkbox-link class with a link.
$('.feeds-ui-checkbox-link:not(.processed)').each(function(i) {
$(this).addClass('processed').after(
'<a href="#" onclick="return false;" class="feeds-ui-trigger-remove">' + $('label', this).text() + '</a>'
).hide();
});
// Check the box and then submit.
$('.feeds-ui-trigger-remove').click(function() {
// Use click, not form.submit() - submit() would use the wrong submission
// handler.
$(this).prev().children().children().children().attr('checked', 1);
$('input.form-submit.feeds-ui-hidden-submit').click();
});
// Replace radio with .feeds-ui-radio-link class with a link.
$('.feeds-ui-radio-link:not(.processed)').parent().each(function(i) {
checked = '';
if ($(this).children('input').attr('checked')) {
checked = ' checked';
}
$(this).addClass('processed').after(
'<a href="#" onclick="return false;" class="feeds-ui-check-submit' + checked + '" id="' + $(this).children('input').attr('id') + '">' + $(this).parent().text() + '</a>'
);
$(this).hide();
});
// Hide the the radio that is selected.
$('.feeds-ui-check-submit.checked').parent().hide();
// Check the radio and then submit.
$('.feeds-ui-check-submit').click(function() {
// Use click, not form.submit() - submit() would use the wrong submission
// handler.
$('#' + $(this).attr('id')).attr('checked', 1);
$('input.form-submit.feeds-ui-hidden-submit').click();
});
};

View File

@@ -0,0 +1,137 @@
<?php
/**
* @file
*/
/**
* Implements hook_help().
*/
function feeds_ui_help($path, $arg) {
switch ($path) {
case 'admin/structure/feeds':
$output = '<p>' . t('Create one or more Feed importers for pulling content into Drupal. You can use these importers from the <a href="@import">Import</a> page or - if you attach them to a content type - simply by creating a node from that content type.', array('@import' => url('import'))) . '</p>';
return $output;
}
}
/**
* Implements hook_menu().
*/
function feeds_ui_menu() {
$items = array();
$items['admin/structure/feeds'] = array(
'title' => 'Feeds importers',
'description' => 'Configure one or more Feeds importers to aggregate RSS and Atom feeds, import CSV files or more.',
'page callback' => 'drupal_get_form',
'page arguments' => array('feeds_ui_overview_form'),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
);
$items['admin/structure/feeds/create'] = array(
'title' => 'Add importer',
'page callback' => 'drupal_get_form',
'page arguments' => array('feeds_ui_create_form'),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
'type' => MENU_LOCAL_ACTION,
);
$items['admin/structure/feeds/%feeds_importer'] = array(
'title callback' => 'feeds_ui_importer_title',
'title arguments' => array(3),
'page callback' => 'feeds_ui_edit_page',
'page arguments' => array(3),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
);
$items['admin/structure/feeds/%feeds_importer/edit'] = array(
'title' => 'Edit',
'page callback' => 'feeds_ui_edit_page',
'page arguments' => array(3),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 1,
);
$items['admin/structure/feeds/%feeds_importer/export'] = array(
'title' => 'Export',
'page callback' => 'drupal_get_form',
'page arguments' => array('feeds_ui_export_form', 3),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
$items['admin/structure/feeds/%feeds_importer/clone'] = array(
'title' => 'Clone',
'page callback' => 'drupal_get_form',
'page arguments' => array('feeds_ui_create_form', 3),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
$items['admin/structure/feeds/%feeds_importer/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array('feeds_ui_delete_form', 3),
'access arguments' => array('administer feeds'),
'file' => 'feeds_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 4,
);
return $items;
}
/**
* Implements hook_theme().
*/
function feeds_ui_theme() {
return array(
'feeds_ui_overview_form' => array(
'render element' => 'form',
'file' => 'feeds_ui.admin.inc',
),
'feeds_ui_mapping_form' => array(
'render element' => 'form',
'file' => 'feeds_ui.admin.inc',
),
'feeds_ui_edit_page' => array(
'variables' => array('info' => NULL, 'active' => NULL),
'file' => 'feeds_ui.admin.inc',
),
'feeds_ui_plugin_form' => array(
'render element' => 'form',
'file' => 'feeds_ui.admin.inc',
),
'feeds_ui_container' => array(
'variables' => array('container' => NULL),
'file' => 'feeds_ui.admin.inc',
),
);
}
/**
* Implements hook_admin_menu_map().
*/
function feeds_ui_admin_menu_map() {
// Add awareness to the administration menu of the various importers so they
// are included in the dropdown menu.
if (!user_access('administer feeds')) {
return;
}
$map['admin/structure/feeds/%feeds_importer'] = array(
'parent' => 'admin/structure/feeds',
'arguments' => array(
array('%feeds_importer' => feeds_enabled_importers()),
),
);
return $map;
}
/**
* Title callback for importers.
*/
function feeds_ui_importer_title($importer) {
return t('@importer', array('@importer' => $importer->config['name']));
}

View File

@@ -0,0 +1,117 @@
<?php
/**
* @file
* Tests for Feeds Admin UI module.
*/
/**
* Test basic Feeds UI functionality.
*/
class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase {
public static function getInfo() {
return array(
'name' => 'Feeds UI user interface',
'description' => 'Tests Feeds Admin UI module\'s GUI.',
'group' => 'Feeds',
);
}
/**
* UI functionality tests on
* feeds_ui_overview(),
* feeds_ui_create_form(),
* Change plugins on feeds_ui_edit_page().
*/
public function testEditFeedConfiguration() {
// Create an importer.
$this->createImporterConfiguration('Test feed', 'test_feed');
// Assert UI elements.
$this->drupalGet('admin/structure/feeds/test_feed');
$this->assertText('Basic settings');
$this->assertText('Fetcher');
$this->assertText('HTTP Fetcher');
$this->assertText('Parser');
$this->assertText('Common syndication parser');
$this->assertText('Processor');
$this->assertText('Node processor');
$this->assertText('Getting started');
$this->assertRaw('admin/structure/feeds/test_feed/settings');
$this->assertRaw('admin/structure/feeds/test_feed/settings/FeedsNodeProcessor');
$this->assertRaw('admin/structure/feeds/test_feed/fetcher');
$this->assertRaw('admin/structure/feeds/test_feed/parser');
$this->assertRaw('admin/structure/feeds/test_feed/processor');
$this->drupalGet('import');
$this->assertText('Basic page');
// Select some other plugins.
$this->drupalGet('admin/structure/feeds/test_feed');
$this->clickLink('Change', 0);
$this->assertText('Select a fetcher');
$edit = array(
'plugin_key' => 'FeedsFileFetcher',
);
$this->drupalPost('admin/structure/feeds/test_feed/fetcher', $edit, 'Save');
$this->clickLink('Change', 1);
$this->assertText('Select a parser');
$edit = array(
'plugin_key' => 'FeedsCSVParser',
);
$this->drupalPost('admin/structure/feeds/test_feed/parser', $edit, 'Save');
$this->clickLink('Change', 2);
$this->assertText('Select a processor');
$edit = array(
'plugin_key' => 'FeedsUserProcessor',
);
$this->drupalPost('admin/structure/feeds/test_feed/processor', $edit, 'Save');
// Assert changed configuration.
$this->assertPlugins('test_feed', 'FeedsFileFetcher', 'FeedsCSVParser', 'FeedsUserProcessor');
// Delete importer.
$this->drupalPost('admin/structure/feeds/test_feed/delete', array(), 'Delete');
$this->drupalGet('import');
$this->assertNoText('Test feed');
// Create the same importer again.
$this->createImporterConfiguration('Test feed', 'test_feed');
// Test basic settings settings.
$edit = array(
'name' => 'Syndication feed',
'content_type' => 'page',
'import_period' => 3600,
);
$this->drupalPost('admin/structure/feeds/test_feed/settings', $edit, 'Save');
// Assert results of change.
$this->assertText('Syndication feed');
$this->assertText('Your changes have been saved.');
$this->assertText('Attached to: Basic page');
$this->assertText('Periodic import: every 1 hour');
$this->drupalGet('admin/structure/feeds');
$this->assertLink('Basic page');
// Configure processor.
$edit = array(
'content_type' => 'article',
);
$this->drupalPost('admin/structure/feeds/test_feed/settings/FeedsNodeProcessor', $edit, 'Save');
$this->assertFieldByName('content_type', 'article');
// Create a feed node.
$edit = array(
'title' => 'Development Seed',
'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2',
);
$this->drupalPost('node/add/page', $edit, 'Save');
$this->assertText('Basic page Development Seed has been created.');
// @todo Refreshing/deleting feed items. Needs to live in feeds.test
}
}