Changeset 5779 in spip-zone


Ignore:
Timestamp:
Sep 29, 2006, 4:57:30 PM (15 years ago)
Author:
skedus@…
Message:

Version 0.4

  • Add documentation French/English?
  • Add theme switcher, based on Philippe Drouot/Fil? switcher plugin
  • Add new 'balise' #SKTHEME_HABILLAGES_SWITCHER for user squelette usage.
  • Improve private area interface
Location:
_plugins_/_test_/sktheme
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_test_/sktheme/DOCUMENTATION.txt

    r5736 r5779  
    44// The Theme directory structure need to be like this
    55// This is only for the public theme
    6 //
     6// 
    77// themes/
    88//   squelettes/
     
    5656// squelette.xml (use to give description in the interface)
    5757//
     58// <pre>
    5859//    <habillage>
    5960//      <nom>name_of_the_squelette</nom>
     
    7172//      </description>
    7273//    </squelette>
     74// </pre>
    7375//
    7476// ---------------------------------------------------------------------------
  • _plugins_/_test_/sktheme/TODO.txt

    r5736 r5779  
    1 //
    2 // list:
    3 // TODO: Add online user documentation
    4 // TODO: probably add some tests to be sure that 'dossier_squelettes'
    5 //       is not used already.
    6 // DONE: create a 'habillage.xml' file to specify squelette dependances
     1// <b>DONE</b>: create a 'habillage.xml' file to specify squelette dependances
    72//       (a 'habillage' could not fit all the available 'squelettes' :)
    83//       This file could contained description such in plugin.xml
    94//       dependance <squelette>S_Name</squelette>
    10 // DONE: create a 'squelette.xml' for description/copyright/author ...
    11 // DONE: Improve text language in the interface
    12 // TODO: Create some icons for the private area
    13 // TODO: Create a real process for private area theme (see Franck ideas)
    14 // DONE: Add a filter to show only available habillages for a given squelette
    15 // TODO: Include a 'switcher' possibility based on 'switcher' plugin
    16 // DONE: Add an original habillage for the default squelette one
    17 // TODO: Download a squelette or habillage zip distribution trough the net
    18 //       an install it.
     5// <b>DONE</b>: create a 'squelette.xml' for description/copyright/author ...
     6// <b>DONE</b>: Improve text language in the interface
     7// <b>DONE</b>: Add a filter to show only available habillages for a given squelette
     8// <b>DONE</b>: Add an original habillage for the default squelette one
     9// <b>DONE</b>: Include a 'switcher' possibility based on 'switcher' plugin
     10// <b>DONE</b>: Add a 'balise' for habillage possibilities #SKTHEME_HABILLAGES
    1911//
     12// <b>TODO</b>: probably add some tests to be sure that 'dossier_squelettes' is not used already.
     13// <b>TODO</b>: Add online user documentation
     14// <b>TODO</b>: Create some icons for the private area
     15// <b>TODO</b>: Download a squelette or habillage zip distribution trough the net and install it.
     16// <b>TODO</b>: Create a real process for private area theme (see Franck ideas)
     17//
  • _plugins_/_test_/sktheme/exec/sktheme_config.php

    r5736 r5779  
    2626  global $squelettes_public_dir;
    2727  global $habillages_public_dir;
     28  global $habillage_switcher_style;
     29  global $theme_switcher_style;
     30  global $switcher_activated;
     31  global $switcher_admin_only;
    2832 
    2933  debut_page(_T('sktheme:title_config'),'configuration','sktheme_config');
     
    3741  debut_gauche();
    3842 
    39   // Include 'raccourcis'
    40   sktheme_raccourcis();
     43  // Include Doc box
     44  sktheme_config_doc_box();
    4145 
    4246  debut_droite();
    43   echo "<br />";
     47 
     48  //
     49  // PUBLIC THEMES DIRECTORIES CONFIG
     50  //
    4451  debut_cadre_trait_couleur('', false, "sktheme_config", _T('sktheme:public_themes_config'));
    4552 
     
    5158  }
    5259 
    53   // Print formular
    54   echo '<br />';
     60  // Set directories
    5561  echo '<FORM ACTION="'.generer_url_ecrire("sktheme_config", "sktheme_action=set_dir").'" METHOD="POST">';
     62 
     63  // Set squelettes_public_dir
     64  debut_cadre_gris_clair();
    5665  echo '<strong>'._T('sktheme:squelettes_public_dir').' : </strong><INPUT TYPE=TEXT  NAME="squelettes_public_dir" SIZE=25 VALUE="'.
    5766    $GLOBALS['meta']['sktheme_squelettes_public_dir'].'">';
    58   echo '<br />';
    59   echo '<br />';
     67  fin_cadre_gris_clair();
     68 
     69  // Set habillages_public_dir
     70  debut_cadre_couleur();
    6071  echo '<strong>'._T('sktheme:habillages_public_dir').' : </strong><INPUT TYPE=TEXT  NAME="habillages_public_dir" SIZE=25 VALUE="'.
    6172    $GLOBALS['meta']['sktheme_habillages_public_dir'].'">';
    62   echo '<br />';
     73  fin_cadre_couleur();
     74 
    6375  echo '<P><DIV ALIGN="RIGHT"><INPUT TYPE=SUBMIT VALUE="'._T('sktheme:save_public_directories').'"></DIV></P>';
    6476  echo '</FORM>';
    65   
     77 
    6678  fin_cadre_trait_couleur(); 
    6779 
    68   debut_cadre_trait_couleur('', false, "sktheme_config", _T('sktheme:private_themes_config'));
    69   echo '<br />';
    70   echo _T('sktheme:to_be_done');
    71   echo '<br />';
     80  //
     81  // PRIVATE THEMES DIRECTORIES CONFIG
     82  //
     83  //   debut_cadre_trait_couleur('', false, "sktheme_config", _T('sktheme:private_themes_config'));
     84  //   echo '<br />';
     85  //   echo _T('sktheme:to_be_done');
     86  //   echo '<br />';
     87  //   fin_cadre_trait_couleur(); 
     88  //
     89  // SWITCHER OPTIONS
     90  //
     91  // if submit : save switcher options
     92  if ($sktheme_action=="set_switcher") {
     93    ecrire_meta('sktheme_theme_switcher_style',$theme_switcher_style);
     94    ecrire_meta('sktheme_habillage_switcher_style',$habillage_switcher_style);
     95    ecrire_meta('sktheme_switcher_activated',$switcher_activated);
     96    ecrire_meta('sktheme_switcher_admin_only',$switcher_admin_only);
     97    ecrire_metas();
     98  }
     99  debut_cadre_trait_couleur('', false, "sktheme_config", _T('sktheme:themes_switcher'));
     100 
     101  echo '<FORM ACTION="'.generer_url_ecrire("sktheme_config", "sktheme_action=set_switcher").'" METHOD="POST">';
     102 
     103  // Set sktheme_switcher_activated
     104  debut_cadre_gris_clair();
     105  echo '<strong>'._T('sktheme:switcher_activated').' : </strong>';
     106  echo '<INPUT TYPE=RADIO  NAME="switcher_activated"  VALUE="yes" ';
     107  if (isset($GLOBALS['meta']['sktheme_switcher_activated']) AND ($GLOBALS['meta']['sktheme_switcher_activated']=="yes")) {
     108    echo " CHECKED ";
     109  }
     110  echo '>'._T('sktheme:yes');
     111  echo '<INPUT TYPE=RADIO  NAME="switcher_activated"  VALUE="no" ';
     112  if (isset($GLOBALS['meta']['sktheme_switcher_activated']) AND ($GLOBALS['meta']['sktheme_switcher_activated']=="no")) {
     113    echo " CHECKED ";
     114  }
     115  echo '>'._T('sktheme:no');
     116  fin_cadre_gris_clair();
     117 
     118  // Set sktheme_switcher_admin_only
     119  debut_cadre_couleur();
     120  echo '<strong>'._T('sktheme:switcher_admin_only').' : </strong>';
     121  echo '<INPUT TYPE=RADIO  NAME="switcher_admin_only"  VALUE="yes" ';
     122  if (isset($GLOBALS['meta']['sktheme_switcher_admin_only']) AND ($GLOBALS['meta']['sktheme_switcher_admin_only']=="yes")) {
     123    echo " CHECKED ";
     124  }
     125  echo '>'._T('sktheme:yes');
     126  echo '<INPUT TYPE=RADIO  NAME="switcher_admin_only"  VALUE="no" ';
     127  if (isset($GLOBALS['meta']['sktheme_switcher_admin_only']) AND ($GLOBALS['meta']['sktheme_switcher_admin_only']=="no")) {
     128    echo " CHECKED ";
     129  }
     130  echo '>'._T('sktheme:no');
     131  fin_cadre_couleur();
     132 
     133  // Set theme_switcher_style
     134  debut_cadre_gris_clair();
     135  echo '<strong>'._T('sktheme:theme_switcher_style').' : </strong>';
     136  echo "<br>";
     137  echo '<TEXTAREA  COLS="50" ROWS="8" NAME="theme_switcher_style">';
     138  echo $GLOBALS['meta']['sktheme_theme_switcher_style'].'</TEXTAREA>'; 
     139  fin_cadre_gris_clair();
     140 
     141  // Set habillage_switcher_style
     142  debut_cadre_couleur();
     143  echo '<strong>'._T('sktheme:habillage_switcher_style').' : </strong>';
     144  echo "<br>";
     145  echo '<TEXTAREA  COLS="50" ROWS="8" NAME="habillage_switcher_style">';
     146  echo $GLOBALS['meta']['sktheme_habillage_switcher_style'].'</TEXTAREA>'; 
     147  fin_cadre_couleur();
     148 
     149   
     150  echo '<P><DIV ALIGN="RIGHT"><INPUT TYPE=SUBMIT VALUE="'._T('sktheme:save_switcher_options').'"></DIV></P>';
     151  echo '</FORM>';
     152 
    72153  fin_cadre_trait_couleur(); 
    73154 
  • _plugins_/_test_/sktheme/exec/sktheme_public_choice.php

    r5736 r5779  
    2222include_spip('inc/layer');          // for spip layer functions
    2323include_spip('inc/utils');          // for _request function
    24 include_spip('inc/plugin');         //
     24include_spip('inc/plugin');         // xml function
    2525include_spip('inc/sktheme_util');   // for sktheme_* functions
    2626include_spip('inc/sktheme_xml');    // for sktheme_* functions
     
    4949  debut_gauche();
    5050  // Include 'raccourcis'
    51   sktheme_raccourcis();
     51  sktheme_public_theme_doc_box();
    5252 
    5353  debut_droite();
    54   echo "<br />";
    5554 
    5655  //
    5756  // Choose Squelette
    58   $dir = "../".$GLOBALS['meta']['sktheme_squelettes_public_dir'];
     57  $s_dir = _DIR_RACINE.$GLOBALS['meta']['sktheme_squelettes_public_dir'];
    5958  debut_cadre_trait_couleur('', false, "sktheme_public_squelette_list",
    6059                            _T('sktheme:available_squelette_list')." : ".$GLOBALS['meta']['sktheme_squelettes_public_dir']);
    6160 
    6261  $squelettes_list = array('dist' => '' );
    63   if (is_dir($dir)) {
    64     if ($dh = opendir($dir)) {
     62  if (is_dir($s_dir)) {
     63    if ($dh = opendir($s_dir)) {
    6564      while (($file = readdir($dh)) !== false) {
    66         if ( (is_dir($dir."/".$file)) AND ($file[0]!=".") ) {
    67           $squelettes_list[$file]=$dir."/".$file;
     65        if ( (is_dir($s_dir."/".$file)) AND ($file[0]!=".") ) {
     66          $squelettes_list[$file]=$s_dir."/".$file;
    6867        }
    6968      }
     
    119118  //
    120119  // Choose Habillage
    121   $dir ="../".$GLOBALS['meta']['sktheme_habillages_public_dir'];
     120  $h_dir = _DIR_RACINE.$GLOBALS['meta']['sktheme_habillages_public_dir'];
    122121  debut_cadre_trait_couleur('', false, "sktheme_public_habillage_list",
    123                             _T('sktheme:available_habillage_list'." : ".$GLOBALS['meta']['sktheme_habillages_public_dir']));
     122                            _T('sktheme:available_habillage_list')." : ".$GLOBALS['meta']['sktheme_habillages_public_dir']);
    124123 
    125124 
    126125  $habillages_list = array($original => '');
    127   if (is_dir($dir)) {
    128     if ($dh = opendir($dir)) {
     126  if (is_dir($h_dir)) {
     127    if ($dh = opendir($h_dir)) {
    129128      while (($file = readdir($dh)) !== false) {
    130         if ( (is_dir($dir."/".$file)) AND ($file[0]!=".") ) {
    131           $habillages_list[$file]=$dir."/".$file;
     129        if ( (is_dir($h_dir."/".$file)) AND ($file[0]!=".") ) {
     130          $habillages_list[$file]=$h_dir."/".$file;
    132131        }
    133132      }
  • _plugins_/_test_/sktheme/inc/sktheme_util.php

    r5736 r5779  
    2424  // onglet($texte, $lien, $onglet_ref, $onglet, $icone="")
    2525  onglet(_T('sktheme:public_choice'),  "?exec=sktheme_public_choice",  "sktheme_public_choice", "sktheme_public_choice", "");
    26   onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_public_choice", "sktheme_private_choice", "");
     26  //onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_public_choice", "sktheme_private_choice", "");
    2727  onglet(_T('sktheme:configuration'),  "?exec=sktheme_config",         "sktheme_public_choice", "sktheme_config", "");
     28  onglet(_T('sktheme:documentation'),  "?exec=sktheme_doc",            "sktheme_public_choice", "sktheme_doc", "");
    2829   fin_onglet();
    2930
     
    3435  // onglet($texte, $lien, $onglet_ref, $onglet, $icone="")
    3536  onglet(_T('sktheme:public_choice'),  "?exec=sktheme_public_choice",  "sktheme_private_choice", "sktheme_public_choice", "");
    36   onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_private_choice", "sktheme_private_choice", "");
     37  //onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_private_choice", "sktheme_private_choice", "");
    3738  onglet(_T('sktheme:configuration'),  "?exec=sktheme_config",         "sktheme_private_choice", "sktheme_config", "");
     39  onglet(_T('sktheme:documentation'),  "?exec=sktheme_doc",            "sktheme_private_choice", "sktheme_doc", "");
    3840  fin_onglet();
    3941
     
    4446  // onglet($texte, $lien, $onglet_ref, $onglet, $icone="")
    4547  onglet(_T('sktheme:public_choice'),  "?exec=sktheme_public_choice",  "sktheme_config", "sktheme_public_choice", "");
    46   onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_config", "sktheme_private_choice", "");
     48  //onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_config", "sktheme_private_choice", "");
    4749  onglet(_T('sktheme:configuration'),  "?exec=sktheme_config",         "sktheme_config", "sktheme_config", "");
     50  onglet(_T('sktheme:documentation'),  "?exec=sktheme_doc",            "sktheme_config", "sktheme_doc", "");
     51  fin_onglet();
     52
     53}
     54function sktheme_doc_onglets() {
     55
     56  debut_onglet();
     57  // onglet($texte, $lien, $onglet_ref, $onglet, $icone="")
     58  onglet(_T('sktheme:public_choice'),  "?exec=sktheme_public_choice",  "sktheme_doc", "sktheme_public_choice", "");
     59  //onglet(_T('sktheme:private_choice'), "?exec=sktheme_private_choice", "sktheme_config", "sktheme_private_choice", "");
     60  onglet(_T('sktheme:configuration'),  "?exec=sktheme_config",         "sktheme_doc", "sktheme_config", "");
     61  onglet(_T('sktheme:documentation'),  "?exec=sktheme_doc",            "sktheme_doc", "sktheme_doc", "");
    4862  fin_onglet();
    4963
     
    6074}
    6175
     76// Build documentation
     77function sktheme_config_doc_box() {
     78 
     79  debut_cadre_relief();
     80  echo _T('sktheme:config_doc_directories');
     81  fin_cadre_relief();
     82  debut_cadre_relief();
     83  echo _T('sktheme:config_doc_switcher');
     84  fin_cadre_relief();
     85 
     86}
     87
     88// Build documentation
     89function  sktheme_public_theme_doc_box() {
     90  debut_cadre_relief();
     91  echo _T('sktheme:public_theme_doc_squelette');
     92  fin_cadre_relief();
     93  debut_cadre_relief();
     94  echo _T('sktheme:public_theme_doc_habillage');
     95  fin_cadre_relief();
     96 
     97}
    6298
    6399?>
  • _plugins_/_test_/sktheme/inc/sktheme_xml.php

    r5736 r5779  
    1515  //
    1616  // ---------------------------------------------------------------------
     17if (!defined("_ECRIRE_INC_VERSION")) return;
    1718
    1819function sktheme_xml_get_infos($xml_dir,$xml_type){
     20
     21  include_spip('inc/plugin');
     22
    1923  $ret = array();
    20   if ((@file_exists(_DIR_PLUGINS))&&(is_dir(_DIR_PLUGINS))){
    21     if (@file_exists(_DIR_PLUGINS."$xml_dir/$xml_type.xml")) {
    22       lire_fichier(_DIR_PLUGINS."$xml_dir/$xml_type.xml", $texte);
     24  if ((@file_exists($xml_dir))&&(is_dir($xml_dir))){
     25    if (@file_exists($xml_dir."/$xml_type.xml")) {
     26      lire_fichier($xml_dir."/$xml_type.xml", $texte);
    2327      $arbre = parse_plugin_xml($texte);
    2428      if (!isset($arbre[$xml_type])&&is_array($arbre[$xml_type]))
     
    2731    else {
    2832      // pour arriver ici on l'a vraiment cherche...
     33      //debug echo "error: erreur_plugin_fichier_def_absent $xml_dir/$xml_type.xml<br>";
    2934      $arbre = array('erreur' => array(_T('erreur_plugin_fichier_def_absent')." : $xml_dir/$xml_type.xml"));
    3035    }
     
    8287  }
    8388  return $ret;
    84   }
     89}
    8590
    8691function sktheme_xml_verifie_conformite($xml_dir,$xml_type="plugin",&$arbre){
  • _plugins_/_test_/sktheme/lang/sktheme_en.php

    r5736 r5779  
    2525
    2626          // C
    27           "configuration" => "Configuration",
    28 
     27          "configuration" => "Advanced configuration",
     28          "config_doc_directories" => "<b>R&eacute;pertoires</b>:<br>
     29          It is possible to re-defined default directories locations of yours
     30          <i>squelettes/habillages</i> distributions.Default is  <i>'themes/squelettes'</i>
     31           and <i>'themes/habillages'</i>, directories are always relatives to
     32          your SPIP root site.
     33          ",
     34          "config_doc_switcher" => "<b>Switcher</b>:<br>
     35          The theme switcher can be activated to include a selection list in the
     36          public area, and then easily test themes. It is possible to limit this
     37          functionnality to the administrator only.<br>
     38          Moreover you can modify the style of this theme selector.<br>
     39          <br>
     40          A new 'balise' <b>#SKTHEME_HABILLAGES_SWITCHER</b> is available to
     41          include an 'habillage' selector list in your squelette. This list is
     42          composed of all available 'habillage' corresponding to the squelette
     43          distribution you have choosen. You can as well modify this
     44          list selector style here.
     45         
     46         
     47          ",
     48         
    2949          // D
     50          "documentation" => "Documentation",
     51          "extra_documentation" => "Extra Documentation",
    3052
    3153          // E
     
    5173
    5274          // N
     75          "no" => "No",
    5376          "no_available_habillage" => "No available habillage",
    5477          "no_available_squelette" => "No available squelette",
     
    5881
    5982          // P
    60           "private_choice" => "Private choice",
     83          "private_choice" => "Private theme choice",
    6184          "private_themes_config" => "Private themes configuration",
    6285          "private_theme_choice" => "Private theme choice",
    63           "public_choice" => "Public choice",
     86          "public_choice" => "Public theme choice",
    6487          "public_theme_choice" => "Public theme choice",
    6588          "public_themes_config" => "Public themes configuration",
    66 
     89          "public_theme_doc_squelette" => "<b>Squelette choice:</b><br>
     90          Each time you will choose a 'squelette' (more exactly a squelettes distribution)
     91          the 'habillage' list will be updated with the available ones.
     92          The small square represent the state of the distribution, stable,
     93          test, experimental, ...<br>
     94          Clic on the small black triangle to get more details about the distribution.
     95          You can find a theme directory exemple on http:skedus.free.fr
     96          ",
     97          "public_theme_doc_habillage" => "<b>Habillage choice:</b><br>
     98          An Habillage is modifing colors and graphical aspect of your squelettes.
     99          It is composed of CSS, pictures, ...<br>
     100          A squelette distribution always contain a default 'habillage' which is
     101          called <b>Original</b>. 
     102          ",
     103         
    67104          // Q
    68105
     
    73110          "save_public_directories" => "Save directories",
    74111          "save_squelette" => "Save squelette",
     112          "save_switcher_options" => "Save switcher options",
    75113          "squelettes_public_dir" => "Public squelettes directory",
     114          "switcher_activated" => "Theme switcher activated",
     115          "switcher_admin_only" => "Only for administrators",
     116          "switcher_style" => "Switcher style",
    76117
    77118          // T
    78119          "to_be_done" => "To be done !",
     120          "themes_switcher" => "Theme switch",
    79121
    80122          // U
     
    89131
    90132          // Y
     133          "yes" => "Yes",
    91134
    92135          // Z
  • _plugins_/_test_/sktheme/lang/sktheme_fr.php

    r5736 r5779  
    2525
    2626          // C
    27           "configuration" => "Configuration",
    28 
     27          "configuration" => "Configuration avanc&eacute;e",
     28          "config_doc_directories" => "<b>R&eacute;pertoires</b>:<br>
     29          Il est possible de red&eacute;finir les r&eacute;pertoires de stockage
     30          de vos <i>'squelettes'</i> et de vos <i>'habillages'</i>, par
     31          d&eacute;faut il s'agit de <i>'themes/squelettes'</i> et de
     32          <i>'themes/habillages'</i>, les r&eacute;pertoires sont toujours
     33          relatifs &agrave; la racine de votre site SPIP
     34          ",
     35          "config_doc_switcher" => "<b>Switcher</b>:<br>
     36          Le 'switcher' de th&egrave;mes permet de faire apparaitre une liste de
     37          selection de th&egrave;mes dans l'espace public et ainsi tester
     38          les diff&eacute;rents th&egrave;mes plus rapidement. Il est possible
     39          de ne donner cette possibilit&eacute; qu'aux administrateurs<br>
     40          De plus vous pouvez changer le style de votre selecteur de
     41          th&egrave;mes ici.
     42          <br>
     43          <br>
     44          Il existe &eacute;galement une balise <b>#SKTHEME_HABILLAGES_SWITCHER</b>
     45          qu'il est possible d'int&eacute;grer &agrave; vos squelettes pour disposer
     46          cette fois d'un selectionneur d'habillage correspondant &agrave; votre
     47          choix de squelette. Une fois encore vous pouvez en modifier le style si besoin.
     48          ",
    2949          // D
     50          "documentation" => "Documentation",
     51          "extra_documentation" => "Extra Documentation",
    3052
    3153          // E
     
    5173
    5274          // N
     75          "no" => "Non",
    5376          "no_available_habillage" => "Aucun habillage disponible",
    5477          "no_available_squelette" => "Aucun squelette disponible",
     
    5881
    5982          // P
    60           "private_choice" => "Choix priv&eacute;",
     83          "private_choice" => "Choix th&egrave;me priv&eacute;",
    6184          "private_themes_config" => "Configuration pour les th&egrave;mes priv&eacute;s",
    6285          "private_theme_choice" => "Choix du th&egrave;me de l'espace priv&eacute;",
    63           "public_choice" => "Choix public",
     86          "public_choice" => "Choix th&egrave;me public",
    6487          "public_theme_choice" => "Choix du th&egrave;me de l'espace public",
    6588          "public_themes_config" => "Configuration pour les th&egrave;mes publics",
    66 
     89          "public_theme_doc_squelette" => "<b>Choix du squelette :</b><br>
     90          Chaque fois que vous choisirez un squelette (plus exactement une
     91          distribution de squelettes) la liste des habillages disponibles se
     92          mettra &agrave; jour. Le petit carr&eacute;s indique l'&eacute;stat de
     93          la distribution de squelette, stable, test, experimentale ...<br>
     94          Pour plus de d&eacute;tail sur une distribution cliquez sur la
     95          fl&egrave;che noire.
     96          Il est possible de trouver un r&eacute;pertoire de th&egrave;mes exemple
     97          sur http:skedus.free.fr
     98          ",
     99          "public_theme_doc_habillage" => "<b>Choix de l'habillage :</b><br>
     100          Les habillages permettent de modifier les couleurs et l'aspect
     101          graphique de votre distribution de squelettes. Il s'agit de CSS et/ou d'images
     102          etc ...<br>
     103          Une distribution de squelette contient toujours une
     104          pr&eacute;sentation graphique par d&eacute;faut, ceci correspond
     105          &agrave; l'habillage nomm&eacute; <b>Original</b>.
     106          ",
    67107          // Q
    68108
     
    73113          "save_public_directories" => "Enregistrer les r&eacute;pertoires",
    74114          "save_squelette" => "Enregister le squelette",
     115          "save_switcher_options" => "Enregistrer les options du switcher",
    75116          "squelettes_public_dir" => "R&eacute;pertoires pour les squelettes publics",
     117          "switcher_activated" => "Activer le switcher de th&egrave;me",
     118          "switcher_admin_only" => "Seulement pour les administrateurs",
     119          "switcher_style" => "Style du switcher",
    76120
    77121          // T
    78122          "to_be_done" => "&agrave; faire !",
     123          "themes_switcher" => "Switcher de th&egrave;me",
    79124
    80125          // U
     
    89134
    90135          // Y
     136          "yes" => "Oui",
    91137
    92138          // Z
  • _plugins_/_test_/sktheme/plugin.xml

    r5736 r5779  
    11<plugin>
    22 <nom>SkTheme</nom>
    3  <version>0.3</version>
     3 <version>0.4</version>
    44 <etat>test</etat>
    55 <auteur>Jerome RICHARD
     
    2626    <inclure>sktheme_fonctions.php</inclure>
    2727 </pipeline>
     28 <pipeline>
     29    <nom>affichage_final</nom>
     30    <action>affichage_final</action>
     31    <inclure>sktheme_fonctions.php</inclure>
     32 </pipeline>
     33 <pipeline>
     34   <nom>insert_head</nom>
     35      <inclure>sktheme_head.php</inclure>
     36 </pipeline>
    2837 </plugin>
  • _plugins_/_test_/sktheme/sktheme_fonctions.php

    r5736 r5779  
    1919define('_DIR_PLUGIN_SKTHEME',(_DIR_PLUGINS.end($p)));
    2020
     21include_spip('inc/sktheme_list');
     22
    2123// Add private area button
    2224function sktheme_ajouter_boutons($boutons_admin) {
     
    3234}
    3335
     36
     37//
     38// Include Philippe Drouot switcher functionnality
     39// Based on Fil contrib
     40function sktheme_affichage_final($texte){
     41       
     42  global $html;
     43 
     44  $sktheme_list = sktheme_list();
     45   
     46  // Insertion du Javascript de rechargement de page
     47  // Always include this script used for #SKTHEME_HABILLAGES_SWITCHER and #SKTHEME_THEMES_SWITCHER
     48  $code = '<script type="text/javascript">
     49                //<![CDATA[
     50                function sktheme_gotof(url) {
     51                window.location=url;
     52                }//]]>
     53                </script>';       
     54 
     55  if (isset($GLOBALS['meta']['sktheme_switcher_activated'])
     56      AND ($GLOBALS['meta']['sktheme_switcher_activated']=="yes")) {
     57    if ($html) {
     58               
     59      // Doit-on afficher le seleecteur de squelette ? (Fonctionnalitée restreinte aux seuls administrateurs ?)
     60      $afficherSelecteur=TRUE;
     61      if (isset($GLOBALS['meta']['sktheme_switcher_admin_only'])
     62          AND ($GLOBALS['meta']['sktheme_switcher_admin_only']=="yes")
     63          AND (!isset($_COOKIE['spip_admin']))) $afficherSelecteur=FALSE;
     64               
     65      if ($afficherSelecteur) {
     66                       
     67                       
     68        // Insertion du sélecteur de squelettes                 
     69        $code.='<div id="sktheme_switcher" style="top: 0;left: 20px; position: absolute; background-color: transparent;z-index: 100;">';
     70        $code.='<form action="" method="post">';
     71        $code.='<select name="selecteurTheme" style="'.$GLOBALS['meta']['sktheme_theme_switcher_style'].'" onchange="sktheme_gotof(this.options[this.selectedIndex].value)">';
     72        $code.='<option selected="selected" value="">Themes</option>';
     73        foreach( $sktheme_list as $value )      $code.='<option value="'.parametre_url(self(),'sktheme',$value).'">&nbsp;-> '.$value.'</option>';
     74        $code.='</select>';
     75        $code.='</form>';
     76        $code.='</div>';
     77      }
     78
     79                       
     80    }
     81  }
     82 
     83  $texte=eregi_replace("<body([^>]*)>","<body \\1>$code",$texte);
     84  return($texte);
     85}
     86
    3487?>
  • _plugins_/_test_/sktheme/sktheme_options.php

    r5736 r5779  
    1616  //
    1717  // ---------------------------------------------------------------------
     18  // cache desactivation
     19  $_SERVER['REQUEST_METHOD']='POST';
    1820
    1921include_spip("inc/meta");
     22include_spip('inc/sktheme_balises');
    2023
    2124// Set a default configuration - each values can be modify
     
    2629  ecrire_meta('sktheme_squelette_public_name',"dist");
    2730  ecrire_meta('sktheme_habillage_public_name',"");
     31  ecrire_meta('sktheme_theme_switcher_style',"font-size: 10px;background-color: #FFF;color: #0C479D;border-top: 1px solid #CECECE; border-bottom: 2px solid #4A4A4A; border-left: 1px solid #CECECE; border-right: 1px solid #CECECE;margin:2px .5em;");
     32  ecrire_meta('sktheme_habillage_switcher_style',"font-size: 10px;background-color: #FFF;color: #0C479D;border-top: 1px solid #CECECE; border-bottom: 2px solid #4A4A4A; border-left: 1px solid #CECECE; border-right: 1px solid #CECECE;margin:2px .5em;");
     33  ecrire_meta('sktheme_switcher_activated',"no");
     34  ecrire_meta('sktheme_switcher_admin_only',"yes");
    2835  ecrire_metas();
    2936}
    3037
     38// Set default user choice
     39$s_dir = $GLOBALS['meta']['sktheme_squelettes_public_dir'].'/'.$GLOBALS['meta']['sktheme_squelette_public_name'];
     40$h_dir = $GLOBALS['meta']['sktheme_habillages_public_dir'].'/'.$GLOBALS['meta']['sktheme_habillage_public_name'];
     41
     42//
     43// SWITCHER THEME
     44//
     45// Contrib de Fil : voir http://trac.rezo.net/trac/spip-zone/browser/_contribs_/switcher/switcher.php
     46// --------------------------------------------------------------------------------------------------
     47// Ask sktheme
     48if (isset($_GET['sktheme'])) {
     49 
     50  // sktheme format :
     51  // for theme           = squelette_name::habillage_name
     52  // for habillage only  = __current::habillage_name
     53  //
     54  list($squelette,$habillage)= split ("::", $_GET['sktheme']);
     55   
     56  // For habillage only
     57  if ($squelette == "__current") {
     58    $squelette = $GLOBALS['meta']['sktheme_squelette_public_name'];
     59  }
     60   
     61  $s_dir = $GLOBALS['meta']['sktheme_squelettes_public_dir'].'/'.$squelette;
     62  $h_dir = $GLOBALS['meta']['sktheme_habillages_public_dir'].'/'.$habillage;
     63   
     64  if (is_dir(_DIR_RACINE.$s_dir)) {
     65    // theme exist put a cookie
     66    setcookie('spip_sktheme', $_COOKIE['spip_sktheme'] = $_GET['sktheme'], NULL, '/');
     67  } else {
     68    // not valid remove cookie
     69    setcookie('spip_sktheme', $_COOKIE['spip_sktheme'] = '', -24*3600, '/');
     70  }
     71}
     72
     73if (isset($_COOKIE['spip_sktheme'])) {
     74  list($squelette,$habillage)= split ("::", $_COOKIE['spip_sktheme']);
     75  // For habillage only
     76  if ($squelette == "__current") {
     77    $squelette = $GLOBALS['meta']['sktheme_squelette_public_name'];
     78  }
     79  $s_dir_new = $GLOBALS['meta']['sktheme_squelettes_public_dir'].'/'.$squelette;
     80  $h_dir_new = $GLOBALS['meta']['sktheme_habillages_public_dir'].'/'.$habillage;
     81 
     82  if (is_dir(_DIR_RACINE.$s_dir_new)) {
     83    $s_dir = $s_dir_new;
     84  }
     85  if (is_dir(_DIR_RACINE.$h_dir_new)) {
     86    $h_dir = $h_dir_new;
     87  }
     88}
     89
    3190// So set only the 'dossier_squelettes' to the corresponding user choice
    32 $dossier_squelettes =  $GLOBALS['meta']['sktheme_habillages_public_dir'].'/'.$GLOBALS['meta']['sktheme_habillage_public_name'].
    33 ':'.$GLOBALS['meta']['sktheme_squelettes_public_dir'].'/'.$GLOBALS['meta']['sktheme_squelette_public_name'];
     91$dossier_squelettes = $h_dir.':'.$s_dir;
     92
    3493
    3594?>
Note: See TracChangeset for help on using the changeset viewer.