| 1 |
<?php |
<?php |
| 2 |
// $Id: front_page.module,v 1.75.2.3 2008/04/19 11:45:24 augustin Exp $ |
// $Id: front_page.module,v 1.75.2.4 2008/04/19 12:15:38 augustin Exp $ |
| 3 |
/** |
/** |
| 4 |
* |
* |
| 5 |
* This module allows the site admin to set advanced front page settings. |
* This module allows the site admin to set advanced front page settings. |
| 30 |
$special_note .= '</p>'. t('<p>The default setting for new roles is SAME AS AUTHENTICATED USERS.</p>') .'</fieldset>'; |
$special_note .= '</p>'. t('<p>The default setting for new roles is SAME AS AUTHENTICATED USERS.</p>') .'</fieldset>'; |
| 31 |
} |
} |
| 32 |
return t('<p>Setup custom front pages for your site. Click on the option to expand the form and customise your settings.</p><p><em>Anonymous User</em> = visitor not logged in | <em>Authenticated User</em> = visitor who is logged in</p>') . $special_note; |
return t('<p>Setup custom front pages for your site. Click on the option to expand the form and customise your settings.</p><p><em>Anonymous User</em> = visitor not logged in | <em>Authenticated User</em> = visitor who is logged in</p>') . $special_note; |
| 33 |
} |
} |
| 34 |
} |
} |
| 35 |
|
|
| 36 |
/** |
/** |
| 37 |
* Implementation of hook_menu. |
* Implementation of hook_menu. |
| 38 |
*/ |
*/ |
| 39 |
function front_page_menu() { |
function front_page_menu() { |
| 40 |
$items['admin/settings/front'] = array( |
$items['admin/settings/front'] = array( |
| 41 |
'title' => 'Advanced front page settings', |
'title' => 'Advanced front page settings', |
| 42 |
'description' => 'Specify a unique layout or splash page based on role type - override your HOME and breadcrumb links - display a custom mission style notice for users who haven\'t visited in a while - disable site and display a \'temporarily offline\' message.', |
'description' => 'Specify a unique layout or splash page based on role type - override your HOME and breadcrumb links - display a custom mission style notice for users who haven\'t visited in a while - disable site and display a \'temporarily offline\' message.', |
| 43 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 44 |
'page arguments' => array('front_page_admin'), |
'page arguments' => array('front_page_admin'), |
| 45 |
'access arguments' => array('administer menu')); |
'access arguments' => array('administer menu')); |
| 46 |
$items['front_page'] = array( |
$items['front_page'] = array( |
| 47 |
'title' => '', |
'title' => '', |
| 48 |
'page callback' => 'front_page', |
'page callback' => 'front_page', |
| 49 |
'access arguments' => array('access frontpage'), |
'access arguments' => array('access frontpage'), |
| 50 |
'type' => MENU_SUGGESTED_ITEM); |
'type' => MENU_SUGGESTED_ITEM); |
| 51 |
return $items; |
return $items; |
| 52 |
} |
} |
| 53 |
|
|
| 168 |
'#title' => t('Site maintenance'), |
'#title' => t('Site maintenance'), |
| 169 |
'#default_value' => variable_get('site_offline', 0), |
'#default_value' => variable_get('site_offline', 0), |
| 170 |
'#options' => array(t('Online'), t('Off-line')), |
'#options' => array(t('Online'), t('Off-line')), |
| 171 |
'#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="@user-login">user login</a> page.', array('@user-login' => url('user',array('query' => drupal_get_destination())))), |
'#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="@user-login">user login</a> page.', array('@user-login' => url('user', array('query' => drupal_get_destination())))), |
| 172 |
); |
); |
| 173 |
|
|
| 174 |
$form['front_offline']['site_offline_message'] = array( |
$form['front_offline']['site_offline_message'] = array( |
| 230 |
'#default_value' => variable_get('front_page_breadcrumb_redirect', ''), |
'#default_value' => variable_get('front_page_breadcrumb_redirect', ''), |
| 231 |
'#cols' => 20, '#rows' => 1, |
'#cols' => 20, '#rows' => 1, |
| 232 |
'#description' => t('Specify where the user should be redirected to. An example would be <em>node/12</em>. Leave blank when you\'re not using HOME redirect.'), |
'#description' => t('Specify where the user should be redirected to. An example would be <em>node/12</em>. Leave blank when you\'re not using HOME redirect.'), |
| 233 |
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') |
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') |
| 234 |
); |
); |
| 235 |
|
|
| 236 |
$form['site'] = array( |
$form['site'] = array( |
| 250 |
); |
); |
| 251 |
|
|
| 252 |
|
|
| 253 |
return system_settings_form($form); |
return system_settings_form($form); |
| 254 |
} |
} |
| 255 |
|
|
| 256 |
|
|
| 257 |
/*********************************************** |
/*********************************************** |
| 258 |
* Function to handle the display of the front page. |
* Function to handle the display of the front page. |
| 259 |
***********************************************/ |
*/ |
| 260 |
function front_page() { |
function front_page() { |
| 261 |
// Set a default value for landing zone if no front_page variables are filled. |
// Set a default value for landing zone if no front_page variables are filled. |
| 262 |
// If the module is turned on but empty in certain areas then a redirection loop will occur. |
// If the module is turned on but empty in certain areas then a redirection loop will occur. |