Project

General

Profile

Download (21.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/**
3
 * @file
4
 * Overrides of generic themeing functions in cdm_dataportal.theme.php.
5
 */
6

    
7
/**
8
 * @todo Please document this function.
9
 * @see http://drupal.org/node/1354
10
 */
11
function garland_cichorieae_cdm_descriptionElementTextData($variables) {
12
  $element = $variables['element'];
13
  $asListElement = $variables['asListElement'];
14
  $feature_uuid = $variables['feature_uuid'];
15

    
16
  $description = '';
17
  if (isset($element->multilanguageText_L10n->text)) {
18
    $description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
19
  }
20
  $sourceRefs = '';
21
  $result = array();
22
  $res_author;
23
  $res_date;
24
  $do_links = TRUE;
25
  $default_theme = variable_get('theme_default', 'garland_cichorieae');
26

    
27
  if (($default_theme == 'flora_malesiana' || $default_theme == 'flore_afrique_centrale' || $default_theme == 'flore_gabon') && $element->feature->titleCache == 'Citation') {
28
    $asListElement = TRUE;
29
  }
30
  elseif ($element->feature->uuid == UUID_CHROMOSOMES_NUMBERS) {
31
    $asListElement = TRUE;
32
  }
33
  else {
34
    $asListElement = FALSE;
35
  }
36

    
37
  // Printing annotations footnotes.
38
  $annotation_fkeys = theme('cdm_annotations_as_footnotekeys', array(
39
    'cdmBase_list' => $element,
40
    'footnote_list_key' => $feature_uuid,
41
  ));
42

    
43
  if ($feature_uuid == UUID_NAME_USAGE || $feature_uuid == UUID_CHROMOSOMES) {
44
    $do_links = FALSE;
45
  }
46

    
47
  if (is_array($element->sources)) {
48
    foreach ($element->sources as $source) {
49
      // Initialize some variables.
50
      if ($feature_uuid == UUID_NAME_USAGE) {
51
        $referenceCitation = cdm_ws_get(
52
          CDM_WS_NOMENCLATURAL_REFERENCE_CITATION,
53
          array($source->citation->uuid),
54
          "microReference=" . urlencode($source->citationMicroReference
55
        ));
56
        $referenceCitation = $referenceCitation->String;
57
      }
58
      else {
59
        $referenceCitation = theme('cdm_OriginalSource', array(
60
          'source' => $source,
61
          'doLink' => $do_links,
62
        ));
63
      }
64
      if ($description && strlen($description) > 0 && $referenceCitation) {
65
        $sourceRefs .= ' (' . $referenceCitation . ')';
66
      }
67
      elseif ($referenceCitation) {
68
        $sourceRefs = $referenceCitation;
69
      }
70
      // Generate the output.
71
      if (strlen($sourceRefs) > 0) {
72
        $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
73
      }
74
      $name_used_in_source_link_to_show = '';
75
      if (isset($source->nameUsedInSource->uuid) && ($feature_uuid != UUID_NAME_USAGE)) {
76
        // Do a link to name page.
77
        $name_used_in_source_link_to_show = l($source->nameUsedInSource->titleCache, path_to_name($source->nameUsedInSource->uuid), array(), NULL, NULL, FALSE, TRUE);
78
      }
79
      elseif (isset($source->nameUsedInSource->uuid) && ($feature_uuid == UUID_NAME_USAGE)) {
80
        // Do not do link for NAME USAGE feature.
81
        $name_used_in_source_link_to_show = $source->nameUsedInSource->titleCache;
82
      }
83
      elseif (isset($source->nameUsedInSource->originalNameString) && strlen($source->nameUsedInSource->originalNameString) > 0) {
84
        // Show a text without link.
85
        $name_used_in_source_link_to_show = $source->nameUsedInSource->originalNameString;
86
      }
87

    
88
      if ($asListElement && ($feature_uuid == UUID_NAME_USAGE)) {
89
        $out = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
90
        // Adding ":" if necesary.
91
        if (!empty($name_used_in_source_link_to_show) && (!empty($description) || !empty($sourceRefs))) {
92
          $out .= ': ';
93
        }
94

    
95
        $out .= $description . $sourceRefs . theme('cdm_annotations_as_footnotekeys', array(
96
          'cdmBase_list' => $element,
97
          'footnote_list_key' => $feature_uuid,
98
        )) . $annotation_fkeys . '</li>';
99
      }
100
      elseif ($asListElement) {
101

    
102
        $out = '<li class="descriptionText DescriptionElement">';
103
        // Adding ":" if necessary.
104
        if (!empty($name_used_in_source_link_to_show)) {
105
          if ( (!empty($description)|| !empty($sourceRefs)) && $feature_uuid != UUID_CHROMOSOMES_NUMBERS) {
106
            $out .= $name_used_in_source_link_to_show . ': ';
107
          } else {
108
            $out .= $name_used_in_source_link_to_show . ' ';
109
          }
110
        }
111

    
112
        $out .= $description . $sourceRefs . theme('cdm_annotations_as_footnotekeys', array(
113
          'cdmBase_list' => $element,
114
          'footnote_list_key' => $feature_uuid,
115
        )) . $annotation_fkeys . '</li>';
116
        // Special handling for flora malesiana.
117
        // TODO: possible better way to implement this case?
118
      }
119
      else {
120
        if (isset($name_used_in_source_link_to_show)) {
121
          $name_used_in_source_link_to_show = ' (name in source: ' . $name_used_in_source_link_to_show . ')';
122
        }
123
        if (!isset($description)) {
124
          $description = '';
125
        }
126
        if (!isset($sourceRefs)) {
127
            $sourceRefs = '';
128
        }
129
        if (!isset($name_used_in_source_link_to_show)) {
130
            $name_used_in_source_link_to_show = '';
131
        }
132
        if (!isset($annotation_fkeys)) {
133
            $annotation_fkeys = '';
134
        }
135
        $out = '<span class="' . html_class_atttibute_ref($element) . '"> ' . $description . $sourceRefs . $name_used_in_source_link_to_show . $annotation_fkeys . '</span>';
136
      }
137
    }
138
  }
139

    
140
  // If no sources, print the description.
141
  if (!isset($out)) {
142
    $out = '<span class="' . html_class_atttibute_ref($element) . '"> ' . $description . $annotation_fkeys . '</span>';
143
  }
144

    
145
  /* Dead code:
146
   *
147
   * Disabled code; can this be removed?
148
  if ($feature_uuid == UUID_NAME_USAGE){ foreach($element->sources as
149
  $source){ $referenceCitation =
150
  cdm_ws_get(CDM_WS_NOMENCLATURAL_REFERENCE_CITATION,
151
  array($source->citation->uuid),
152
  "microReference=".urlencode($source->citationMicroReference));
153
  $referenceCitation = $referenceCitation->String; if($description &&
154
  strlen($description) > 0 && $referenceCitation ){ $sourceRefs .= '
155
  ('.$referenceCitation.')' ; }else if ($referenceCitation){ $sourceRefs =
156
  $referenceCitation; } } }else{ foreach($element->sources as $source){
157
  $referenceCitation = theme('cdm_OriginalSource', $source,
158
  ($feature_uuid == UUID_NAME_USAGE) ? FALSE : TRUE); if($description &&
159
  strlen($description) > 0 && $referenceCitation ){ $sourceRefs .= '
160
  ('.$referenceCitation.')' ; }else if ($referenceCitation){ $sourceRefs =
161
  $referenceCitation; } } } if(strlen($sourceRefs) > 0){ $sourceRefs = '<span
162
  class="sources">' . $sourceRefs . '</span>'; } if
163
  ($source->nameUsedInSource->uuid && ($feature_uuid != UUID_NAME_USAGE)){
164
  //do a link to name page $name_used_in_source_link_to_show =
165
  l($source->nameUsedInSource->titleCache,
166
  path_to_name($source->nameUsedInSource->uuid), array(), NULL, NULL, FALSE
167
  ,TRUE); }else if ($source->nameUsedInSource->uuid && ($feature_uuid ==
168
  UUID_NAME_USAGE)){ //do not do link for NAME USAGE feature
169
  $name_used_in_source_link_to_show = $source->nameUsedInSource->titleCache;
170
  }else if (strlen($source->nameUsedInSource->originalNameString) > 0){
171
  //show a text without link $name_used_in_source_link_to_show =
172
  $source->nameUsedInSource->originalNameString; } if($asListElement &&
173
  ($feature_uuid == UUID_NAME_USAGE)){ $out = '<li class="descriptionText">'
174
  . $name_used_in_source_link_to_show; //adding ":" if necesary if
175
  ($name_used_in_source_link_to_show && ($description || $sourceRefs)){ $out
176
  .= ': '; } $out .= $description . $sourceRefs .
177
  theme('cdm_annotations_as_footnotekeys', $element) . '</li>'; }else if
178
  ($asListElement){ $out = '<li class="descriptionText">' .
179
  $name_used_in_source_link_to_show; //adding ":" if necesary if
180
  ($name_used_in_source_link_to_show && ($description || $sourceRefs)){ $out
181
  .= ': '; } $out .= $description . $sourceRefs .
182
  theme('cdm_annotations_as_footnotekeys', $element) . '</li>'; //special
183
  handling for flora malesiana TODO: possible better way to implement this
184
  case? }else{ if ($name_used_in_source_link_to_show){
185
  $name_used_in_source_link_to_show = ' (name in source: '.
186
  $name_used_in_source_link_to_show . ')'; } $out = $description .
187
  $sourceRefs . $name_used_in_source_link_to_show; $out .=
188
  theme('cdm_annotations_as_footnotekeys', $element); }
189
  */
190
  // Add annotations as footnote key.
191
  // $out .= theme('cdm_annotations_as_footnotekeys', $element); move above.
192
  return $out;
193
}
194

    
195
// NO LONGER NEEDED - since term representation is changed now in the cdm for
196
// the cichorieae
197
// ====> delete
198
// /**
199
// * @overrides theme_cdm_taggedtext2html in order to replace t.infr and
200
// t.infgen. with '[unranked]'
201
// */
202
// function garland_cichorieae_cdm_taggedtext2html(array &$taggedtxt, $tag =
203
// 'span', $glue = ' ', $skiptags = array()){
204
// $out = '';
205
// $i = 0;
206
// foreach($taggedtxt as $tt){
207
// if(!in_array($tt->type, $skiptags) && strlen($tt->text) > 0){
208
// $out .= (strlen($out) > 0 && ++$i < count($taggedtxt)? $glue : '').'<'.$tag.'
209
// class="'.$tt->type.'">';
210
// if($tt->type == "rank" && ($tt->text == "t.infr." || $tt->text ==
211
// "t.infgen.")){
212
// $out .= t('[unranked]');
213
// }else{
214
// $out .= t($tt->text);
215
// }
216
// $out .= '</'.$tag.'>';
217
// }
218
// }
219
// return $out;
220
// }
221
/**
222
 * Returns HTML for a cdm_descriptionElementArray.
223
 *
224
 * @param array $variables
225
 *   An associative array containing:
226
 *   - elementArray: The array with CDM description elements being formatted.
227
 *   - feature: The description feature container object for the
228
 *     description element array.
229
 *   - glue: String for joining the description elements together.
230
 *   - sortArray: Boolean, TRUE if the array should be sorted before themeing.
231
 *   - enclosingHTML: HTML tag, e.g. 'div', in which to wrap the description.
232
 *
233
 * @ingroup themeable
234
 */
235
function garland_cichorieae_cdm_descriptionElementArray($variables) {
236
  $elementArray = $variables['elementArray'];
237
  $feature = $variables['feature'];
238
  $glue = $variables['glue'];
239
  $sortArray = $variables['sortArray'];
240
  $enclosingHtml = $variables['enclosingHtml'];
241

    
242
  $enclosingHtml = 'div';
243
  $out = '<' . $enclosingHtml . ' class="description" id="' . $feature->representation_L10n . '">';
244

    
245
  if ($sortArray) {
246
    sort($elementArray);
247
  }
248

    
249
  $out .= join($elementArray, $glue);
250

    
251
  $out .= '</' . $enclosingHtml . '>';
252
  return $out;
253
}
254

    
255
/*
256
  ***** GARLAND OVERRIDES *****
257
*/
258

    
259
/**
260
 * Sets the body-tag class attribute.
261
 *
262
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
263
 */
264
function phptemplate_body_class($sidebar_left, $sidebar_right) {
265
  if ($sidebar_left != '' && $sidebar_right != '') {
266
    $class = 'sidebars';
267
  }
268
  else {
269
    if ($sidebar_left != '') {
270
      $class = 'sidebar-left';
271
    }
272
    if ($sidebar_right != '') {
273
      $class = 'sidebar-right';
274
    }
275
  }
276

    
277
  if (isset($class)) {
278
    print ' class="' . $class . '"';
279
  }
280
}
281

    
282
/**
283
 * Allow themable wrapping of all comments.
284
 */
285
/*
286
function phptemplate_comment_wrapper($content, $type = NULL) {
287
  static $node_type;
288
  if (isset($type)) $node_type = $type;
289

    
290
  if (! $content || $node_type == 'forum') {
291
    return '<div id="comments">' . $content . '</div>';
292
  }
293
  else {
294
    return '<div id="comments"><h2 class="comments">' . t('Comments') . '</h2>' . $content . '</div>';
295
  }
296
}
297
*/
298

    
299
/**
300
 * Override or insert PHPTemplate variables into the templates.
301
 */
302
function _phptemplate_variables($hook, $vars) {
303
  if ($hook == 'page') {
304

    
305
    if ($secondary = menu_secondary_local_tasks()) {
306
      $output = '<span class="clear"></span>';
307
      $output .= "<ul class=\"tabs secondary\">\n" . $secondary . "</ul>\n";
308
      $vars['tabs2'] = $output;
309
    }
310

    
311
    // Hook into color.module
312
    if (module_exists('color')) {
313
      _color_page_alter($vars);
314
    }
315
    return $vars;
316
  }
317
  return array();
318
}
319

    
320
/**
321
 * Returns HTML for the rendered local tasks.
322
 *
323
 * The default implementation renders them as tabs.
324
 *
325
 * @ingroup themeable
326
 */
327
function phptemplate_menu_local_tasks() {
328
  $output = '';
329

    
330
  if ($primary = menu_primary_local_tasks()) {
331
    $output .= "<ul class=\"tabs primary\">\n" . $primary . "</ul>\n";
332
  }
333

    
334
  return $output;
335
}
336

    
337
/**
338
 * @deprecated define name render templates via the layout settings
339
 */
340
function garland_cichorieae_get_partDefinition() {
341
  return
342
    array(
343
        'ZoologicalName' => array(
344
            'namePart' => array('name' => TRUE),
345
            'referencePart' => array('authors' => TRUE),
346
            'microreferencePart' => array('microreference' => TRUE),
347
            'statusPart' => array('status' => TRUE),
348
            'descriptionPart' => array('description' => TRUE),
349
        ),
350
        'BotanicalName' => array(
351
            'namePart' => array('name' => TRUE),
352
            'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
353
            'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
354
            'statusPart' => array('status' => TRUE),
355
            'descriptionPart' => array('description' => TRUE),
356
        ),
357
        '#DEFAULT' => array(
358
            'namePart' => array(
359
                'name' => TRUE,
360
                'authors' => TRUE
361
            ),
362
            'referencePart' => array(
363
                'reference' => TRUE
364
            ),
365
            'microreferencePart' => array(
366
                'microreference' => TRUE,
367
            ),
368
            'statusPart' => array(
369
                'status' => TRUE,
370
            ),
371
            'descriptionPart' => array(
372
                'description' => TRUE,
373
            ),
374
        )
375
    );
376
}
377

    
378
/**
379
 * @deprecated define name render templates via the layout settings
380
 */
381
function garland_cichorieae_get_nameRenderTemplate($variables) {
382
  $templates = array(
383
   'taxon_page_title,polytomousKey'=> array(
384
        'namePart' => array('#uri' => TRUE),
385
      ),
386
    'taxon_page_synonymy,related_taxon'=> array(
387
        'nameAuthorPart' => array('#uri' => TRUE),
388
        'referencePart' => TRUE,
389
        'statusPart' => TRUE,
390
        'descriptionPart' => TRUE,
391
      ),
392
    'acceptedFor,typedesignations,list_of_taxa' => array(
393
        'nameAuthorPart' => array('#uri' => TRUE),
394
        'referencePart' => TRUE,
395
      ),
396
    '#DEFAULT' => array(
397
        'nameAuthorPart' => array('#uri' => TRUE),
398
        'referencePart' => TRUE,
399
      )
400
    );
401
  return $templates;
402
}
403

    
404
/**
405
 * Returns HTML for taxon list thumbnails.
406
 *
407
 * Theme specific mods:
408
 * $captionElements = array('title', '#uri'=>t('open Image'));
409
 * $mediaLinkType:
410
 * "NORMAL": link to the image page or to the $alternativeMediaUri if it is
411
 * defined instead of
412
 * "LIGHTBOX": open the link in a light box,
413
 * TODO expose those in admin section, by adding 'em to gallery_settings see
414
 * http://dev.e-taxonomy.eu/trac/ticket/2494.
415
 *
416
 * @param array $variables
417
 *   An associative array containing:
418
 *   - taxon: The taxon object for which to theme the thumbnails.
419
 *
420
 * @ingroup themeable
421
 */
422
function garland_cichorieae_cdm_taxon_list_thumbnails($variables) {
423
  $out = '';
424
  $taxon = $variables['taxon'];
425

    
426
  $gallery_settings = getGallerySettings(CDM_DATAPORTAL_SEARCH_GALLERY_NAME);
427

    
428
  $mediaLinkType = 'NORMAL';
429
  $showCaption = $gallery_settings['cdm_dataportal_show_thumbnail_captions'];
430
  $captionElements = array();
431
  if ($showCaption) {
432
    $captionElements = array('title', '#uri' => t('open Image'));
433
  }
434

    
435
  $gallery_name = $taxon->uuid;
436

    
437
  $galleryLinkUri = path_to_taxon($taxon->uuid, 'images');
438

    
439
  $mediaList = $mediaList = _load_media_for_taxon($taxon);
440

    
441
  $out .= theme('cdm_media_gallerie', array(
442
    'mediaList' => $mediaList,
443
    'galleryName' => $gallery_name,
444
    'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
445
    'cols' => $gallery_settings['cdm_dataportal_media_cols'],
446
    'maxRows' => $gallery_settings['cdm_dataportal_media_maxRows'],
447
    'captionElements' => $captionElements,
448
    'mediaLinkType' => $mediaLinkType,
449
    'alternativeMediaUri' => $galleryLinkUri,
450
    'showCaption' => NULL,
451
  ));
452

    
453
  return $out;
454
}
455

    
456
/**
457
 * @todo Please document this function.
458
 * @see http://drupal.org/node/1354
459
 */
460
function garland_cichorieae_cdm_feature_name($variables) {
461
  $feature_name = $variables['feature_name'];
462
  switch ($feature_name) {
463
    case "Protologue":
464
      return t("Original Publication");
465
    default:
466
      return ucfirst($feature_name);
467
  }
468
}
469

    
470
/*
471
======== Special functions for subtheme handling=============
472
*/
473

    
474
/**
475
 * @todo Please document this function.
476
 * @see http://drupal.org/node/1354
477
 */
478
function sub_theme() {
479
  global $user, $custom_theme;
480

    
481
  // Only select the user selected theme if it is available in the
482
  // list of enabled themes.
483
  $theme = $user->theme && $themes[$user->theme]->status ? $user->theme : variable_get('theme_default', 'garland');
484

    
485
  // Allow modules to override the present theme... only select custom theme
486
  // if it is available in the list of installed themes.
487
  $theme = $custom_theme && $themes[$custom_theme] ? $custom_theme : $theme;
488

    
489
  return $theme;
490
}
491

    
492
/**
493
 * Return the path to the currently selected sub theme.
494
 */
495
function path_to_sub_theme() {
496
  $themes = list_themes();
497
  $theme = sub_theme();
498
  return dirname($themes[$theme]->filename);
499
}
500

    
501
/**
502
 * Implements hook_preprocess_HOOK() for theme_page().
503
 *
504
 * Assign the css classes primary-links and secondary-links to the menus.
505
 * Modify primary-links if cdm_api module exists.
506
 */
507
function garland_cichorieae_preprocess_page(&$vars) {
508
  if (isset($vars['main_menu'])) {
509
    /*
510
    obsolete, see http://dev.e-taxonomy.eu/trac/ticket/2191
511
    if(module_exists('cdm_api')){ foreach($vars['main_menu'] as $key =>
512
    $menu_item){ // nb this makes each menu item you click opening a new
513
    browser window..
514
    $menu_item['attributes']['target']=generalizeString($menu_item['title']);
515
    $main_menu[] = $menu_item; }; }else{ $main_menu = $vars['main_menu'] ; };
516
    */
517
    $vars['primary_nav'] = theme('links__system_main_menu', array(
518
      'links' => $vars['main_menu'], 'attributes' => array(
519
        'class' => array(
520
          'links', 'inline', 'main-menu', 'primary-links',
521
        )),
522
        'heading' => array(
523
          'text' => t('Main menu'), 'level' => 'h2', 'class' => array(
524
            'element-invisible',
525
          ))));
526
  }
527
  else {
528
    $vars['primary_nav'] = FALSE;
529
  }
530
  if (isset($vars['secondary_menu'])) {
531
    $vars['secondary_nav'] = theme('links__system_secondary_menu', array(
532
      'links' => $vars['secondary_menu'], 'attributes' => array(
533
        'class' => array(
534
          'links',
535
          'inline',
536
          'secondary-menu',
537
          'secondary-links',
538
        )),
539
        'heading' => array(
540
          'text' => t('Secondary menu'),
541
          'level' => 'h2',
542
          'class' => array('element-invisible'),
543
        )));
544
  }
545
  else {
546
    $vars['secondary_nav'] = FALSE;
547
  }
548

    
549
  /*
550
  Display node title as page title for the comment form.
551
  Comment @WA: it would probably be better to select $uuid from node_cdm
552
  table and link to cdm_dataportal/taxon/%uuid instead.
553
  */
554
  if (arg(0) == 'comment' && arg(1) == 'reply') {
555
    $node = $vars['page']['content']['system_main']['comment_node']['#node'];
556
    $vars['title'] = l(check_plain($node->title), 'node/' . $node->nid);
557
  }
558
}
559

    
560
/**
561
 * Implements hook_preprocess_HOOK() for theme_node().
562
 *
563
 * Fixes file urls in nodes. In nodes, relative urls are used to include files
564
 * like <img src="/files/..
565
 *
566
 * Portals can be installed in configurations with
567
 * sub-directories however, in which case these urls need to be adjusted.
568
 * Examples: mysite.org, mysite.org/myportal, mysite.org/portals/myportal.
569
 *
570
 * Therefore preprocess nodes and replace these urls with a the appropriate url
571
 * for the current setup.
572
 *
573
 * @author W.Addink <w.addink@eti.uva.nl>
574
 */
575
function garland_cichorieae_preprocess_node(&$vars) {
576
  $body = '';
577
  // Warning: use #markup value, for which filters like php, html etc are applied!
578
  if (isset($vars['content']['body'][0]['#markup'])) {
579
    $body = $vars['content']['body'][0]['#markup'];
580
  }
581
  else {
582
    $vars['fixed_body'] = '';
583
    return;
584
  }
585

    
586
  $file_path = '/' . variable_get('file_public_path', conf_path() . '/files');
587
  global $base_url;
588
  if ($base_url == '/') {
589
    drupal_set_message(t('
590
      The $base_url in this portal could not be set, please set the $base_url
591
      manually your Drupal settings.php file.', 'error'
592
    ));
593
  }
594
  $fixed_file_path = $base_url . $file_path;
595
  $preg_file_path = preg_quote($file_path, '/');
596
  $body = preg_replace('/src\s*=\s*["]\s*' . $preg_file_path . '/', 'src="' . $fixed_file_path, $body);
597
  $body = preg_replace('/src\s*=\s*[\']\s*' . $preg_file_path . '/', 'src=\'' . $fixed_file_path, $body);
598
  $body = preg_replace('/href\s*=\s*["]\s*' . $preg_file_path . '/', 'href="' . $fixed_file_path, $body);
599
  $body = preg_replace('/href\s*=\s*[\']\s*' . $preg_file_path . '/', 'href=\'' . $fixed_file_path, $body);
600

    
601
  $vars['fixed_body'] = $body;
602
}
603

    
604
/**
605
 * Implements hook_form_FORM_ID_alter() for comment_form().
606
 *
607
 * Alter the comment form to make it look like a D5 style comment form.
608
 *
609
 * @author W.Addink <w.addink@eti.uva.nl>
610
 */
611
function garland_cichorieae_form_comment_form_alter(&$form, &$form_state) {
612

    
613
  if (!isset($form['comment_preview'])) {
614
    $form['header'] = array(
615
      '#markup' => '<h2>' . t('Reply') . '</h2>',
616
      '#weight' => -2,
617
    );
618
  }
619
  $form['subject']['#title'] = $form['subject']['#title'] . ':';
620
  $form['comment_body']['und'][0]['#title'] = $form['comment_body']['und'][0]['#title'] . ':';
621
  if (isset($form['author']['_author']['#title'])) {
622
    $form['author']['_author']['#title'] = $form['author']['_author']['#title'] . ':';
623
  }
624
  $form['actions']['submit']['#value'] = t('Post comment');
625
  $form['actions']['submit']['#weight'] = 1000;
626
  $form['actions']['preview']['#value'] = t('Preview comment');
627
}
628

    
629
/**
630
 * Implements hook_preprocess_HOOK() for theme_comment().
631
 *
632
 * Alter the comment display to make it look like a D5 style comment.
633
 *
634
 * @author W.Addink <w.addink@eti.uva.nl>
635
 */
636
function garland_cichorieae_preprocess_comment(&$variables) {
637
  $comment = $variables['elements']['#comment'];
638
  if (isset($comment->subject)) {
639
    // Print title without link.
640
    $variables['title'] = $comment->subject;
641
    if ($variables['status'] == 'comment-preview') {
642
      // Add 'new' to preview.
643
      $variables['new'] = t('new');
644
    }
645
  }
646
}
(12-12/13)