Index: media_mover_api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/media_mover_api.module,v
retrieving revision 1.1.2.73
diff -u -p -r1.1.2.73 media_mover_api.module
--- media_mover_api.module	18 Apr 2008 12:53:19 -0000	1.1.2.73
+++ media_mover_api.module	27 Apr 2008 11:08:32 -0000
@@ -1,7 +1,7 @@
 <?php
-
 /* $Id: media_mover_api.module,v 1.1.2.73 2008/04/18 12:53:19 arthuregg Exp $ */
 
+include_once ('media_mover_token.inc');
 
 /*
  * This file contains all the generic functions for media_moving.
Index: media_mover_token.inc
===================================================================
RCS file: media_mover_token.inc
diff -N media_mover_token.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ media_mover_token.inc	27 Apr 2008 11:08:32 -0000
@@ -0,0 +1,138 @@
+<?php
+
+function media_mover_token_get_config($cid) {
+   //okay, we need to get the node, file and configuration in.
+  //If there is no node, we'll have to account for that...
+  if ($config = _mm_get_configuration($cid)) {
+    $config_data = _mm_get_configuration_data($cid);  
+    while ($state = db_fetch_array($config_data)) {    
+      $config['states'][$state['verb']] = $state;
+    }
+    return $config;
+  }
+  
+  return false;
+}
+
+/**
+ * Implementation of hook_token_values().
+ */
+function media_mover_api_token_values($type, $object = NULL) {
+  $values = array();
+  switch ($type) {    
+    
+    case 'mm_config':      
+      $config = $object;      
+      foreach ($config as $k => $v) {
+        if ($k == 'status') {
+          //@TODO
+          //$values['status_name'] = media_mover_api_con($v);
+        }
+        if ($k == 'states') {
+          foreach ($v as $verb => $state) {            
+            foreach ($state as $state_key => $state_var) {              
+              if (is_string($state_var)) {
+                $values["{$verb}-{$state_key}"] = $state_var;
+              }
+            }
+            if (function_exists("{$state['module']}_token_values")) {             
+              //Would be nice to have this stuff... but not sure how to integrate nicely without jumbling the interface.              
+              $extra_config_tokens = call_user_func("{$state['module']}_token_values",$type,unserialize($state['configuration']));
+              foreach ($extra_config_tokens as $config_key => $config_val) {
+                $values["{$verb}-{$state_key}-{$config_key}"] = $config_val;   
+              }
+            }
+          }
+        } else {
+          $values[$k] = $v;
+        }
+      }
+      break;
+    case 'mm_file':
+
+      $file = (object)$object;
+      
+      foreach ($file as $key => $v) {
+        
+        if ($k == 'status') {
+          $values['status_name'] = media_mover_api_item_status($v);
+        }
+        if (is_array($v)) {
+          //this handles the data element
+          foreach ($v as $file_key => $file_v) {
+            $values['data-' . $file_key] = $file_v;
+          }
+        } else {
+          $values[$key] = $v;
+        }
+      }
+      break;
+  }
+
+  return $values;
+}
+
+/**
+ * Implementation of hook_token_list().
+ */
+function media_mover_api_token_list($type = 'all') {
+
+  //@TODO: Flesh these out with real descriptions
+  if ($type == 'mm_file' || $type == 'all') {
+    $tokens['Media Mover File'] = array ( 
+    
+    'mmfid' => t('Media Mover File Id'),
+    'nid' => t('Node Id of assocaited node (if any)'),
+    'fid' => t('File Id of associated file type entry (if any)'),
+    'cid' => t('Media Mover configuration from whence this file came'),
+    'harvest_file' => t('Path to harvested file'),
+    'process_file' => t('Path to processed file'),
+    'storage_file' => t('Path to stored file'),
+    'complete_file' => t('Path to completed file'),
+    'url' => t('Url for file access (if any)'),
+    'status' => t('Status code of file'),
+    'status_name' => t('Status name of file'),
+    'date' => t('Date of creation'),
+ );
+ 
+    $tokens['Media Mover File'] = array_merge($tokens['Media Mover File'], 
+    array ( 
+    'data-filesize' => t('Filesize of completed file'),
+    'data-filename' => t('Filename of compelted file'),
+    'data-filepath' => t('Filepath of completed file'),
+    'data-harvest_module' => t('Module used for harvesting'),
+    'data-harvest_action' => t('Action of harvesting Module'),
+    'data-harvest_file' => t('Harvested file'),
+     'data-node' => t('Node??'), )
+    );
+    
+    
+    
+  }
+  
+  if ($type == "mm_config") {
+    $tokens['Media Mover Configuration'] = array ( 
+       'cid' => t('Media Mover Configuration '),
+       'name' => t('Name of Configuration'),
+       'description' => t('Configuration description'),
+       'status' => t('Configuration status'),
+       //@TODO
+       //'status_name' => t('Configuration status name'),
+       'start_time' => t('Configuration start time'),
+       'last_start_time' => t('Configuration last start time'),
+       'rss' => t('is configuration exposed via RSS?'),
+       'cron' => t('is configuration set to run on cron'),
+    );
+    
+    
+    $tokens['Media Mover Configuration']['harvest-module'] = t("Module used for Harvesting");
+    $tokens['Media Mover Configuration']['storage-module'] = t("Module used for Storage");
+    $tokens['Media Mover Configuration']['process-module'] = t("Module used for Processing");
+    $tokens['Media Mover Configuration']['complete-module'] = t("Module used for Completion");
+    
+  }
+
+  return $tokens;
+}
+
+?>
\ No newline at end of file
