| 173 | | } |
|---|
| 174 | | |
|---|
| 175 | | $arg_name = "media"; |
|---|
| 176 | | |
|---|
| 177 | | /* Check if we should output raw annodex, cmml etc or display |
|---|
| 178 | | * information about the video. |
|---|
| 179 | | */ |
|---|
| 180 | | if(isset($_GET[$arg_name])) { |
|---|
| 181 | | $mode = $_GET[$arg_name]; |
|---|
| 182 | | switch ($mode) { |
|---|
| 183 | | case "cmml": |
|---|
| 184 | | output_cmml($node); |
|---|
| 185 | | die; |
|---|
| 186 | | break; |
|---|
| 187 | | case "annodex": |
|---|
| 188 | | /* We need to call output() rather than |
|---|
| 189 | | * output_annodex() because of apps like the |
|---|
| 190 | | * firefox extension that want both of them on |
|---|
| 191 | | * the one link. |
|---|
| 192 | | */ |
|---|
| 193 | | output($node); |
|---|
| 194 | | die; |
|---|
| 195 | | break; |
|---|
| 196 | | case "theora": |
|---|
| 197 | | output_ogg($node); |
|---|
| 198 | | die; |
|---|
| 199 | | break; |
|---|
| 200 | | default: |
|---|
| 201 | | output($node); |
|---|
| 202 | | die; |
|---|
| 203 | | break; |
|---|
| 204 | | } |
|---|
| 205 | | } else { |
|---|
| 206 | | |
|---|
| 207 | | $output .= headers($node, $arg_name); |
|---|
| 208 | | $output .= "<br>"; |
|---|
| 209 | | $output .= "<br>"; |
|---|
| 210 | | if( !$_GET['clip'] ) { |
|---|
| 211 | | $output .= clip_table( $node, $arg_name, $_GET['clip'] ); |
|---|
| 212 | | } else if( $editing ) { |
|---|
| 213 | | switch( $_GET['clip'] ) { |
|---|
| 214 | | case "new": |
|---|
| 215 | | break; |
|---|
| 216 | | default: |
|---|
| 217 | | break; |
|---|
| 218 | | } |
|---|
| 219 | | } else { |
|---|
| 220 | | drupal_set_message("You do not have permission to edit clips", "error"); |
|---|
| 221 | | } |
|---|
| | 174 | $mode = "view"; |
|---|
| | 175 | } |
|---|
| | 176 | |
|---|
| | 177 | switch( $mode ) { |
|---|
| | 178 | case "edit": |
|---|
| | 179 | $output .= view_header($node, $arg_name); |
|---|
| | 180 | $result = db_query("SELECT * FROM {acidfree_cmml_clips} WHERE `nid`={$node->nid} AND `id`=\"{$_GET['clip']}\""); |
|---|
| | 181 | $row = db_fetch_array( $result ); |
|---|
| | 182 | $output .= clip_table($node, $arg_name, $row['id']); |
|---|
| | 183 | $output .= "<br><br>"; |
|---|
| | 184 | $output .= clip_update_form( $node, $row, "Update clip" ); |
|---|
| | 185 | $output .= view_footer($node, $arg_name); |
|---|
| | 186 | $output .= $node->body; |
|---|
| 228 | | } else if( $editing ) { |
|---|
| 229 | | $output .= clip_table( $node, $arg_name, $_GET['clip'] ); |
|---|
| 230 | | $output .= "<br>"; |
|---|
| 231 | | $result = db_query("SELECT * FROM {acidfree_cmml_clips} WHERE nid={$node->nid} AND `id`=\"{$_GET['clip']}\""); |
|---|
| 232 | | $row = db_fetch_array( $result ); |
|---|
| 233 | | $output .= clip_update_form( $node, $row, "Update clip"); |
|---|
| 234 | | } |
|---|
| 235 | | |
|---|
| 236 | | $output .= footer($node,$arg_name); |
|---|
| 237 | | $output .= $node->body; |
|---|
| 238 | | } |
|---|
| 239 | | |
|---|
| | 195 | $output .= view_footer($node, $arg_name); |
|---|
| | 196 | $output .= $node->body; |
|---|
| | 197 | |
|---|
| | 198 | break; |
|---|
| | 199 | |
|---|
| | 200 | case "media": |
|---|
| | 201 | $media = select_media( $arg_name ); |
|---|
| | 202 | output_media( $media, $node ); |
|---|
| | 203 | break; |
|---|
| | 204 | } |
|---|
| | 429 | |
|---|
| | 430 | function select_media( $arg_name ) { |
|---|
| | 431 | |
|---|
| | 432 | if( isset($_GET[$arg_name])) { |
|---|
| | 433 | return $_GET[$arg_name]; |
|---|
| | 434 | } else { |
|---|
| | 435 | return false; |
|---|
| | 436 | } |
|---|
| | 437 | } |
|---|
| | 438 | |
|---|
| | 439 | function output_media( $media, $node ) { |
|---|
| | 440 | switch ($media) { |
|---|
| | 441 | case "cmml": |
|---|
| | 442 | output_cmml($node); |
|---|
| | 443 | die; |
|---|
| | 444 | break; |
|---|
| | 445 | case "annodex": |
|---|
| | 446 | /* We need to call output() rather than |
|---|
| | 447 | * output_annodex() because of apps like the |
|---|
| | 448 | * firefox extension that want both of them on |
|---|
| | 449 | * the one link. |
|---|
| | 450 | */ |
|---|
| | 451 | output($node); |
|---|
| | 452 | die; |
|---|
| | 453 | break; |
|---|
| | 454 | case "theora": |
|---|
| | 455 | output_ogg($node); |
|---|
| | 456 | die; |
|---|
| | 457 | break; |
|---|
| | 458 | default: |
|---|
| | 459 | output($node); |
|---|
| | 460 | die; |
|---|
| | 461 | break; |
|---|
| | 462 | } |
|---|
| | 463 | } |
|---|
| | 464 | |
|---|
| | 465 | function mode( $arg_name ) { |
|---|
| | 466 | |
|---|
| | 467 | if( $_POST['id'] || $_POST['desc'] || $_POST['start_seconds'] |
|---|
| | 468 | || $_POST['start_minutes'] || $_POST['start_hours'] ) |
|---|
| | 469 | return "add"; |
|---|
| | 470 | |
|---|
| | 471 | if( $_GET['clip'] ) { |
|---|
| | 472 | return "edit"; |
|---|
| | 473 | } |
|---|
| | 474 | |
|---|
| | 475 | if( select_media( $arg_name ) ) { |
|---|
| | 476 | return "media"; |
|---|
| | 477 | } |
|---|
| | 478 | |
|---|
| | 479 | return "view"; |
|---|
| | 480 | } |
|---|
| | 481 | |
|---|
| | 482 | function can_edit( $node ) { |
|---|
| | 483 | |
|---|
| | 484 | if (acidfree_access('update',$node)) { |
|---|
| | 485 | return TRUE; |
|---|
| | 486 | } else { |
|---|
| | 487 | return FALSE; |
|---|
| | 488 | } |
|---|
| | 489 | } |
|---|
| | 490 | |
|---|
| | 491 | function view_header($node, $arg_name) { |
|---|
| | 492 | return headers($node, $arg_name); |
|---|
| | 493 | } |
|---|
| | 494 | |
|---|
| | 495 | function view_footer($node, $arg_name) { |
|---|
| | 496 | return footer($node, $arg_name); |
|---|
| | 497 | } |
|---|
| | 498 | |
|---|