Changeset 5216


Ignore:
Timestamp:
Mar 21, 2010, 3:08:01 PM (14 years ago)
Author:
patdenice
Message:

feature 1522: LocalFiles Editor is now compatible with new local files directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/LocalFilesEditor/admin.php

    r5215 r5216  
    4040               l10n('locfiledit_onglet_localconf'),
    4141               $my_base_url.'&tab=localconf');
     42$tabsheet->add('css',
     43               l10n('locfiledit_onglet_css'),
     44               $my_base_url.'&tab=css');
    4245$tabsheet->add('tpl',
    4346               l10n('locfiledit_onglet_tpl'),
     
    139142    break;
    140143
     144  case 'css':
     145    $selected = 0;
     146    $options[] = l10n('locfiledit_choose_file');
     147    $options[] = '----------------------';
     148    $value = PHPWG_ROOT_PATH . "local/css/rules.css";
     149    $options[$value] = 'local / css / rules.css';
     150    if ($edited_file == $value) $selected = $value;
     151    $options[] = '----------------------';
     152       
     153    foreach (get_dirs($conf['themes_dir']) as $theme_id)
     154    {
     155      $value = PHPWG_ROOT_PATH . 'local/css/'.$theme_id.'-rules.css';
     156      $options[$value] = 'local / css / '.$theme_id.'-rules.css';
     157      if ($edited_file == $value) $selected = $value;
     158    }
     159    $template->assign('css_lang_tpl', array(
     160        'OPTIONS' => $options,
     161        'SELECTED' => $selected));
     162    $editarea_options['syntax'] = 'css';
     163    break;
     164
    141165  case 'tpl':
    142166    // New file form creation
     
    151175      $options['parent'] = array_merge($options['parent'], get_rec_dirs(PHPWG_ROOT_PATH . 'template-extension'));
    152176
    153       // Model list
    154       $eligible_templates = array(
    155           'about.tpl',
    156           'footer.tpl',
    157           'header.tpl',
    158           'identification.tpl',
    159           'index.tpl',
    160           'mainpage_categories.tpl',
    161           'menubar.tpl',
    162           'menubar_categories.tpl',
    163           'menubar_identification.tpl',
    164           'menubar_links.tpl',
    165           'menubar_menu.tpl',
    166           'menubar_specials.tpl',
    167           'menubar_tags.tpl',
    168           'navigation_bar.tpl',
    169           'nbm.tpl',
    170           'notification.tpl',
    171           'picture.tpl',
    172           'picture_content.tpl',
    173           'picture_nav_buttons.tpl',
    174           'popuphelp.tpl',
    175           'profile.tpl',
    176           'profile_content.tpl',
    177           'redirect.tpl',
    178           'register.tpl',
    179           'search.tpl',
    180           'search_rules.tpl',
    181           'slideshow.tpl',
    182           'tags.tpl',
    183           'thumbnails.tpl',
    184           'upload.tpl');
    185 
    186177      $options['model'][] = l10n('locfiledit_empty_page');
    187178      $options['model'][] = '----------------------';
     179      $i = 0;
    188180      foreach (get_extents() as $pwg_template)
    189181      {
    190182        $value = PHPWG_ROOT_PATH . 'template-extension/' . $pwg_template;
    191183        $options['model'][$value] =  'template-extension / ' . str_replace('/', ' / ', $pwg_template);
     184        $i++;
    192185      }
    193       $template_dir = PHPWG_ROOT_PATH . 'template';
    194       foreach (get_dirs($template_dir) as $pwg_template)
     186      foreach (get_dirs($conf['themes_dir']) as $theme_id)
    195187      {
    196         if (count($options['model']) > 2)
     188        if ($i)
    197189        {
    198190          $options['model'][] = '----------------------';
     191          $i = 0;
    199192        }
    200         $dir = $template_dir . '/' . $pwg_template . '/';
     193        $dir = $conf['themes_dir'] . '/' . $theme_id . '/template/';
    201194        if (is_dir($dir) and $content = opendir($dir))
    202195        {
    203196          while ($node = readdir($content))
    204197          {
    205             if (is_file($dir . $node) and in_array($node, $eligible_templates))
     198            if (is_file($dir.$node) and get_extension($node) == 'tpl')
    206199            {
    207200              $value = $dir . $node;
    208               $options['model'][$value] = $pwg_template . ' / ' . $node;
     201              $options['model'][$value] = $theme_id . ' / ' . $node;
     202              $i++;
    209203            }
    210204          }
    211205        }
     206      }
     207      if (end($options['model']) == '----------------------')
     208      {
     209        array_pop($options['model']);
    212210      }
    213211      // Assign variables to template
     
    221219    }
    222220    // List existing template extensions
    223     $template_dir = PHPWG_ROOT_PATH . 'template-extension';
    224221    $selected = 0;
    225222    $options[] = l10n('locfiledit_choose_file');
     
    251248    foreach (get_languages() as $language_code => $language_name)
    252249    {
    253       $value = PHPWG_ROOT_PATH.'language/'.$language_code.'/local.lang.php';
     250      $value = PHPWG_ROOT_PATH.'local/language/'.$language_code.'.lang.php';
    254251      if ($edited_file == $value)
    255252      {
Note: See TracChangeset for help on using the changeset viewer.