diff options
| author | shadlaws <shad@shadlaws.com> | 2013-03-13 16:18:12 +0100 | 
|---|---|---|
| committer | shadlaws <shad@shadlaws.com> | 2013-03-13 16:18:12 +0100 | 
| commit | a14030346897989b4a94931a8c1a1c9b38523ab2 (patch) | |
| tree | bf2f4b2446c8b0705e99204c26fd0f35dabfa45d /modules/gallery/controllers | |
| parent | 8b457bf39b51495706a6be501f93f80bbd6d1fef (diff) | |
#2061 - Remove Uploadify from add_photo_form/add_photo_form_completed events.
- Added code around event calls in uploader to add Uploadify-specific JS to update the inputs.
- Removed Uploadify JS from tag_event.  Now it's uploader-agnostic.
- Refactored tag_event autocomplete code (no functional changes).
Diffstat (limited to 'modules/gallery/controllers')
| -rw-r--r-- | modules/gallery/controllers/uploader.php | 19 | 
1 files changed, 17 insertions, 2 deletions
| diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php index 8e09dbed..c708db92 100644 --- a/modules/gallery/controllers/uploader.php +++ b/modules/gallery/controllers/uploader.php @@ -123,10 +123,25 @@ class Uploader_Controller extends Controller {        ->label(t("Add photos to %album_title", array("album_title" => html::purify($album->title))));      $group->uploadify("uploadify")->album($album); -    $group = $form->group("actions"); -    $group->uploadify_buttons(""); +    $group_actions = $form->group("actions"); +    $group_actions->uploadify_buttons(""); +    $inputs_before_event = array_keys($form->add_photos->inputs);      module::event("add_photos_form", $album, $form); +    $inputs_after_event = array_keys($form->add_photos->inputs); + +    // For each new input in add_photos, attach JS to make uploadify update its value. +    foreach (array_diff($inputs_after_event, $inputs_before_event) as $input) { +      if (!$input) { +        // Likely a script input - don't do anything with it. +        continue; +      } +      $group->uploadify->script_data($input, $group->{$input}->value); +      $group->script("") +        ->text("$('input[name=\"$input\"]').change(function (event) { +                  $('#g-uploadify').uploadifySettings('scriptData', {'$input': $(this).val()}); +                });"); +    }      return $form;    } | 
