Ignore:
Timestamp:
Apr 4, 2010, 10:44:52 PM (14 years ago)
Author:
nikrou
Message:
  • Improve categories selections in admin
  • Fix some mispelling language keys
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/photoWidget/admin.php

    r5611 r5647  
    3030
    3131if (!empty($_POST['submit'])) {
    32   if (isset($_POST['pw_all_categories']) && $_POST['pw_all_categories']!=$me->pw_all_categories) {
    33     $me->pw_all_categories = $_POST['pw_all_categories'];
    34     array_push($GLOBALS['page']['infos'],
    35                l10n('You choose that mode for').' '.l10n('all categories'));
    36     $save_config = true;
    37   } else {
    38     if (!empty($_POST['pw_categories']) && $_POST['pw_categories']!=$me->pw_categories) {
    39       $me->pw_categories = $_POST['pw_categories'];
     32  if (isset($_POST['pw_all_categories'])) {
     33    if ($_POST['pw_all_categories']==1) {
    4034      array_push($GLOBALS['page']['infos'],
    41                  l10n('You choose that mode for').' '.
    42                  l10n_dec('one category',
    43                           'severals categories',
    44                           count($_POST['pw_categories'])));
     35                 l10n('You choose that mode for').' '.l10n('all categories'));
     36      $me->pw_all_categories = 1;
     37      $me->pw_categories = array();
    4538      $save_config = true;
     39    } else {
     40      if (isset($_POST['pw_categories'])) {
     41        if (count($_POST['pw_categories'])==1 && ($_POST['pw_categories'][0]=='__none__')) {
     42          array_push($GLOBALS['page']['errors'],
     43                     l10n('You must choose at least one category'));
     44          $me->pw_categories = array();
     45          $save_config = true;     
     46        } else {
     47          array_push($GLOBALS['page']['infos'],
     48                     l10n('You choose that mode for').' '.
     49                     l10n_dec('one category',
     50                              'severals categories',
     51                              count($_POST['pw_categories'])));
     52          $me->pw_all_categories = 0;
     53          $me->pw_categories = $_POST['pw_categories'];       
     54          $save_config = true;     
     55        }
     56      } else {
     57        array_push($GLOBALS['page']['errors'],
     58                   l10n('You must choose at least one category'));
     59      }
    4660    }
    4761  }
    48     if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) {
     62
     63  if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) {
    4964    $me->pw_width = intval($_POST['pw_width']);
    5065    array_push($GLOBALS['page']['infos'], l10n('Width has been updated'));
Note: See TracChangeset for help on using the changeset viewer.