Ignore:
Timestamp:
Jul 8, 2011, 5:58:37 PM (13 years ago)
Author:
nikrou
Message:

Fix issue preventing config to be persistent.
Thanks to xtouf and Billr for reporting bug.

Update Italian translations, thanks to rio.

Location:
extensions/pwgCumulus/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/pwgCumulus/include/admin_menu.inc.php

    r11344 r11667  
    2020// +-----------------------------------------------------------------------+
    2121
     22if (!defined('PHPWG_ROOT_PATH')) {
     23  die('Hacking attempt!');
     24}
     25
     26$save_config = false;
    2227$Positions = array('before' => l10n('Before'),
    2328                   'after' => l10n('After')
    2429                   );
    25 
    26 $position_order = $me->position_order;
    27 $position_block_id = $me->position_block_id;
    2830
    2931include_once(PHPWG_ROOT_PATH.'include/block.class.php');
     
    3739}
    3840
    39 if (!empty($_POST['pwg_cumulus_in_main_menu']) && !$me->pwg_cumulus_in_main_menu) {
    40   $me->pwg_cumulus_in_main_menu = true;
    41   $page['infos'][] = l10n('Tags cloud added in main menu');
    42   $save_config = true;
    43 } elseif (empty($_POST['pwg_cumulus_in_main_menu']) && $me->pwg_cumulus_in_main_menu) {
    44   $me->pwg_cumulus_in_main_menu = false;
    45   $page['infos'][] = l10n('Tags cloud removed from main menu');
    46   $save_config = true;
    47 }
     41if (!empty($_POST['submit'])) {
     42  if (!empty($_POST['pwg_cumulus_in_main_menu']) && $_POST['pwg_cumulus_in_main_menu']!=$me->pwg_cumulus_in_main_menu) {
     43    $me->pwg_cumulus_in_main_menu = true;
     44    $page['infos'][] = l10n('Tags cloud added in main menu');
     45    $save_config = true;
     46  } elseif (empty($_POST['pwg_cumulus_in_main_menu']) && $me->pwg_cumulus_in_main_menu) {
     47    $me->pwg_cumulus_in_main_menu = false;
     48    $page['infos'][] = l10n('Tags cloud removed from main menu');
     49    $save_config = true;
     50  }
    4851
    49 if (!empty($_POST['position_order']) && isset($Positions[$_POST['position_order']])) {
    50   $position_order = $_POST['position_order'];
    51 }
     52  if (!empty($_POST['position_order']) && isset($Positions[$_POST['position_order']])
     53      && !empty($_POST['position_block_id']) && isset($Blocks[$_POST['position_block_id']])
     54      && ($_POST['position_order']!=$me->position_order || $_POST['position_block_id']!=$me->position_block_id)) {
     55   
     56    $me->position_order = $_POST['position_order'];
     57    $me->position_block_id = $_POST['position_block_id'];
     58    $page['infos'][] = l10n('Block\'s position has been updated');   
     59    $save_config = true;
     60  }
    5261
    53 if (!empty($_POST['position_block_id']) && isset($Blocks[$_POST['position_block_id']])) {
    54   $position_block_id = $_POST['position_block_id'];
    55 }
    56 
    57 if ($position_order!=null && $position_block_id!=null) {
    58   $me->position_order = $position_order;
    59   $me->position_block_id = $position_block_id; 
    60   $page['infos'][] = l10n('Position in main menu has been updated'); 
    61   $me->save_config();
     62  if ($save_config) {
     63    $me->save_config();
     64  }
    6265}
    6366
    6467$template->assign('MENUBAR_BLOCKS', $Blocks);
    65 $template->assign('POSITION_ORDER', $position_order);
     68$template->assign('POSITION_ORDER', $me->position_order);
    6669$template->assign('POSITIONS', $Positions);
    67 $template->assign('POSITION_BLOCK_ID', $position_block_id);
     70$template->assign('POSITION_BLOCK_ID', $me->position_block_id);
    6871$template->assign('PWG_CUMULUS_IN_MAIN_MENU', $me->pwg_cumulus_in_main_menu);
    6972?>
  • extensions/pwgCumulus/include/pwgCumulusConfig.class.php

    r11344 r11667  
    3535
    3636    if (!file_exists($this->get_config_filename())) {
     37      $this->setDefaults();
    3738      $this->save_config();
    3839    }
     
    4546      $this->config = $c;
    4647    }
    47     $this->setDefaults();
    4848  }
    4949
     
    7979
    8080  private function setDefaults() {
    81     include_once $this->plugin_dir.'/default_values.inc.php';
     81    include $this->plugin_dir.'/default_values.inc.php';
    8282
    8383    foreach ($default_values as $key => $value) {
Note: See TracChangeset for help on using the changeset viewer.