]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added some fixes for what to show when address books are (de)selected, all contacts...
authorThomas Tanghus <thomas@tanghus.net>
Tue, 14 Feb 2012 12:57:11 +0000 (13:57 +0100)
committerThomas Tanghus <thomas@tanghus.net>
Tue, 14 Feb 2012 12:57:11 +0000 (13:57 +0100)
apps/contacts/ajax/loadintro.php
apps/contacts/css/contacts.css
apps/contacts/js/contacts.js

index d3249c19107e70dbf2ce34ba1f682c744799b181..8e5673655a17541e9d1f513ba6439ef610eb98bc 100644 (file)
 require_once('../../../lib/base.php');
 function bailOut($msg) {
        OC_JSON::error(array('data' => array('message' => $msg)));
-       OC_Log::write('contacts','ajax/newcontact.php: '.$msg, OC_Log::DEBUG);
+       OC_Log::write('contacts','ajax/loadintro.php: '.$msg, OC_Log::DEBUG);
        exit();
 }
 function debug($msg) {
-       OC_Log::write('contacts','ajax/newcontact.php: '.$msg, OC_Log::DEBUG);
+       OC_Log::write('contacts','ajax/loadintro.php: '.$msg, OC_Log::DEBUG);
 }
 // foreach ($_POST as $key=>$element) {
 //     debug('_POST: '.$key.'=>'.$element);
index 86322a2cc2a31e944e3e1f77c80464d0381e6363..460859fae1755d64585d4d64b343ac91e3043135 100644 (file)
@@ -77,7 +77,8 @@ dl.form
 .delete { background:url('../../../core/img/actions/delete.svg') no-repeat center; }
 .edit { background:url('../../../core/img/actions/rename.svg') no-repeat center; }
 .mail { background:url('../../../core/img/actions/mail.svg') no-repeat center; }
-.globe { background:url('../img/globe.svg') no-repeat center; }
+/*.globe { background:url('../img/globe.svg') no-repeat center; }*/
+.globe { background:url('../../../core/img/actions/public.svg') no-repeat center; }
 
 #messagebox_msg { font-weight: bold; font-size: 1.2em; }
 
index 6effbdd3ee4972dc18dda227ecfdaf5586a59081..9e3faec192ae4477d54c1de84e1e2e5b2e843ca0 100644 (file)
@@ -251,6 +251,44 @@ Contacts={
                        honpre:'',
                        honsuf:'',
                        data:undefined,
+                       update:function() {
+                               // Make sure proper DOM is loaded.
+                               console.log('Card.update(), #n: ' + $('#n').length);
+                               console.log('Card.update(), #contacts: ' + $('#contacts li').length);
+                               if($('#n').length == 0 && $('#contacts li').length > 0) {
+                                       $.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
+                                               if(jsondata.status == 'success'){
+                                                       $('#rightcontent').html(jsondata.data.page);
+                                                       Contacts.UI.loadHandlers();
+                                                       if($('#contacts li').length > 0) {
+                                                               var firstid = $('#contacts li:first-child').data('id');
+                                                               console.log('trying to load: ' + firstid);
+                                                               $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':firstid},function(jsondata){
+                                                                       if(jsondata.status == 'success'){
+                                                                               Contacts.UI.Card.loadContact(jsondata.data);
+                                                                       } else{
+                                                                               Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+                                                                       }
+                                                               });
+                                                       }
+                                               } else{
+                                                       Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+                                               }
+                                       });
+                               }
+                               if($('#contacts li').length == 0) {
+                                       // load intro page
+                                       $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
+                                               if(jsondata.status == 'success'){
+                                                       id = '';
+                                                       $('#rightcontent').data('id','');
+                                                       $('#rightcontent').html(jsondata.data.page);
+                                               } else {
+                                                       Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+                                               }
+                                       });
+                               }
+                       },
                        export:function() {
                                document.location.href = OC.linkTo('contacts', 'export.php') + '?contactid=' + this.id;
                                //$.get(OC.linkTo('contacts', 'export.php'),{'contactid':this.id},function(jsondata){
@@ -311,6 +349,8 @@ Contacts={
                                                this.data = undefined;
                                                // Load first in list.
                                                if($('#contacts li').length > 0) {
+                                                       Contacts.UI.Card.update();
+                                                       /*
                                                        var firstid = $('#contacts li:first-child').data('id');
                                                        console.log('trying to load: ' + firstid);
                                                        $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':firstid},function(jsondata){
@@ -320,7 +360,7 @@ Contacts={
                                                                else{
                                                                        Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
                                                                }
-                                                       });
+                                                       });*/
                                                } else {
                                                        // load intro page
                                                        $.getJSON('ajax/loadintro.php',{},function(jsondata){
@@ -447,6 +487,7 @@ Contacts={
                                $('#reverse_comma').text(this.famname + ', ' + this.givname);*/
                                $('#contact_identity').find('*[data-element="N"]').data('checksum', this.data.N[0]['checksum']);
                                $('#contact_identity').find('*[data-element="FN"]').data('checksum', this.data.FN[0]['checksum']);
+                               $('#contact_identity').show();
                        },
                        editNew:function(){ // add a new contact
                                //Contacts.UI.notImplemented();
@@ -1079,9 +1120,11 @@ Contacts={
                         * Reload the contacts list.
                         */
                        update:function(){
+                               console.log('Contacts.update, start');
                                $.getJSON('ajax/contacts.php',{},function(jsondata){
                                        if(jsondata.status == 'success'){
                                                $('#contacts').html(jsondata.data.page);
+                                               Contacts.UI.Card.update();
                                        }
                                        else{
                                                Contacts.UI.messageBox(t('contacts', 'Error'),jsondata.data.message);