mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-30 19:52:17 +01:00
Scrutinizer fixes
This commit is contained in:
parent
6a5253eae5
commit
8cbfec3b0a
@ -9,5 +9,6 @@
|
|||||||
"jquery": true,
|
"jquery": true,
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"devel": true,
|
"devel": true,
|
||||||
"globals": { "OC": false }
|
"globals": { "OC": false },
|
||||||
|
"maxerr": 100
|
||||||
}
|
}
|
@ -267,7 +267,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
|
|
||||||
Contact.prototype.addProperty = function($option, name) {
|
Contact.prototype.addProperty = function($option, name) {
|
||||||
console.log('Contact.addProperty', name)
|
console.log('Contact.addProperty', name)
|
||||||
var $elem;
|
var $elem, $list;
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case 'NICKNAME':
|
case 'NICKNAME':
|
||||||
case 'TITLE':
|
case 'TITLE':
|
||||||
@ -276,7 +276,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
case 'NOTE':
|
case 'NOTE':
|
||||||
$elem = this.$fullelem.find('[data-element="' + name.toLowerCase() + '"]');
|
$elem = this.$fullelem.find('[data-element="' + name.toLowerCase() + '"]');
|
||||||
$elem.addClass('new').show();
|
$elem.addClass('new').show();
|
||||||
var $list = this.$fullelem.find('ul.' + name.toLowerCase());
|
$list = this.$fullelem.find('ul.' + name.toLowerCase());
|
||||||
$list.show();
|
$list.show();
|
||||||
$elem.find('input:not(:checkbox),textarea').first().focus();
|
$elem.find('input:not(:checkbox),textarea').first().focus();
|
||||||
$option.prop('disabled', true);
|
$option.prop('disabled', true);
|
||||||
@ -284,16 +284,16 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
case 'TEL':
|
case 'TEL':
|
||||||
case 'URL':
|
case 'URL':
|
||||||
case 'EMAIL':
|
case 'EMAIL':
|
||||||
var $elem = this.renderStandardProperty(name.toLowerCase());
|
$elem = this.renderStandardProperty(name.toLowerCase());
|
||||||
var $list = this.$fullelem.find('ul.' + name.toLowerCase());
|
$list = this.$fullelem.find('ul.' + name.toLowerCase());
|
||||||
$list.show();
|
$list.show();
|
||||||
$list.append($elem);
|
$list.append($elem);
|
||||||
$elem.find('input.value').addClass('new');
|
$elem.find('input.value').addClass('new');
|
||||||
$elem.find('input:not(:checkbox)').first().focus();
|
$elem.find('input:not(:checkbox)').first().focus();
|
||||||
break;
|
break;
|
||||||
case 'ADR':
|
case 'ADR':
|
||||||
var $elem = this.renderAddressProperty();
|
$elem = this.renderAddressProperty();
|
||||||
var $list = this.$fullelem.find('ul.' + name.toLowerCase());
|
$list = this.$fullelem.find('ul.' + name.toLowerCase());
|
||||||
$list.show();
|
$list.show();
|
||||||
$list.append($elem);
|
$list.append($elem);
|
||||||
$elem.find('.display').trigger('click');
|
$elem.find('.display').trigger('click');
|
||||||
@ -301,8 +301,8 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
$elem.find('input:not(:checkbox)').first().focus();
|
$elem.find('input:not(:checkbox)').first().focus();
|
||||||
break;
|
break;
|
||||||
case 'IMPP':
|
case 'IMPP':
|
||||||
var $elem = this.renderIMProperty();
|
$elem = this.renderIMProperty();
|
||||||
var $list = this.$fullelem.find('ul.' + name.toLowerCase());
|
$list = this.$fullelem.find('ul.' + name.toLowerCase());
|
||||||
$list.show();
|
$list.show();
|
||||||
$list.append($elem);
|
$list.append($elem);
|
||||||
$elem.find('input.value').addClass('new');
|
$elem.find('input.value').addClass('new');
|
||||||
@ -336,10 +336,9 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
var element = this.propertyTypeFor(obj);
|
var element = this.propertyTypeFor(obj);
|
||||||
var $container = this.propertyContainerFor(obj);
|
var $container = this.propertyContainerFor(obj);
|
||||||
console.log('Contact.deleteProperty, element', element, $container);
|
console.log('Contact.deleteProperty, element', element, $container);
|
||||||
var params = {
|
params.name = element;
|
||||||
name: element,
|
params.value = null;
|
||||||
value: null
|
|
||||||
};
|
|
||||||
if(this.multi_properties.indexOf(element) !== -1) {
|
if(this.multi_properties.indexOf(element) !== -1) {
|
||||||
params['checksum'] = this.checksumFor(obj);
|
params['checksum'] = this.checksumFor(obj);
|
||||||
if(params['checksum'] === 'new' && $.trim(this.valueFor(obj)) === '') {
|
if(params['checksum'] === 'new' && $.trim(this.valueFor(obj)) === '') {
|
||||||
@ -436,8 +435,8 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
*/
|
*/
|
||||||
Contact.prototype.saveAll = function(cb) {
|
Contact.prototype.saveAll = function(cb) {
|
||||||
console.log('Contact.saveAll');
|
console.log('Contact.saveAll');
|
||||||
|
var self = this;
|
||||||
if(!this.id) {
|
if(!this.id) {
|
||||||
var self = this;
|
|
||||||
this.add({isnew:true}, function(response) {
|
this.add({isnew:true}, function(response) {
|
||||||
if(response.error) {
|
if(response.error) {
|
||||||
console.warn('No response object');
|
console.warn('No response object');
|
||||||
@ -447,7 +446,6 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var self = this;
|
|
||||||
this.setAsSaving(this.$fullelem, true);
|
this.setAsSaving(this.$fullelem, true);
|
||||||
var data = JSON.stringify(this.data);
|
var data = JSON.stringify(this.data);
|
||||||
//console.log('stringified', data);
|
//console.log('stringified', data);
|
||||||
@ -483,8 +481,9 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
*/
|
*/
|
||||||
Contact.prototype.saveProperty = function(params) {
|
Contact.prototype.saveProperty = function(params) {
|
||||||
console.log('Contact.saveProperty', params);
|
console.log('Contact.saveProperty', params);
|
||||||
|
var self = this;
|
||||||
|
|
||||||
if(!this.id) {
|
if(!this.id) {
|
||||||
var self = this;
|
|
||||||
this.add({isnew:true}, function(response) {
|
this.add({isnew:true}, function(response) {
|
||||||
if(!response || response.status === 'error') {
|
if(!response || response.status === 'error') {
|
||||||
console.warn('No response object');
|
console.warn('No response object');
|
||||||
@ -515,7 +514,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log('args', args);
|
console.log('args', args);
|
||||||
var self = this;
|
|
||||||
this.setAsSaving(obj, true);
|
this.setAsSaving(obj, true);
|
||||||
$.when(this.storage.patchContact(this.metadata.backend, this.metadata.parent, this.id, args))
|
$.when(this.storage.patchContact(this.metadata.backend, this.metadata.parent, this.id, args))
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
|
@ -666,6 +666,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
var acceptdrop = '.dragContact';
|
var acceptdrop = '.dragContact';
|
||||||
var $groupList = this.$groupList;
|
var $groupList = this.$groupList;
|
||||||
var tmpl = this.$groupListItemTemplate;
|
var tmpl = this.$groupListItemTemplate;
|
||||||
|
var $elem;
|
||||||
|
|
||||||
if(!this.findById('all').length) {
|
if(!this.findById('all').length) {
|
||||||
tmpl.octemplate({id: 'all', type: 'all', num: '', name: t('contacts', 'All')}).appendTo($groupList);
|
tmpl.octemplate({id: 'all', type: 'all', num: '', name: t('contacts', 'All')}).appendTo($groupList);
|
||||||
@ -678,7 +679,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
// Favorites
|
// Favorites
|
||||||
// Map to strings to easier lookup in contacts list.
|
// Map to strings to easier lookup in contacts list.
|
||||||
var contacts = $.map(response.data.favorites, function(c) {return String(c);});
|
var contacts = $.map(response.data.favorites, function(c) {return String(c);});
|
||||||
var $elem = self.findById('fav');
|
$elem = self.findById('fav');
|
||||||
$elem = $elem.length ? $elem : tmpl.octemplate({
|
$elem = $elem.length ? $elem : tmpl.octemplate({
|
||||||
id: 'fav',
|
id: 'fav',
|
||||||
type: 'fav',
|
type: 'fav',
|
||||||
@ -706,7 +707,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
// Normal groups
|
// Normal groups
|
||||||
$.each(response.data.categories, function(c, category) {
|
$.each(response.data.categories, function(c, category) {
|
||||||
var contacts = $.map(category.contacts, function(c) {return String(c);});
|
var contacts = $.map(category.contacts, function(c) {return String(c);});
|
||||||
var $elem = self.findById(category.id);
|
$elem = self.findById(category.id);
|
||||||
if($elem.length) {
|
if($elem.length) {
|
||||||
$elem.find('.numcontacts').text(contacts.length > 0 && contacts.length || '');
|
$elem.find('.numcontacts').text(contacts.length > 0 && contacts.length || '');
|
||||||
} else {
|
} else {
|
||||||
@ -748,7 +749,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
$.each(response.data.shared, function(c, shared) {
|
$.each(response.data.shared, function(c, shared) {
|
||||||
var sharedindicator = '<img class="shared svg" src="' + OC.imagePath('core', 'actions/shared') + '"'
|
var sharedindicator = '<img class="shared svg" src="' + OC.imagePath('core', 'actions/shared') + '"'
|
||||||
+ 'title="' + t('contacts', 'Shared by {owner}', {owner:shared.owner}) + '" />';
|
+ 'title="' + t('contacts', 'Shared by {owner}', {owner:shared.owner}) + '" />';
|
||||||
var $elem = self.findById(shared.id);
|
$elem = self.findById(shared.id);
|
||||||
$elem = $elem.length ? $elem : (tmpl).octemplate({
|
$elem = $elem.length ? $elem : (tmpl).octemplate({
|
||||||
id: shared.id,
|
id: shared.id,
|
||||||
type: 'shared',
|
type: 'shared',
|
||||||
@ -781,7 +782,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var $elem = self.findById(self.lastgroup);
|
$elem = self.findById(self.lastgroup);
|
||||||
$elem.addClass('active');
|
$elem.addClass('active');
|
||||||
self.loaded = true;
|
self.loaded = true;
|
||||||
} // TODO: else
|
} // TODO: else
|
||||||
|
11083
js/jshint.js
11083
js/jshint.js
File diff suppressed because it is too large
Load Diff
@ -1,99 +0,0 @@
|
|||||||
{
|
|
||||||
// JSHint Default Configuration File (as on JSHint website)
|
|
||||||
// See http://jshint.com/docs/ for more details
|
|
||||||
|
|
||||||
"maxerr" : 50, // {int} Maximum error before stopping
|
|
||||||
|
|
||||||
// Enforcing
|
|
||||||
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
|
||||||
"camelcase" : false, // true: Identifiers must be in camelCase
|
|
||||||
"curly" : true, // true: Require {} for every new block or scope
|
|
||||||
"eqeqeq" : true, // true: Require triple equals (===) for comparison
|
|
||||||
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
|
|
||||||
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
|
|
||||||
"indent" : 4, // {int} Number of spaces to use for indentation
|
|
||||||
"latedef" : true, // true: Require variables/functions to be defined before being used
|
|
||||||
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
|
|
||||||
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
|
||||||
"noempty" : true, // true: Prohibit use of empty blocks
|
|
||||||
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
|
|
||||||
"plusplus" : true, // true: Prohibit use of `++` & `--`
|
|
||||||
"quotmark" : "single", // Quotation mark consistency:
|
|
||||||
// false : do nothing (default)
|
|
||||||
// true : ensure whatever is used is consistent
|
|
||||||
// "single" : require single quotes
|
|
||||||
// "double" : require double quotes
|
|
||||||
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
|
||||||
"unused" : true, // true: Require all defined variables be used
|
|
||||||
"strict" : false, // true: Requires all functions run in ES5 Strict Mode
|
|
||||||
"trailing" : true, // true: Prohibit trailing whitespaces
|
|
||||||
"maxparams" : false, // {int} Max number of formal params allowed per function
|
|
||||||
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
|
||||||
"maxstatements" : false, // {int} Max number statements per function
|
|
||||||
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
|
||||||
"maxlen" : false, // {int} Max number of characters per line
|
|
||||||
|
|
||||||
// Relaxing
|
|
||||||
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
|
||||||
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
|
||||||
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
|
||||||
"eqnull" : false, // true: Tolerate use of `== null`
|
|
||||||
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
|
|
||||||
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
|
|
||||||
// (ex: `for each`, multiple try/catch, function expression…)
|
|
||||||
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
|
||||||
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
|
||||||
"funcscope" : false, // true: Tolerate defining variables inside control statements"
|
|
||||||
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
|
||||||
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
|
||||||
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
|
||||||
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
|
||||||
"laxcomma" : false, // true: Tolerate comma-first style coding
|
|
||||||
"loopfunc" : false, // true: Tolerate functions being defined in loops
|
|
||||||
"multistr" : false, // true: Tolerate multi-line strings
|
|
||||||
"proto" : false, // true: Tolerate using the `__proto__` property
|
|
||||||
"scripturl" : false, // true: Tolerate script-targeted URLs
|
|
||||||
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
|
|
||||||
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
|
||||||
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
|
||||||
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
|
||||||
"validthis" : false, // true: Tolerate using this in a non-constructor function
|
|
||||||
|
|
||||||
// Environments
|
|
||||||
"browser" : true, // Web Browser (window, document, etc)
|
|
||||||
"couch" : false, // CouchDB
|
|
||||||
"devel" : true, // Development/debugging (alert, confirm, etc)
|
|
||||||
"dojo" : false, // Dojo Toolkit
|
|
||||||
"jquery" : true, // jQuery
|
|
||||||
"mootools" : false, // MooTools
|
|
||||||
"node" : false, // Node.js
|
|
||||||
"nonstandard" : true, // Widely adopted globals (escape, unescape, etc)
|
|
||||||
"prototypejs" : false, // Prototype and Scriptaculous
|
|
||||||
"rhino" : false, // Rhino
|
|
||||||
"worker" : false, // Web Workers
|
|
||||||
"wsh" : false, // Windows Scripting Host
|
|
||||||
"yui" : false, // Yahoo User Interface
|
|
||||||
|
|
||||||
// Legacy
|
|
||||||
"nomen" : false, // true: Prohibit dangling `_` in variables
|
|
||||||
"onevar" : true, // true: Allow only one `var` statement per function
|
|
||||||
"passfail" : false, // true: Stop on first error
|
|
||||||
"white" : true, // true: Check against strict whitespace and indentation rules
|
|
||||||
|
|
||||||
// Custom Globals
|
|
||||||
"predef" : [ // additional predefined global variables
|
|
||||||
"process",
|
|
||||||
"module",
|
|
||||||
"exports",
|
|
||||||
"require",
|
|
||||||
"define",
|
|
||||||
"__dirname",
|
|
||||||
"__filename",
|
|
||||||
"Buffer",
|
|
||||||
"TR",
|
|
||||||
"TRPAT",
|
|
||||||
"GETTEXT",
|
|
||||||
"GETSTATICURL",
|
|
||||||
"ko"
|
|
||||||
]
|
|
||||||
}
|
|
@ -114,7 +114,6 @@ OC.ContactsImporter = OC.ContactsImporter || {
|
|||||||
_getTemplate: function() {
|
_getTemplate: function() {
|
||||||
var defer = $.Deferred(), self = this;
|
var defer = $.Deferred(), self = this;
|
||||||
if(!this.$template) {
|
if(!this.$template) {
|
||||||
var self = this;
|
|
||||||
$.get(OC.filePath('contacts', 'templates', 'importdialog.html'), function(tmpl) {
|
$.get(OC.filePath('contacts', 'templates', 'importdialog.html'), function(tmpl) {
|
||||||
defer.resolve($(tmpl));
|
defer.resolve($(tmpl));
|
||||||
})
|
})
|
||||||
|
@ -157,7 +157,8 @@ class Hooks{
|
|||||||
// reset tags
|
// reset tags
|
||||||
$tagMgr->delete($tags);
|
$tagMgr->delete($tags);
|
||||||
|
|
||||||
$backend = $this->app->getBackend('local');
|
$app = new App();
|
||||||
|
$backend = $app->getBackend('local');
|
||||||
$addressBookInfos = $backend->getAddressBooksForUser();
|
$addressBookInfos = $backend->getAddressBooksForUser();
|
||||||
|
|
||||||
foreach($addressBookInfos as $addressBookInfo) {
|
foreach($addressBookInfos as $addressBookInfo) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user