diff --git a/ajax/addcard.php b/ajax/addcard.php index 4e68dc96..0cecd3bd 100644 --- a/ajax/addcard.php +++ b/ajax/addcard.php @@ -43,12 +43,22 @@ $parameters = $_POST['parameters']; $vcard = new Sabre_VObject_Component('VCARD'); $vcard->add(new Sabre_VObject_Property('FN',$fn)); $vcard->add(new Sabre_VObject_Property('UID',OC_Contacts_VCard::createUID())); -foreach(array('ADR', 'TEL', 'EMAIL', 'ORG') as $propname){ + +// Data to add ... +$add = array('TEL', 'EMAIL', 'ORG'); +$address = false; +for($i = 0; $i < 7; $i++){ + if( isset($values['ADR'][$i] ) && $values['ADR'][$i]) $address = true; +} +if( $address ) $add[] = 'ADR'; + +// Add data +foreach( $add as $propname){ if( !( isset( $values[$propname] ) && $values[$propname] )){ continue; } $value = $values[$propname]; - if( isset( $parameters[$propname] ) && count$parameters[$propname] ){ + if( isset( $parameters[$propname] ) && count( $parameters[$propname] )){ $prop_parameters = $parameters[$propname]; } else{ diff --git a/appinfo/info.xml b/appinfo/info.xml index d18a19c3..0e2b1336 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,4 +1,4 @@ - + contacts Contacts diff --git a/css/formtastic.css b/css/formtastic.css new file mode 100644 index 00000000..629c2207 --- /dev/null +++ b/css/formtastic.css @@ -0,0 +1,272 @@ +/* ------------------------------------------------------------------------------------------------- + +ownCloud changes: search for OWNCLOUD + +Based on formtastic style sheet +This stylesheet forms part of the Formtastic Rails Plugin +(c) 2008-2011 Justin French + +--------------------------------------------------------------------------------------------------*/ +/* NORMALIZE AND RESET - obviously inspired by Yahoo's reset.css, but scoped to just .formtastic +--------------------------------------------------------------------------------------------------*/ +.formtastic, +.formtastic ul, +.formtastic ol, +.formtastic li, +.formtastic fieldset, +.formtastic legend, +/*.formtastic input, +.formtastic textarea, +.formtastic select, COMMENTED BY OWNCLOUD */ +.formtastic p { + margin:0; + padding:0; +} + +.formtastic fieldset { + border:0; +} + +.formtastic em, +.formtastic strong { + font-style:normal; + font-weight:normal; +} + +.formtastic ol, +.formtastic ul { + list-style:none; +} + +.formtastic abbr, +.formtastic acronym { + border:0; + font-variant:normal; +} + +/*.formtastic input, +.formtastic textarea { + font-family:sans-serif; + font-size:inherit; + font-weight:inherit; +} + +.formtastic input, +.formtastic textarea, +.formtastic select { + font-size:100%; +} COMMENTED BY OWNCLOUD */ + +.formtastic legend { + white-space:normal; + color:#000; +} + +/* SEMANTIC ERRORS +--------------------------------------------------------------------------------------------------*/ +.formtastic .errors { + color:#cc0000; + margin:0.5em 0 1.5em 25%; + list-style:square; +} + +.formtastic .errors li { + padding:0; + border:none; + display:list-item; +} + + +/* BUTTONS +--------------------------------------------------------------------------------------------------*/ +.formtastic .buttons { + overflow:hidden; /* clear containing floats */ + padding-left:25%; +} + +.formtastic .button { + float:left; + padding-right:0.5em; + border:none; /* ADDED BY OWNCLOUD */ +} + + +/* INPUTS +--------------------------------------------------------------------------------------------------*/ +.formtastic .inputs { + overflow:hidden; /* clear containing floats */ +} + +.formtastic .input { + overflow:hidden; /* clear containing floats */ + padding:0.5em 0; /* padding and negative margin juggling is for Firefox */ + margin-top:-0.5em; + margin-bottom:1em; +} + + +/* LEFT ALIGNED LABELS +--------------------------------------------------------------------------------------------------*/ +.formtastic .input .label { + display:block; + width:25%; + float:left; + padding-top:.2em; +} + +.formtastic .fragments .label, +.formtastic .choices .label { + position:absolute; + width:95%; + left:0px; +} + +.formtastic .fragments .label label, +.formtastic .choices .label label { + position:absolute; +} + +/* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets) +--------------------------------------------------------------------------------------------------*/ +.formtastic .choices { + position:relative; +} + +.formtastic .choices-group { + float:left; + width:74%; + margin:0; + padding:0 0 0 25%; +} + +.formtastic .choice { + padding:0; + border:0; +} + + +/* INLINE HINTS +--------------------------------------------------------------------------------------------------*/ +.formtastic .input .inline-hints { + color:#666; + margin:0.5em 0 0 25%; +} + + +/* INLINE ERRORS +--------------------------------------------------------------------------------------------------*/ +.formtastic .inline-errors { + color:#cc0000; + margin:0.5em 0 0 25%; +} + +.formtastic .errors { + color:#cc0000; + margin:0.5em 0 0 25%; + list-style:square; +} + +.formtastic .errors li { + padding:0; + border:none; + display:list-item; +} + + +/* STRING, NUMERIC, PASSWORD, EMAIL, URL, PHONE, SEARCH (ETC) OVERRIDES +--------------------------------------------------------------------------------------------------*/ +.formtastic .stringish input { + width:72%; +} + +.formtastic .stringish input[size] { + width:auto; + max-width:72%; +} + + +/* TEXTAREA OVERRIDES +--------------------------------------------------------------------------------------------------*/ +.formtastic .text textarea { + width:72%; +} + +.formtastic .text textarea[cols] { + width:auto; + max-width:72%; +} + + +/* HIDDEN OVERRIDES +--------------------------------------------------------------------------------------------------*/ +.formtastic .hidden { + display:none; +} + + +/* BOOLEAN LABELS +--------------------------------------------------------------------------------------------------*/ +.formtastic .boolean label { + padding-left:25%; + display:block; +} + + +/* CHOICE GROUPS +--------------------------------------------------------------------------------------------------*/ +.formtastic .choices-group { + margin-bottom:-0.5em; +} + +.formtastic .choice { + margin:0.1em 0 0.5em 0; +} + +.formtastic .choice label { + float:none; + width:100%; + line-height:100%; + padding-top:0; + margin-bottom:0.6em; +} + + +/* ADJUSTMENTS FOR INPUTS INSIDE LABELS (boolean input, radio input, check_boxes input) +--------------------------------------------------------------------------------------------------*/ +.formtastic .choice label input, +.formtastic .boolean label input { + margin:0 0.3em 0 0.1em; + line-height:100%; +} + + +/* FRAGMENTED INPUTS (DATE/TIME/DATETIME) +--------------------------------------------------------------------------------------------------*/ +.formtastic .fragments { + position:relative; +} + +.formtastic .fragments-group { + float:left; + width:74%; + margin:0; + padding:0 0 0 25%; +} + +.formtastic .fragment { + float:left; + width:auto; + margin:0 .3em 0 0; + padding:0; + border:0; +} + +.formtastic .fragment label { + display:none; +} + +.formtastic .fragment label input { + display:inline; + margin:0; + padding:0; +} diff --git a/css/styles.css b/css/styles.css index c1abd0ef..972902c0 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,3 +1,33 @@ .contacts_details_left {text-align:right;vertical-align:top;padding:2px;} .contacts_details_right {text-align:left;vertical-align:top;padding:2px;} + +#contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;} +#contacts_details_photo { margin:.5em 0em .5em 25%; } + #contacts_deletecard {position:absolute;top:15px;right:0;} +#contacts_details_list { list-style:none; } +#contacts_details_list li { overflow:hidden; } +#contacts_details_list li p.contacts_property_name { width:25%; float:left; } +#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; } +#contacts_addproperty, #contacts_addproperty_button { margin-left:25%; } + +.contacts_property_data ul, .contacts_property_data ol { list-style:none; } +.contacts_property_data li { overflow: hidden; } +.contacts_property_data li label { width:20%; float:left; } +.contacts_property_data li input { width:70%;overflow:hidden; } + +/* Form setup ----------------------------------------------------------------*/ +/* .forme {} */ +/* .forme ul, .forme ol { list-style:none; } */ +/* .forme .inputs, .forme .buttons { overflow: hidden; } */ + +/* Labels --------------------------------------------------------------------*/ +/* .forme .input .label { width:25%; float:left; display:block; } */ + +/* Inputs --------------------------------------------------------------------*/ +/* .forme .stringish input { width:72%; } */ +/* .forme .text textarea { width:72%; } */ + +/* Buttons -------------------------------------------------------------------*/ +/* .forme .buttons { padding-left:25%; } */ +/* .forme .button { float:left; padding-left:0.5em; } */ diff --git a/js/interface.js b/js/interface.js index 2f4a736f..da5c1f37 100644 --- a/js/interface.js +++ b/js/interface.js @@ -40,7 +40,8 @@ $(document).ready(function(){ var id = $('#rightcontent').data('id'); $.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){ if(jsondata.status == 'success'){ - $('#rightcontent').append(jsondata.data.page); + $('#contacts_details_list').append(jsondata.data.page); + $('#contacts_addproperty').hide(); } else{ alert(jsondata.data.message); @@ -68,9 +69,10 @@ $(document).ready(function(){ $('#contacts_addpropertyform input[type="submit"]').live('click',function(){ $.post('ajax/addproperty.php',$('#contacts_addpropertyform').serialize(),function(jsondata){ if(jsondata.status == 'success'){ - $('#contacts_details').append(jsondata.data.page); + $('#contacts_details_list').append(jsondata.data.page); $('#contacts_addpropertyform').remove(); $('#contacts_addcontactsparts').remove(); + $('#contacts_addproperty').show(); } else{ alert(jsondata.data.message); @@ -78,7 +80,7 @@ $(document).ready(function(){ }, 'json'); return false; }); - + $('#contacts_newcontact').click(function(){ $.getJSON('ajax/showaddcard.php',{},function(jsondata){ if(jsondata.status == 'success'){ @@ -107,12 +109,12 @@ $(document).ready(function(){ return false; }); - $('.contacts_details_property [data-use="edit"]').live('click',function(){ + $('.contacts_property [data-use="edit"]').live('click',function(){ var id = $('#rightcontent').data('id'); - var checksum = $(this).parent().parent().data('checksum'); + var checksum = $(this).parents('li').first().data('checksum'); $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_details_property[data-checksum="'+checksum+'"] .contacts_details_right').html(jsondata.data.page); + $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page); } else{ alert(jsondata.data.message); @@ -122,9 +124,9 @@ $(document).ready(function(){ }); $('#contacts_setpropertyform input[type="submit"]').live('click',function(){ - $.post('ajax/setproperty.php',$(this).parent('form').serialize(),function(jsondata){ + $.post('ajax/setproperty.php',$(this).parents('form').first().serialize(),function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_details_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page); + $('.contacts_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page); } else{ alert(jsondata.data.message); @@ -133,12 +135,12 @@ $(document).ready(function(){ return false; }); - $('.contacts_details_property [data-use="delete"]').live('click',function(){ + $('.contacts_property [data-use="delete"]').live('click',function(){ var id = $('#rightcontent').data('id'); - var checksum = $(this).parent().parent().data('checksum'); + var checksum = $(this).parents('li').first().data('checksum'); $.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum },function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_details_property[data-checksum="'+checksum+'"]').remove(); + $('.contacts_property[data-checksum="'+checksum+'"]').remove(); } else{ alert(jsondata.data.message); @@ -148,11 +150,11 @@ $(document).ready(function(){ }); - $('.contacts_details_property').live('mouseenter',function(){ + $('.contacts_property').live('mouseenter',function(){ $(this).find('span').show(); }); - - $('.contacts_details_property').live('mouseleave',function(){ + + $('.contacts_property').live('mouseleave',function(){ $(this).find('span').hide(); }); }); diff --git a/templates/index.php b/templates/index.php index 98ebc1b0..630dca41 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,6 +1,7 @@
diff --git a/templates/part.addcardform.php b/templates/part.addcardform.php index 9899f552..8e482cc4 100644 --- a/templates/part.addcardform.php +++ b/templates/part.addcardform.php @@ -1,51 +1,111 @@ -
+ - - +
+
    +
  1. + + +
  2. +
+
- -
- -
- -

-

-

-

-

-

-

-
- -
- - -
- -
- -
- -
- -
- +
+
    +
  1. + +
    +
  2. +
  3. + + +
  4. +
+
+
+
    +
  1. + + +
  2. +
  3. +
    + + + +
      +
    1. + + +
    2. +
    3. + + +
    4. +
    +
    +
  4. +
+
+
+ t('Address'); ?> +
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
  7. + + +
  8. +
  9. + + +
  10. +
  11. + + +
  12. +
  13. + + +
  14. +
  15. + + +
  16. +
+
+
+
    +
  1. + +
  2. +
+
diff --git a/templates/part.addpropertyform.php b/templates/part.addpropertyform.php index 7c366e03..b0e93b01 100644 --- a/templates/part.addpropertyform.php +++ b/templates/part.addpropertyform.php @@ -1,44 +1,72 @@ -
- - -
- +
  • + + +

    + +

    +

    + +


    + +
  • + - - - + diff --git a/templates/part.details.php b/templates/part.details.php index 438f84d4..afb2b468 100644 --- a/templates/part.details.php +++ b/templates/part.details.php @@ -1,16 +1,11 @@ - - - - - - - - - inc('part.property', array('property' => $_['details']['FN'][0])); ?> - +

    + + + + + +
      inc('part.property', array('property' => $_['details']['BDAY'][0])); ?> @@ -26,7 +21,7 @@ -
      - -
    +
    diff --git a/templates/part.property.php b/templates/part.property.php index ffc056e5..4bc3a4d8 100644 --- a/templates/part.property.php +++ b/templates/part.property.php @@ -1,72 +1,66 @@ - - - - - - - - - t('Birthday'); ?> - - l('date',new DateTime($_['property']['value'])); ?> +
  • + +

    t('Birthday'); ?>

    +

    + l('date',new DateTime($_['property']['value'])); ?> - +

    - t('Organization'); ?> - +

    t('Organization'); ?>

    +

    - +

    - t('Email'); ?> - +

    t('Email'); ?>

    +

    - +

    - t('Phone'); ?> - +

    t('Phone'); ?>

    +

    (t(ucwords(str_replace('cell','mobile',strtolower($_['property']['parameters']['TYPE'])))); ?>) - +

    - +

    t('Address'); ?>
    (t(ucwords($_['property']['parameters']['TYPE'])); ?>) - - +

    +

    - t('PO Box'); ?>
    +
    - t('Extended'); ?>
    +
    - t('Street'); ?>
    +
    - t('City'); ?>
    +
    - t('Region'); ?>
    +
    - t('Zipcode'); ?>
    +
    - t('Country'); ?> + - +

    - +
  • diff --git a/templates/part.setpropertyform.php b/templates/part.setpropertyform.php index 69c78979..afdba2bd 100644 --- a/templates/part.setpropertyform.php +++ b/templates/part.setpropertyform.php @@ -1,18 +1,49 @@ - - - - -
    -
    -
    -
    -
    -
    -
    - - - - - - -
    +
  • +
    + + + +

    +
      +
    1. + + +
    2. +
    3. + + +
    4. +
    5. + + +
    6. +
    7. + + +
    8. +
    9. + + +
    10. +
    11. + + +
    12. +
    13. + + +
    14. +
    + +

    +

    + +

    +

    + +

    +

    + + +
    +
  • diff --git a/templates/settings.php b/templates/settings.php index f5c37c5a..d9130625 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -1,7 +1,7 @@
    Contacts
    - CardDAV syncing address: + CardDAV syncing address: