]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: Misc. cleanup tweaks.
authorThomas Tanghus <thomas@tanghus.net>
Sat, 7 Apr 2012 14:03:11 +0000 (16:03 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sat, 7 Apr 2012 14:03:43 +0000 (16:03 +0200)
apps/contacts/ajax/saveproperty.php
apps/contacts/css/contacts.css
apps/contacts/js/contacts.js
apps/contacts/templates/part.contact.php
apps/contacts/templates/part.edit_address_dialog.php
apps/contacts/templates/settings.php
core/js/oc-vcategories.js

index 924d873652c753c61adfff199c7ebcbc7efc3924..4cef4d1e7a5b6010a3f7c1fb795193ecb398b5e7 100644 (file)
@@ -97,39 +97,39 @@ switch($element) {
                }
                break;
        case 'CATEGORIES':
-               /* multi autocomplete triggers an save with empty value */
+               /* multi autocomplete triggers an save with empty value
                if (!$value) {
                        $value = $vcard->getAsString('CATEGORIES');
                }
-               break;
+               break;*/
        case 'EMAIL':
                $value = strtolower($value);
                break;
 }
 
 if(!$value) {
-       bailOut(OC_Contacts_App::$l10n->t('Cannot save empty value.'));
-}
-
-/* setting value */
-switch($element) {
-       case 'BDAY':
-       case 'FN':
-       case 'N':
-       case 'ORG':
-       case 'NOTE':
-       case 'NICKNAME':
-       case 'CATEGORIES':
-               debug('Setting string:'.$name.' '.$value);
-               $vcard->setString($name, $value);
-               break;
-       case 'EMAIL':
-       case 'TEL':
-       case 'ADR': // should I delete the property if empty or throw an error?
-               debug('Setting element: (EMAIL/TEL/ADR)'.$element);
-               if(!$value) {
-                       unset($vcard->children[$line]); // Should never happen...
-               } else {
+       unset($vcard->children[$line]);
+       $checksum = '';
+} else {
+       /* setting value */
+       switch($element) {
+               case 'BDAY':
+               case 'FN':
+               case 'N':
+               case 'ORG':
+               case 'NOTE':
+               case 'NICKNAME':
+                       debug('Setting string:'.$name.' '.$value);
+                       $vcard->setString($name, $value);
+                       break;
+               case 'CATEGORIES':
+                       debug('Setting string:'.$name.' '.$value);
+                       $vcard->children[$line]->setValue($value);
+                       break;
+               case 'EMAIL':
+               case 'TEL':
+               case 'ADR': // should I delete the property if empty or throw an error?
+                       debug('Setting element: (EMAIL/TEL/ADR)'.$element);
                        $vcard->children[$line]->setValue($value);
                        $vcard->children[$line]->parameters = array();
                        if(!is_null($parameters)) {
@@ -142,12 +142,12 @@ switch($element) {
                                        }
                                }
                        }
-               }
-               break;
+                       break;
+       }
+       // Do checksum and be happy
+       $checksum = md5($vcard->children[$line]->serialize());
 }
-// Do checksum and be happy
-$checksum = md5($vcard->children[$line]->serialize());
-debug('New checksum: '.$checksum);
+//debug('New checksum: '.$checksum);
 
 if(!OC_Contacts_VCard::edit($id,$vcard)) {
        bailOut(OC_Contacts_App::$l10n->t('Error updating contact property.'));
index 4e7d8c285a3f29e2ee37e213a5506a4030b5db48..5d3ebf65fbe67be4b659f25b082a3a71bb0b7571 100644 (file)
 #contacts_propertymenu li a { padding: 3px; display: block }
 #contacts_propertymenu li:hover { background-color: #1d2d44; }
 #contacts_propertymenu li a:hover { color: #fff }
-#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;}
+#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; }
 #card { width: auto;/*max-width: 70em; border: thin solid lightgray; display: block;*/ }
 #firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; }
 #firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
 
 #card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 14em; float: left; }
 .categories { float: left; width: 16em; }
-#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #fefefe; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none  !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
-#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; }
-input[type="text"]:invalid,input[type="email"]:invalid,input[type="tel"]:invalid,input[type="date"]:invalid { color: #bbb !important; }
+#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select, textarea { background-color: #fefefe; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none  !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
+#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active, textarea:focus, textarea:hover { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; }
+input[type="text"]:invalid,input[type="email"]:invalid,input[type="tel"]:invalid,input[type="date"]:invalid, textarea:invalid { color: #bbb !important; }
+textarea { min-height: 4em; }
 dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
 .form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ }
 .form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; }
+#address.form dt { min-width: 5em; }
+#address.form dl { min-width: 10em; }
 
 .loading { background: url('../../../core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
 .ui-autocomplete-loading { background: url('../../../core/img/loading.gif') right center no-repeat; }
index cc4da5837e0483567aa5ac4ee64a324a42464728..3b264c0197efdb1163b71d0bee30191a3c9de9e7 100644 (file)
@@ -116,7 +116,7 @@ Contacts={
                },
                loadListHandlers:function() {
                        //$('.add,.delete').hide();
-                       $('.globe,.mail,.delete,.edit').tipsy();
+                       $('.globe,.mail,.delete,.edit,.tip').tipsy();
                        $('.addresscard,.propertylist li,.propertycontainer').hover(
                                function () {
                                        $(this).find('.globe,.mail,.delete,.edit').fadeIn(100);
@@ -171,10 +171,6 @@ Contacts={
 //                             Contacts.UI.Card.editAddress();
 //                             return false;
 //                     });
-                       $('#n').click(function(){
-                               Contacts.UI.Card.editName();
-                               //return false;
-                       });
                        $('#edit_name').click(function(){
                                Contacts.UI.Card.editName();
                                return false;
@@ -258,12 +254,12 @@ Contacts={
                                        });
                                }
                        },
-                       export:function() {
+                       do_export:function() {
                                document.location.href = OC.linkTo('contacts', 'export.php') + '?contactid=' + this.id;
                                //$.get(OC.linkTo('contacts', 'export.php'),{'contactid':this.id},function(jsondata){
                                //});
                        },
-                       import:function(){
+                       do_import:function(){
                                Contacts.UI.notImplemented();
                        },
                        add:function(n, fn, aid, isnew){ // add a new contact
@@ -293,11 +289,11 @@ Contacts={
                                                                if(isnew) {
                                                                        Contacts.UI.Card.addProperty('EMAIL');
                                                                        Contacts.UI.Card.addProperty('TEL');
-                                                                       Contacts.UI.Card.addProperty('BDAY');
                                                                        Contacts.UI.Card.addProperty('NICKNAME');
                                                                        Contacts.UI.Card.addProperty('ORG');
                                                                        Contacts.UI.Card.addProperty('CATEGORIES');
                                                                        $('#fn').focus();
+                                                                       $('#fn').select();
                                                                }
                                                        }
                                                        else{
@@ -315,7 +311,7 @@ Contacts={
                                        }
                                });
                        },
-                       delete:function() {
+                       do_delete:function() {
                                $('#contacts_deletecard').tipsy('hide');
                                OC.dialogs.confirm(t('contacts', 'Are you sure you want to delete this contact?'), t('contacts', 'Warning'), function(answer) {
                                        if(answer == true) {
@@ -1256,7 +1252,7 @@ Contacts={
                                          });
                                }
                        },
-                       import:function(){
+                       do_import:function(){
                                Contacts.UI.notImplemented();
                        },
                        submit:function(button, bookid){
@@ -1289,9 +1285,7 @@ Contacts={
                        }
                },
                Contacts:{
-                       /**
-                        * Reload the contacts list.
-                        */
+                       // Reload the contacts list.
                        update:function(){
                                console.log('Contacts.update, start');
                                $.getJSON('ajax/contacts.php',{},function(jsondata){
@@ -1306,9 +1300,7 @@ Contacts={
                                });
                                setTimeout(Contacts.UI.Contacts.lazyupdate, 500);
                        },
-                       /**
-                        * Add thumbnails to the contact list as they become visible in the viewport.
-                        */
+                       // Add thumbnails to the contact list as they become visible in the viewport.
                        lazyupdate:function(){
                                $('#contacts li').live('inview', function(){
                                        if (!$(this).find('a').attr('style')) {
@@ -1328,9 +1320,6 @@ $(document).ready(function(){
        OCCategories.changed = Contacts.UI.Card.categoriesChanged;
        OCCategories.app = 'contacts';
 
-       /**
-        * Show the Addressbook chooser
-        */
        $('#chooseaddressbook').click(function(){
                Contacts.UI.Addressbooks.overview();
                return false;
@@ -1363,7 +1352,7 @@ $(document).ready(function(){
        });
 
        $('#contacts_deletecard').live('click',function(){
-               Contacts.UI.Card.delete();
+               Contacts.UI.Card.do_delete();
        });
 
        $('#contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
index 961ce693e65d3b0ef48edaf5113f7a1f1142ac0d..03d2fad8530284a9e1f32d6d9ba0508bbe192ce3 100644 (file)
@@ -17,7 +17,7 @@ $id = isset($_['id']) ? $_['id'] : '';
                <li><a data-type="CATEGORIES"><?php echo $l->t('Categories'); ?></a></li>
        </ul>
        </div>
-       <img  onclick="Contacts.UI.Card.export();" class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" />
+       <img  onclick="Contacts.UI.Card.do_export();" class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" />
        <img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
        </div>
 
@@ -37,7 +37,7 @@ $id = isset($_['id']) ? $_['id'] : '';
                <iframe name="file_upload_target" id='file_upload_target' src=""></iframe>
        </fieldset>
        </form>
-       </div>
+       </div> <!-- contact_photo -->
 
        <div id="contact_identity" class="contactsection">
        <form method="post">
@@ -62,7 +62,7 @@ $id = isset($_['id']) ? $_['id'] : '';
        </dl>
        </fieldset>
        </form>
-       </div>
+       </div> <!-- contact_identity -->
 
        <!-- div class="delimiter"></div -->
        <div id="contact_communication" class="contactsection">
@@ -73,7 +73,7 @@ $id = isset($_['id']) ? $_['id'] : '';
                <!-- legend><?php echo $l->t('Email'); ?></legend -->
                        <ul id="emaillist" class="propertylist">
                        <li class="template" style="white-space: nowrap; display: none;" data-element="EMAIL">
-                               <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
+                               <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
                                <input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="action mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
                                <a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
                        </ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
@@ -85,7 +85,7 @@ $id = isset($_['id']) ? $_['id'] : '';
                <!-- legend><?php echo $l->t('Phone'); ?></legend -->
                        <ul id="phonelist" class="propertylist">
                                <li class="template" style="white-space: nowrap; display: none;" data-element="TEL">
-                               <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" /> 
+                               <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" /> 
                                <input type="text" required="required" class="nonempty contacts_property" style="width:10em; border: 0px;" name="value" value="" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
                                <select multiple="multiple" name="parameters[TYPE][]">
                                        <?php echo html_select_options($_['phone_types'], array()) ?>
@@ -106,15 +106,14 @@ $id = isset($_['id']) ? $_['id'] : '';
                        </dt><dd><ul class="addresslist"></ul></dd></dl>
 
                </fieldset>
-               </div>
+               </div> <!-- addressdisplay -->
                </div> <!-- Addresses -->
        </form>
-       </div>
+       </div> <!-- contact_communication -->
        <div id="contact_note" class="contactsection">
        <form class="float" method="post">
        <fieldset id="note" class="formfloat propertycontainer contactpart" data-element="NOTE">
-       <!-- legend><?php echo $l->t('Note'); ?> --><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><!-- /legend -->
-       <textarea class="contacts_property note" name="value" cols="40" rows="10" placeholder="<?php echo $l->t('Notes'); ?>"></textarea>
+       <textarea class="contacts_property note" name="value" cols="40" rows="10" required="required" placeholder="<?php echo $l->t('Add notes here.'); ?>"></textarea>
        </fieldset>
        </form>
        </div> <!-- contact_note -->
@@ -131,7 +130,7 @@ $(document).ready(function(){
                                Contacts.UI.Card.loadContact(jsondata.data);
                        }
                        else{
-                               Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+                               OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
                        }
                });
        }
index 0ecdc4e1915dfeecef84f387f9d7d3702a4585d4..507a3acaa0c89b17bc336771316ac1d423838881 100644 (file)
@@ -22,44 +22,44 @@ foreach(isset($adr['parameters']['TYPE'])?array($adr['parameters']['TYPE']):arra
                                <label class="label" for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_pobox" name="value[ADR][0]" value="<?php echo isset($adr['value'][0])?$adr['value'][0]:''; ?>">
+                               <input type="text" id="adr_pobox" name="value[ADR][0]" placeholder="<?php echo $l->t('PO Box'); ?>" value="<?php echo isset($adr['value'][0])?$adr['value'][0]:''; ?>">
                        </dd>
                        <dd>
                        <dt>
                                <label class="label" for="adr_extended"><?php echo $l->t('Extended'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_extended" name="value[ADR][1]" value="<?php echo isset($adr['value'][1])?$adr['value'][1]:''; ?>">
+                               <input type="text" id="adr_extended" name="value[ADR][1]" placeholder="<?php echo $l->t('Extended'); ?>" value="<?php echo isset($adr['value'][1])?$adr['value'][1]:''; ?>">
                        </dd>
                        <dt>
                                <label class="label" for="adr_street"><?php echo $l->t('Street'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_street" name="value[ADR][2]" value="<?php echo isset($adr['value'][2])?$adr['value'][2]:''; ?>">
+                               <input type="text" id="adr_street" name="value[ADR][2]" placeholder="<?php echo $l->t('Street'); ?>" value="<?php echo isset($adr['value'][2])?$adr['value'][2]:''; ?>">
                        </dd>
                        <dt>
                                <label class="label" for="adr_city"><?php echo $l->t('City'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_city" name="value[ADR][3]" value="<?php echo isset($adr['value'][3])?$adr['value'][3]:''; ?>">
+                               <input type="text" id="adr_city" name="value[ADR][3]" placeholder="<?php echo $l->t('City'); ?>" value="<?php echo isset($adr['value'][3])?$adr['value'][3]:''; ?>">
                        </dd>
                        <dt>
                                <label class="label" for="adr_region"><?php echo $l->t('Region'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_region" name="value[ADR][4]" value="<?php echo isset($adr['value'][4])?$adr['value'][4]:''; ?>">
+                               <input type="text" id="adr_region" name="value[ADR][4]" placeholder="<?php echo $l->t('Region'); ?>" value="<?php echo isset($adr['value'][4])?$adr['value'][4]:''; ?>">
                        </dd>
                        <dt>
                                <label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_zipcode" name="value[ADR][5]" value="<?php echo isset($adr['value'][5])?$adr['value'][5]:''; ?>">
+                               <input type="text" id="adr_zipcode" name="value[ADR][5]" placeholder="<?php echo $l->t('Zipcode'); ?>" value="<?php echo isset($adr['value'][5])?$adr['value'][5]:''; ?>">
                        </dd>
                        <dt>
                                <label class="label" for="adr_country"><?php echo $l->t('Country'); ?></label>
                        </dt>
                        <dd>
-                               <input type="text" id="adr_country" name="value[ADR][6]" value="<?php echo isset($adr['value'][6])?$adr['value'][6]:''; ?>">
+                               <input type="text" id="adr_country" name="value[ADR][6]" placeholder="<?php echo $l->t('Country'); ?>" value="<?php echo isset($adr['value'][6])?$adr['value'][6]:''; ?>">
                        </dd>
                </dl>
        </fieldset>
index d77c4d380278bfad2d021c982e30424a172b4475..5627a15c50a7894fe6669c58e2a32f4724e71e0c 100644 (file)
@@ -8,6 +8,6 @@
                <dt><?php echo $l->t('iOS/OS X'); ?></dt>
                <dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/principals/<?php echo OC_User::getUser(); ?></code>/</dd>
                </dl>
+               Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
        </fieldset>
-       Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
 </form>
index a6dcccf88e074586501acbd027f7db86c6ca97cf..931ea37edbe449a78c76154df0dd98c15537aaf6 100644 (file)
@@ -19,7 +19,7 @@ OCCategories={
                                                height: 350, minHeight:200, width: 250, minWidth: 200,
                                                buttons: {
                                                        'Delete':function() {
-                                                               OCCategories.delete();
+                                                               OCCategories.do_delete();
                                                        },
                                                        'Rescan':function() {
                                                                OCCategories.rescan();
@@ -53,7 +53,7 @@ OCCategories={
                        }
                });
        },
-       delete:function(){
+       do_delete:function(){
                var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
                categories += '&app=' + OCCategories.app;
                console.log('OCCategories.delete: ' + categories);