]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: make name editable again
authorBart Visscher <bartv@thisnet.nl>
Fri, 2 Dec 2011 20:24:48 +0000 (21:24 +0100)
committerBart Visscher <bartv@thisnet.nl>
Fri, 2 Dec 2011 20:24:48 +0000 (21:24 +0100)
apps/contacts/ajax/setproperty.php
apps/contacts/js/interface.js
apps/contacts/templates/part.details.php
apps/contacts/templates/part.property.FN.php [new file with mode: 0644]
apps/contacts/templates/part.setpropertyform.php

index c9102c4a2ee23c43e12e70b2586dc03148120d8d..22f228cbf437e81a8c78434b0597ef05dd672905 100644 (file)
@@ -107,7 +107,12 @@ OC_Contacts_VCard::edit($id,$vcard->serialize());
 $adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
 $phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
 
-$tmpl = new OC_Template('contacts','part.property');
+if ($vcard->children[$line]->name == 'FN'){
+       $tmpl = new OC_Template('contacts','part.property.FN');
+}
+else{
+       $tmpl = new OC_Template('contacts','part.property');
+}
 $tmpl->assign('adr_types',$adr_types);
 $tmpl->assign('phone_types',$phone_types);
 $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line));
index ba1c0e536c2d3a2c8241ace04ad4432d87fabfca..eb81e87268285cf6b25c4add6823e56d88d2fda4 100644 (file)
@@ -110,7 +110,7 @@ $(document).ready(function(){
 
        $('.contacts_property [data-use="edit"]').live('click',function(){
                var id = $('#rightcontent').data('id');
-               var checksum = $(this).parents('li').first().data('checksum');
+               var checksum = $(this).parents('.contacts_property').first().data('checksum');
                $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
                        if(jsondata.status == 'success'){
                                $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page)
index f6d69005a088b7eae6ff6c67ec88d152d7d2b871..afad0b7f64cc36f7c4b55e79fe8cef6439b7d3dd 100644 (file)
@@ -1,5 +1,5 @@
 <?php if(array_key_exists('FN',$_['details'])): ?>
-       <p id="contacts_details_name"><?php echo $_['details']['FN'][0]['value']; ?></p>
+       <?php echo $this->inc('part.property.FN', array('property' => $_['details']['FN'][0])); ?>
        <img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
 
        <?php if(isset($_['details']['PHOTO'])): // Emails first ?>
diff --git a/apps/contacts/templates/part.property.FN.php b/apps/contacts/templates/part.property.FN.php
new file mode 100644 (file)
index 0000000..83cef94
--- /dev/null
@@ -0,0 +1,9 @@
+       <p id="contacts_details_name" class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
+               <?php echo $_['property']['value']; ?>
+               <span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
+       </p>
+<?php if (!isset($_['details'])): ?>
+<script>
+$('#leftcontent li.active a').text('<?php echo $_['property']['value']; ?>');
+</script>
+<?php endif ?>
index f216a55f5e97a9262338828f34e1927eba50d94e..8635d7db1ce5dc4438b51384e4f7135cbe25c647 100644 (file)
@@ -1,7 +1,9 @@
        <form id="contacts_setpropertyform">
                <input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
                <input type="hidden" name="id" value="<?php echo $_['id']; ?>">
-               <?php if($_['property']['name']=='ADR'): ?>
+               <?php if($_['property']['name']=='FN'): ?>
+                       <p class="contacts_property_data"><input id="fn" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
+               <?php elseif($_['property']['name']=='ADR'): ?>
                        <p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
                        <ol class="contacts_property_data" id="contacts_addresspart">
                                <li class="input">