/[drupal]/contributions/modules/cck_multimage/cck_multimage.module
ViewVC logotype

Diff of /contributions/modules/cck_multimage/cck_multimage.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Thu Aug 9 06:00:19 2007 UTC revision 1.2, Sat Aug 18 05:47:22 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: multimage.module,v 1.0 2007/08/05 18:35:00 silviogutierrez Exp $  // $Id$
3    
4  /**  /**
5   * @file   * @file
# Line 9  Line 9 
9   *   *
10   */   */
11    
12    
13    /**
14     * Implementation of hook_perm() in order implement access control to CCK Multimage administration.
15     */
16    function cck_multimage_perm() {
17      return array('administer CCK Multimage');
18    }
19    
20    
21  /**  /**
22   * Implemenation of hook_menu().   * Implemenation of hook_menu().
23   */   */
24  function cck_multimage_menu($maycache) {  function cck_multimage_menu($maycache) {
25    $items = array();    $items = array();
26    if ($maycache) {    if (!$maycache) {
27      $items[] = array(      $items[] = array(
28        'path' => 'admin/content/cck-multimages',        'path' => 'admin/content/cck-multimages',
29        'title' => t('CCK Multimage'),        'title' => t('CCK Multimage'),
30            'description' => t('View, Edit and Administer your Multimages.'),            'description' => t('View, Edit and Administer your Multimages.'),
31        'callback' => 'cck_multimage_admin',        'callback' => 'cck_multimage_admin',
32        'access' => TRUE,        'access' => user_access('administer CCK Multimage'),
33    
34      );      );
35    }    }
36    return $items;    return $items;
# Line 28  function cck_multimage_menu($maycache) { Line 38  function cck_multimage_menu($maycache) {
38  }  }
39    
40    
41    
42    
43  /**  /**
44   * Implementaiton of hook_help().   * Implementaiton of hook_help().
45   */   */
# Line 221  function cck_multimage_nodeapi(&$node, $ Line 233  function cck_multimage_nodeapi(&$node, $
233  }  }
234    
235  function theme_cck_multimage($images, $settings, $node, $field, $teaser) {  function theme_cck_multimage($images, $settings, $node, $field, $teaser) {
236    //print_r($images);  
237      if(!isset($images[0]['nid'])) {
238      //There seems to be some error with imagecache, when you delete all images from a node, it wont fully delete the first image info.
239      //This checks against this bug, makes sure it does not print out anything if there are no images.
240        return;
241      }
242    
243    if ($teaser) {    if ($teaser) {
244          $imagecache_directory = $settings['teaser-preset'];          $imagecache_directory = $settings['teaser-preset'];
245      $css_root = 'multimage-teaser';      $css_root = 'multimage-teaser';
# Line 231  function theme_cck_multimage($images, $s Line 249  function theme_cck_multimage($images, $s
249          $css_root = 'multimage';          $css_root = 'multimage';
250    }    }
251    
252    //print $imagecache_directory;  
   
253    $multimage_image_id = $css_root . '-' . $node->nid .'-'. $field['field_name'];    $multimage_image_id = $css_root . '-' . $node->nid .'-'. $field['field_name'];
254    $multimage_container = $css_root;    $multimage_container = $css_root;
255    $multimage_image_class = $css_root . '-image';    $multimage_image_class = 'multimage-image';
256    $multimage_top = $css_root . '-top';    $multimage_top = $css_root . '-top';
257    $multimage_bottom = $css_root . '-bottom';    $multimage_bottom = $css_root . '-bottom';
258    
# Line 286  function theme_cck_multimage($images, $s Line 303  function theme_cck_multimage($images, $s
303           $output .= '<img class="multimage-buffer" src= "" alt="" style="display: none;" />';           $output .= '<img class="multimage-buffer" src= "" alt="" style="display: none;" />';
304    $output .= '</div>';    $output .= '</div>';
305    
306    drupal_add_js(array($multimage_image_id  => $fileNames, $multimage_image_id . '-captions' => $fileCaptions), 'setting');    drupal_add_js(array($multimage_image_id  => $fileNames, $multimage_image_id . '-captions' => $fileCaptions, $multimage_image_id . '-mode' => (isset($images[1]) ? 'multiple' : 'single')), 'setting');
307    
308    if ($settings['compatibility']) { //Add a dynamic JS file that detects the browser and removes the fade effect from IE6.    if ($settings['compatibility']) { //Add a dynamic JS file that detects the browser and removes the fade effect from IE6.
309          drupal_add_js(drupal_get_path('module', 'cck_multimage') .'/cck_multimage_javascript.php');      drupal_add_js(drupal_get_path('module', 'cck_multimage') .'/cck_multimage_javascript.php');
310    }    }
311    else { //Static JS File.    else { //Static JS File.
312          drupal_add_js(drupal_get_path('module', 'cck_multimage') .'/cck_multimage.js');      drupal_add_js(drupal_get_path('module', 'cck_multimage') .'/cck_multimage.js');
313    }    }
314    
315    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2