diff --git a/ding_campaign.admin.inc b/ding_campaign.admin.inc index 133e47d..314eee6 100644 --- a/ding_campaign.admin.inc +++ b/ding_campaign.admin.inc @@ -136,13 +136,16 @@ function ding_campaign_add_rule($form, $form_state) { */ function ding_campaign_campaign_rule_form_submit($form, &$form_state) { $c = count($form_state['input']['rule_type']); + $nid = $form_state['build_info']['args'][0]->nid; if ($c > 0) { // Delete existing rules. db_delete('ding_campaign_rules') - ->condition('cid', $form_state['build_info']['args'][0]->nid) + ->condition('cid', $nid) ->execute(); + entity_get_controller('node')->resetCache(array($nid)); + // Add new rules. for ($i = 0; $i < $c; $i++) { if ($form_state['input']['rule_value'][$i] != '' || $form_state['input']['rule_type'][$i] == 'rule_generic') { @@ -206,8 +209,8 @@ function ding_campaign_rule_form($rule = NULL, $type = NULL) { '#type' => 'textfield', '#title' => t('Rule value'), '#default_value' => ($rule) ? $rule : '', - '#size' => 24, - '#maxlength' => 24, + '#size' => 64, + '#maxlength' => 255, '#prefix' => '
', '#suffix' => '
', '#autocomplete_path' => 'ding_campaign/autocomplete/' . $type, diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.features.field_base.inc b/ding_campaign.features.field_base.inc similarity index 88% rename from modules/ding_campaign_ctype/ding_campaign_ctype.features.field_base.inc rename to ding_campaign.features.field_base.inc index 050ae98..9c5b515 100644 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.features.field_base.inc +++ b/ding_campaign.features.field_base.inc @@ -1,13 +1,13 @@ 'entityreference', ); + // Exported field_base: 'field_camp_behavior' + $field_bases['field_camp_behavior'] = array( + 'active' => 1, + 'cardinality' => 1, + 'deleted' => 0, + 'entity_types' => array(), + 'field_name' => 'field_camp_behavior', + 'foreign keys' => array(), + 'indexes' => array( + 'value' => array( + 0 => 'value', + ), + ), + 'locked' => 0, + 'module' => 'list', + 'settings' => array( + 'allowed_values' => array( + 0 => '', + 1 => '', + ), + 'allowed_values_function' => '', + 'profile2_private' => FALSE, + ), + 'translatable' => 0, + 'type' => 'list_boolean', + ); + // Exported field_base: 'field_camp_image' $field_bases['field_camp_image'] = array( 'active' => 1, diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.features.field_instance.inc b/ding_campaign.features.field_instance.inc similarity index 86% rename from modules/ding_campaign_ctype/ding_campaign_ctype.features.field_instance.inc rename to ding_campaign.features.field_instance.inc index 1753c37..9fc4396 100644 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.features.field_instance.inc +++ b/ding_campaign.features.field_instance.inc @@ -1,13 +1,13 @@ 'ding_campaign', + 'default_value' => array( + 0 => array( + 'value' => 0, + ), + ), + 'deleted' => 0, + 'description' => 'If set, the clicked campaign will open in a new tab/window', + 'display' => array( + 'default' => array( + 'label' => 'above', + 'module' => 'list', + 'settings' => array(), + 'type' => 'list_default', + 'weight' => 8, + ), + 'full' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + 'teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + 'teaser_highlight' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + ), + 'entity_type' => 'node', + 'field_name' => 'field_camp_behavior', + 'label' => 'Open in new tab/window', + 'required' => 0, + 'settings' => array( + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'options', + 'settings' => array( + 'display_label' => 1, + ), + 'type' => 'options_onoff', + 'weight' => 7, + ), + ); + // Exported field_instance: 'node-ding_campaign-field_camp_image' $field_instances['node-ding_campaign-field_camp_image'] = array( 'bundle' => 'ding_campaign', @@ -259,7 +314,7 @@ function ding_campaign_ctype_field_default_field_instances() { 'module' => 'options', 'settings' => array(), 'type' => 'options_buttons', - 'weight' => 4, + 'weight' => 2, ), ); @@ -429,7 +484,9 @@ function ding_campaign_ctype_field_default_field_instances() { t('Campaign link'); t('Campaign settings'); t('Campaign text'); + t('If set, the clicked campaign will open in a new tab/window'); t('Libraries and Groups'); + t('Open in new tab/window'); t('Weight'); return $field_instances; diff --git a/ding_campaign.features.inc b/ding_campaign.features.inc new file mode 100644 index 0000000..c8c743f --- /dev/null +++ b/ding_campaign.features.inc @@ -0,0 +1,280 @@ + "1"); + } +} + +/** + * Implements hook_image_default_styles(). + */ +function ding_campaign_image_default_styles() { + $styles = array(); + + // Exported image style: ding_campaign_p_100. + $styles['ding_campaign_p_100'] = array( + 'name' => 'ding_campaign_p_100', + 'label' => 'Campaign (100% - 1200px)', + 'effects' => array( + 7 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 1200, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_p_25. + $styles['ding_campaign_p_25'] = array( + 'name' => 'ding_campaign_p_25', + 'label' => 'Campaign (25% - 280px)', + 'effects' => array( + 1 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 280, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_p_33. + $styles['ding_campaign_p_33'] = array( + 'name' => 'ding_campaign_p_33', + 'label' => 'Campaign (33% - 380px)', + 'effects' => array( + 3 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 380, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_p_50. + $styles['ding_campaign_p_50'] = array( + 'name' => 'ding_campaign_p_50', + 'label' => 'Campaign (50% - 580px)', + 'effects' => array( + 4 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 580, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_p_66. + $styles['ding_campaign_p_66'] = array( + 'name' => 'ding_campaign_p_66', + 'label' => 'Campaign (66% - 780px)', + 'effects' => array( + 5 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 780, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_p_75. + $styles['ding_campaign_p_75'] = array( + 'name' => 'ding_campaign_p_75', + 'label' => 'Campaign (75% - 880px)', + 'effects' => array( + 6 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 880, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + ); + + // Exported image style: ding_campaign_w_180. + $styles['ding_campaign_w_180'] = array( + 'name' => 'ding_campaign_w_180', + 'effects' => array( + 3 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 180, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + 'label' => 'ding_campaign_w_180', + ); + + // Exported image style: ding_campaign_w_280. + $styles['ding_campaign_w_280'] = array( + 'name' => 'ding_campaign_w_280', + 'effects' => array( + 4 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 280, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + 'label' => 'ding_campaign_w_280', + ); + + // Exported image style: ding_campaign_w_380. + $styles['ding_campaign_w_380'] = array( + 'name' => 'ding_campaign_w_380', + 'effects' => array( + 5 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 380, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + 'label' => 'ding_campaign_w_380', + ); + + // Exported image style: ding_campaign_w_480. + $styles['ding_campaign_w_480'] = array( + 'name' => 'ding_campaign_w_480', + 'effects' => array( + 6 => array( + 'label' => 'Scale', + 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', + 'effect callback' => 'image_scale_effect', + 'dimensions callback' => 'image_scale_dimensions', + 'form callback' => 'image_scale_form', + 'summary theme' => 'image_scale_summary', + 'module' => 'image', + 'name' => 'image_scale', + 'data' => array( + 'width' => 480, + 'height' => '', + 'upscale' => 1, + ), + 'weight' => 1, + ), + ), + 'label' => 'ding_campaign_w_480', + ); + + return $styles; +} + +/** + * Implements hook_node_info(). + */ +function ding_campaign_node_info() { + $items = array( + 'ding_campaign' => array( + 'name' => t('Campaign'), + 'base' => 'node_content', + 'description' => t('Create a new campaign that based on different rules will be shown in a given context on the site.'), + 'has_title' => '1', + 'title_label' => t('Campaign name'), + 'help' => '', + ), + ); + return $items; +} diff --git a/ding_campaign.info b/ding_campaign.info index 41b2ca3..c3c3d61 100644 --- a/ding_campaign.info +++ b/ding_campaign.info @@ -1,11 +1,69 @@ -name = Ding campaign -description = Campaign system. Displays context-sensitive, ad-like campaigns. -package = Ding! -version = "7.x-0.4" -core = 7.x -configure = admin/config/ding/campaign -dependencies[] = field -dependencies[] = image -dependencies[] = features -dependencies[] = ctools -dependencies[] = ding_campaign_ctype +name = Ding campaign +description = Campaign system. Displays context-sensitive, ad-like campaigns. +core = 7.x +package = Ding! +version = 7.x-2.3.1+easy +project = ding_campaign +dependencies[] = ctools +dependencies[] = entityreference +dependencies[] = features +dependencies[] = image +dependencies[] = list +dependencies[] = media +dependencies[] = og_ui +dependencies[] = scheduler +dependencies[] = strongarm +dependencies[] = text +configure = admin/config/ding/campaign +features[ctools][] = strongarm:strongarm:1 +features[features_api][] = api:2 +features[field_base][] = ding_campaign_group_ref +features[field_base][] = field_camp_behavior +features[field_base][] = field_camp_image +features[field_base][] = field_camp_link +features[field_base][] = field_camp_settings +features[field_base][] = field_camp_text_full +features[field_base][] = field_camp_text_plain +features[field_base][] = field_camp_weight +features[field_instance][] = node-ding_campaign-ding_campaign_group_ref +features[field_instance][] = node-ding_campaign-field_camp_behavior +features[field_instance][] = node-ding_campaign-field_camp_image +features[field_instance][] = node-ding_campaign-field_camp_link +features[field_instance][] = node-ding_campaign-field_camp_settings +features[field_instance][] = node-ding_campaign-field_camp_text_full +features[field_instance][] = node-ding_campaign-field_camp_text_plain +features[field_instance][] = node-ding_campaign-field_camp_weight +features[image][] = ding_campaign_p_100 +features[image][] = ding_campaign_p_25 +features[image][] = ding_campaign_p_33 +features[image][] = ding_campaign_p_50 +features[image][] = ding_campaign_p_66 +features[image][] = ding_campaign_p_75 +features[image][] = ding_campaign_w_180 +features[image][] = ding_campaign_w_280 +features[image][] = ding_campaign_w_380 +features[image][] = ding_campaign_w_480 +features[node][] = ding_campaign +features[variable][] = comment_anonymous_ding_campaign +features[variable][] = comment_default_mode_ding_campaign +features[variable][] = comment_default_per_page_ding_campaign +features[variable][] = comment_ding_campaign +features[variable][] = comment_form_location_ding_campaign +features[variable][] = comment_preview_ding_campaign +features[variable][] = comment_subject_field_ding_campaign +features[variable][] = field_bundle_settings_node__ding_campaign +features[variable][] = language_content_type_ding_campaign +features[variable][] = menu_options_ding_campaign +features[variable][] = menu_parent_ding_campaign +features[variable][] = node_options_ding_campaign +features[variable][] = node_preview_ding_campaign +features[variable][] = node_submitted_ding_campaign +features[variable][] = scheduler_publish_enable_ding_campaign +features[variable][] = scheduler_publish_required_ding_campaign +features[variable][] = scheduler_publish_revision_ding_campaign +features[variable][] = scheduler_publish_touch_ding_campaign +features[variable][] = scheduler_unpublish_enable_ding_campaign +features[variable][] = scheduler_unpublish_required_ding_campaign +features[variable][] = scheduler_unpublish_revision_ding_campaign +features_exclude[dependencies][options] = options +mtime = 1431613941 diff --git a/ding_campaign.install b/ding_campaign.install index 0907213..43ffc8e 100644 --- a/ding_campaign.install +++ b/ding_campaign.install @@ -117,3 +117,16 @@ function ding_campaign_update_7002(&$sandbox) { function ding_campaign_update_7003(&$sandbox) { return db_drop_field('ding_campaign', 'pane_id'); } + +/** + * Expand the rule column max length. + */ +function ding_campaign_update_7004() { + $new_def = array( + 'type' => 'varchar', + 'length' => 255, + ); + + db_change_field('ding_campaign_rules', 'rule', 'rule', $new_def); +} + diff --git a/ding_campaign.module b/ding_campaign.module index dc75fb7..f03023f 100644 --- a/ding_campaign.module +++ b/ding_campaign.module @@ -4,6 +4,8 @@ * Provides campaign feature to various node types in Ding. */ +include_once 'ding_campaign.features.inc'; + /** * Implements hook_menu(). */ @@ -170,6 +172,7 @@ function ding_campaign_display($context, $count, $offset, $style = 'medium') { // Get link value. $link = $wrapper->field_camp_link->value(); + if (!empty($link)) { $current['#link'] = array( '#theme' => 'link', @@ -180,21 +183,25 @@ function ding_campaign_display($context, $count, $offset, $style = 'medium') { 'class' => array( 'ding-campaing--link', ), - 'target' => '_blank', ), 'html' => FALSE, 'absolute' => TRUE, ), ); + + if ($wrapper->field_camp_behavior->value()) { + $current['#link']['#options']['attributes']['target'] = '_blank'; + } } // Get text both plain and full. $text = $wrapper->field_camp_text_plain->value(); - $text = !empty($text) ? $text : $wrapper->field_camp_text_full->value(); + $text = (!empty($text)) ? $text : $wrapper->field_camp_text_full->value(); if (!empty($text)) { $current['#text'] = array( - 'content' => $text, + '#markup' => (is_array($text) && isset($text['safe_value'])) ? $text['safe_value'] : $text, ); + unset($current['#link']); } // Get image. @@ -212,12 +219,11 @@ function ding_campaign_display($context, $count, $offset, $style = 'medium') { if (!empty($link)) { // Sadly the link theme function do not generate children. $image = $current['#image']; - $current['#image'] = $current['#link']; + $current['#image'] = (isset($current['#link'])) ? $current['#link'] : NULL; $current['#image']['#text'] = drupal_render($image); $current['#image']['#options']['html'] = TRUE; } } - // Get weight. $weight = $wrapper->field_camp_weight->value(); if (!empty($weight)) { @@ -447,6 +453,47 @@ function ding_campaign_form_alter(&$form, &$form_state, $form_id) { } } +/** + * Implements hook_form_FORM_ID_alter(). + */ +function ding_campaign_form_ding_campaign_node_form_alter(&$form, &$form_state) { + // Add states for form elements based on Campaign settings selected options. + $form['field_camp_text_full']['#states'] = array( + 'visible' => array( + ':input[name="field_camp_settings[und]"]' => array('value' => 'full'), + ), + ); + $form['field_camp_text_plain']['#states'] = array( + 'visible' => array( + ':input[name="field_camp_settings[und]"]' => array('value' => 'plain'), + ), + ); + $form['field_camp_image']['#states'] = array( + 'visible' => array( + ':input[name="field_camp_settings[und]"]' => array('value' => 'image'), + ), + ); + array_unshift($form['actions']['submit']['#submit'], 'ding_campaign_form_ding_campaign_node_form_submit'); +} + +function ding_campaign_form_ding_campaign_node_form_submit(&$form, &$form_state) { + $field_camp_settings = $form_state['values']['field_camp_settings'][LANGUAGE_NONE][0]['value']; + switch ($field_camp_settings) { + case 'full': + $form_state['values']['field_camp_text_plain'][LANGUAGE_NONE][0]['value'] = ''; + $form_state['values']['field_camp_image'][LANGUAGE_NONE][0]['fid'] = ''; + break; + case 'plain': + $form_state['values']['field_camp_text_full'][LANGUAGE_NONE][0]['value'] = ''; + $form_state['values']['field_camp_image'][LANGUAGE_NONE][0]['fid'] = ''; + break; + case 'image': + $form_state['values']['field_camp_text_full'][LANGUAGE_NONE][0]['value'] = ''; + $form_state['values']['field_camp_text_plain'][LANGUAGE_NONE][0]['value'] = ''; + break; + } +} + /** * Implements hook_node_insert(). */ diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.strongarm.inc b/ding_campaign.strongarm.inc similarity index 71% rename from modules/ding_campaign_ctype/ding_campaign_ctype.strongarm.inc rename to ding_campaign.strongarm.inc index 1ea55dd..078fc1a 100644 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.strongarm.inc +++ b/ding_campaign.strongarm.inc @@ -1,13 +1,13 @@ disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ $strongarm->api_version = 1; - $strongarm->name = 'opening_hours_enabled_ding_campaign'; + $strongarm->name = 'scheduler_publish_enable_ding_campaign'; + $strongarm->value = 1; + $export['scheduler_publish_enable_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_publish_required_ding_campaign'; + $strongarm->value = 0; + $export['scheduler_publish_required_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_publish_revision_ding_campaign'; + $strongarm->value = 0; + $export['scheduler_publish_revision_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_publish_touch_ding_campaign'; + $strongarm->value = 1; + $export['scheduler_publish_touch_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_unpublish_enable_ding_campaign'; + $strongarm->value = 1; + $export['scheduler_unpublish_enable_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_unpublish_required_ding_campaign'; + $strongarm->value = 0; + $export['scheduler_unpublish_required_ding_campaign'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'scheduler_unpublish_revision_ding_campaign'; $strongarm->value = 0; - $export['opening_hours_enabled_ding_campaign'] = $strongarm; + $export['scheduler_unpublish_revision_ding_campaign'] = $strongarm; return $export; } diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.features.inc b/modules/ding_campaign_ctype/ding_campaign_ctype.features.inc deleted file mode 100644 index 5c7282b..0000000 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.features.inc +++ /dev/null @@ -1,141 +0,0 @@ - "1"); - } - list($module, $api) = func_get_args(); - if ($module == "strongarm" && $api == "strongarm") { - return array("version" => "1"); - } -} - -/** - * Implements hook_image_default_styles(). - */ -function ding_campaign_ctype_image_default_styles() { - $styles = array(); - - // Exported image style: ding_campaign_w_180. - $styles['ding_campaign_w_180'] = array( - 'name' => 'ding_campaign_w_180', - 'effects' => array( - 3 => array( - 'label' => 'Scale', - 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', - 'effect callback' => 'image_scale_effect', - 'dimensions callback' => 'image_scale_dimensions', - 'form callback' => 'image_scale_form', - 'summary theme' => 'image_scale_summary', - 'module' => 'image', - 'name' => 'image_scale', - 'data' => array( - 'width' => 180, - 'height' => '', - 'upscale' => 1, - ), - 'weight' => 1, - ), - ), - 'label' => 'ding_campaign_w_180', - ); - - // Exported image style: ding_campaign_w_280. - $styles['ding_campaign_w_280'] = array( - 'name' => 'ding_campaign_w_280', - 'effects' => array( - 4 => array( - 'label' => 'Scale', - 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', - 'effect callback' => 'image_scale_effect', - 'dimensions callback' => 'image_scale_dimensions', - 'form callback' => 'image_scale_form', - 'summary theme' => 'image_scale_summary', - 'module' => 'image', - 'name' => 'image_scale', - 'data' => array( - 'width' => 280, - 'height' => '', - 'upscale' => 1, - ), - 'weight' => 1, - ), - ), - 'label' => 'ding_campaign_w_280', - ); - - // Exported image style: ding_campaign_w_380. - $styles['ding_campaign_w_380'] = array( - 'name' => 'ding_campaign_w_380', - 'effects' => array( - 5 => array( - 'label' => 'Scale', - 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', - 'effect callback' => 'image_scale_effect', - 'dimensions callback' => 'image_scale_dimensions', - 'form callback' => 'image_scale_form', - 'summary theme' => 'image_scale_summary', - 'module' => 'image', - 'name' => 'image_scale', - 'data' => array( - 'width' => 380, - 'height' => '', - 'upscale' => 1, - ), - 'weight' => 1, - ), - ), - 'label' => 'ding_campaign_w_380', - ); - - // Exported image style: ding_campaign_w_480. - $styles['ding_campaign_w_480'] = array( - 'name' => 'ding_campaign_w_480', - 'effects' => array( - 6 => array( - 'label' => 'Scale', - 'help' => 'Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.', - 'effect callback' => 'image_scale_effect', - 'dimensions callback' => 'image_scale_dimensions', - 'form callback' => 'image_scale_form', - 'summary theme' => 'image_scale_summary', - 'module' => 'image', - 'name' => 'image_scale', - 'data' => array( - 'width' => 480, - 'height' => '', - 'upscale' => 1, - ), - 'weight' => 1, - ), - ), - 'label' => 'ding_campaign_w_480', - ); - - return $styles; -} - -/** - * Implements hook_node_info(). - */ -function ding_campaign_ctype_node_info() { - $items = array( - 'ding_campaign' => array( - 'name' => t('Campaign'), - 'base' => 'node_content', - 'description' => t('Create a new campaign that based on different rules will be shown in a given context on the site.'), - 'has_title' => '1', - 'title_label' => t('Campaign name'), - 'help' => '', - ), - ); - return $items; -} diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.field_group.inc b/modules/ding_campaign_ctype/ding_campaign_ctype.field_group.inc deleted file mode 100644 index 60df614..0000000 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.field_group.inc +++ /dev/null @@ -1,99 +0,0 @@ -disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */ - $field_group->api_version = 1; - $field_group->identifier = 'group_ding_campaign_content|node|ding_campaign|form'; - $field_group->group_name = 'group_ding_campaign_content'; - $field_group->entity_type = 'node'; - $field_group->bundle = 'ding_campaign'; - $field_group->mode = 'form'; - $field_group->parent_name = ''; - $field_group->data = array( - 'label' => 'Content', - 'weight' => '3', - 'children' => array( - 0 => 'field_camp_link', - 1 => 'field_camp_text_full', - 2 => 'field_camp_text_plain', - ), - 'format_type' => 'fieldset', - 'format_settings' => array( - 'formatter' => 'collapsible', - 'instance_settings' => array( - 'description' => '', - 'classes' => '', - 'required_fields' => 1, - ), - ), - ); - $export['group_ding_campaign_content|node|ding_campaign|form'] = $field_group; - - $field_group = new stdClass(); - $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */ - $field_group->api_version = 1; - $field_group->identifier = 'group_ding_campaign_images|node|ding_campaign|form'; - $field_group->group_name = 'group_ding_campaign_images'; - $field_group->entity_type = 'node'; - $field_group->bundle = 'ding_campaign'; - $field_group->mode = 'form'; - $field_group->parent_name = ''; - $field_group->data = array( - 'label' => 'Images', - 'weight' => '2', - 'children' => array( - 0 => 'field_camp_image', - ), - 'format_type' => 'fieldset', - 'format_settings' => array( - 'formatter' => 'collapsible', - 'instance_settings' => array( - 'description' => '', - 'classes' => '', - 'required_fields' => 1, - ), - ), - ); - $export['group_ding_campaign_images|node|ding_campaign|form'] = $field_group; - - $field_group = new stdClass(); - $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */ - $field_group->api_version = 1; - $field_group->identifier = 'group_ding_campaign_settings|node|ding_campaign|form'; - $field_group->group_name = 'group_ding_campaign_settings'; - $field_group->entity_type = 'node'; - $field_group->bundle = 'ding_campaign'; - $field_group->mode = 'form'; - $field_group->parent_name = ''; - $field_group->data = array( - 'label' => 'Settings', - 'weight' => '1', - 'children' => array( - 0 => 'field_camp_settings', - 1 => 'field_camp_weight', - 2 => 'ding_campaign_group_ref', - ), - 'format_type' => 'fieldset', - 'format_settings' => array( - 'formatter' => 'collapsible', - 'instance_settings' => array( - 'description' => '', - 'classes' => '', - 'required_fields' => 1, - ), - ), - ); - $export['group_ding_campaign_settings|node|ding_campaign|form'] = $field_group; - - return $export; -} diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.info b/modules/ding_campaign_ctype/ding_campaign_ctype.info deleted file mode 100644 index c58359a..0000000 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.info +++ /dev/null @@ -1,67 +0,0 @@ -name = Ding campaign ctype -description = Content type and image styles for ding_campaign module -core = 7.x -package = Ding! -php = 5.2.4 -dependencies[] = ctools -dependencies[] = ding_campaign -dependencies[] = ding_event -dependencies[] = entityreference -dependencies[] = features -dependencies[] = field_group -dependencies[] = image -dependencies[] = list -dependencies[] = media -dependencies[] = og -dependencies[] = og_ui -dependencies[] = options -dependencies[] = strongarm -dependencies[] = text -features[ctools][] = field_group:field_group:1 -features[ctools][] = strongarm:strongarm:1 -features[features_api][] = api:1 -features[field_base][] = ding_campaign_group_ref -features[field_base][] = field_camp_image -features[field_base][] = field_camp_link -features[field_base][] = field_camp_settings -features[field_base][] = field_camp_text_full -features[field_base][] = field_camp_text_plain -features[field_base][] = field_camp_weight -features[field_group][] = group_ding_campaign_content|node|ding_campaign|form -features[field_group][] = group_ding_campaign_images|node|ding_campaign|form -features[field_group][] = group_ding_campaign_settings|node|ding_campaign|form -features[field_instance][] = node-ding_campaign-ding_campaign_group_ref -features[field_instance][] = node-ding_campaign-field_camp_image -features[field_instance][] = node-ding_campaign-field_camp_link -features[field_instance][] = node-ding_campaign-field_camp_settings -features[field_instance][] = node-ding_campaign-field_camp_text_full -features[field_instance][] = node-ding_campaign-field_camp_text_plain -features[field_instance][] = node-ding_campaign-field_camp_weight -features[image][] = ding_campaign_w_180 -features[image][] = ding_campaign_w_280 -features[image][] = ding_campaign_w_380 -features[image][] = ding_campaign_w_480 -features[node][] = ding_campaign -features[variable][] = comment_anonymous_ding_campaign -features[variable][] = comment_default_mode_ding_campaign -features[variable][] = comment_default_per_page_ding_campaign -features[variable][] = comment_ding_campaign -features[variable][] = comment_form_location_ding_campaign -features[variable][] = comment_preview_ding_campaign -features[variable][] = comment_subject_field_ding_campaign -features[variable][] = field_bundle_settings_node__ding_campaign -features[variable][] = language_content_type_ding_campaign -features[variable][] = menu_options_ding_campaign -features[variable][] = menu_parent_ding_campaign -features[variable][] = node_options_ding_campaign -features[variable][] = node_preview_ding_campaign -features[variable][] = node_submitted_ding_campaign -features[variable][] = opening_hours_enabled_ding_campaign -features_exclude[field][node-ding_campaign-field_camp_image] = node-ding_campaign-field_camp_image -features_exclude[field][node-ding_campaign-field_camp_link] = node-ding_campaign-field_camp_link -features_exclude[field][node-ding_campaign-field_camp_settings] = node-ding_campaign-field_camp_settings -features_exclude[field][node-ding_campaign-field_camp_text_full] = node-ding_campaign-field_camp_text_full -features_exclude[field][node-ding_campaign-field_camp_text_plain] = node-ding_campaign-field_camp_text_plain -features_exclude[field][node-ding_campaign-field_camp_weight] = node-ding_campaign-field_camp_weight -features_exclude[field][node-ding_campaign-og_group_ref] = node-ding_campaign-og_group_ref -features_exclude[field][node-ding_campaign-ding_campaign_group_ref] = node-ding_campaign-ding_campaign_group_ref diff --git a/modules/ding_campaign_ctype/ding_campaign_ctype.module b/modules/ding_campaign_ctype/ding_campaign_ctype.module deleted file mode 100644 index dc2002d..0000000 --- a/modules/ding_campaign_ctype/ding_campaign_ctype.module +++ /dev/null @@ -1,7 +0,0 @@ - t('Campaign image width'), '#description' => t('Applicable for image campaigns. Image will be resized to selected width, height will be selected automatically.'), '#options' => array( - 'medium' => t('Default (medium)'), - 'ding_campaign_w_180' => t('180px'), - 'ding_campaign_w_280' => t('280px'), - 'ding_campaign_w_380' => t('380px'), - 'ding_campaign_w_480' => t('480px'), + 'ding_campaign_p_25' => t('25% (280px)'), + 'ding_campaign_p_33' => t('33% (380px)'), + 'ding_campaign_p_50' => t('50% (580px)'), + 'ding_campaign_p_66' => t('66% (780px)'), + 'ding_campaign_p_75' => t('75% (880px)'), + 'ding_campaign_p_100' => t('100% (1200px)'), + ), - '#default_value' => (isset($form_state['conf']['ding_campaign_image_style'])) ? $form_state['conf']['ding_campaign_image_style'] : 'medium', + '#default_value' => (isset($form_state['conf']['ding_campaign_image_style'])) ? $form_state['conf']['ding_campaign_image_style'] : 'ding_campaign_p_25', ); drupal_add_css(drupal_get_path('module', 'ding_campaign') . '/css/ding_campaign.admin.css');