Skip to content
This repository has been archived by the owner on Jul 26, 2019. It is now read-only.

Commit

Permalink
Adding candidate data importers and other stuff
Browse files Browse the repository at this point in the history
referenences #80
  • Loading branch information
Sumeet Pareek committed Jan 27, 2014
1 parent 512b7f7 commit d286349
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
* Implements hook_ctools_plugin_api().
*/
function f_candidate_details_ctools_plugin_api() {
list($module, $api) = func_get_args();
if ($module == "feeds" && $api == "feeds_importer_default") {
return array("version" => "1");
}
list($module, $api) = func_get_args();
if ($module == "feeds_tamper" && $api == "feeds_tamper_default") {
return array("version" => "2");
}
list($module, $api) = func_get_args();
if ($module == "page_manager" && $api == "pages_default") {
return array("version" => "1");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* @file
* f_candidate_details.features.metatag.inc
*/

/**
* Implements hook_metatag_export_default().
*/
function f_candidate_details_metatag_export_default() {
$config = array();

// Exported Metatag config instance: node:ct_candidate_details.
$config['node:ct_candidate_details'] = array(
'instance' => 'node:ct_candidate_details',
'config' => array(
'title' => array(
'value' => '[node:field_cd_name] | [node:field_cd_pc] Constituency Candidate | India Lok Sabha Elections 2014 | [site:name]',
),
),
);

return $config;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ function f_candidate_details_user_default_permissions() {
'module' => 'panelizer',
);

// Exported permission: clear candidate_data_import feeds.
$permissions['clear candidate_data_import feeds'] = array(
'name' => 'clear candidate_data_import feeds',
'roles' => array(),
'module' => 'feeds',
);

// Exported permission: create ct_candidate_details content.
$permissions['create ct_candidate_details content'] = array(
'name' => 'create ct_candidate_details content',
Expand Down Expand Up @@ -87,6 +94,17 @@ function f_candidate_details_user_default_permissions() {
'module' => 'node',
);

// Exported permission: import candidate_data_import feeds.
$permissions['import candidate_data_import feeds'] = array(
'name' => 'import candidate_data_import feeds',
'roles' => array(
'Administrator' => 'Administrator',
'Content Approver' => 'Content Approver',
'Content Author' => 'Content Author',
),
'module' => 'feeds',
);

// Exported permission: publish any ct_candidate_details content.
$permissions['publish any ct_candidate_details content'] = array(
'name' => 'publish any ct_candidate_details content',
Expand All @@ -108,6 +126,22 @@ function f_candidate_details_user_default_permissions() {
'module' => 'publishcontent',
);

// Exported permission: tamper candidate_data_import.
$permissions['tamper candidate_data_import'] = array(
'name' => 'tamper candidate_data_import',
'roles' => array(
'Administrator' => 'Administrator',
),
'module' => 'feeds_tamper',
);

// Exported permission: unlock candidate_data_import feeds.
$permissions['unlock candidate_data_import feeds'] = array(
'name' => 'unlock candidate_data_import feeds',
'roles' => array(),
'module' => 'feeds',
);

// Exported permission: unpublish any ct_candidate_details content.
$permissions['unpublish any ct_candidate_details content'] = array(
'name' => 'unpublish any ct_candidate_details content',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/**
* @file
* f_candidate_details.feeds_importer_default.inc
*/

/**
* Implements hook_feeds_importer_default().
*/
function f_candidate_details_feeds_importer_default() {
$export = array();

$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'candidate_data_import';
$feeds_importer->config = array(
'name' => 'Candidate Data Import',
'description' => '',
'fetcher' => array(
'plugin_key' => 'FeedsFileFetcher',
'config' => array(
'allowed_extensions' => 'txt csv tsv xml opml',
'direct' => 0,
'directory' => 'private://feeds',
'allowed_schemes' => array(
'public' => 'public',
'private' => 'private',
),
),
),
'parser' => array(
'plugin_key' => 'FeedsCSVParser',
'config' => array(
'delimiter' => ',',
'no_headers' => 0,
),
),
'processor' => array(
'plugin_key' => 'FeedsNodeProcessor',
'config' => array(
'expire' => '-1',
'author' => '1',
'authorize' => 0,
'mappings' => array(
0 => array(
'source' => 'name',
'target' => 'field_cd_name',
'unique' => FALSE,
),
1 => array(
'source' => 'state',
'target' => 'field_cd_state',
'unique' => FALSE,
),
2 => array(
'source' => 'loksabha',
'target' => 'field_cd_pc',
'unique' => FALSE,
),
3 => array(
'source' => 'mobile',
'target' => 'field_cd_phone',
'unique' => FALSE,
),
4 => array(
'source' => 'email',
'target' => 'field_cd_email',
'unique' => FALSE,
),
5 => array(
'source' => 'gender',
'target' => 'field_cd_gender',
'unique' => FALSE,
),
6 => array(
'source' => 'dob',
'target' => 'field_cd_dob_text',
'unique' => FALSE,
),
7 => array(
'source' => 'education',
'target' => 'field_cd_education_qualification',
'unique' => FALSE,
),
8 => array(
'source' => 'name',
'target' => 'title',
'unique' => FALSE,
),
9 => array(
'source' => 'link',
'target' => 'field_cd_links:url',
'unique' => FALSE,
),
10 => array(
'source' => 'linktitle',
'target' => 'field_cd_links:title',
'unique' => FALSE,
),
),
'update_existing' => '0',
'input_format' => 'plain_text',
'skip_hash_check' => 0,
'bundle' => 'ct_candidate_details',
),
),
'content_type' => '',
'update' => 0,
'import_period' => '-1',
'expire_period' => 3600,
'import_on_create' => 1,
'process_in_background' => 0,
);
$export['candidate_data_import'] = $feeds_importer;

return $export;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @file
* f_candidate_details.feeds_tamper_default.inc
*/

/**
* Implements hook_feeds_tamper_default().
*/
function f_candidate_details_feeds_tamper_default() {
$export = array();

$feeds_tamper = new stdClass();
$feeds_tamper->disabled = FALSE; /* Edit this to true to make a default feeds_tamper disabled initially */
$feeds_tamper->api_version = 2;
$feeds_tamper->id = 'candidate_data_import-gender-convert_case';
$feeds_tamper->importer = 'candidate_data_import';
$feeds_tamper->source = 'gender';
$feeds_tamper->plugin_id = 'convert_case';
$feeds_tamper->settings = array(
'mode' => '1',
);
$feeds_tamper->weight = 0;
$feeds_tamper->description = 'Convert case';
$export['candidate_data_import-gender-convert_case'] = $feeds_tamper;

return $export;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@ version = 7.x-1.0
project = f_candidate_details
dependencies[] = ctools
dependencies[] = f_site_controller
dependencies[] = features
dependencies[] = feeds
dependencies[] = feeds_tamper
dependencies[] = image
dependencies[] = link
dependencies[] = list
dependencies[] = metatag
dependencies[] = number
dependencies[] = page_manager
dependencies[] = panelizer
dependencies[] = publishcontent
dependencies[] = views
features[ctools][] = feeds:feeds_importer_default:1
features[ctools][] = feeds_tamper:feeds_tamper_default:2
features[ctools][] = page_manager:pages_default:1
features[ctools][] = panelizer:panelizer:1
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:1
features[feeds_importer][] = candidate_data_import
features[feeds_tamper][] = candidate_data_import-gender-convert_case
features[field][] = node-ct_candidate_details-field_cd_address
features[field][] = node-ct_candidate_details-field_cd_age
features[field][] = node-ct_candidate_details-field_cd_dob_text
Expand All @@ -37,6 +45,7 @@ features[field][] = node-ct_candidate_details-field_cd_profession_occupation
features[field][] = node-ct_candidate_details-field_cd_special_category
features[field][] = node-ct_candidate_details-field_cd_state
features[field][] = node-ct_candidate_details-field_cd_state_text
features[metatag][] = node:ct_candidate_details
features[node][] = ct_candidate_details
features[page_manager_handlers][] = term_view_panel_context
features[panelizer_defaults][] = node:ct_candidate_details:default:default
Expand All @@ -48,14 +57,18 @@ features[user_permission][] = administer panelizer node ct_candidate_details def
features[user_permission][] = administer panelizer node ct_candidate_details layout
features[user_permission][] = administer panelizer node ct_candidate_details overview
features[user_permission][] = administer panelizer node ct_candidate_details settings
features[user_permission][] = clear candidate_data_import feeds
features[user_permission][] = create ct_candidate_details content
features[user_permission][] = delete any ct_candidate_details content
features[user_permission][] = delete own ct_candidate_details content
features[user_permission][] = edit any ct_candidate_details content
features[user_permission][] = edit own ct_candidate_details content
features[user_permission][] = import candidate_data_import feeds
features[user_permission][] = publish any ct_candidate_details content
features[user_permission][] = publish editable ct_candidate_details content
features[user_permission][] = publish own ct_candidate_details content
features[user_permission][] = tamper candidate_data_import
features[user_permission][] = unlock candidate_data_import feeds
features[user_permission][] = unpublish any ct_candidate_details content
features[user_permission][] = unpublish editable ct_candidate_details content
features[user_permission][] = unpublish own ct_candidate_details content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ function f_site_controller_taxonomy_default_vocabularies() {
'module' => 'taxonomy',
'weight' => '0',
),
'vocab_pc' => array(
'name' => 'Parliament Constituencies',
'machine_name' => 'vocab_pc',
'description' => 'List of Parliament Constituencies of India',
'hierarchy' => '0',
'module' => 'taxonomy',
'weight' => '0',
),
'vocab_states' => array(
'name' => 'States',
'machine_name' => 'vocab_states',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name = Site Controller
description = Holds site wide components and deployment related install hooks
core = 7.x
package = AAP Features
php = 5.2.4
version = 7.x-1.0
project = f_site_controller
dependencies[] = ctools
Expand All @@ -15,5 +16,5 @@ features[taxonomy][] = vocab_elections
features[taxonomy][] = vocab_pc
features[taxonomy][] = vocab_states
features[variable][] = pathauto_taxonomy_term_vocab_elections_pattern
features[variable][] = pathauto_taxonomy_term_vocab_pc_pattern
features[variable][] = pathauto_taxonomy_term_vocab_ls_pattern
features[variable][] = pathauto_taxonomy_term_vocab_states_pattern
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ function f_site_controller_strongarm() {
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'pathauto_taxonomy_term_vocab_pc_pattern';
$strongarm->value = 'parliament-constituency/[term:name]';
$export['pathauto_taxonomy_term_vocab_pc_pattern'] = $strongarm;
$strongarm->name = 'pathauto_taxonomy_term_vocab_ls_pattern';
$strongarm->value = 'candidate-details-by-lok-sabha/[term:name]';
$export['pathauto_taxonomy_term_vocab_ls_pattern'] = $strongarm;

$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'pathauto_taxonomy_term_vocab_states_pattern';
$strongarm->value = 'state/[term:name]';
$strongarm->value = 'candidate-details-by-state/[term:name]';
$export['pathauto_taxonomy_term_vocab_states_pattern'] = $strongarm;

return $export;
Expand Down

0 comments on commit d286349

Please sign in to comment.