Created a window for address book properties and add the cardDav URL

This commit is contained in:
Alexandre Cloutier
2014-05-15 14:44:31 -04:00
parent d58184af15
commit 07445eb069
12 changed files with 468 additions and 147 deletions

View File

@@ -146,7 +146,7 @@
"You cannot delete the card of \"%{0}\"."
= "You cannot delete the card of \"%{0}\".";
"Address Book Name" = "Address Book Name";
"You cannot subscribe to a folder that you own!"
= "You cannot subscribe to a folder that you own.";
@@ -205,3 +205,13 @@
"A total of %{0} cards were imported in the addressbook." = "A total of %{0} cards were imported in the addressbook.";
"Reload" = "Reload";
/* Properties window */
"Address Book Name:" = "Address Book Name:";
"Public Access" = "Public Access";
"Links to this Address Book" = "Links to this Address Book";
"Authenticated User Access" = "Authenticated User Access";
"CardDAV URL: " = "CardDAV URL: ";
"OK" = "OK";
"Cancel" = "Cancel";

View File

@@ -22,8 +22,9 @@ ContactsUI_OBJC_FILES = \
UIxListEditor.m \
UIxContactsListActions.m \
UIxContactFoldersView.m \
UIxContactFolderActions.m
UIxContactFolderActions.m \
UIxContactFolderProperties.m
ContactsUI_RESOURCE_FILES += \
product.plist \

View File

@@ -0,0 +1,35 @@
/* UIxContactFolderProperties.h - this file is part of SOGo
*
* Copyright (C) 2008-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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <SOGoUI/UIxComponent.h>
@class NSString;
@class SOGoContactGCSFolder;
@interface UIxContactFolderProperties : UIxComponent
{
SOGoContactGCSFolder *addressBook;
NSString *baseCardDAVURL, *basePublicCardDAVURL;
}
- (NSString *) addressBookName;
@end

View File

@@ -0,0 +1,93 @@
/* UIxContactFolderProperties.m - this file is part of SOGo
*
* Copyright (C) 2008-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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import "UIxContactFolderProperties.h"
@implementation UIxContactFolderProperties
- (id) init
{
if ((self = [super init]))
{
addressBook = [self clientObject];
baseCardDAVURL = nil;
basePublicCardDAVURL = nil;
}
return self;
}
- (void) dealloc
{
[baseCardDAVURL release];
[basePublicCardDAVURL release];
[super dealloc];
}
- (NSString *) addressBookName
{
return [addressBook displayName];
}
- (NSString *) _baseCardDAVURL
{
NSString *davURL;
if (!baseCardDAVURL)
{
davURL = [[addressBook realDavURL] absoluteString];
if ([davURL hasSuffix: @"/"])
baseCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
else
baseCardDAVURL = davURL;
[baseCardDAVURL retain];
}
return baseCardDAVURL;
}
- (NSString *) cardDavURL
{
return [NSString stringWithFormat: @"%@/", [self _baseCardDAVURL]];
}
- (NSString *) _basePublicCardDAVURL
{
NSString *davURL;
if (!basePublicCardDAVURL)
{
davURL = [[addressBook publicDavURL] absoluteString];
if ([davURL hasSuffix: @"/"])
basePublicCardDAVURL = [davURL substringToIndex: [davURL length] - 1];
else
basePublicCardDAVURL = davURL;
[basePublicCardDAVURL retain];
}
return basePublicCardDAVURL;
}
- (NSString *) publicCardDavURL
{
return [NSString stringWithFormat: @"%@/", [self _basePublicCardDAVURL]];
}
@end

View File

@@ -118,6 +118,10 @@
pageName = "UIxContactsUserRightsEditor";
actionName = "saveUserRights";
};
properties = {
protectedBy = "View";
pageName = "UIxContactFolderProperties";
};
};
};

View File

@@ -506,7 +506,7 @@ vtodo_class2 = "(Confidential task)";
"Links to this Calendar" = "Links to this Calendar";
"Authenticated User Access" = "Authenticated User Access";
"CalDAV URL" = "CalDAV URL";
"CalDAV URL: " = "CalDAV URL: ";
"WebDAV ICS URL" = "WebDAV ICS URL";
"WebDAV XML URL" = "WebDAV XML URL";

View File

@@ -0,0 +1,63 @@
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE var:component>
<var:component xmlns="http://www.w3.org/1999/xhtml"
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">
<div class="tabsContainer" id="propertiesTabs">
<ul>
<li target="properties">
<span><var:string label:value="Properties" /></span></li>
<li target="LinksView">
<span><var:string label:value="Links to this Address Book" /></span></li>
</ul>
<div class="tabs">
<!-- First Tab -->
<div id="properties" class="tab">
<fieldset>
<legend><var:string label:value="Properties"/></legend>
<div>
<var:string label:value="Address Book Name:" />
<input type="text" name="addressBookName" id="addressBookName" class="textField" var:value="addressBookName" />
</div>
</fieldset>
</div>
<!-- Second Tab -->
<div id="LinksView" class="tab">
<fieldset id="authenticatedLinks">
<legend><var:string label:value="Authenticated User Access"/></legend>
<div>
<var:string label:value="CardDAV URL: "/>
<var:string value="cardDavURL" />
</div>
</fieldset>
<var:if condition="isPublicAccessEnabled">
<fieldset id="publicLinks">
<legend><var:string label:value="Public Access"/></legend>
<div>
<var:string label:value="CardDAV URL: "/>
<var:string value="publicCardDavURL" />
</div>
</fieldset>
</var:if>
</div>
<!-- Buttons -->
<div id="buttons">
<a href="#" class="button actionButton" id="okButton" name="okButton">
<span><var:string label:value="OK"/></span></a>
<a href="#" class="button" id="cancelButton" name="cancelButton">
<span><var:string label:value="Cancel"/></span></a>
</div>
</div>
</div>
</var:component>

View File

@@ -10,7 +10,7 @@
const:toolbar="none"
const:popup="YES"
title="title">
<div id="colorPickerDialog" style="display: none;" class="dialog left">
<div>
<span class="blc-FFFFFF"><!-- --></span>
@@ -85,59 +85,59 @@
<span class="blc-99FF99"><!-- --></span>
</div>
</div>
<form const:href="saveProperties" name="propertiesform" id="propertiesform">
<input type="hidden" const:name="calendarID" const:id="calendarID"
var:value="calendarID"/>
var:value="calendarID"/>
<div class="tabsContainer" id="propertiesTabs">
<ul>
<li target="propertiesView"><span>
<var:string label:value="Properties" /></span></li>
<li target="davLinksView"><span>
<var:string label:value="Links to this Calendar"/></span></li>
<var:string label:value="Properties" /></span></li>
<li target="davLinksView"><span>
<var:string label:value="Links to this Calendar"/></span></li>
</ul>
<div class="tabs">
<div id="propertiesView" class="tab">
<!--<div id="propertiesView">-->
<fieldset>
<legend><var:string label:value="Properties"/></legend>
<div><span class="label"><var:string label:value="Name:"/></span
<!--<div id="propertiesView">-->
<fieldset>
<legend><var:string label:value="Properties"/></legend>
<div><span class="label"><var:string label:value="Name:"/></span
><span class="content"><input type="text"
name="calendarName" id="calendarName"
class="textField"
var:value="calendarName"
/></span></div>
<div><span class="label"><var:string label:value="Color:"/></span
<div><span class="label"><var:string label:value="Color:"/></span
><span class="content"
><div id="colorButton" class="colorBox" var:data-color="calendarColor"><!-- space --></div
><input type="hidden" name="calendarColor" id="calendarColor" var:value="calendarColor"
/></span></div>
<var:if condition="userIsOwner"
><div
><label><input type="checkbox" const:class="checkBox"
name="includeInFreeBusy"
id="includeInFreeBusy"
var:checked="includeInFreeBusy"
/><var:string label:value="Include in free-busy"
/></label
></div
></var:if>
</fieldset>
<fieldset>
<legend><var:string label:value="Synchronization"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
><div id="colorButton" class="colorBox" var:data-color="calendarColor"><!-- space --></div
><input type="hidden" name="calendarColor" id="calendarColor" var:value="calendarColor"
/></span></div>
<var:if condition="userIsOwner"
><div
><label><input type="checkbox" const:class="checkBox"
name="includeInFreeBusy"
id="includeInFreeBusy"
var:checked="includeInFreeBusy"
/><var:string label:value="Include in free-busy"
/></label
></div
></var:if>
</fieldset>
<fieldset>
<legend><var:string label:value="Synchronization"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
name="synchronizeCalendar"
id="synchronizeCalendar"
id="synchronizeCalendar"
var:checked="synchronizeCalendar"
var:disabled="mustSynchronize"
/><var:string label:value="Synchronize"
/></label></div>
<var:if condition="mustSynchronize" const:negate="YES"
><div><span class="label"><var:string
<var:if condition="mustSynchronize" const:negate="YES"
><div><span class="label"><var:string
label:value="Tag:"/></span
><span class="content"><input type="text"
name="calendarSyncTag"
@@ -153,90 +153,96 @@
name="allCalendarSyncTags"
id="allCalendarSyncTags"
var:value="allCalendarSyncTags"
/></div></var:if>
</fieldset>
<fieldset>
<legend><var:string label:value="Display"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
/></div></var:if>
</fieldset>
<fieldset>
<legend><var:string label:value="Display"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
id="showCalendarAlarms" var:checked="showCalendarAlarms"
/><var:string label:value="Show alarms"/></label></div>
<div><label
><input type="checkbox" const:class="checkBox"
<div><label
><input type="checkbox" const:class="checkBox"
id="showCalendarTasks" var:checked="showCalendarTasks"
/><var:string label:value="Show tasks"
/></label></div>
<var:if condition="isWebCalendar"
><div><label
><input type="checkbox" const:class="checkBox"
<var:if condition="isWebCalendar"
><div><label
><input type="checkbox" const:class="checkBox"
id="reloadOnLogin" var:checked="reloadOnLogin"
/><var:string label:value="Reload on login"
/></label></div></var:if>
</fieldset>
<var:if condition="isWebCalendar" const:negate="YES">
<var:if condition="calendar.activeUserIsOwner">
<fieldset>
<legend><var:string label:value="Notifications"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyOnPersonalModifications" var:checked="notifyOnPersonalModifications"
/><var:string label:value="Receive a mail when I modify my calendar"/></label></div>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyOnExternalModifications" var:checked="notifyOnExternalModifications"
/><var:string label:value="Receive a mail when someone else modifies my calendar"
/></label></div>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyUserOnPersonalModifications" var:checked="notifyUserOnPersonalModifications"
/><var:string label:value="When I modify my calendar, send a mail to:"
/></label></div>
<div><span class="label"
><entity name="nbsp"/></span><span class="content">
<input type="text" name="notifiedUserOnPersonalModifications" id="notifiedUserOnPersonalModifications"
class="textField"
var:value="notifiedUserOnPersonalModifications"
/></span></div>
</fieldset>
</var:if>
</var:if>
</div>
<div id="davLinksView" class="tab">
<var:if condition="isWebCalendar"
><fieldset id="webCalendarUrl">
<legend><var:string label:value="URL:"/></legend>
<div><a const:class="clickableLink" var:href="webCalendarURL" var:title="webCalendarURL"
target="_new"><var:string var:value="webCalendarURL"/></a></div>
</fieldset
></var:if>
<var:if condition="isWebCalendar" const:negate="YES"
><fieldset id="authenticatedLinks">
<legend><var:string label:value="Authenticated User Access"/></legend>
<div><a const:class="clickableLink" var:href="calDavURL" var:title="calDavURL"
><var:string label:value="CalDAV URL"/></a><br/>
<a const:class="clickableLink" var:href="webDavICSURL" var:title="webDavICSURL"
><var:string label:value="WebDAV ICS URL"/></a><br/>
<a const:class="clickableLink" var:href="webDavXMLURL" var:title="webDavXMLURL"
><var:string label:value="WebDAV XML URL"/></a></div>
</fieldset>
<var:if condition="isPublicAccessEnabled"
><fieldset id="publicLinks">
<legend><var:string label:value="Public Access"/></legend>
<div><a const:class="clickableLink" var:href="publicCalDavURL" var:title="publicCalDavURL"
><var:string label:value="CalDAV URL"/></a><br/>
<a const:class="clickableLink" var:href="publicWebDavICSURL" var:title="publicWebDavICSURL"
><var:string label:value="WebDAV ICS URL"/></a><br/>
<a const:class="clickableLink" var:href="publicWebDavXMLURL" var:title="publicWebDavXMLURL"
><var:string label:value="WebDAV XML URL"/></a></div>
</fieldset
></var:if
></var:if>
</fieldset>
<var:if condition="isWebCalendar" const:negate="YES">
<var:if condition="calendar.activeUserIsOwner">
<fieldset>
<legend><var:string label:value="Notifications"/></legend>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyOnPersonalModifications" var:checked="notifyOnPersonalModifications"
/><var:string label:value="Receive a mail when I modify my calendar"/></label></div>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyOnExternalModifications" var:checked="notifyOnExternalModifications"
/><var:string label:value="Receive a mail when someone else modifies my calendar"
/></label></div>
<div><label
><input type="checkbox" const:class="checkBox"
id="notifyUserOnPersonalModifications" var:checked="notifyUserOnPersonalModifications"
/><var:string label:value="When I modify my calendar, send a mail to:"
/></label></div>
<div><span class="label"
><entity name="nbsp"/></span><span class="content">
<input type="text" name="notifiedUserOnPersonalModifications" id="notifiedUserOnPersonalModifications"
class="textField"
var:value="notifiedUserOnPersonalModifications"
/></span></div>
</fieldset>
</var:if>
</var:if>
</div>
<div id="davLinksView" class="tab">
<var:if condition="isWebCalendar">
<fieldset id="webCalendarUrl">
<legend><var:string label:value="URL:"/></legend>
<div><a const:class="clickableLink" var:href="webCalendarURL" var:title="webCalendarURL"
target="_new"><var:string var:value="webCalendarURL"/></a></div>
</fieldset>
</var:if>
<var:if condition="isWebCalendar" const:negate="YES">
<fieldset id="authenticatedLinks">
<legend><var:string label:value="Authenticated User Access"/></legend>
<div>
<span>
<var:string label:value="CalDAV URL: "/>
<var:string value="calDavURL" />
</span><br/>
<a const:class="clickableLink" var:href="webDavICSURL" var:title="webDavICSURL">
<var:string label:value="WebDAV ICS URL"/></a><br/>
<a const:class="clickableLink" var:href="webDavXMLURL" var:title="webDavXMLURL">
<var:string label:value="WebDAV XML URL"/></a></div>
</fieldset>
<var:if condition="isPublicAccessEnabled">
<fieldset id="publicLinks">
<legend><var:string label:value="Public Access"/></legend>
<div>
<span>
<var:string label:value="CalDAV URL: "/>
<var:string value="publicCalDavURL"/>
</span><br/>
<a const:class="clickableLink" var:href="publicWebDavICSURL" var:title="publicWebDavICSURL">
<var:string label:value="WebDAV ICS URL"/></a><br/>
<a const:class="clickableLink" var:href="publicWebDavXMLURL" var:title="publicWebDavXMLURL">
<var:string label:value="WebDAV XML URL"/></a></div>
</fieldset>
</var:if>
</var:if>
</div>
</div>
</div>
<div id="buttons">
<a href="#" class="button actionButton" id="okButton"
name="okButton">

View File

@@ -690,6 +690,7 @@ function addListToOpener (tag, aBookId, aBookName, listId) {
"tag": tag
});
}
function addListToOpenerCallback (http) {
var data = http.callbackData;
var received = http.responseText.evalJSON (true);
@@ -814,6 +815,7 @@ function onAddressBookImport(event) {
div.setStyle({ top: top + "px", left: left + "px" });
div.show();
}
function hideContactsImport(event) {
$("uploadDialog").hide();
}
@@ -821,6 +823,7 @@ function hideContactsImport(event) {
function hideImportResults () {
$("uploadResults").hide();
}
function validateUploadForm () {
rc = false;
if ($("contactsFile").value.length) {
@@ -832,6 +835,7 @@ function validateUploadForm () {
}
return rc;
}
function uploadCompleted(response) {
jQuery('#uploadCancel').show();
var btn = jQuery('#uploadSubmit');
@@ -1058,39 +1062,19 @@ function updateAddressBooksMenus() {
}
function onAddressBookModify(event) {
var folders = $("contactFolders");
var selected = folders.getSelectedNodes()[0];
if (selected.getAttribute("owner") != "nobody") {
var currentName = selected.innerHTML.unescapeHTML();
showPromptDialog(_("Properties"),
_("Address Book Name"),
onAddressBookModifyConfirm,
currentName);
}
}
function onAddressBookModifyConfirm() {
var folders = $("contactFolders");
var selected = folders.getSelectedNodes()[0];
var newName = this.value;
var currentName = this.getAttribute("previousValue");
if (newName && newName.length > 0
&& newName != currentName) {
var url = (URLForFolderID(selected.getAttribute("id"))
+ "/renameFolder?name=" + escape(newName.utf8encode()));
triggerAjaxRequest(url, folderRenameCallback,
{node: selected, name: newName});
}
disposeDialog();
}
function folderRenameCallback(http) {
if (http.readyState == 4) {
if (isHttpStatus204(http.status)) {
var dict = http.callbackData;
dict["node"].innerHTML = dict["name"];
}
}
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 onMenuSharing(event) {

View File

@@ -18,6 +18,20 @@ function onLoadCalendarProperties() {
var okButton = $("okButton");
okButton.observe("click", onOKClick);
Event.observe(document, "keydown", onDocumentKeydown);
}
function onDocumentKeydown(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();
}
}
function onCancelClick(event) {

View File

@@ -0,0 +1,40 @@
DIV
{ clear: both; }
FIELDSET
{ margin-bottom: 5px;
border: 1px solid #FFFFFF;
border-top: 1px solid #909090;
border-left: 1px solid #909090; }
FIELDSET DIV
{ margin-left: 20px;
margin-right: 10px; }
SPAN.label
{ cursor: default;
width: 55px;
text-align: right;
line-height: 2em;
float: left;
display: block; }
SPAN.content
{ line-height: 1.5em;
vertical-align: middle;
margin-left: 4px; }
SPAN.content INPUT.textField
{ width: 160px; }
DIV#buttons
{ position: absolute;
bottom: 5px;
right: 5px;
padding: 10px;
padding-top: 5px;
text-align: right; }
LABEL
{ white-space: nowrap; }

View File

@@ -0,0 +1,71 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onLoadContactFolderProperties() {
var tabsContainer = $("propertiesTabs");
var controller = new SOGoTabsController();
controller.attachToTabsContainer(tabsContainer);
var okButton = $("okButton");
okButton.observe("click", onOKClick);
var cancelButton = $("cancelButton");
cancelButton.observe("click", onCancelClick);
Event.observe(document, "keydown", onDocumentKeydown);
}
function onOKClick(event) {
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});
}
else {
alert_("You do not own this address book");
}
}
else
window.close();
}
else
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();
}
}
}
function onCancelClick(event) {
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);
}
}
if (event.keyCode == Event.KEY_ESC) {
onCancelClick();
}
}
document.observe("dom:loaded", onLoadContactFolderProperties);