move the campaign builder to /admin/content

master
Marek Isalski 7 years ago
parent 0d138b6c54
commit 889d625e37

@ -18,10 +18,10 @@ function fulcrm_campaign_admin_campaign() {
$result = $query->orderByHeader( $header )->execute(); $result = $query->orderByHeader( $header )->execute();
$rows = array(); $rows = array();
foreach ( $result as $row ) { foreach ( $result as $row ) {
$rows[] = array( array( 'data' => '<a href="' . url('admin/config/services/fulcrm/campaign/' . $row->fcid) . '">' . $row->fcid . '</a>' ), $rows[] = array( array( 'data' => '<a href="' . url('admin/content/fulcrm/campaign/' . $row->fcid) . '">' . $row->fcid . '</a>' ),
array( 'data' => $row->name ), array( 'data' => $row->name ),
array( 'data' => $row->subject ), array( 'data' => $row->subject ),
array( 'data' => '<a href="' . url('admin/config/services/fulcrm/campaign/' . $row->fcid . '/edit') . '">arrange</a>' ), array( 'data' => '<a href="' . url('admin/content/fulcrm/campaign/' . $row->fcid . '/edit') . '">arrange</a>' ),
); );
} }
@ -55,7 +55,7 @@ function fulcrm_campaign_admin_campaign_settings_form( $form, &$form_state, $fci
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'name' ] ) ? $form_state[ 'values' ][ 'name' ] : $campaign->name ), '#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'name' ] ) ? $form_state[ 'values' ][ 'name' ] : $campaign->name ),
); );
$form[ 'subject' ] = array( '#type' => 'textfield', $form[ 'subject' ] = array( '#type' => 'textfield',
'#title' => 'Subject (on email)', '#title' => 'Subject (of email)',
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'subject' ] ) ? $form_state[ 'values' ][ 'subject' ] : $campaign->subject ), '#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'subject' ] ) ? $form_state[ 'values' ][ 'subject' ] : $campaign->subject ),
); );
@ -80,7 +80,7 @@ function fulcrm_campaign_admin_campaign_new_form_submit( $form, &$form_state ) {
if ( $tid ) if ( $tid )
fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid ); fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid );
drupal_set_message( t( 'Mailshot created!' ) ); drupal_set_message( t( 'Mailshot created!' ) );
drupal_goto( 'admin/config/services/fulcrm/campaign/' . $fcid . '/edit' ); drupal_goto( 'admin/content/fulcrm/campaign/' . $fcid . '/edit' );
} else } else
drupal_set_message( t( 'There was an error creating the campaign.' ), $type = 'error' ); drupal_set_message( t( 'There was an error creating the campaign.' ), $type = 'error' );
} }
@ -103,7 +103,7 @@ function fulcrm_campaign_admin_campaign_new_form( $form, &$form_state ) {
); );
$form[ 'subject' ] = array( '#type' => 'textfield', $form[ 'subject' ] = array( '#type' => 'textfield',
'#default_value' => '', '#default_value' => '',
'#title' => 'Subject (on email)', '#title' => 'Subject (of email)',
); );
$form[ 'actions' ] = array( '#type' => 'actions' ); $form[ 'actions' ] = array( '#type' => 'actions' );
@ -181,7 +181,7 @@ function fulcrm_campaign_admin_campaign_node_form( $form, &$form_state, $node )
$query->condition( 'fulcrm_campaign_node.nid', $node->nid ); $query->condition( 'fulcrm_campaign_node.nid', $node->nid );
foreach ( $query->execute() as $row ) { foreach ( $query->execute() as $row ) {
$in_campaigns[ $row->fcid ] = array( 'name' => ( check_plain( $row->name ) . ' (<a href="' . $in_campaigns[ $row->fcid ] = array( 'name' => ( check_plain( $row->name ) . ' (<a href="' .
url('admin/config/services/fulcrm/campaign/template/' . $row->fcid . '/edit') . url('admin/content/fulcrm/campaign/' . $row->fcid . '/edit') .
'">configure</a>)' ), '">configure</a>)' ),
'subject' => check_plain( $row->subject ) ); 'subject' => check_plain( $row->subject ) );
if ( array_key_exists( $row->fcid, $campaigns ) ) if ( array_key_exists( $row->fcid, $campaigns ) )
@ -191,7 +191,7 @@ function fulcrm_campaign_admin_campaign_node_form( $form, &$form_state, $node )
$form[ 'nid' ] = array( '#type' => 'hidden', $form[ 'nid' ] = array( '#type' => 'hidden',
'#value' => $node->nid ); '#value' => $node->nid );
$header = array( 'name' => array( 'data' => t('Name') ), 'subject' => array( 'data' => t('Subject') ) ); $header = array( 'name' => array( 'data' => t('Name (for internal use)') ), 'subject' => array( 'data' => t('Subject (of email)') ) );
if ( $campaigns ) { if ( $campaigns ) {
$form[ 'add_to_campaigns' ] = array( '#type' => 'fieldset', $form[ 'add_to_campaigns' ] = array( '#type' => 'fieldset',
@ -288,7 +288,7 @@ function theme_fulcrm_campaign_admin_campaign_edit_form( $variables ) {
$form = $variables['form']; $form = $variables['form'];
$rows = array(); $rows = array();
foreach ( element_children( $form[ 'content' ] ) as $id ) { foreach ( element_children( $form[ 'content' ] ) as $id ) {
$form[ 'content' ][ $id ][ 'weight' ][ '#attributes' ][ 'class' ] = array( 'fms-content-item-weight' ); $form[ 'content' ][ $id ][ 'weight' ][ '#attributes' ][ 'class' ] = array( 'fulcrm-campaign-content-item-weight' );
$rows[] = array( 'data' => array( drupal_render( $form[ 'content' ][ $id ][ 'title' ] ), $rows[] = array( 'data' => array( drupal_render( $form[ 'content' ][ $id ][ 'title' ] ),
drupal_render( $form[ 'content' ][ $id ][ 'weight' ] ), drupal_render( $form[ 'content' ][ $id ][ 'weight' ] ),
), ),
@ -296,9 +296,9 @@ function theme_fulcrm_campaign_admin_campaign_edit_form( $variables ) {
); );
} }
$header = array( t('Title'), t('Weight') ); $header = array( t('Title'), t('Weight') );
$output = theme( 'table', array( 'header' => $header, 'rows' => $rows, 'attributes' => array( 'id' => 'fms-content-items-table' ) ) ); $output = theme( 'table', array( 'header' => $header, 'rows' => $rows, 'attributes' => array( 'id' => 'fulcrm-campaign-content-items-table' ) ) );
$output .= drupal_render_children( $form ); $output .= drupal_render_children( $form );
drupal_add_tabledrag( 'fms-content-items-table', 'order', 'sibling', 'fms-content-item-weight' ); drupal_add_tabledrag( 'fulcrm-campaign-content-items-table', 'order', 'sibling', 'fulcrm-campaign-content-item-weight' );
return $output; return $output;
} }
@ -484,7 +484,7 @@ function fulcrm_campaign_admin_campaign_delete_form_submit( $form, &$form_state
db_delete( 'fulcrm_campaign' )->condition( 'fcid', $fcid )->execute(); db_delete( 'fulcrm_campaign' )->condition( 'fcid', $fcid )->execute();
drupal_set_message( t('Campaign deleted.'), 'status', FALSE ); drupal_set_message( t('Campaign deleted.'), 'status', FALSE );
} }
$form_state[ 'redirect' ] = 'admin/config/services/fulcrm/campaign'; $form_state[ 'redirect' ] = 'admin/content/fulcrm/campaign';
} }
function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid ) { function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid ) {
@ -506,7 +506,7 @@ function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid
'#value' => t('Delete'), '#value' => t('Delete'),
); );
$form[ 'actions' ][ 'cancel' ] = array( '#type' => 'link', $form[ 'actions' ][ 'cancel' ] = array( '#type' => 'link',
'#href' => 'admin/config/services/fulcrm/campaign', '#href' => 'admin/content/fulcrm/campaign',
'#title' => 'Cancel', '#title' => 'Cancel',
); );

@ -17,60 +17,61 @@ function fulcrm_campaign_permission() {
} }
function fulcrm_campaign_menu() { function fulcrm_campaign_menu() {
$items[ 'admin/config/services/fulcrm/campaign' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign', $items[ 'admin/content/fulcrm/campaign' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign',
'title' => 'fulcrm Campaigns', 'title' => 'fulcrm Campaigns',
'description' => 'Administer campaigns created in Drupal and pushed to fulcrm.', 'description' => 'Administer campaigns created in Drupal and pushed to fulcrm.',
'access arguments' => array('build fulcrm campaign'), 'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc', 'file' => 'fulcrm_campaign.admin.inc',
); 'type' => MENU_LOCAL_TASK,
$items[ 'admin/config/services/fulcrm/campaign/new' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_new', );
'type' => MENU_LOCAL_ACTION, $items[ 'admin/content/fulcrm/campaign/new' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_new',
'title' => 'Create a Campaign', 'type' => MENU_LOCAL_ACTION,
'description' => 'Create an fulcrm Campaign.', 'title' => 'Create a Campaign',
'access arguments' => array('build fulcrm campaign'), 'description' => 'Create an fulcrm Campaign.',
'file' => 'fulcrm_campaign.admin.inc', 'access arguments' => array('build fulcrm campaign'),
'weight' => 1, 'file' => 'fulcrm_campaign.admin.inc',
); 'weight' => 1,
$items[ 'admin/config/services/fulcrm/campaign/%' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings', );
'title' => 'Settings', $items[ 'admin/content/fulcrm/campaign/%' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings',
'page arguments' => array( 5 ), 'title' => 'Settings',
'access arguments' => array('build fulcrm campaign'), 'page arguments' => array( 4 ),
'file' => 'fulcrm_campaign.admin.inc', 'access arguments' => array('build fulcrm campaign'),
'weight' => 1, 'file' => 'fulcrm_campaign.admin.inc',
); 'weight' => 1,
$items[ 'admin/config/services/fulcrm/campaign/%/settings' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings', );
'title' => 'Settings', $items[ 'admin/content/fulcrm/campaign/%/settings' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings',
'type' => MENU_DEFAULT_LOCAL_TASK, 'title' => 'Settings',
'access arguments' => array('build fulcrm campaign'), 'type' => MENU_DEFAULT_LOCAL_TASK,
'page arguments' => array( 5 ), 'access arguments' => array('build fulcrm campaign'),
'weight' => 1, 'page arguments' => array( 4 ),
); 'weight' => 1,
$items[ 'admin/config/services/fulcrm/campaign/%/sync' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_sync', );
'title' => 'Sync to fulcrm', $items[ 'admin/content/fulcrm/campaign/%/sync' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_sync',
'type' => MENU_DEFAULT_LOCAL_TASK, 'title' => 'Sync to fulcrm',
'access arguments' => array('build fulcrm campaign'), 'type' => MENU_LOCAL_TASK,
'file' => 'fulcrm_campaign.admin.inc', 'access arguments' => array('build fulcrm campaign'),
'page arguments' => array( 5 ), 'file' => 'fulcrm_campaign.admin.inc',
'weight' => 10, 'page arguments' => array( 4 ),
); 'weight' => 10,
$items[ 'admin/config/services/fulcrm/campaign/%/edit' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_edit', );
'title' => 'Edit', $items[ 'admin/content/fulcrm/campaign/%/edit' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_edit',
'type' => MENU_LOCAL_TASK, 'title' => 'Edit',
'page arguments' => array( 5 ), 'type' => MENU_LOCAL_TASK,
'access arguments' => array('build fulcrm campaign'), 'page arguments' => array( 4 ),
'file' => 'fulcrm_campaign.admin.inc', 'access arguments' => array('build fulcrm campaign'),
'weight' => 2, 'file' => 'fulcrm_campaign.admin.inc',
); 'weight' => 2,
$items[ 'admin/config/services/fulcrm/campaign/%/delete' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_delete', );
'title' => 'Delete', $items[ 'admin/content/fulcrm/campaign/%/delete' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_delete',
'type' => MENU_LOCAL_TASK, 'title' => 'Delete',
'page arguments' => array( 5 ), 'type' => MENU_LOCAL_TASK,
'access arguments' => array('build fulcrm campaign'), 'page arguments' => array( 4 ),
'file' => 'fulcrm_campaign.admin.inc', 'access arguments' => array('build fulcrm campaign'),
'weight' => 5, 'file' => 'fulcrm_campaign.admin.inc',
); 'weight' => 5,
);
$items[ 'node/%node/fulcrm/campaign' ] = array( 'title' => 'Mailshot', $items[ 'node/%node/fulcrm/campaign' ] = array( 'title' => 'fulcrm Campaign',
'page callback' => 'fulcrm_campaign_admin_campaign_node', 'page callback' => 'fulcrm_campaign_admin_campaign_node',
'page arguments' => array( 1 ), 'page arguments' => array( 1 ),
'access arguments' => array('build fulcrm campaign'), 'access arguments' => array('build fulcrm campaign'),

Loading…
Cancel
Save