From 87b010c70030befd873e2135822328ce9c45f622 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 16 May 2014 15:57:33 -0400 Subject: [PATCH] Indentation --- UI/Contacts/GNUmakefile | 6 +- UI/Contacts/UIxContactFolderProperties.h | 2 +- UI/Contacts/UIxContactFolderProperties.m | 20 +-- .../ContactsUI/UIxContactFolderProperties.wox | 106 ++++++------ UI/WebServerResources/ContactsUI.js | 158 +++++++++--------- .../UIxContactFolderProperties.js | 68 ++++---- 6 files changed, 179 insertions(+), 181 deletions(-) diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index 7158670d1..6e32c50db 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -22,9 +22,9 @@ ContactsUI_OBJC_FILES = \ UIxListEditor.m \ UIxContactsListActions.m \ UIxContactFoldersView.m \ - UIxContactFolderActions.m \ - UIxContactFolderProperties.m - + UIxContactFolderActions.m \ + UIxContactFolderProperties.m + ContactsUI_RESOURCE_FILES += \ product.plist \ diff --git a/UI/Contacts/UIxContactFolderProperties.h b/UI/Contacts/UIxContactFolderProperties.h index 346ec5529..9d8fd6a94 100644 --- a/UI/Contacts/UIxContactFolderProperties.h +++ b/UI/Contacts/UIxContactFolderProperties.h @@ -1,6 +1,6 @@ /* UIxContactFolderProperties.h - this file is part of SOGo * - * Copyright (C) 2008-2014 Inverse inc. + * Copyright (C) 2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/UI/Contacts/UIxContactFolderProperties.m b/UI/Contacts/UIxContactFolderProperties.m index 00144c03c..391d82f3d 100644 --- a/UI/Contacts/UIxContactFolderProperties.m +++ b/UI/Contacts/UIxContactFolderProperties.m @@ -1,6 +1,6 @@ /* UIxContactFolderProperties.m - this file is part of SOGo * - * Copyright (C) 2008-2014 Inverse inc. + * Copyright (C) 2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,14 +75,14 @@ NSString *davURL; if (!basePublicCardDAVURL) - { - davURL = [[addressBook publicDavURL] absoluteString]; - if ([davURL hasSuffix: @"/"]) - basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1]; - else - basePublicCardDAVURL = davURL; - [basePublicCardDAVURL retain]; - } + { + davURL = [[addressBook publicDavURL] absoluteString]; + if ([davURL hasSuffix: @"/"]) + basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1]; + else + basePublicCardDAVURL = davURL; + [basePublicCardDAVURL retain]; + } return basePublicCardDAVURL; } @@ -96,7 +96,7 @@ { // NOTE: This method is the same found in Common/UIxAclEditor.m return [[SOGoSystemDefaults sharedSystemDefaults] - enablePublicAccess]; + enablePublicAccess]; } @end diff --git a/UI/Templates/ContactsUI/UIxContactFolderProperties.wox b/UI/Templates/ContactsUI/UIxContactFolderProperties.wox index 7dd139840..bcecf8ba8 100644 --- a/UI/Templates/ContactsUI/UIxContactFolderProperties.wox +++ b/UI/Templates/ContactsUI/UIxContactFolderProperties.wox @@ -1,63 +1,63 @@ - + xmlns:var="http://www.skyrix.com/od/binding" + xmlns:const="http://www.skyrix.com/od/constant" + xmlns:uix="OGo:uix" + xmlns:rsrc="OGo:url" + xmlns:label="OGo:label" + className="UIxPageFrame" + const:toolbar="none" + const:popup="YES" + title="title"> +
-
    -
  • -
  • -
  • -
  • -
- -
- -
-
- +
    +
  • +
  • +
  • +
  • +
+ +
+ +
+
+ +
+ + +
+
+
+ + +
+ + + -
- - -
- - - - -
- - -
- - - - -
+ +
+ + +
+
diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index e6d1a5cfe..02fa1ece7 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -266,7 +266,7 @@ function _onContactMenuAction(folderItem, action, refresh) { var selectedFolders = $("contactFolders").getSelectedNodes(); var folderId = $(folderItem).readAttribute("folderId"); if (folderId) - folderId = folderId.substring(1); + folderId = folderId.substring(1); if (Object.isArray(document.menuTarget) && selectedFolders.length > 0) { var selectedFolderId = $(selectedFolders[0]).readAttribute("id"); var contactIds = $(document.menuTarget).collect(function(row) { @@ -313,7 +313,7 @@ function onMenuExportContact (event) { return row.readAttribute("id"); }); var url = ApplicationBaseURL + "/" + selectedFolderId + "/export" - + "?uid=" + contactIds.join("&uid="); + + "?uid=" + contactIds.join("&uid="); window.location.href = url; } } @@ -528,7 +528,7 @@ function onToolbarDeleteSelectedContactsConfirm(dialogId) { ('ids=' + rowIds.collect(function (s) { return encodeURIComponent(s.unescapeHTML()); }).join(",")), - { "Content-type": "application/x-www-form-urlencoded" }); + { "Content-type": "application/x-www-form-urlencoded" }); } function onContactDeleteEventCallback(http) { @@ -616,9 +616,9 @@ function newList(sender) { var li = $(Contact.currentAddressBook); var listEditing = li.getAttribute("list-editing"); if (listEditing && listEditing == "available") - openContactWindow(URLForFolderID(Contact.currentAddressBook) + "/newlist"); + openContactWindow(URLForFolderID(Contact.currentAddressBook) + "/newlist"); else - showAlertDialog(_("You cannot create a list in a shared address book.")); + showAlertDialog(_("You cannot create a list in a shared address book.")); return false; } @@ -670,9 +670,9 @@ function onConfirmContactSelection(event) { addListToOpener(tag, Contact.currentAddressBook, currentAddressBookName, cid); } else { - var cname = '' + rows[i].readAttribute("contactname"); - var email = '' + rows[i].cells[1].innerHTML; - addContact(tag, currentAddressBookName + '/' + cname, cid, cname, email); + var cname = '' + rows[i].readAttribute("contactname"); + var email = '' + rows[i].cells[1].innerHTML; + addContact(tag, currentAddressBookName + '/' + cname, cid, cname, email); } } @@ -685,10 +685,10 @@ function onConfirmContactSelection(event) { function addListToOpener (tag, aBookId, aBookName, listId) { var url = UserFolderURL + "Contacts/" + aBookId + "/" + listId + "/properties"; triggerAjaxRequest (url, addListToOpenerCallback, { - "aBookId": aBookId, - "aBookName": aBookName, - "tag": tag - }); + "aBookId": aBookId, + "aBookName": aBookName, + "tag": tag + }); } function addListToOpenerCallback (http) { @@ -827,11 +827,11 @@ function hideImportResults () { function validateUploadForm () { rc = false; if ($("contactsFile").value.length) { - var btn = jQuery('#uploadSubmit'); - jQuery('#uploadCancel').fadeOut('fast'); - btn.addClass("disabled"); - btn.children('span').text(_('Uploading')); - rc = true; + var btn = jQuery('#uploadSubmit'); + jQuery('#uploadCancel').fadeOut('fast'); + btn.addClass("disabled"); + btn.children('span').text(_('Uploading')); + rc = true; } return rc; } @@ -1062,18 +1062,18 @@ function updateAddressBooksMenus() { } function onAddressBookModify(event) { - var folders = $("contactFolders"); - var selected = folders.getSelectedNodes()[0]; - var addressBookID = selected.getAttribute("id"); - var url = ApplicationBaseURL + addressBookID + "/properties"; - var windowID = sanitizeWindowName(addressBookID + " properties"); - var width = 410; - var height = 410; + var folders = $("contactFolders"); + var selected = folders.getSelectedNodes()[0]; + var addressBookID = selected.getAttribute("id"); + var url = ApplicationBaseURL + addressBookID + "/properties"; + var windowID = sanitizeWindowName(addressBookID + " properties"); + var width = 410; + var height = 410; - $(function() { - var properties = window.open(url, windowID, "width="+width+",height="+height+",resizable=0"); - properties.focus(); - }).delay(0.1); + $(function() { + var properties = window.open(url, windowID, "width="+width+",height="+height+",resizable=0"); + properties.focus(); + }).delay(0.1); } @@ -1263,15 +1263,15 @@ getMenus = function() { return menus; } -function configureSelectionButtons() { - var container = $("contactSelectionButtons"); - if (container) { - var buttons = container.select("A.button"); - for (var i = 0; i < buttons.length; i++) { - $(buttons[i]).observe("click", onConfirmContactSelection); + function configureSelectionButtons() { + var container = $("contactSelectionButtons"); + if (container) { + var buttons = container.select("A.button"); + for (var i = 0; i < buttons.length; i++) { + $(buttons[i]).observe("click", onConfirmContactSelection); + } } } -} function onDocumentKeydown(event) { var target = Event.element(event); @@ -1329,12 +1329,12 @@ function onDocumentKeydown(event) { } /*function fixSearchFieldPosition () { - var panel = $("filterPanel"); - if (panel) { - panel.style.position = "relative"; - panel.style.top = "7px"; - } - }*/ + var panel = $("filterPanel"); + if (panel) { + panel.style.position = "relative"; + panel.style.top = "7px"; + } + }*/ function initContacts(event) { if ($(document.body).hasClassName("popup")) { @@ -1393,36 +1393,36 @@ onContactsWindowResize = function (event) { handle.adjust(); } -function resetCategoriesMenu() { - var menu = $("categoriesMenu"); - if (menu) { - menu.parentNode.removeChild(menu); - } + function resetCategoriesMenu() { + var menu = $("categoriesMenu"); + if (menu) { + menu.parentNode.removeChild(menu); + } - menu = createElement("div", "categoriesMenu", "menu"); - var menuUL = createElement("ul", null, "choiceMenu"); - menu.appendChild(menuUL); - if (UserDefaults && UserDefaults["SOGoContactsCategories"]) { - for (var i = 0; - i < UserDefaults["SOGoContactsCategories"].length; - i++) { - var catName = UserDefaults["SOGoContactsCategories"][i]; - if (catName.length > 0) { - var menuLI = createElement("li"); - menuLI.observe("mousedown", onCategoriesMenuItemClick); - menuLI.category = catName; - menuLI.appendChild(document.createTextNode(catName)); - menuUL.appendChild(menuLI); + menu = createElement("div", "categoriesMenu", "menu"); + var menuUL = createElement("ul", null, "choiceMenu"); + menu.appendChild(menuUL); + if (UserDefaults && UserDefaults["SOGoContactsCategories"]) { + for (var i = 0; + i < UserDefaults["SOGoContactsCategories"].length; + i++) { + var catName = UserDefaults["SOGoContactsCategories"][i]; + if (catName.length > 0) { + var menuLI = createElement("li"); + menuLI.observe("mousedown", onCategoriesMenuItemClick); + menuLI.category = catName; + menuLI.appendChild(document.createTextNode(catName)); + menuUL.appendChild(menuLI); + } } } + + menu.prepareVisibility = onCategoriesMenuPrepareVisibility; + + var pageContent = $("pageContent"); + pageContent.appendChild(menu); } - menu.prepareVisibility = onCategoriesMenuPrepareVisibility; - - var pageContent = $("pageContent"); - pageContent.appendChild(menu); -} - function onCategoriesMenuPrepareVisibility() { var contactsList = $("contactsList"); if (contactsList) { @@ -1514,16 +1514,16 @@ function configureDraggables() { var rows = jQuery("tr.vcard"); try { rows.draggable("destroy"); } catch (e) {} rows.draggable({ - helper: function (event) { return '
'; }, - start: startDragging, - drag: whileDragging, - stop: stopDragging, - appendTo: 'body', - cursorAt: { right: 25 }, - scroll: false, - distance: 4, - zIndex: 20 - }); + helper: function (event) { return '
'; }, + start: startDragging, + drag: whileDragging, + stop: stopDragging, + appendTo: 'body', + cursorAt: { right: 25 }, + scroll: false, + distance: 4, + zIndex: 20 + }); } } @@ -1557,7 +1557,7 @@ function startDragging(event, ui) { handle.html(count); if (event.shiftKey || currentFolderIsRemote()) { - handle.addClass("copy"); + handle.addClass("copy"); } handle.show(); } @@ -1607,8 +1607,8 @@ function dropSelectedContacts(action, toId) { return encodeURIComponent(s.unescapeHTML()); }).join('&uid='); triggerAjaxRequest(url, actionContactCallback, fromId, - ('folder='+ toId + '&uid=' + uids), - { "Content-type": "application/x-www-form-urlencoded" }); + ('folder='+ toId + '&uid=' + uids), + { "Content-type": "application/x-www-form-urlencoded" }); } } } diff --git a/UI/WebServerResources/UIxContactFolderProperties.js b/UI/WebServerResources/UIxContactFolderProperties.js index 6854856c5..7d998a186 100644 --- a/UI/WebServerResources/UIxContactFolderProperties.js +++ b/UI/WebServerResources/UIxContactFolderProperties.js @@ -15,57 +15,55 @@ function onLoadContactFolderProperties() { } function onOKClick(event) { - var AddressBookName = $("addressBookName"); - var folders = parent$("contactFolders"); - var selected = folders.getSelectedNodes()[0]; + var AddressBookName = $("addressBookName"); + var folders = parent$("contactFolders"); + var selected = folders.getSelectedNodes()[0]; - if (!AddressBookName.value.blank()) { - var newName = AddressBookName.value; - var currentName = AddressBookName.defaultValue; - if (newName && newName.length > 0 && newName != currentName) { - if (selected.getAttribute("owner") != "nobody") { - var url = (URLForFolderID(selected.getAttribute("id")) + "/renameFolder?name=" + escape(newName.utf8encode())); - triggerAjaxRequest(url, folderRenameCallback, {node: selected, name: newName}); + if (!AddressBookName.value.blank()) { + var newName = AddressBookName.value; + var currentName = AddressBookName.defaultValue; + if (newName && newName.length > 0 && newName != currentName) { + if (selected.getAttribute("owner") != "nobody") { + var url = (URLForFolderID(selected.getAttribute("id")) + "/renameFolder?name=" + escape(newName.utf8encode())); + triggerAjaxRequest(url, folderRenameCallback, {node: selected, name: newName}); - } - else { - alert_("You do not own this address book"); - } + } + else { + alert_("You do not own this address book"); + } + } + else + window.close(); } else - window.close(); - } - else - alert(_("Please specify an address book name.")); + alert(_("Please specify an address book name.")); Event.stop(event); } function folderRenameCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - var dict = http.callbackData; - dict["node"].innerHTML = dict["name"]; - window.close(); + if (http.readyState == 4) { + if (isHttpStatus204(http.status)) { + var dict = http.callbackData; + dict["node"].innerHTML = dict["name"]; + window.close(); + } } - } } function onCancelClick(event) { - window.close(); + window.close(); } function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName == "INPUT" || target.tagName == "SELECT") { - if (event.keyCode == Event.KEY_RETURN) { - onOKClick(event); + var target = Event.element(event); + if (target.tagName == "INPUT" || target.tagName == "SELECT") { + if (event.keyCode == Event.KEY_RETURN) { + onOKClick(event); + } + } + if (event.keyCode == Event.KEY_ESC) { + onCancelClick(); } - } - if (event.keyCode == Event.KEY_ESC) { - onCancelClick(); - } } - - document.observe("dom:loaded", onLoadContactFolderProperties);