/[drupal]/contributions/modules/mysite/mysite_icon/mysite_icon.module
ViewVC logotype

Diff of /contributions/modules/mysite/mysite_icon/mysite_icon.module

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

revision 1.2, Thu Oct 25 00:56:04 2007 UTC revision 1.3, Sun Apr 6 23:08:26 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: mysite_icon.module,v 1.1 2007/10/21 16:31:10 agentken Exp $  // $Id: mysite_icon.module,v 1.2 2007/10/25 00:56:04 agentken Exp $
3    
4    /**
5     * @defgroup mysite_icon MySite Icons module
6     *
7     * Creates and manages icons for use with the MySite module's content browser.
8     */
9    
10  /**  /**
11   * @file   * @file
12   * Creates and manages icons for use with the MySite module's content browser.   * Creates and manages icons for use with the MySite module's content browser.
13     *
14     * @ingroup mysite_icon
15   */   */
16    
17  /**  /**
18   * Implementation of hook_help().   * Implementation of hook_help().
  * @ingroup drupal  
19   */   */
20  function mysite_icon_help($section) {  function mysite_icon_help($section) {
21    switch ($section) {    switch ($section) {
# Line 18  function mysite_icon_help($section) { Line 25  function mysite_icon_help($section) {
25        break;        break;
26      case 'admin/settings/mysite/icons':      case 'admin/settings/mysite/icons':
27        $output = t('<p>MySite offers the option to view content selections as a table of image icons.  In order to use this feature, you must have a directory writable by your Drupal installation.  For most users, this directory will be <em>files/mysite</em>.  If you see an error message below, MySite Icons may not work properly until you configure a storage directory.</p>');        $output = t('<p>MySite offers the option to view content selections as a table of image icons.  In order to use this feature, you must have a directory writable by your Drupal installation.  For most users, this directory will be <em>files/mysite</em>.  If you see an error message below, MySite Icons may not work properly until you configure a storage directory.</p>');
28        return $output;        return $output;
29        break;        break;
30    }    }
31  }  }
32    
33  /**  /**
34   * Implementation of hook_menu().   * Implementation of hook_menu().
  * @ingroup drupal  
35   */   */
36  function mysite_icon_menu($may_cache) {  function mysite_icon_menu($may_cache) {
37    $items = array();    $items = array();
# Line 33  function mysite_icon_menu($may_cache) { Line 39  function mysite_icon_menu($may_cache) {
39    if ($may_cache) {    if ($may_cache) {
40      $items[] = array('path' => 'admin/settings/mysite/icons',      $items[] = array('path' => 'admin/settings/mysite/icons',
41        'title' => t('Content icons'),        'title' => t('Content icons'),
42        'description' => t('Manage icons for use with the MySite content browser.'),        'description' => t('Manage icons for use with the MySite content browser.'),
43        'weight' => 6,        'weight' => 6,
44        'callback' => 'mysite_icon_configure',        'callback' => 'mysite_icon_configure',
45        'type' => MENU_LOCAL_TASK,        'type' => MENU_LOCAL_TASK,
46        'access' => $admin);        'access' => $admin);
47      $items[] = array('path' => 'admin/settings/mysite_icon',      $items[] = array('path' => 'admin/settings/mysite_icon',
48        'title' => t('MySite Icons'),        'title' => t('MySite Icons'),
49        'description' => t('Manage icons for use with the MySite content browser.'),        'description' => t('Manage icons for use with the MySite content browser.'),
50        'weight' => 0,        'weight' => 0,
51        'callback' => 'mysite_icon_admin',        'callback' => 'mysite_icon_admin',
52        'access' => $admin);        'access' => $admin);
53      $items[] = array('path' => 'admin/settings/mysite/icons/browse',      $items[] = array('path' => 'admin/settings/mysite/icons/browse',
54        'title' => t('Current icons'),        'title' => t('Current icons'),
55        'description' => t('Add icons for use with the MySite content browser.'),        'description' => t('Add icons for use with the MySite content browser.'),
56        'weight' => -6,        'weight' => -6,
57        'callback' => 'mysite_icon_current',        'callback' => 'mysite_icon_current',
58        'type' => MENU_LOCAL_TASK,        'type' => MENU_LOCAL_TASK,
59        'access' => $admin);        'access' => $admin);
60      $items[] = array('path' => 'admin/settings/mysite/icons/add',      $items[] = array('path' => 'admin/settings/mysite/icons/add',
61        'title' => t('Add content icon'),        'title' => t('Add content icon'),
62        'description' => t('Add icons for use with the MySite content browser.'),        'description' => t('Add icons for use with the MySite content browser.'),
63        'weight' => 2,        'weight' => 2,
64        'callback' => 'mysite_icon_add',        'callback' => 'mysite_icon_add',
65        'type' => MENU_LOCAL_TASK,        'type' => MENU_LOCAL_TASK,
66        'access' => $admin);        'access' => $admin);
67      $items[] = array('path' => 'admin/settings/mysite/icons/configure',      $items[] = array('path' => 'admin/settings/mysite/icons/configure',
68        'title' => t('Icon settings'),        'title' => t('Icon settings'),
69        'description' => t('Default icon settings for the MySite content browser.'),        'description' => t('Default icon settings for the MySite content browser.'),
70        'weight' => -10,        'weight' => -10,
71        'callback' => 'mysite_icon_configure',        'callback' => 'mysite_icon_configure',
72        'type' => MENU_DEFAULT_LOCAL_TASK,        'type' => MENU_DEFAULT_LOCAL_TASK,
73        'access' => $admin);        'access' => $admin);
74    }    }
75    else {    else {
76      // only show these tabs on the change/delete pages      // only show these tabs on the change/delete pages
# Line 74  function mysite_icon_menu($may_cache) { Line 80  function mysite_icon_menu($may_cache) {
80      }      }
81      $items[] = array('path' => 'admin/settings/mysite/icons/change/'. arg(5),      $items[] = array('path' => 'admin/settings/mysite/icons/change/'. arg(5),
82        'title' => t('Change'),        'title' => t('Change'),
83        'description' => t('Change content icon.'),        'description' => t('Change content icon.'),
84        'weight' => 4,        'weight' => 4,
85        'callback' => 'mysite_icon_change',        'callback' => 'mysite_icon_change',
86        'type' => $type,        'type' => $type,
87        'access' => $admin);        'access' => $admin);
88      $items[] = array('path' => 'admin/settings/mysite/icons/delete/'. arg(5),      $items[] = array('path' => 'admin/settings/mysite/icons/delete/'. arg(5),
89        'title' => t('Delete'),        'title' => t('Delete'),
90        'description' => t('Delete content icon.'),        'description' => t('Delete content icon.'),
91        'weight' => 6,        'weight' => 6,
92        'callback' => 'mysite_icon_delete',        'callback' => 'mysite_icon_delete',
93        'type' => $type,        'type' => $type,
94        'access' => $admin);        'access' => $admin);
95    }    }
96    // load the includes that we need    // load the includes that we need
97    if (arg(0) == 'admin' && arg(2) == 'mysite' && arg(3) == 'icons') {    if (arg(0) == 'admin' && arg(2) == 'mysite' && arg(3) == 'icons') {
# Line 99  function mysite_icon_menu($may_cache) { Line 105  function mysite_icon_menu($may_cache) {
105    
106  /**  /**
107   * Function needed to make help display properly   * Function needed to make help display properly
  * @ingroup icons  
108   */   */
109  function mysite_icon_admin() {  function mysite_icon_admin() {
110    drupal_goto('admin/settings/mysite/icons');    drupal_goto('admin/settings/mysite/icons');
# Line 108  function mysite_icon_admin() { Line 113  function mysite_icon_admin() {
113    
114  /**  /**
115   * MySite Icons configuration page   * MySite Icons configuration page
  * @ingroup icons  
116   */   */
117  function mysite_icon_configure() {  function mysite_icon_configure() {
118    $folder = variable_get('mysite_icon_path', 'mysite');    $folder = variable_get('mysite_icon_path', 'mysite');
# Line 121  function mysite_icon_configure() { Line 125  function mysite_icon_configure() {
125    
126  /**  /**
127   * Check to see if icons can be uploaded   * Check to see if icons can be uploaded
128   *   *
129   * @param $path   * @param $path
130   * The path to the MySite Icons folder   * The path to the MySite Icons folder
131   * @return   * @return
132   * The real directory as defined by file_check_directory()   * The real directory as defined by file_check_directory()
  *  
  * @ingroup icons  
133   */   */
134  function mysite_icon_folder_check($path) {  function mysite_icon_folder_check($path) {
135    $dir = file_check_directory($path, 1);    $dir = file_check_directory($path, 1);
136    if (!$dir) {    if (!$dir) {
137      // folder could not be created      // folder could not be created
# Line 145  function mysite_icon_folder_check($path) Line 147  function mysite_icon_folder_check($path)
147   * The path to the MySite Icons folder   * The path to the MySite Icons folder
148   * @param $folder   * @param $folder
149   * The name of the MySite Icons folder   * The name of the MySite Icons folder
  *  
  * @ingroup icons  
  * @ingroup forms  
150   */   */
151  function mysite_icon_settings_form($path, $folder) {  function mysite_icon_settings_form($path, $folder) {
152    $form = array();    $form = array();
153    $form['mysite_icon_path'] = array(    $form['mysite_icon_path'] = array(
154      '#type' => 'textfield',      '#type' => 'textfield',
155      '#title' => t('MySite Icons Directory'),      '#title' => t('MySite Icons Directory'),
156      '#size' => 30,      '#size' => 30,
157      '#maxlength' => 80,      '#maxlength' => 80,
158      '#default_value' => $folder,      '#default_value' => $folder,
# Line 161  function mysite_icon_settings_form($path Line 160  function mysite_icon_settings_form($path
160      '#description' => t('This folder will reside in %path, and is a file system path where the files will be stored. Do not use a leading or trailing slash. This directory has to exist and be writable by Drupal. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.', array('%path' => file_directory_path()))      '#description' => t('This folder will reside in %path, and is a file system path where the files will be stored. Do not use a leading or trailing slash. This directory has to exist and be writable by Drupal. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.', array('%path' => file_directory_path()))
161      );      );
162    $form['mysite_icon_dimensions'] = array(    $form['mysite_icon_dimensions'] = array(
163      '#type' => 'textfield',      '#type' => 'textfield',
164      '#title' => t('Icon maximum dimensions'),      '#title' => t('Icon maximum dimensions'),
165      '#default_value' => variable_get('mysite_icon_dimensions', '120x60'),      '#default_value' => variable_get('mysite_icon_dimensions', '120x60'),
166      '#size' => 15, '#maxlength' => 10,      '#size' => 15, '#maxlength' => 10,
167      '#description' => t('Maximum dimensions for icons, Width x Height, in pixels.')      '#description' => t('Maximum dimensions for icons, Width x Height, in pixels.')
168      );      );
169    $form['mysite_icon_file_size'] = array(    $form['mysite_icon_file_size'] = array(
170      '#type' => 'textfield',      '#type' => 'textfield',
171      '#title' => t('Icon maximum file size'),      '#title' => t('Icon maximum file size'),
172      '#default_value' => variable_get('mysite_icon_file_size', '32'),      '#default_value' => variable_get('mysite_icon_file_size', '32'),
173      '#size' => 15, '#maxlength' => 10,      '#size' => 15, '#maxlength' => 10,
174      '#description' => t('Maximum file size for icons, in kB.')      '#description' => t('Maximum file size for icons, in kB.')
175      );      );
176    $form['mysite_icon_download'] = array(    $form['mysite_icon_download'] = array(
# Line 186  function mysite_icon_settings_form($path Line 185  function mysite_icon_settings_form($path
185    
186  /**  /**
187   * Show current MySite Icons   * Show current MySite Icons
  * @ingroup icons  
188   */   */
189  function mysite_icon_current() {  function mysite_icon_current() {
190    global $base_url;    global $base_url;
# Line 223  function mysite_icon_current() { Line 221  function mysite_icon_current() {
221   * Add a new icon   * Add a new icon
222   *   *
223   * Display a list of <select> boxes showing items that can have icons uploaded.   * Display a list of <select> boxes showing items that can have icons uploaded.
  *  
  * @ingroup icons  
224   */   */
225  function mysite_icon_add() {  function mysite_icon_add() {
226    $folder = variable_get('mysite_icon_path', 'mysite');    $folder = variable_get('mysite_icon_path', 'mysite');
# Line 276  function mysite_icon_add() { Line 272  function mysite_icon_add() {
272    
273  /**  /**
274   * Forms API for adding new icon   * Forms API for adding new icon
275   *   *
276   * @param $type   * @param $type
277   * The MySite content type   * The MySite content type
278   * @param $type_id   * @param $type_id
279   * The MySite content type id   * The MySite content type id
280   * @return   * @return
281   * An upload form generated by the FormsAPI   * An upload form generated by the FormsAPI
  *  
  * @ingroup icons  
  * @ingroup forms  
282   */   */
283  function mysite_icon_new_form($type, $type_id) {  function mysite_icon_new_form($type, $type_id) {
284    $form = mysite_icon_form($type, $type_id, $icon = NULL, $name = 'mysite_icon');    $form = mysite_icon_form($type, $type_id, $icon = NULL, $name = 'mysite_icon');
# Line 294  function mysite_icon_new_form($type, $ty Line 287  function mysite_icon_new_form($type, $ty
287    
288  /**  /**
289   * FormsAPI for icon creation   * FormsAPI for icon creation
290   * @ingroup icons   */
  * @ingroup forms  
  */  
291  function mysite_icon_new_form_submit($form_id, &$form_values) {  function mysite_icon_new_form_submit($form_id, &$form_values) {
292    if ($file = file_check_upload('icon')) {    if ($file = file_check_upload('icon')) {
293      mysite_icon_validate_picture($file, $form_values);      mysite_icon_validate_picture($file, $form_values);
294      $iid = db_next_id('{mysite_icon}_iid');      $iid = db_next_id('{mysite_icon}_iid');
295      db_query("INSERT INTO {mysite_icon} (iid, type, type_id, icon) VALUES ('%d', '%s', %d, '%s')", $iid, $form_values['type'], $form_values['type_id'], $form_values['icon']);      db_query("INSERT INTO {mysite_icon} (iid, type, type_id, icon) VALUES ('%d', '%s', %d, '%s')", $iid, $form_values['type'], $form_values['type_id'], $form_values['icon']);
296      drupal_set_message(t('Icon successfully changed.'));      drupal_set_message(t('Icon successfully changed.'));
# Line 314  function mysite_icon_new_form_submit($fo Line 305  function mysite_icon_new_form_submit($fo
305   *   *
306   * @param $options   * @param $options
307   * The avaialbe type options generated by mysite_icon_add()   * The avaialbe type options generated by mysite_icon_add()
  *  
  * @ingroup icons  
  * @ingroup forms  
308   */   */
309  function mysite_icon_add_form($options) {  function mysite_icon_add_form($options) {
310    $form = array();    $form = array();
# Line 327  function mysite_icon_add_form($options) Line 315  function mysite_icon_add_form($options)
315      array_unshift($opts, t('Select @key', array('@key' => $key)));      array_unshift($opts, t('Select @key', array('@key' => $key)));
316      $form['icon_id_'. $key] = array(      $form['icon_id_'. $key] = array(
317        '#type' => 'select',        '#type' => 'select',
318        '#title' => t('Add new %key icon', array('%key' => $key)),        '#title' => t('Add new %key icon', array('%key' => $key)),
319        '#default_value' => 0,        '#default_value' => 0,
320        '#options' => $opts,        '#options' => $opts,
321      );      );
322    }    }
323    $form['submit'] = array('#type' => 'submit', '#value' => t('Select Item and Continue'));    $form['submit'] = array('#type' => 'submit', '#value' => t('Select Item and Continue'));
324    return $form;    return $form;
325  }  }
326    
327  /**  /**
328   * FormsAPI for icon selection   * FormsAPI for icon selection
  * @ingroup icons  
  * @ingroup forms  
329   */   */
330  function mysite_icon_add_form_submit($form_id, &$form_values) {  function mysite_icon_add_form_submit($form_id, &$form_values) {
331    foreach ($form_values as $key => $value) {    foreach ($form_values as $key => $value) {
# Line 359  function mysite_icon_add_form_submit($fo Line 345  function mysite_icon_add_form_submit($fo
345   * @return   * @return
346   * An upload form according to the FormsAPI.   * An upload form according to the FormsAPI.
347   *   *
  * @ingroup icons  
348   */   */
349  function mysite_icon_change() {  function mysite_icon_change() {
350    $folder = variable_get('mysite_icon_path', 'mysite');    $folder = variable_get('mysite_icon_path', 'mysite');
# Line 380  function mysite_icon_change() { Line 365  function mysite_icon_change() {
365    }    }
366    else {    else {
367      $output = t('There is an error in the configuration of the MySite Icons upload folder.');      $output = t('There is an error in the configuration of the MySite Icons upload folder.');
368    }    }
369    return $output;    return $output;
370  }  }
371    
# Line 389  function mysite_icon_change() { Line 374  function mysite_icon_change() {
374   *   *
375   * @param $icon   * @param $icon
376   * Data object taken from {mysite_icon}   * Data object taken from {mysite_icon}
  *  
  * @ingroup icons  
  * @ingroup forms  
377   */   */
378  function mysite_icon_change_form($icon) {  function mysite_icon_change_form($icon) {
379    $form = mysite_icon_form($icon->type, $icon->type_id, $icon->icon, 'mysite_icon_change');    $form = mysite_icon_form($icon->type, $icon->type_id, $icon->icon, 'mysite_icon_change');
# Line 401  function mysite_icon_change_form($icon) Line 383  function mysite_icon_change_form($icon)
383    
384  /**  /**
385   * FormsAPI for icon change   * FormsAPI for icon change
  * @ingroup icons  
  * @ingroup forms  
386   */   */
387  function mysite_icon_change_form_submit($form_id, &$form_values) {  function mysite_icon_change_form_submit($form_id, &$form_values) {
388    if ($file = file_check_upload('icon')) {    if ($file = file_check_upload('icon')) {
389      mysite_icon_validate_picture($file, $form_values);      mysite_icon_validate_picture($file, $form_values);
390      db_query("UPDATE {mysite_icon} SET icon = '%s' WHERE iid = %d", $form_values['icon'], $form_values['iid']);      db_query("UPDATE {mysite_icon} SET icon = '%s' WHERE iid = %d", $form_values['icon'], $form_values['iid']);
391      drupal_set_message(t('Icon successfully changed.'));      drupal_set_message(t('Icon successfully changed.'));
392    }    }
# Line 417  function mysite_icon_change_form_submit( Line 397  function mysite_icon_change_form_submit(
397    
398  /**  /**
399   * Delete an existing icon   * Delete an existing icon
  * @ingroup icons  
400   */   */
401  function mysite_icon_delete() {  function mysite_icon_delete() {
402    $iid = arg(5);    $iid = arg(5);
# Line 438  function mysite_icon_delete() { Line 417  function mysite_icon_delete() {
417   *   *
418   * @param $icon   * @param $icon
419   * Data object taken from {mysite_icon}   * Data object taken from {mysite_icon}
  *  
  * @ingroup icons  
  * @ingroup forms  
420   */   */
421  function mysite_icon_delete_form($icon) {  function mysite_icon_delete_form($icon) {
422    $form = array();    $form = array();
# Line 457  function mysite_icon_delete_form($icon) Line 433  function mysite_icon_delete_form($icon)
433    
434  /**  /**
435   * FormsAPI for icon delete   * FormsAPI for icon delete
  * @ingroup icons  
  * @ingroup forms  
436   */   */
437  function mysite_icon_delete_form_submit($form_id, $form_values) {  function mysite_icon_delete_form_submit($form_id, $form_values) {
438    $icon = mysite_icon_get($form_values['iid']);    $icon = mysite_icon_get($form_values['iid']);
# Line 479  function mysite_icon_delete_form_submit( Line 453  function mysite_icon_delete_form_submit(
453   * @param $iid   * @param $iid
454   * The icon id of the icon being loaded from {mysite_icon}   * The icon id of the icon being loaded from {mysite_icon}
455   * @return   * @return
456   * An object of data from {mysite_icon}   * An object of data from {mysite_icon}
  *  
  * @ingroup icons  
457   */   */
458  function mysite_icon_get($iid) {  function mysite_icon_get($iid) {
459    $icon = db_fetch_object(db_query("SELECT iid, type, type_id, icon FROM {mysite_icon} WHERE iid = %d", $iid));    $icon = db_fetch_object(db_query("SELECT iid, type, type_id, icon FROM {mysite_icon} WHERE iid = %d", $iid));
# Line 490  function mysite_icon_get($iid) { Line 462  function mysite_icon_get($iid) {
462    
463  /**  /**
464   * Helper function to find icon data based on known keys   * Helper function to find icon data based on known keys
465   *   *
466   * @param $type   * @param $type
467   * The MySite content type   * The MySite content type
468   * @param $type_id   * @param $type_id
469   * The MySite content type id   * The MySite content type id
470   * @return   * @return
471   * An object of data from {mysite_icon}   * An object of data from {mysite_icon}
  * @ingroup icons  
472   */   */
473  function mysite_icon_lookup($type, $type_id) {  function mysite_icon_lookup($type, $type_id) {
474    $icon = db_fetch_object(db_query("SELECT iid, type, type_id, icon FROM {mysite_icon} WHERE type = '%s' AND type_id = %d", $type, $type_id));    $icon = db_fetch_object(db_query("SELECT iid, type, type_id, icon FROM {mysite_icon} WHERE type = '%s' AND type_id = %d", $type, $type_id));
# Line 506  function mysite_icon_lookup($type, $type Line 477  function mysite_icon_lookup($type, $type
477    
478  /**  /**
479   * Form builder function   * Form builder function
480   *   *
481   * An internal function to re-use common form elements   * An internal function to re-use common form elements
482   *   *
483   * @param $type   * @param $type
484   * The MySite content type   * The MySite content type
485   * @param $type_id   * @param $type_id
# Line 517  function mysite_icon_lookup($type, $type Line 488  function mysite_icon_lookup($type, $type
488   * An object of data from {mysite_icon}   * An object of data from {mysite_icon}
489   * @param $name   * @param $name
490   * The name of the form this will be inserted into   * The name of the form this will be inserted into
  *  
  * @ingroup icons  
  * @ingroup forms  
491   */   */
492  function mysite_icon_form($type = NULL, $type_id = NULL, $icon = NULL, $name = 'mysite_icon') {  function mysite_icon_form($type = NULL, $type_id = NULL, $icon = NULL, $name = 'mysite_icon') {
493    $form = array();    $form = array();
# Line 575  function mysite_icon_form($type = NULL, Line 543  function mysite_icon_form($type = NULL,
543   * The $form_values submitted, passed by reference.   * The $form_values submitted, passed by reference.
544   * @param $form_element   * @param $form_element
545   * The name of the form element asking for validation   * The name of the form element asking for validation
  *  
  * @ingroup icons  
  * @ingroup forms  
546   */   */
547  function mysite_icon_validate_picture($file, &$form_values, $form_element = 'icon') {  function mysite_icon_validate_picture($file, &$form_values, $form_element = 'icon') {
548    // get the size restrictions    // get the size restrictions
# Line 629  function mysite_icon_file_download($file Line 594  function mysite_icon_file_download($file
594      else {      else {
595        return -1;        return -1;
596      }      }
597    }    }
598  }  }
599    
600  /**  /**
601   * Theme function for displaying icons to the user   * Theme function for displaying icons to the user
602   *   *
603   * @param $type   * @param $type
604   * The MySite content type   * The MySite content type
605   * @param $type_id   * @param $type_id
# Line 645  function mysite_icon_file_download($file Line 610  function mysite_icon_file_download($file
610   * An object of data from {mysite_icon}   * An object of data from {mysite_icon}
611   * @return   * @return
612   * HTML that displays the icon or a default icon   * HTML that displays the icon or a default icon
  *  
  * @ingroup icons  
  * @ingroup themes  
613   */   */
614  function theme_mysite_icon($type, $type_id, $title, $icon) {  function theme_mysite_icon($type, $type_id, $title, $icon) {
615    $output = NULL;    $output = NULL;
# Line 679  function theme_mysite_icon($type, $type_ Line 641  function theme_mysite_icon($type, $type_
641    
642  /**  /**
643   * Theme function to add an edit link to the browse menu   * Theme function to add an edit link to the browse menu
644   *   *
645   * @param $type   * @param $type
646   * The MySite content type   * The MySite content type
647   * @param $type_id   * @param $type_id
648   * The MySite content type id   * The MySite content type id
649   * @return   * @return
650   * A linked * that lets the administrator change the icon at mysite_icon_change() or mysite_icon_add()   * A linked * that lets the administrator change the icon at mysite_icon_change() or mysite_icon_add()
  *  
  * @ingroup icons  
  * @ingroup themes  
651   */   */
652  function theme_mysite_icon_add_link($type, $type_id) {  function theme_mysite_icon_add_link($type, $type_id) {
653    $icon = mysite_icon_lookup($type, $type_id);    $icon = mysite_icon_lookup($type, $type_id);
# Line 702  function theme_mysite_icon_add_link($typ Line 661  function theme_mysite_icon_add_link($typ
661    
662  /**  /**
663   * Theme function for previewing / displaying an icon   * Theme function for previewing / displaying an icon
664   *   *
665   * @param $image   * @param $image
666   * The MySite content type   * The MySite content type
667   * @param $title   * @param $title
# Line 715  function theme_mysite_icon_add_link($typ Line 674  function theme_mysite_icon_add_link($typ
674   * The maximum height (in pixels) of the icon   * The maximum height (in pixels) of the icon
675   * @return   * @return
676   * The HTML to display the icon   * The HTML to display the icon
  *  
  * @ingroup icons  
  * @ingroup themes  
677   */   */
678  function theme_mysite_icon_default($image, $title, $maxwidth = 120, $maxheight = 60) {  function theme_mysite_icon_default($image, $title, $maxwidth = 120, $maxheight = 60) {
679    // needed because CSS doesn't know where the theme file is located    // needed because CSS doesn't know where the theme file is located
# Line 726  function theme_mysite_icon_default($imag Line 682  function theme_mysite_icon_default($imag
682    // truncate the title if its too long    // truncate the title if its too long
683    if (strlen($title) > 32) {    if (strlen($title) > 32) {
684      $title = substr($title, 0, 32) .'...';      $title = substr($title, 0, 32) .'...';
685    }    }
686    // we don't check_plain() since this all gets wrapped in l() later.    // we don't check_plain() since this all gets wrapped in l() later.
687    $output = '<div class="mysite-icon" style="width: '. $maxwidth .'px; height: '. $maxheight .'px; background: no-repeat url('. $image .');"><div class="mysite-icon-text">'. $title .'</div></div>';    $output = '<div class="mysite-icon" style="width: '. $maxwidth .'px; height: '. $maxheight .'px; background: no-repeat url('. $image .');"><div class="mysite-icon-text">'. $title .'</div></div>';
688    return $output;    return $output;
# Line 734  function theme_mysite_icon_default($imag Line 690  function theme_mysite_icon_default($imag
690    
691  /**  /**
692   * Theme function for displaying a default icon   * Theme function for displaying a default icon
693   *   *
694   * @param $image   * @param $image
695   * The MySite content type   * The MySite content type
696   * @param $title   * @param $title
# Line 747  function theme_mysite_icon_default($imag Line 703  function theme_mysite_icon_default($imag
703   * The maximum height (in pixels) of the icon   * The maximum height (in pixels) of the icon
704   * @return   * @return
705   * The HTML to display the icon   * The HTML to display the icon
  *  
  * @ingroup icons  
  * @ingroup themes  
706   */   */
707  function theme_mysite_icon_custom($image, $title, $maxwidth = 120, $maxheight = 60) {  function theme_mysite_icon_custom($image, $title, $maxwidth = 120, $maxheight = 60) {
708    // this allows private downloads to work correctly, since we have to pass $getsize == FALSE    // this allows private downloads to work correctly, since we have to pass $getsize == FALSE

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

  ViewVC Help
Powered by ViewVC 1.1.2