beginning to restore ahah magic... need to figure out the change from the old multifo...
authorDarrel O\'Pry
Thu, 17 Jul 2008 04:54:15 +0000 (04:54 +0000)
committerDarrel O\'Pry
Thu, 17 Jul 2008 04:54:15 +0000 (04:54 +0000)
and the current widget system....

filefield.module
filefield_widget.inc

index 4ac0c82..9113c8d 100644 (file)
@@ -19,6 +19,8 @@ function filefield_init() {
   // file hooks and callbacks.
   module_load_include('inc', 'filefield', 'filefield_file');
   module_load_include('inc', 'filefield', 'field_file');
+
+  drupal_add_js(drupal_get_path('module', 'filefield') .'/filefield.js');
   drupal_add_css(drupal_get_path('module', 'filefield') .'/filefield.css');
 }
 
@@ -30,7 +32,7 @@ function filefield_menu() {
 
   $items['filefield/js/upload/%/%/%'] = array(
     'page callback' => 'filefield_js',
-    'page arguments' => array(3, 4, 5, 'filefield_file_upload_js'),
+    'page arguments' => array(3, 4, 5, '_filefield_file_upload'),
     'access callback' => 'filefield_edit_access',
     'access arguments' => array(3),
     'type' => MENU_CALLBACK,
@@ -38,7 +40,7 @@ function filefield_menu() {
   );
   $items['filefield/js/delete/%/%/%'] = array(
     'page callback' => 'filefield_js',
-    'page arguments' => array(3, 4, 5, 'filefield_file_edit_delete_js'),
+    'page arguments' => array(3, 4, 5, '_filefield_file_delete'),
     'access callback' => 'filefield_edit_access',
     'access arguments' => array(3),
     'type' => MENU_CALLBACK,
index 2a5b6b5..5bb71ae 100644 (file)
@@ -170,8 +170,15 @@ function filefield_widget_process($element, $edit, &$form_state, $form) {
       '#name' => $element['#field_name'] .'_'. $element['#delta'] .'_remove_btn',
       '#type' => 'submit', 
       '#value' => t('Remove'),
-      '#process' => array('filefield_widget_process_remove_btn'),
+      '#process' => array('filefield_widget_process_remove_btn', 'form_expand_ahah'),
       '#submit' => array('filefield_widget_submit_remove_btn'),
+      '#ahah' => array( // with JavaScript    
+         'path' => 'filefield/js/remove/'. $element['#field_name'] .'/'. $element['#type_name'] .'/'. $element['#delta'],    
+         'wrapper' => $element['#id'],   
+         'method' => 'replace',    
+         'effect' => 'fade',   
+      ),
       '#field_name' => $element['#field_name'],
       '#delta' => $element['#delta'],
     );
@@ -189,8 +196,14 @@ function filefield_widget_process($element, $edit, &$form_state, $form) {
     $element['upload_btn'] = array(
       '#type' => 'submit', 
       '#value' => t('Upload'),
-      '#process' => array('filefield_widget_process_upload_btn'),
+      '#process' => array('filefield_widget_process_upload_btn', 'form_expand_ahah'),
       '#submit' => array('filefield_widget_submit_upload_btn'),
+      '#ahah' => array( // with JavaScript    
+         'path' => 'filefield/js/upload/'. $element['#field_name'] .'/'. $element['#type_name'] .'/'. $element['#delta'],    
+         'wrapper' => $element['#id'],   
+         'method' => 'replace',    
+         'effect' => 'fade',   
+      ),
       '#field_name' => $element['#field_name'],
       '#delta' => $element['#delta'],
       '#type_name' => $element['#type_name'],