Commit fbe67deb authored by Nathan Vexler's avatar Nathan Vexler Committed by Nathan Vexler
Browse files

ODO-50 Add services endpoint to uw_ct_contact

parent cc2e548a
......@@ -24,6 +24,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'text_default',
'weight' => 6,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -133,6 +139,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'hidden',
'weight' => 9,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -193,6 +205,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'email_default',
'weight' => 2,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -256,6 +274,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'term_reference_tree',
'weight' => 10,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -325,6 +349,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'image',
'weight' => 0,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -361,6 +391,7 @@ function uw_ct_contact_field_default_field_instances() {
'entity_translation_sync' => FALSE,
'file_directory' => 'uploads/images',
'file_extensions' => 'png gif jpg jpeg',
'focal_point' => 0,
'image_field_caption' => 0,
'max_filesize' => '10 MB',
'max_resolution' => '3000x3000',
......@@ -440,6 +471,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'text_default',
'weight' => 4,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -500,6 +537,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'text_default',
'weight' => 3,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -560,6 +603,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'link_default',
'weight' => 7,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -635,6 +684,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'text_default',
'weight' => 5,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -695,6 +750,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'text_default',
'weight' => 1,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -754,6 +815,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'hidden',
'weight' => 11,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -860,6 +927,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'link_default',
'weight' => 8,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......@@ -934,6 +1007,12 @@ function uw_ct_contact_field_default_field_instances() {
'type' => 'hidden',
'weight' => 12,
),
'embedded' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'entity_teaser' => array(
'label' => 'above',
'settings' => array(),
......
......@@ -11,6 +11,9 @@ function uw_ct_contact_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "context" && $api == "context") {
return array("version" => "3");
}
if ($module == "services" && $api == "services") {
return array("version" => "3");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
......
......@@ -32,6 +32,7 @@ function uw_ct_contact_menu_default_menu_links() {
'language' => 'und',
'menu_links_customized' => 0,
);
// Translatables
// Included for use with string extractors like potx.
t('Contact groups');
......
......@@ -10,6 +10,15 @@
function uw_ct_contact_user_default_permissions() {
$permissions = array();
// Exported permission: 'administer services'.
$permissions['administer services'] = array(
'name' => 'administer services',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'create contact content'.
$permissions['create contact content'] = array(
'name' => 'create contact content',
......@@ -81,6 +90,33 @@ function uw_ct_contact_user_default_permissions() {
'module' => 'override_node_options',
);
// Exported permission: 'get a system variable'.
$permissions['get a system variable'] = array(
'name' => 'get a system variable',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'get any binary files'.
$permissions['get any binary files'] = array(
'name' => 'get any binary files',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'get own binary files'.
$permissions['get own binary files'] = array(
'name' => 'get own binary files',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'override contact authored by option'.
$permissions['override contact authored by option'] = array(
'name' => 'override contact authored by option',
......@@ -143,5 +179,32 @@ function uw_ct_contact_user_default_permissions() {
'module' => 'override_node_options',
);
// Exported permission: 'perform unlimited index queries'.
$permissions['perform unlimited index queries'] = array(
'name' => 'perform unlimited index queries',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'save file information'.
$permissions['save file information'] = array(
'name' => 'save file information',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
// Exported permission: 'set a system variable'.
$permissions['set a system variable'] = array(
'name' => 'set a system variable',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'services',
);
return $permissions;
}
name = Contact
description = Used for the contacts page to display a view of site contacts
description = Used for the contacts page to display a view of site contacts WARNING: exporting breaks services.inc file.
core = 7.x
package = uWaterloo Content Types
dependencies[] = better_formats
......@@ -17,6 +17,9 @@ dependencies[] = override_node_options
dependencies[] = rdf
dependencies[] = scheduler
dependencies[] = schemaorg
dependencies[] = services
dependencies[] = services_api_key_auth
dependencies[] = services_views
dependencies[] = strongarm
dependencies[] = taxonomy
dependencies[] = term_reference_tree
......@@ -32,6 +35,7 @@ dependencies[] = views_php
stylesheets[all][] = css/uw_ct_contact.css
features[context][] = contact_group_block
features[ctools][] = context:context:3
features[ctools][] = services:services:3
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
......@@ -61,19 +65,27 @@ features[field_instance][] = node-contact-field_contact_website_url
features[field_instance][] = node-contact-title_field
features[menu_links][] = menu-site-manager-vocabularies_contact-groups:admin/structure/taxonomy/uwaterloo_contact_group
features[node][] = contact
features[services_endpoint][] = uwaterloo_contacts_v1
features[taxonomy][] = uwaterloo_contact_group
features[user_permission][] = administer services
features[user_permission][] = create contact content
features[user_permission][] = delete any contact content
features[user_permission][] = delete own contact content
features[user_permission][] = edit any contact content
features[user_permission][] = edit own contact content
features[user_permission][] = enter contact revision log entry
features[user_permission][] = get a system variable
features[user_permission][] = get any binary files
features[user_permission][] = get own binary files
features[user_permission][] = override contact authored by option
features[user_permission][] = override contact authored on option
features[user_permission][] = override contact promote to front page option
features[user_permission][] = override contact published option
features[user_permission][] = override contact revision option
features[user_permission][] = override contact sticky option
features[user_permission][] = perform unlimited index queries
features[user_permission][] = save file information
features[user_permission][] = set a system variable
features[variable][] = comment_anonymous_contact
features[variable][] = comment_contact
features[variable][] = comment_default_mode_contact
......@@ -97,6 +109,7 @@ features[variable][] = scheduler_unpublish_enable_contact
features[variable][] = scheduler_unpublish_revision_contact
features[variable][] = schemaorg_title_contact
features[variable][] = schemaorg_type_contact
features[views_view][] = services_contacts
features[views_view][] = uw_staff_contacts_vw
features_exclude[field][node-contact-field_contact_additional_info] = node-contact-field_contact_additional_info
features_exclude[field][node-contact-field_contact_affiliation] = node-contact-field_contact_affiliation
......
<?php
/**
* @file
* uw_ct_contact.services.inc
*/
/**
* Implements hook_default_services_endpoint().
*/
function uw_ct_contact_default_services_endpoint() {
$web_service_user = user_load_by_name('WCMS web service user');
$web_service_user_id = $web_service_user->uid;
$export = array();
$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'uwaterloo_contacts_v1';
$endpoint->server = 'rest_server';
$endpoint->path = 'api/v1/contacts';
$endpoint->authentication = array(
'services_api_key_auth' => array(
'api_key' => '96ab9383e6ad48c23aa1504dc9cc5c52',
'user' => $web_service_user_id,
),
);
$endpoint->server_settings = array();
$endpoint->resources = array(
'all_contacts' => array(
'operations' => array(
'index' => array(
'enabled' => '1',
),
),
),
);
$endpoint->debug = 0;
$export['uwaterloo_contacts_v1'] = $endpoint;
return $export;
}
......@@ -10,6 +10,250 @@
function uw_ct_contact_views_default_views() {
$export = array();
$view = new view();
$view->name = 'services_contacts';
$view->description = 'View to give json feed for opportunities using services module';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Services Contacts';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'role';
$handler->display->display_options['access']['role'] = array(
17 => '17',
);
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Global: PHP */
$handler->display->display_options['fields']['php']['id'] = 'php';
$handler->display->display_options['fields']['php']['table'] = 'views';
$handler->display->display_options['fields']['php']['field'] = 'php';
$handler->display->display_options['fields']['php']['label'] = 'unique_key';
$handler->display->display_options['fields']['php']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php']['php_value'] = '$trimmed = trim(base_path(), \'/\');
$node = $data -> nid;
$unique = $trimmed. \'-\'. $node;
return $unique;';
$handler->display->display_options['fields']['php']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php']['php_click_sortable'] = '';
/* Field: Global: PHP */
$handler->display->display_options['fields']['php_2']['id'] = 'php_2';
$handler->display->display_options['fields']['php_2']['table'] = 'views';
$handler->display->display_options['fields']['php_2']['field'] = 'php';
$handler->display->display_options['fields']['php_2']['label'] = 'friendly_name';
$handler->display->display_options['fields']['php_2']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php_2']['php_value'] = '$site = variable_get(\'site_name\');
return $site;';
$handler->display->display_options['fields']['php_2']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php_2']['php_click_sortable'] = '';
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = 'nid';
/* Field: Content revision: Vid */
$handler->display->display_options['fields']['vid']['id'] = 'vid';
$handler->display->display_options['fields']['vid']['table'] = 'node_revision';
$handler->display->display_options['fields']['vid']['field'] = 'vid';
$handler->display->display_options['fields']['vid']['label'] = 'vid';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = 'full_given_name';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Field: Content: Listing page image */
$handler->display->display_options['fields']['field_contact_image']['id'] = 'field_contact_image';
$handler->display->display_options['fields']['field_contact_image']['table'] = 'field_data_field_contact_image';
$handler->display->display_options['fields']['field_contact_image']['field'] = 'field_contact_image';
$handler->display->display_options['fields']['field_contact_image']['label'] = 'avatar';
$handler->display->display_options['fields']['field_contact_image']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_contact_image']['settings'] = array(
'image_style' => '',
'image_link' => '',
);
/* Field: Content: Title or position */
$handler->display->display_options['fields']['field_contact_title']['id'] = 'field_contact_title';
$handler->display->display_options['fields']['field_contact_title']['table'] = 'field_data_field_contact_title';
$handler->display->display_options['fields']['field_contact_title']['field'] = 'field_contact_title';
$handler->display->display_options['fields']['field_contact_title']['label'] = 'title_or_position';
/* Field: Content: Contact Person */
$handler->display->display_options['fields']['field_contact_watiam_id']['id'] = 'field_contact_watiam_id';
$handler->display->display_options['fields']['field_contact_watiam_id']['table'] = 'field_data_field_contact_watiam_id';
$handler->display->display_options['fields']['field_contact_watiam_id']['field'] = 'field_contact_watiam_id';
$handler->display->display_options['fields']['field_contact_watiam_id']['label'] = 'user_id';
/* Field: Content: Phone # */
$handler->display->display_options['fields']['field_contact_phone']['id'] = 'field_contact_phone';
$handler->display->display_options['fields']['field_contact_phone']['table'] = 'field_data_field_contact_phone';
$handler->display->display_options['fields']['field_contact_phone']['field'] = 'field_contact_phone';
$handler->display->display_options['fields']['field_contact_phone']['label'] = 'primary_telephone_number';
/* Field: Content: Additional information */
$handler->display->display_options['fields']['field_contact_additional_info']['id'] = 'field_contact_additional_info';
$handler->display->display_options['fields']['field_contact_additional_info']['table'] = 'field_data_field_contact_additional_info';
$handler->display->display_options['fields']['field_contact_additional_info']['field'] = 'field_contact_additional_info';
$handler->display->display_options['fields']['field_contact_additional_info']['label'] = 'additional_info_raw';
/* Field: Global: PHP */
$handler->display->display_options['fields']['php_1']['id'] = 'php_1';
$handler->display->display_options['fields']['php_1']['table'] = 'views';
$handler->display->display_options['fields']['php_1']['field'] = 'php';
$handler->display->display_options['fields']['php_1']['label'] = 'machine_name';
$handler->display->display_options['fields']['php_1']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php_1']['php_value'] = '$trimmed = trim(base_path(), \'/\');
return $trimmed;';
$handler->display->display_options['fields']['php_1']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php_1']['php_click_sortable'] = '';
/* Field: Content: Affiliation */
$handler->display->display_options['fields']['field_contact_affiliation']['id'] = 'field_contact_affiliation';
$handler->display->display_options['fields']['field_contact_affiliation']['table'] = 'field_data_field_contact_affiliation';
$handler->display->display_options['fields']['field_contact_affiliation']['field'] = 'field_contact_affiliation';
$handler->display->display_options['fields']['field_contact_affiliation']['label'] = 'affiliation';
/* Field: Content: All taxonomy terms */
$handler->display->display_options['fields']['term_node_tid']['id'] = 'term_node_tid';
$handler->display->display_options['fields']['term_node_tid']['table'] = 'node';
$handler->display->display_options['fields']['term_node_tid']['field'] = 'term_node_tid';
$handler->display->display_options['fields']['term_node_tid']['label'] = 'group(s)';
$handler->display->display_options['fields']['term_node_tid']['limit'] = TRUE;
$handler->display->display_options['fields']['term_node_tid']['vocabularies'] = array(
'uwaterloo_contact_group' => 'uwaterloo_contact_group',
'uwaterloo_audience' => 0,
'undergrad_award_affiliation' => 0,
'bibliography_keywords' => 0,
'uw_blog_tags' => 0,
'uw_departments' => 0,
'uw_event_tags' => 0,
'uw_event_type' => 0,
'uwaterloo_profiles' => 0,
'project_role' => 0,
'project_status' => 0,
'project_topic' => 0,
'service_categories' => 0,
'strategic_alignment' => 0,
'undergrad_award_citizenship' => 0,
'undergrad_award_deadline' => 0,
'undergrad_award_detail' => 0,
'undergrad_award_enrollment' => 0,
'undergrad_award_process' => 0,
'undergrad_award_program' => 0,
'undergrad_award_term' => 0,
'undergrad_award_type' => 0,
);
/* Field: Content: Contact for */
$handler->display->display_options['fields']['field_contact_reason']['id'] = 'field_contact_reason';
$handler->display->display_options['fields']['field_contact_reason']['table'] = 'field_data_field_contact_reason';
$handler->display->display_options['fields']['field_contact_reason']['field'] = 'field_contact_reason';
$handler->display->display_options['fields']['field_contact_reason']['label'] = 'contact_for';
/* Field: Content: Email */
$handler->display->display_options['fields']['field_contact_email_address']['id'] = 'field_contact_email_address';
$handler->display->display_options['fields']['field_contact_email_address']['table'] = 'field_data_field_contact_email_address';
$handler->display->display_options['fields']['field_contact_email_address']['field'] = 'field_contact_email_address';
$handler->display->display_options['fields']['field_contact_email_address']['label'] = 'primary_email_address';
/* Field: Content: Location */
$handler->display->display_options['fields']['field_contact_location']['id'] = 'field_contact_location';
$handler->display->display_options['fields']['field_contact_location']['table'] = 'field_data_field_contact_location';
$handler->display->display_options['fields']['field_contact_location']['field'] = 'field_contact_location';
$handler->display->display_options['fields']['field_contact_location']['label'] = 'primary_office';
/* Field: Content: Link to Profile */
$handler->display->display_options['fields']['field_contact_profile_url']['id'] = 'field_contact_profile_url';
$handler->display->display_options['fields']['field_contact_profile_url']['table'] = 'field_data_field_contact_profile_url';
$handler->display->display_options['fields']['field_contact_profile_url']['field'] = 'field_contact_profile_url';
$handler->display->display_options['fields']['field_contact_profile_url']['label'] = 'profile_url';
$handler->display->display_options['fields']['field_contact_profile_url']['click_sort_column'] = 'url';
/* Field: Content: Link to Personal Website or CV */
$handler->display->display_options['fields']['field_contact_website_url']['id'] = 'field_contact_website_url';
$handler->display->display_options['fields']['field_contact_website_url']['table'] = 'field_data_field_contact_website_url';
$handler->display->display_options['fields']['field_contact_website_url']['field'] = 'field_contact_website_url';
$handler->display->display_options['fields']['field_contact_website_url']['label'] = 'homepage';
$handler->display->display_options['fields']['field_contact_website_url']['click_sort_column'] = 'url';
/* Field: Global: PHP */
$handler->display->display_options['fields']['php_3']['id'] = 'php_3';
$handler->display->display_options['fields']['php_3']['table'] = 'views';
$handler->display->display_options['fields']['php_3']['field'] = 'php';
$handler->display->display_options['fields']['php_3']['label'] = 'url';
$handler->display->display_options['fields']['php_3']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php_3']['php_value'] = 'global $base_url;
$link = drupal_lookup_path(\'alias\',"node/". $data->nid);
$service_link = $base_url. \'/\'. $link;
return $service_link;';
$handler->display->display_options['fields']['php_3']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php_3']['php_click_sortable'] = '';
/* Field: Content: Updated date */
$handler->display->display_options['fields']['changed']['id'] = 'changed';
$handler->display->display_options['fields']['changed']['table'] = 'node';
$handler->display->display_options['fields']['changed']['field'] = 'changed';
$handler->display->display_options['fields']['changed']['label'] = 'updated';
$handler->display->display_options['fields']['changed']['date_format'] = 'custom';
$handler->display->display_options['fields']['changed']['custom_date_format'] = 'c';
$handler->display->display_options['fields']['changed']['second_date_format'] = 'long';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
$handler->display->display_options['filter_groups']['groups'] = array(
1 => 'AND',
2 => 'OR',
);
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'contact' => 'contact',
);
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
/* Display: Services */
$handler = $view->new_display('services', 'Services', 'uwaterloo_contacts_services');
$handler->display->display_options['path'] = 'all_contacts';
$translatables['services_contacts'] = array(
t('Master'),
t('more'),