diff --git a/apps/contacts/ajax/categories/add.php b/apps/contacts/ajax/categories/add.php deleted file mode 100644 index 9b6c262978..0000000000 --- a/apps/contacts/ajax/categories/add.php +++ /dev/null @@ -1,39 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -require_once('../../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -OC_JSON::checkAppEnabled('contacts'); - -function bailOut($msg) { - OC_JSON::error(array('data' => array('message' => $msg))); - OC_Log::write('contacts','ajax/categories/add.php: '.$msg, OC_Log::DEBUG); - exit(); -} -function debug($msg) { - OC_Log::write('contacts','ajax/categories/add.php: '.$msg, OC_Log::DEBUG); -} - -$category = isset($_GET['category'])?strip_tags($_GET['category']):null; - -if(is_null($category)) { - bailOut(OC_Contacts_App::$l10n->t('No category to add?')); -} - -debug(print_r($category, true)); - -$categories = new OC_VCategories('contacts'); -if($categories->hasCategory($category)) { - bailOut(OC_Contacts_App::$l10n->t('This category already exists: '.$category)); -} else { - $categories->add($category, true); -} - -OC_JSON::success(array('data' => array('categories'=>$categories->categories()))); - -?> diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 0769791ea3..95a7ac2019 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -63,11 +63,11 @@ if(!$checksum) { if(is_array($value)){ $value = array_map('strip_tags', $value); ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form! - if($name == 'CATEGORIES') { - $value = OC_Contacts_VCard::escapeDelimiters($value, ','); - } else { + //if($name == 'CATEGORIES') { + // $value = OC_Contacts_VCard::escapeDelimiters($value, ','); + //} else { $value = OC_Contacts_VCard::escapeDelimiters($value, ';'); - } + //} } else { $value = trim(strip_tags($value)); } diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index a6f7d9316f..7c36a511d6 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -188,10 +188,3 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; } .typelist { float: left; max-width: 10em; } /* for multiselect */ .addresslist { clear: both; } -#categoryform .scrollarea { position: absolute; left: 10px; top: 10px; right: 10px; bottom: 50px; overflow: auto; border:1px solid #ddd; background: #f8f8f8; } -#categoryform .bottombuttons { position: absolute; bottom: 10px;} -#categoryform .bottombuttons * { float: left;} -/*#categorylist { border:1px solid #ddd;}*/ -#categorylist li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; } -#categorylist li:hover, li:active { background:#eee; } -#category_addinput { width: 10em; } diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 48b2b8b4f0..04f6c65a14 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -45,13 +45,14 @@ $freeSpace=max($freeSpace,0); $maxUploadFilesize = min($maxUploadFilesize ,$freeSpace); OC_Util::addScript('','jquery.multiselect'); +OC_Util::addScript('','oc-vcategories'); OC_Util::addScript('contacts','contacts'); OC_Util::addScript('contacts','jquery.combobox'); OC_Util::addScript('contacts','jquery.inview'); OC_Util::addScript('contacts','jquery.Jcrop'); OC_Util::addScript('contacts','jquery.multi-autocomplete'); OC_Util::addStyle('','jquery.multiselect'); -//OC_Util::addStyle('contacts','styles'); +OC_Util::addStyle('','oc-vcategories'); OC_Util::addStyle('contacts','jquery.combobox'); OC_Util::addStyle('contacts','jquery.Jcrop'); OC_Util::addStyle('contacts','contacts'); diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index ccedf1d303..1d19eb47f6 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -10,105 +10,6 @@ String.prototype.strip_tags = function(){ return stripped; }; -Categories={ - edit:function(){ - console.log('Categories.edit'); - $('body').append('
'); - $('#category_dialog').load(OC.filePath('contacts', 'ajax', 'categories/edit.php'), function(response, status, xhr){ - try { - var response = jQuery.parseJSON(response); - console.log('status: ' + status + ', response: ' + response + ', response.status:' + response.status); - if(response.status == 'error'){ - OC.dialogs.alert(response.data.message, 'Error'); - } else { - OC.dialogs.alert(response, 'Error'); - } - } catch(e) { - $('#edit_categories_dialog').dialog({ - modal: true, - height: 350, minHeight:200, width: 250, minWidth: 200, - buttons: { - 'Delete':function() { - Categories.delete(); - }, - 'Rescan':function() { - Categories.rescan(); - } - }, - close : function(event, ui) { - //alert('close'); - $(this).dialog('destroy').remove(); - $('#category_dialog').remove(); - }, - open : function(event, ui) { - $('#category_addinput').live('input',function(){ - if($(this).val().length > 0) { - $('#category_addbutton').removeAttr('disabled'); - } - }); - $('#categoryform').submit(function() { - Categories.add($('#category_addinput').val()); - $('#category_addinput').val(''); - $('#category_addbutton').attr('disabled', 'disabled'); - return false; - }); - $('#category_addbutton').live('click',function(e){ - e.preventDefault(); - if($('#category_addinput').val().length > 0) { - Categories.add($('#category_addinput').val()); - $('#category_addinput').val(''); - } - }); - } - }); - } - }); - }, - delete:function(){ - var categories = $('#categorylist').find('input[type="checkbox"]').serialize(); - console.log('Categories.delete: ' + categories); - $.post(OC.filePath('contacts', 'ajax', 'categories/delete.php'),categories,function(jsondata){ - if(jsondata.status == 'success'){ - Categories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, 'Error'); - } - }); - }, - add:function(category){ - console.log('Categories.add ' + category); - $.getJSON(OC.filePath('contacts', 'ajax', 'categories/add.php'),{'category':category},function(jsondata){ - if(jsondata.status == 'success'){ - Categories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, 'Error'); - } - }); - return false; - }, - rescan:function(){ - console.log('Categories.rescan'); - $.getJSON(OC.filePath('contacts', 'ajax', 'categories/rescan.php'),{},function(jsondata){ - if(jsondata.status == 'success'){ - Categories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, 'Error'); - } - }); - }, - _update:function(categories){ - var categorylist = $('#categorylist'); - categorylist.find('li').remove(); - for(var category in categories) { - var item = '
  • ' + categories[category] + '
  • '; - $(item).appendTo(categorylist); - } - if(Categories.changed != undefined) { - Categories.changed(categories); - } - } -} - Contacts={ UI:{ notImplemented:function() { @@ -146,7 +47,6 @@ Contacts={ console.log('uri: ' + uri); var newWindow = window.open(uri,'_blank'); newWindow.focus(); - //Contacts.UI.notImplemented(); }, mailTo:function(obj) { var adr = Contacts.UI.propertyContainerFor($(obj)).find('input[type="email"]').val().trim(); @@ -252,12 +152,12 @@ Contacts={ $('#bday').datepicker({ dateFormat : 'dd-mm-yy' }); - $('#categories_value').find('select').multiselect({ + /*$('#categories_value').find('select').multiselect({ noneSelectedText: t('contacts', 'Select categories'), header: false, selectedList: 6, classes: 'categories' - }); + });*/ // Style phone types $('#phonelist').find('select.contacts_property').multiselect({ noneSelectedText: t('contacts', 'Select type'), @@ -299,7 +199,7 @@ Contacts={ click: function() { $(this).dialog('close'); } } ] ); - //$('#categories').multiple_autocomplete({source: categories}); + $('#categories').multiple_autocomplete({source: categories}); Contacts.UI.loadListHandlers(); }, Card:{ @@ -440,7 +340,7 @@ Contacts={ $('#rightcontent').data('id',this.id); console.log('loaded: ' + this.data.FN[0]['value']); this.populateNameFields(); - this.loadCategories(); + //this.loadCategories(); this.loadPhoto(); this.loadMails(); this.loadPhones(); @@ -458,7 +358,7 @@ Contacts={ } }, loadSingleProperties:function() { - var props = ['BDAY', 'NICKNAME', 'ORG']; //, 'CATEGORIES']; + var props = ['BDAY', 'NICKNAME', 'ORG', 'CATEGORIES']; // Clear all elements $('#ident .propertycontainer').each(function(){ if(props.indexOf($(this).data('element')) > -1) { @@ -494,12 +394,12 @@ Contacts={ $('#contact_identity').find('#org_label').show(); $('#contact_identity').find('#org_value').show(); break; - /*case 'CATEGORIES': + case 'CATEGORIES': $('#contact_identity').find('#categories').val(value); $('#contact_identity').find('#categories_value').data('checksum', checksum); $('#contact_identity').find('#categories_label').show(); $('#contact_identity').find('#categories_value').show(); - break;*/ + break; } } else { $('#contacts_propertymenu a[data-type="'+props[prop]+'"]').parent().show(); @@ -825,7 +725,7 @@ Contacts={ }*/ }); } else { - alert(jsondata.data.message); + OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); } }); } @@ -1295,7 +1195,8 @@ Contacts={ $(document).ready(function(){ Contacts.UI.loadHandlers(); - Categories.changed = Contacts.UI.Card.categoriesChanged; + OCCategories.changed = Contacts.UI.Card.categoriesChanged; + OCCategories.app = 'contacts'; /** * Show the Addressbook chooser diff --git a/apps/contacts/js/jquery.multi-autocomplete.js b/apps/contacts/js/jquery.multi-autocomplete.js index 4be8d901c9..7cc9df1930 100644 --- a/apps/contacts/js/jquery.multi-autocomplete.js +++ b/apps/contacts/js/jquery.multi-autocomplete.js @@ -13,6 +13,9 @@ } //console.log('_create: ' + this.options['id']); var self = this; + this.element.bind('blur', function( event ) { + self.element.trigger('change'); // Changes wasn't saved when only using the dropdown. + }); this.element.bind( "keydown", function( event ) { if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { @@ -42,6 +45,27 @@ return false; } }); + this.button = $( "" ) + .attr( "tabIndex", -1 ) + .attr( "title", "Show All Items" ) + .insertAfter( this.element ) + .addClass('svg') + .addClass('action') + .addClass('combo-button') + .click(function() { + // close if already visible + if ( self.element.autocomplete( "widget" ).is( ":visible" ) ) { + self.element.autocomplete( "close" ); + return; + } + + // work around a bug (likely same cause as #5265) + $( this ).blur(); + + // pass empty string as value to search for, displaying all results + self.element.autocomplete( "search", "" ); + self.element.focus(); + }); }, }); })( jQuery ); diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index a7e1817d7c..3736f18c64 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -442,9 +442,9 @@ class OC_Contacts_VCard{ //$value = htmlspecialchars($value); if($property->name == 'ADR' || $property->name == 'N'){ $value = self::unescapeDelimiters($value); - } elseif($property->name == 'CATEGORIES') { + }/* elseif($property->name == 'CATEGORIES') { $value = self::unescapeDelimiters($value, ','); - } + }*/ $temp = array( 'name' => $property->name, 'value' => $value, diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index efd797e25c..af159ce9c6 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,6 +1,6 @@
    diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php index 67838238e2..87ee40e99f 100644 --- a/apps/contacts/templates/part.contact.php +++ b/apps/contacts/templates/part.contact.php @@ -55,15 +55,15 @@ $id = isset($_['id']) ? $_['id'] : ''; -
    + + + + +