Commit 9f2d4ad5 authored by profix898's avatar profix898

- task: add url rewrite status to install tab

parent 3e6ecf4a
......@@ -82,7 +82,7 @@ function _gallery_block_admin_block($delta) {
}
// Save/Edit button
$form['element'] = array('#type' => 'value', '#value' => 'gallery_block_'. $delta .'_');
$form['element'] = array('#type' => 'value', '#value' => 'gallery_block_'. $delta);
$form['update_btn'] = array(
'#type' => 'submit',
'#value' => t('Save and Edit'),
......@@ -305,19 +305,18 @@ function _gallery_block_admin_update($form, &$form_state) {
function _gallery_block_admin_save($delta, $values) {
$element = $values['element'];
unset($values['element']);
// Validate _size variable
if (isset($values[$element .'_imageblock_size'])) {
if (!is_numeric($values[$element .'_imageblock_size']) || $values[$element .'_imageblock_size'] < 10) {
$values[$element .'_imageblock_size'] = 10;
drupal_set_message(t('Image size must be a number greater than ten pixels.
(The value has been updated to \'10\' for your convenience.)'), 'error');
}
}
// Save variables
foreach ($values as $key => $value) {
$pos = strpos($key, $element);
if ($pos !== FALSE && $pos == 0) {
// Validate _size variable
if ($key == $element .'imageblock_size') {
if (!is_numeric($value) || $value < 10) {
$value = 10;
drupal_set_message(t('Image size must be a number greater than ten pixels.
(The value has been updated to \'10\' for your convenience.)'), 'error');
}
}
//
if (is_array($value)) {
$value = array_values(array_filter($value));
}
......
......@@ -153,9 +153,27 @@ function _gallery_install_status($form_state) {
// Step 4: Clean URL configuration
_gallery_install_urlrewrite_check($install_status);
if (_gallery_install_urlrewrite($public_path, $htaccess_path, TRUE)) {
$form['urlrewrite'] = array(
'#type' => 'fieldset',
'#title' => t('Clean URLs / URL Rewrite settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Overview of your URL Rewrite settings as specified during install.')
);
$form['urlrewrite']['htaccess_public_path'] = array(
'#title' => t('Public path to your .htaccess file'),
'#type' => 'item',
'#value' => $public_path
);
$form['urlrewrite']['htaccess_filesystem_path'] = array(
'#title' => t('Filesystem path to your .htaccess file'),
'#type' => 'item',
'#value' => $htaccess_path
);
}
// Step 5: User Synchronization
// Always TRUE (= gallery_valid), otherwise we would be redirected to the install wizard page instead
$install_status['usersync']['status'] = TRUE;
$install_status['usersync']['info'] = t('Your initial user synchronization has been completed already.<br /> If you
want to resync all your users or you want to import users from an existing
......@@ -1107,13 +1125,13 @@ function _gallery_install_urlrewrite(&$public_path, &$htaccess_path, $load_confi
gallery_error(t('Error trying to create URL Rewrite plugin instance.'), $ret);
return FALSE;
}
list($ret, $params) = $rewrite_api->fetchEmbedConfig();
if ($ret) {
gallery_error(t('Error trying to fetch Embedded URL Rewrite configuration.'), $ret);
return FALSE;
}
// Load the configuration from G2 (or derive from Drupal path)
if ($load_config) {
if (empty($params['embeddedHtaccess'])) {
......@@ -1126,7 +1144,7 @@ function _gallery_install_urlrewrite(&$public_path, &$htaccess_path, $load_confi
$htaccess_path = $params['embeddedHtaccess'];
}
}
// Check for trailing slash
$public_path .= (substr($public_path, -1) != '/') ? '/' : '';
$htaccess_path .= (substr($htaccess_path, -1) != '/') ? '/' : '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment