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

Contents of /contributions/modules/comicview/comicview.module

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


Revision 1.1 - (show annotations) (download) (as text)
Wed Aug 27 18:25:54 2008 UTC (15 months ago) by pedrofaria
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-php
Initial commit of comicview module.
1 <?php
2
3 function comicview_field_formatter_info() {
4 $formatters = array(
5 'paginated' => array(
6 'label' => 'Comic Paginated',
7 'field types' => array('image'),
8 ),
9 );
10
11 if (module_exists('imagefield') && module_exists('imagecache')) {
12 $rules = array();
13 if (function_exists('imagecache_presets')) {
14 $presets = imagecache_presets();
15 foreach ($presets as $preset_id => $preset_info) {
16 $rules[$preset_id] = $preset_info['presetname'];
17 }
18 }
19 else {
20 $rules = _imagecache_get_presets();
21 }
22
23 foreach ($rules as $ruleid => $view_rule) {
24 $formatters['paginated]['.$view_rule] = array(
25 'label' => 'Comic Paginated ('.$view_rule.')',
26 'field types' => array('image'),
27 );
28 }
29 }
30
31 return $formatters;
32 }
33
34 function comicview_field_formatter($field, $item, $formatter, $node) {
35 global $base_path;
36 static $comicview_js;
37
38 if (!$comicview_js) {
39 drupal_add_css(drupal_get_path('module', 'comicview') . '/comicview.css');
40 //drupal_add_js(array('comicview'=> array('base_path' => $base_path)), 'setting');
41 drupal_add_js(drupal_get_path('module', 'comicview') . '/comicview.js');
42 $comicview_js = TRUE;
43 }
44
45 $i = explode('][', $formatter);
46
47 if (count($i) == 1 && $formatter == 'paginated') {
48 $url = url($item['filepath']);
49 drupal_add_js("comicviews_add_file({$item['nid']}, '{$url}')", 'inline');
50 }
51 else if ($i[0] == 'paginated') {
52 $url = imagecache_create_url($i[1], $item['filepath']);
53 drupal_add_js("comicviews_add_file({$item['nid']}, '{$url}')", 'inline');
54 }
55
56 return;
57 }

  ViewVC Help
Powered by ViewVC 1.1.2