Kaynağa Gözat

pa #642: renommage des "formats" en "supports" et des "supports" en "documents". pa #672: CSS redondant

FGM 13 yıl önce
ebeveyn
işleme
41e48fa2ce

+ 23 - 5
fgcf.install

@@ -18,7 +18,7 @@ function fgcf_install() {
   taxonomy_save_vocabulary($vocabulary);
 
   $vocabulary = array(
-    'name' => 'FGCF Format de cours',
+    'name' => 'FGCF Supports de cours',
     'description' => 'Toute caractéristique de la formation, comme la présence de travaux pratiques, une évaluation, etc.',
     'multiple' => 0,
     'required' => 0,
@@ -31,7 +31,7 @@ function fgcf_install() {
   taxonomy_save_vocabulary($vocabulary);
 
   $vocabulary = array(
-    'name' => 'FGCF Supports remis',
+    'name' => 'FGCF Documents remis',
     'description' => '',
     'multiple' => 0,
     'required' => 0,
@@ -93,12 +93,30 @@ function fgcf_update_6102() {
 }
 
 /**
- * Deploy feature changes.
+ * Deploy feature changes, as per issue #650.
+ * 
+ * @return array
  */
-function fgcf_update_6013() {
+function fgcf_update_6103() {
   // Revert only the CCK field changes.
   features_revert(array('fgcf' => array('content')));
   // OR, to revert all components for all features :
   // features_revert();
   return array();
-}
+}
+
+/**
+ * Rename "FGCF Supports remis" and "FGCF Format de cours" vocabularies as per issue #642
+ *
+ * @return array
+ */
+function fgcf_update_6104() {
+  $ret = array();
+  $sq = "UPDATE {vocabulary} SET name = 'FGCF Documents remis' WHERE name = 'FGCF Supports remis'";
+  $ret[] = update_sql($sq);
+  $sq = "UPDATE {vocabulary} SET name = 'FGCF Supports de cours' WHERE name = 'FGCF Format de cours'";
+  $ret[] = update_sql($sq);
+  $sq = "DELETE FROM {url_alias} WHERE src LIKE 'fgcf/%'";
+  $ret[] = update_sql($sq);
+  return $ret;
+}

+ 16 - 12
fgcf.module

@@ -42,10 +42,10 @@ function fgcf_menu() {
     'access arguments' => $read_access,
     'menu_name' => 'primary-links',
   );
-  $items['fgcf/format'] = array(
+  $items['fgcf/support'] = array(
     'type' => MENU_CALLBACK,
-    'title' => 'Formations par format',
-    'page callback' => 'fgcf_page_format',
+    'title' => 'Formations par support',
+    'page callback' => 'fgcf_page_support',
     'access arguments' => $read_access,
   );
   $items['fgcf/organisme'] = array(
@@ -65,6 +65,7 @@ function fgcf_menu() {
     'page callback' => 'fgcf_page_odt',
     'access arguments' => array('create fgcf_fiche content'),
   );
+  
   return $items;
 }
 
@@ -134,7 +135,11 @@ function fgcf_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
       if ($a3 /* !teaser */  || !$a4 /* page */) {
         break;
       }
-      drupal_add_css(drupal_get_path('module', 'fgcf') .'/theme/css/fgcf.css');
+      
+      // Not redundant with hook_init: fgcf node pages are not on fgcf[/.*] URLs
+      if (in_array($node->type, array_keys(fgcf_node_info()))) {
+        drupal_add_css(drupal_get_path('module', 'fgcf') .'/theme/css/fgcf.css');
+      }
 
       switch ($node->type) {
         case 'fgcf_prestataire':
@@ -196,7 +201,6 @@ function fgcf_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  * Page callback : 'Catalogue Formations'.
  */
 function fgcf_page_home() {
-  drupal_add_css(drupal_get_path('module', 'fgcf') .'/theme/css/fgcf.css');
   drupal_set_title('Catalogue des formations France Galop');
 
   $filter_form = drupal_get_form('fgcf_filter_form');
@@ -206,18 +210,18 @@ function fgcf_page_home() {
 }
 
 /**
- * Page callback : 'Formations par format'.
+ * Page callback : 'Formations par support'.
  */
-function fgcf_page_format($format = 0) {
+function fgcf_page_support($format = 0) {
   $bc = drupal_get_breadcrumb();
   $bc[] = l(t('Catalogue formations'), 'fgcf');
 
   $filter_form = drupal_get_form('fgcf_filter_form');
 
   $ret = $filter_form;
-  $vid = _fgcf_get_vocabulary_by_name('FGCF Format de cours');
+  $vid = _fgcf_get_vocabulary_by_name('FGCF Supports de cours');
   if (empty($format)) {
-    $ret .= views_embed_view('fgcf_formats_de_formations', 'default', $vid);
+    $ret .= views_embed_view('fgcf_supports_de_formations', 'default', $vid);
   }
   else {
     $term = taxonomy_get_term($format);
@@ -225,12 +229,12 @@ function fgcf_page_format($format = 0) {
       $format = 0;
     }
     else {
-      $bc[] = l(t('Formats de formation'), 'fgcf/format');
-      drupal_set_title(t('Format : @term', array('@term' => $term->name)));
+      $bc[] = l(t('Supports de formation'), 'fgcf/support');
+      drupal_set_title(t('Support: @term', array('@term' => $term->name)));
       $values = _fgcf_filter_form_translate_values();
     }
 
-    $ret .= views_embed_view('fgcf_formations_par_format', 'default', $format, $values['dif'], $values['modalites']);
+    $ret .= views_embed_view('fgcf_formations_par_support', 'default', $format, $values['dif'], $values['modalites']);
   }
 
   drupal_set_breadcrumb($bc);

+ 4 - 4
theme/fgcf-home.tpl.php

@@ -8,8 +8,8 @@
 <?php echo $filter_form; ?>
 <div class="item-list">
   <ul>
-    <li><?php print l(t('Thèmes de formation'), 'fgcf/theme'); ?></li>
+    <li><?php print l(t('Thèmes de formation'),     'fgcf/theme'); ?></li>
     <li><?php print l(t('Organismes de formation'), 'fgcf/organisme'); ?></li>
-    <li><?php print l(t('Formats de formation'), 'fgcf/format'); ?></li>
-  </ul>
-</div>
+    <li><?php print l(t('Support de formation'),    'fgcf/support'); ?></li>
+    </ul>
+  </div>

+ 2 - 2
views/fgcf_formations_par_format.php → views/fgcf_formations_par_support.php

@@ -6,8 +6,8 @@
  */
 
 $view = new view;
-$view->name = 'fgcf_formations_par_format';
-$view->description = 'FG Formations par Format';
+$view->name = 'fgcf_formations_par_support';
+$view->description = 'FG Formations par Support';
 $view->tag = 'FGCF';
 $view->view_php = '';
 $view->base_table = 'node';

+ 4 - 4
views/fgcf_formats_de_formations.php → views/fgcf_supports_de_formation.php

@@ -2,12 +2,12 @@
 // $Id$
 /**
  * @file
- * Liste des formats pédagogiques, liant vers les formations correspondantes
+ * Liste des formats pédagogiques (aka "supports"), liant vers les formations correspondantes
  */
 
 $view = new view;
-$view->name = 'fgcf_formats_de_formations';
-$view->description = 'FG Liste des formats de formations';
+$view->name = 'fgcf_supports_de_formations';
+$view->description = 'FG Liste des supports de formations';
 $view->tag = 'FGCF';
 $view->view_php = '';
 $view->base_table = 'term_data';
@@ -41,7 +41,7 @@ $handler->override_option('fields', array(
     'alter' => array(
       'alter_text' => 0,
       'make_link' => 1,
-      'path' => 'fgcf/format/[tid]',
+      'path' => 'fgcf/support/[tid]',
       'trim' => 0,
       'word_boundary' => 1,
       'ellipsis' => 1,