Ignore:
Timestamp:
Jan 8, 2011, 5:34:17 PM (13 years ago)
Author:
grum
Message:

Release 1.4.0
Rewrite some JS
fix bug bug:1983

Location:
extensions/gally/gally-default/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/gally/gally-default/admin/Conf.class.inc.php

    r6109 r8528  
    117117  }
    118118
     119  public function confExists($key)
     120  {
     121    return(array_key_exists($key, $this->values));
     122  }
     123
    119124  public function getConfValue($key)
    120125  {
     
    144149
    145150
     151  /**
     152   * function used to initialize config file
     153   *
     154   */
     155  static public function init($theme)
     156  {
     157    $forcedToDefault=array(
     158      "imageCenterMode" => '',
     159      "imageCenterOffset" => '',
     160      "imageCenterTopMin" => '',
     161      "imageCenterTopBorder" => '',
     162      "interfaceAnimated" => '',
     163      "commentAnimated" => '',
     164      "animateDelay" => '',
     165      "marginContainer" => '',
     166      "paddingContainer" => '',
     167      "tabsAnimated" => '',
     168      "tabsHidden" => '',
     169      "tabsVisible" => '',
     170      "tabsPosition" => '',
     171      "commentRows" => '',
     172      "menuAnimated" => '',
     173      "menuWidth" => '',
     174      "menuMaxWidth" => '',
     175      "menuMSIEMaxWidth" => '',
     176      "imageSimulateHighRes" => '',
     177      "imageScrollMinDeadArea" => ''
     178      //"expandMenu" => '',
     179    );
     180    $gallyDefault = new Conf();
     181    $gallyDefault->setFileName(PHPWG_ROOT_PATH."themes/gally-default/conf/default.conf");
     182    $gallyDefault->read();
     183
     184    $configDefault = new Conf();
     185    $configDefault->setFileName(PHPWG_ROOT_PATH."themes/$theme/conf/default.conf");
     186    $configDefault->read();
     187
     188    $configLocal = new Conf();
     189    $configLocal->setFileName(PHPWG_ROOT_PATH."local/themes/$theme/conf/local.conf");
     190    $configLocal->read();
     191
     192    foreach($forcedToDefault as $key => $param)
     193    {
     194      if($gallyDefault->confExists($key)) $forcedToDefault[$key]=$gallyDefault->getConfValue($key);
     195      if($configDefault->confExists($key)) $forcedToDefault[$key]=$configDefault->getConfValue($key);
     196    }
     197    $configLocal->setConf($forcedToDefault, false);
     198    $configLocal->write();
     199  }
     200
    146201}
    147202
  • extensions/gally/gally-default/admin/GallyDefault.class.inc.php

    r7337 r8528  
    2020class GallyDefault
    2121{
     22  const THEME_VERSION = '1.4.0';
     23
    2224  private $directories=Array(
    2325    'templates.parent' => '',
     
    3234  protected $themeProperties = Array(
    3335      'name' => 'Gally/Default',
    34       'version' => '1.3.1'
     36      'version' => self::THEME_VERSION
    3537    );
     38
     39
     40  /**
     41   * function used to activate a theme
     42   *
     43   * @param String $themeId : theme's id (for example 'gally-lapis-lazulis')
     44   * @param String $themeVersion : theme's release (not gally-default release)
     45   * @param String $gallyDefaultNeeded : gally-default release needed
     46   * @param &Array $errors : array of error messages
     47   */
     48  static public function activate($themeId, $themeVersion, $gallyDefaultNeeded, $errors)
     49  {
     50    if(strnatcmp(self::THEME_VERSION, $gallyDefaultNeeded)<0)
     51    {
     52      if(!is_array($errors))
     53      {
     54        if($errors!='')
     55        {
     56          $errors=array($errors);
     57        }
     58        else
     59        {
     60          $errors=array();
     61        }
     62      }
     63
     64      $errors[]=sprintf(l10n('This theme needs Gally-default theme v%s; actually, Gally-default version is %s.'), $gallyDefaultNeeded, self::THEME_VERSION);
     65    }
     66    else
     67    {
     68      Conf::init($themeId);
     69    }
     70    return($errors);
     71  }
     72
     73  /**
     74   * function used to deactivate a theme
     75   *
     76   */
     77  static public function deactivate()
     78  {
     79  }
    3680
    3781  /**
     
    92136    $this->config->read();
    93137    $this->config->setFileName($this->directories['conf.local']."/default.conf");
    94     $this->config->read();
     138    $this->config->read(false);
    95139    $this->config->setFileName(PHPWG_ROOT_PATH."local/themes/".basename(dirname($this->directories['conf.local']))."/conf/local.conf");
    96140    $this->config->read(false);
Note: See TracChangeset for help on using the changeset viewer.