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();
$rows = array();
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->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 ),
);
$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 ),
);
@ -80,7 +80,7 @@ function fulcrm_campaign_admin_campaign_new_form_submit( $form, &$form_state ) {
if ( $tid )
fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid );
drupal_set_message( t( 'Mailshot created!' ) );
drupal_goto( 'admin/config/services/fulcrm/campaign/' . $fcid . '/edit' );
drupal_goto( 'admin/content/fulcrm/campaign/' . $fcid . '/edit' );
} else
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',
'#default_value' => '',
'#title' => 'Subject (on email)',
'#title' => 'Subject (of email)',
);
$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 );
foreach ( $query->execute() as $row ) {
$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>)' ),
'subject' => check_plain( $row->subject ) );
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',
'#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 ) {
$form[ 'add_to_campaigns' ] = array( '#type' => 'fieldset',
@ -288,7 +288,7 @@ function theme_fulcrm_campaign_admin_campaign_edit_form( $variables ) {
$form = $variables['form'];
$rows = array();
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' ] ),
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') );
$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 );
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;
}
@ -484,7 +484,7 @@ function fulcrm_campaign_admin_campaign_delete_form_submit( $form, &$form_state
db_delete( 'fulcrm_campaign' )->condition( 'fcid', $fcid )->execute();
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 ) {
@ -506,7 +506,7 @@ function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid
'#value' => t('Delete'),
);
$form[ 'actions' ][ 'cancel' ] = array( '#type' => 'link',
'#href' => 'admin/config/services/fulcrm/campaign',
'#href' => 'admin/content/fulcrm/campaign',
'#title' => 'Cancel',
);

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

Loading…
Cancel
Save