Changeset 9d0c16e79447bc7109de05a8238ae4aa99038c8d

Show
Ignore:
Timestamp:
07/24/11 17:54:21 (10 months ago)
Author:
Xemle <xemle@phtagr.org>
Children:
f8be251bb75b2b4dd3cb3284b75393151634f94e
Parents:
64b982d58ab0f272d45ccaf51ff85849e9e7ccc3
git-committer:
Xemle <xemle@phtagr.org> / 2011-07-24T17:54:21Z+0200
Message:

Fix dialog of edit meta

Location:
views/explorer
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • views/explorer/editmeta.ctp

    rafc40e0 r9d0c16e  
    55<fieldset> 
    66<?php 
    7   $locations = array(LOCATION_CITY => '', LOCATION_SUBLOCATION => '', LOCATION_STATE => '', LOCATION_COUNTRY => ''); 
    8   foreach ($data['Location'] as $location) { 
    9     $locations[$location['type']] = $location['name']; 
    10   } 
    11  
    127  echo $form->input('Media.date', array('type' => 'text', 'value' => $data['Media']['date'], 'label' => __("Date", true))); 
    13   echo $html->tag('div', 
    14     $form->label('Tags.text', __('Tags', true)). 
    15     $ajax->autoComplete('Tags.text', 'autocomplete/tag', array('value' => implode(', ', Set::extract('/Tag/name', $data)), 'tokens' => ',')),  
    16     array('class' => 'input text')); 
    17   echo $html->tag('div', 
    18     $form->label('Categories.text', __('Categories', true)). 
    19     $ajax->autoComplete('Categories.text', 'autocomplete/category', array('value' => implode(', ', Set::extract('/Category/name', $data)), 'tokens' => ',')),  
    20     array('class' => 'input text')); 
    21   echo $html->tag('div', 
    22     $form->label('Locations.city', __('City', true)). 
    23     $ajax->autoComplete('Locations.city', 'autocomplete/city', array('value' => $locations[LOCATION_CITY])),  
    24     array('class' => 'input text')); 
    25   echo $html->tag('div', 
    26     $form->label('Locations.sublocation', __('Sublocation', true)). 
    27     $ajax->autoComplete('Locations.sublocation', 'autocomplete/sublocation', array('value' => $locations[LOCATION_SUBLOCATION])),  
    28     array('class' => 'input text')); 
    29   echo $html->tag('div', 
    30     $form->label('Locations.state', __('State', true)). 
    31     $ajax->autoComplete('Locations.state', 'autocomplete/state', array('value' => $locations[LOCATION_STATE])),  
    32     array('class' => 'input text')); 
    33   echo $html->tag('div', 
    34     $form->label('Locations.country', __('Country', true)). 
    35     $ajax->autoComplete('Locations.country', 'autocomplete/country', array('value' => $locations[LOCATION_COUNTRY])),  
    36     array('class' => 'input text')); 
    37   if ($data['Media']['latitude'] || $data['Media']['longitude']) { 
    38     $geo = $data['Media']['latitude'].', '.$data['Media']['longitude']; 
    39   } else { 
    40     $geo = ''; 
    41   } 
    42   echo $form->input('Media.geo', array('value' => $geo, 'label' => __('Geo data', true))); 
     8  echo $form->input('Tags.text', array('label' => __('Tags', true), 'value' => join(', ', Set::extract('/Tag/name', $data)))); 
     9  echo $autocomplete->autoComplete('Tags.text', 'autocomplete/tag', array('split' => true)); 
     10  echo $form->input('Categories.text', array('label' => __('Categories', true), 'value' => join(', ', Set::extract('/Category/name', $data)))); 
     11  echo $autocomplete->autoComplete('Categories.text', 'autocomplete/category', array('split' => true)); 
     12  echo $form->input('Locations.city', array('label' => __('City', true), 'value' => join('', Set::extract('/Location[type='.LOCATION_CITY.']/name', $data)))); 
     13  echo $autocomplete->autoComplete('Locations.city', 'autocomplete/city'); 
     14  echo $form->input('Locations.sublocation', array('label' => __('Sublocation', true), 'value' => join('', Set::extract('/Location[type='.LOCATION_SUBLOCATION.']/name', $data)))); 
     15  echo $autocomplete->autoComplete('Locations.sublocation', 'autocomplete/sublocation'); 
     16  echo $form->input('Locations.state', array('label' => __('State', true), 'value' => join('', Set::extract('/Location[type='.LOCATION_STATE.']/name', $data)))); 
     17  echo $autocomplete->autoComplete('Locations.state', 'autocomplete/state'); 
     18  echo $form->input('Locations.country', array('label' => __('Country', true), 'value' => join('', Set::extract('/Location[type='.LOCATION_COUNTRY.']/name', $data)))); 
     19  echo $autocomplete->autoComplete('Locations.country', 'autocomplete/country'); 
     20  echo $form->input('Media.geo', array('label' => __('Geo data', true), 'maxlength' => 32)); 
    4321?> 
    4422</fieldset> 
  • views/explorer/edittag.ctp

    r82ea1bb r9d0c16e  
    55<fieldset> 
    66<?php 
    7   echo $html->tag('div', 
    8     $form->label('Tags.text', __('Tags', true)). 
    9     $ajax->autoComplete('Tags.text', 'autocomplete/tag', array('value' => implode(', ', Set::extract('/Tag/name', $data)), 'tokens' => ',')),  
    10     array('class' => 'input text')); 
     7  echo $form->input('Tags.text', array('label' => __('Tags', true), 'value' => join(', ', Set::extract('/Tag/name', $data)))); 
     8  echo $autocomplete->autoComplete('Tags.text', 'autocomplete/tag', array('split' => true)); 
    119?> 
    1210</fieldset> 
    13 <?php 
    14   echo $form->submit('Save', array('div' => false));  
    15   echo $ajax->link('Cancel', '/explorer/updatemeta/'.$mediaId, array('update' => 'meta-'.$mediaId, 'class' => 'reset')); 
    16 ?> 
    1711</form> 
  • views/explorer/index.ctp

    r163132b r9d0c16e  
    2020      }); 
    2121      $(this).find('ul li .edit').click(function() { 
    22         $('#dialog').children().remove(); 
    23         $('#dialog').load(':BASE_URLexplorer/editmeta/' + id, function() { 
    24           $(this).dialog({ 
    25             modal: true,  
    26             width: 520, 
    27             title: ':EDIT_TITLE', 
    28             buttons: { 
    29               ':SAVE': function() { 
    30                 var $form = $('#form-meta-' + id); 
    31                 $.post($form.attr('action'), $form.serialize(), function(data) { 
    32                   $('#description-' + id).html(data); 
    33                   $('#description-' + id).find('.tooltip-actions').tooltipAction(); 
    34                 }); 
    35                 $(this).dialog("close"); 
    36               }, 
    37               ':CANCEL': function() { 
    38                 $(this).dialog("close"); 
     22        var $dialog = $('#dialog'); 
     23        $.ajax(':BASE_URLexplorer/editmeta/' + id, { 
     24          success: function(data, xhr, status) { 
     25            $dialog.children().remove(); 
     26            $dialog.append(data); 
     27            $dialog.dialog({ 
     28              modal: true,  
     29              width: 520, 
     30              title: ':EDIT_TITLE', 
     31              buttons: { 
     32                ':SAVE': function() { 
     33                  var $form = $('#form-meta-' + id); 
     34                  $.post($form.attr('action'), $form.serialize(), function(data) { 
     35                    $('#description-' + id).html(data); 
     36                    $('#description-' + id).find('.tooltip-actions').tooltipAction(); 
     37                  }); 
     38                  $(this).dialog("close"); 
     39                }, 
     40                ':CANCEL': function() { 
     41                  $(this).dialog("close"); 
     42                } 
    3943              } 
    40             } 
    41           }); 
    42         });   
     44            }); 
     45          } 
     46        }); 
    4347      }); 
    4448    });