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

Diff of /contributions/modules/copyright/copyright.module

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

revision 1.13.4.26, Sat Aug 9 07:27:48 2008 UTC revision 1.13.4.27, Sat Aug 9 08:09:15 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: copyright.module,v 1.13.4.25 2007/10/05 15:47:40 robrechtj Exp $  // $Id: copyright.module,v 1.13.4.26 2008/08/09 07:27:48 robrechtj Exp $
3    
4  /** Copyright (c) 2004 Matthew Schwartz  <matt at mattschwartz dot net>  /** Copyright (c) 2004 Matthew Schwartz  <matt at mattschwartz dot net>
5      Contributors:      Contributors:
# Line 34  Line 34 
34   * - check whether books works as expected   * - check whether books works as expected
35   * - check whether we've put 'administer copyright' everywhere where needed   * - check whether we've put 'administer copyright' everywhere where needed
36   * - proofread and maybe extend documentation (hook_help())   * - proofread and maybe extend documentation (hook_help())
  * - figure out the right way to do 'view license' - this get_local_paths() looks a bit funny  
  * - does it makes sense to have a 'admin/configure/view/$cpyid' page for all copyrights?  
37   * - node copyright block, to be displayed in 'content' region for 'node' pages   * - node copyright block, to be displayed in 'content' region for 'node' pages
38   * - are there other content types (eg the 'container' from category.module) that actually warrant the   * - are there other content types (eg the 'container' from category.module) that actually warrant the
39   *   same treatment as book pages?   *   same treatment as book pages?
# Line 115  function copyright_menu($may_cache) { Line 113  function copyright_menu($may_cache) {
113        'type' => MENU_CALLBACK,        'type' => MENU_CALLBACK,
114        'access' => user_access('administer copyright'),        'access' => user_access('administer copyright'),
115      );      );
116        $items[] = array(
117          'path' => 'copyright',
118          'title' => t('View copyright'),
119          'type' => MENU_CALLBACK,
120          'callback' => 'copyright_view',
121          'access' => user_access('access content'),
122        );
123    }    }
124    
125    return $items;    return $items;
# Line 249  function copyright_admin($op = 'list', $ Line 254  function copyright_admin($op = 'list', $
254    return drupal_not_found();    return drupal_not_found();
255  }  }
256    
257    /******************************************************************
258     * Menu callback: copyright/* switch.
259     ******************************************************************/
260    
261    function copyright_view($cpyid = NULL) {
262      if (isset($cpyid) && is_numeric($cpyid)) {
263        if (($license = copyright_get_license($cpyid))) {
264          drupal_set_title(t('%name license', array('%name' => $license->name)));
265          return theme('copyright_display', $license);
266        }
267      }
268      else if (!isset($cpyid)) {
269        drupal_set_title(t('All site licenses'));
270        $licenses = copyright_get_licenses();
271        return theme('copyright_display_all', $licenses);
272      }
273      return drupal_not_found();
274    }
275    
276  /******************************************************************  /******************************************************************
277   * Menu callback: admin/content/copyright/add and   * Menu callback: admin/content/copyright/add and
# Line 893  function theme_copyright_block($notice) Line 916  function theme_copyright_block($notice)
916    return $notice;    return $notice;
917  }  }
918    
919    /**
920     * Theming function for display the full license text.
921     */
922    function theme_copyright_display($license) {
923      if (!empty($license->license)) {
924        return $license->license;
925      }
926      return copyright_notice($license);
927    }
928    
929    /**
930     * Theming function for displaying a list of all licenses.
931     */
932    function theme_copyright_display_all($licenses) {
933      $items = array();
934      foreach ($licenses as $license) {
935        $items[] = l(t('%name license', array('%name' => $license->name)), 'copyright/'. $license->cpyid, array(), NULL, NULL, FALSE, TRUE);
936      }
937      return theme('item_list', $items);
938    }
939    
940  /******************************************************************  /******************************************************************
941   * Database access functions (private).   * Database access functions (private).
942   ******************************************************************/   ******************************************************************/

Legend:
Removed from v.1.13.4.26  
changed lines
  Added in v.1.13.4.27

  ViewVC Help
Powered by ViewVC 1.1.2