/[drupal]/contributions/modules/mmedia/media.forms.inc
ViewVC logotype

Diff of /contributions/modules/mmedia/media.forms.inc

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

revision 1.1.2.5, Mon Feb 2 12:13:26 2009 UTC revision 1.1.2.6, Thu Mar 19 13:31:28 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: media.forms.inc,v 1.1.2.4 2008/12/16 15:14:05 rhys Exp $  // $Id: media.forms.inc,v 1.3 2008/12/16 15:11:46 rhys Exp $
3    
4  /**  /**
5   *  The View media form   *  The View media form
6   */   */
7  function mmedia_view_form(&$form_state, $media) {  function mmedia_view_form(&$form_state, $media) {
8    // allow various other modules to do things to view    // allow various other modules to do things to view
9    $profile = variable_get('mmedia_view_profile', null);    $profile = variable_get('mmedia_view_profile', NULL);
10    $profile = ($profile && in_array($profile, mapi_profile_list()) ? array('profile' => $profile) : array());    $profile = ($profile && in_array($profile, mapi_profile_list()) ? array('profile' => $profile) : array());
11    
12    drupal_set_title(t($media->title));    drupal_set_title(t($media->title));
# Line 39  function mmedia_view_form(&$form_state, Line 39  function mmedia_view_form(&$form_state,
39  /**  /**
40   *  The Edit/Add media form   *  The Edit/Add media form
41   */   */
42  function mmedia_edit_form(&$form_state, $media, $type = null) {  function mmedia_edit_form(&$form_state, $media, $type = NULL) {
43    // useful for editing the details of a media file.    // useful for editing the details of a media file.
44    $edit = $media;    $edit = $media;
45    if (is_null($edit)) {    if (is_null($edit)) {
46      $edit = new stdClass;      $edit = new stdClass;
47      $edit->type = null;      $edit->type = NULL;
48      if (in_array($type, mapi_type_list($type))) {      if (in_array($type, mapi_type_list($type))) {
49        $edit->type = $type;        $edit->type = $type;
50      }      }
# Line 56  function mmedia_edit_form(&$form_state, Line 56  function mmedia_edit_form(&$form_state,
56    
57    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));
58    if ($media) {    if ($media) {
59      $breadcrumbs[] = l($media->title, MMEDIA_PATH .'/'. $media->mid);      $breadcrumbs[] = l($media->title, MEDIA_PATH .'/'. $media->mid);
60    }    }
61    drupal_set_breadcrumb($breadcrumbs);    drupal_set_breadcrumb($breadcrumbs);
62    
# Line 81  function mmedia_edit_form(&$form_state, Line 81  function mmedia_edit_form(&$form_state,
81  function mmedia_edit_form_validate($form, &$form_state) {  function mmedia_edit_form_validate($form, &$form_state) {
82    $values = $form_state['values'];    $values = $form_state['values'];
83    if ($values['op'] == t('Delete')) {    if ($values['op'] == t('Delete')) {
84      drupal_goto(MMEDIA_PATH .'/'. $values['mid'] .'/delete');      drupal_goto(MEDIA_PATH .'/'. $values['mid'] .'/delete');
85      exit();      exit();
86    }    }
87    _mmedia_form_process($values);    _mmedia_form_process($values);
# Line 95  function mmedia_edit_form_submit($form, Line 95  function mmedia_edit_form_submit($form,
95    $media = _mmedia_form_post($values);    $media = _mmedia_form_post($values);
96    if ($media->mid) {    if ($media->mid) {
97      $form_state['mid'] = $media->mid;      $form_state['mid'] = $media->mid;
98      $form_state['redirect'] = MMEDIA_PATH .'/'. $media->mid;      $form_state['redirect'] = MEDIA_PATH .'/'. $media->mid;
99    }    }
100  }  }
101    
# Line 105  function mmedia_edit_form_submit($form, Line 105  function mmedia_edit_form_submit($form,
105  function mmedia_delete_form($form_state, $media) {  function mmedia_delete_form($form_state, $media) {
106    // load the media item    // load the media item
107    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));
108    $breadcrumbs[] = l($media->title, MMEDIA_PATH .'/'. $media->mid);    $breadcrumbs[] = l($media->title, MEDIA_PATH .'/'. $media->mid);
109    drupal_set_breadcrumb($breadcrumbs);    drupal_set_breadcrumb($breadcrumbs);
110    
111    // remember for confirmation of the media    // remember for confirmation of the media
# Line 116  function mmedia_delete_form($form_state, Line 116  function mmedia_delete_form($form_state,
116    
117    $form = confirm_form($form,    $form = confirm_form($form,
118      t('Are you sure you want to delete %title?', array('%title' => $media->title)),      t('Are you sure you want to delete %title?', array('%title' => $media->title)),
119      isset($_GET['destination']) ? $_GET['destination'] : MMEDIA_PATH ."/{$mid}/view",      isset($_GET['destination']) ? $_GET['destination'] : MEDIA_PATH ."/{$mid}/view",
120      $notice,      $notice,
121      t('Delete'), t('Cancel'));      t('Delete'), t('Cancel'));
122    
# Line 143  function mmedia_move_form(&$form_state, Line 143  function mmedia_move_form(&$form_state,
143    drupal_add_css(drupal_get_path('module', 'mmedia') .'/mmedia.css');    drupal_add_css(drupal_get_path('module', 'mmedia') .'/mmedia.css');
144    
145    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));    $breadcrumbs = _mmedia_set_breadcrumb(mmedia_folder_load($media->fid));
146    $breadcrumbs[] = l($media->title, MMEDIA_PATH .'/'. $media->mid);    $breadcrumbs[] = l($media->title, MEDIA_PATH .'/'. $media->mid);
147    drupal_set_breadcrumb($breadcrumbs);    drupal_set_breadcrumb($breadcrumbs);
148    
149    $folders = _mmedia_folder_cache();    $folders = _mmedia_folder_cache();
# Line 152  function mmedia_move_form(&$form_state, Line 152  function mmedia_move_form(&$form_state,
152    $current = 0;    $current = 0;
153    $lines = $folders['line'];    $lines = $folders['line'];
154    foreach ($lines as $line => $fid) {    foreach ($lines as $line => $fid) {
155      $depth = (count(explode('/', $line)) - MMEDIA_FOLDER_PATH_ARG - 1);      $depth = (count(explode('/', $line)) - FOLDER_PATH_ARG - 1);
156    
157      // add the appropriate boundaries for accordian viewing      // add the appropriate boundaries for accordian viewing
158      $prefix = '';      $prefix = '';
# Line 170  function mmedia_move_form(&$form_state, Line 170  function mmedia_move_form(&$form_state,
170        '#type' => 'radio',        '#type' => 'radio',
171        '#title' => $folders[$fid]['name'],        '#title' => $folders[$fid]['name'],
172        '#return_value' => $fid,        '#return_value' => $fid,
173        '#default_value' => ($fid == $media->fid ? $fid : false),        '#default_value' => ($fid == $media->fid ? $fid : FALSE),
174        '#parents' => array('folder'),        '#parents' => array('folder'),
175        '#suffix' => '</div>'        '#suffix' => '</div>'
176      );      );

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

  ViewVC Help
Powered by ViewVC 1.1.2