Project

General

Profile

« Previous | Next » 

Revision 78e178e2

Added by Andreas Kohlbecker over 11 years ago

related to: javascript at the and of the page

View differences:

7.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
52 52
    }
53 53
    $pager->records = $taxa;
54 54
  }
55
  $showThumbnails = FALSE;
56
  if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) {
57
    $showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails'];
58
  }
59
  if (!is_numeric($showThumbnails)) {
60
    $showThumbnails = 1;
61
  }
62
  $setSessionUri = url('cdm_api/setvalue/session', array(
63
    'query' => array('var' => '[pageoption][searchtaxa][showThumbnails]', 'val' => ''),
64
  ));
65
  drupal_add_js('jQuery(document).ready(function() {
66

  
67
        // init
68
        if(' . $showThumbnails . ' == 1){
69
              jQuery(\'.media_gallery\').show(20);
70
        } else {
71
          jQuery(\'.media_gallery\').hide(20);
72
        }
73
        // add change hander
74
        jQuery(\'#showThumbnails\').change(
75
          function(event){
76
            var state = 0;
77
            if(jQuery(this).is(\':checked\')){
78
              jQuery(\'.media_gallery\').show(20);
79
              state = 1;
80
            } else {
81
              jQuery(\'.media_gallery\').hide(20);
82
            }
83
            // store state in session variable
84
            var uri = \'' . $setSessionUri . '\' + state;
85
            jQuery.get(uri);
86
          });
87
        });', array('type' => "inline", 'scope' => JS_DEFAULT));
88

  
89
  drupal_set_title(t('Search results'), PASS_THROUGH);
90 55

  
91 56
  $out = '';
92

  
93 57
  // Add thumbnails checkbox and refine search link.
94 58
  $out = '<div class="page_options">';
95 59
  if (isset($_REQUEST['ws'])) {
......
97 61
      $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
98 62
    }
99 63
  }
100
  $out .= '<form name="pageoptions"><input id="showThumbnails" type="checkbox" name="showThumbnails" ' . ($showThumbnails == 1 ? 'checked="checked"' : '') . '> ' . t('Show Thumbnails') . '</form>';
64
  $out .= '<form name="pageoptions"><input id="showThumbnails" type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Show Thumbnails') . '</form>';
101 65
  $out .= '</div>';
102 66

  
103 67
  // List results.

Also available in: Unified diff