Commit f3bbfe6d authored by CardBook's avatar CardBook

version 29.4

parent cb0bd6ed
......@@ -610,6 +610,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
aRow.appendChild(aCheckbox);
aCheckbox.setAttribute('checked', true);
aCheckbox.setAttribute('id', 'namesCheckbox' + aId);
aCheckbox.setAttribute("aria-labelledby", "namesPageSelectedLabel");
aCheckbox.addEventListener("command", function() {
var aTextBox = document.getElementById('namesTextbox' + this.id.replace("namesCheckbox",""));
if (this.checked) {
......@@ -623,6 +624,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var aTextbox = document.createElement('textbox');
aRow.appendChild(aTextbox);
aTextbox.setAttribute('id', 'namesTextbox' + aId);
aTextbox.setAttribute("aria-labelledby", "namesPageNameLabel");
aTextbox.setAttribute('flex', '1');
aTextbox.setAttribute('required', true);
aTextbox.value = aName;
......@@ -633,6 +635,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var aColorbox = document.createElementNS("http://www.w3.org/1999/xhtml","input");
aRow.appendChild(aColorbox);
aColorbox.setAttribute('id', 'serverColorInput' + aId);
aColorbox.setAttribute("aria-labelledby", "namesPageColorLabel");
aColorbox.setAttribute('class', "small-margin");
aColorbox.setAttribute('type', "color");
aColorbox.value = cardbookUtils.randomColor(100);
......@@ -640,6 +643,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var aMenuList = document.createElement('menulist');
aRow.appendChild(aMenuList);
aMenuList.setAttribute('id', 'vCardVersionPageName' + aId);
aMenuList.setAttribute("aria-labelledby", "namesPageVCardVersionLabel");
var aMenuPopup = document.createElement('menupopup');
aMenuList.appendChild(aMenuPopup);
aMenuPopup.setAttribute('id', 'vCardVersionPageNameMenupopup' + aId);
......@@ -657,6 +661,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var aMenuList = document.createElement('menulist');
aRow.appendChild(aMenuList);
aMenuList.setAttribute('id', 'dateFormatMenuList' + aId);
aMenuList.setAttribute("aria-labelledby", "namesPageDateFormatLabel");
aMenuList.setAttribute('hidden', 'true');
var aMenuPopup = document.createElement('menupopup');
aMenuList.appendChild(aMenuPopup);
......@@ -670,6 +675,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var aTextbox = document.createElement('textbox');
aRow.appendChild(aTextbox);
aTextbox.setAttribute('id', 'URLTextbox' + aId);
aTextbox.setAttribute("aria-labelledby", "namesPageURLLabel");
aTextbox.setAttribute('hidden', 'true');
aTextbox.value = aURL;
......@@ -677,10 +683,12 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
aRow.appendChild(aCheckbox1);
aCheckbox1.setAttribute('checked', false);
aCheckbox1.setAttribute('id', 'readonlyCheckbox' + aId);
aCheckbox1.setAttribute("aria-labelledby", "namesPageReadonlyLabel");
var aCheckbox2 = document.createElement('checkbox');
aRow.appendChild(aCheckbox2);
aRow.appendChild(aCheckbox2);
aCheckbox2.setAttribute('checked', false);
aCheckbox2.setAttribute('id', 'urnuuidCheckbox' + aId);
aCheckbox2.setAttribute("aria-labelledby", "namesPageUrnuuidLabel");
},
loadNames: function () {
......
......@@ -167,7 +167,7 @@
<separator class="groove-thin"/>
<description>&remotePage.credentials.description;</description>
<row align="center">
<label value="&usernameLabel;" control="remotePageUsername"/>
<label id="usernameLabel" value="&usernameLabel;" control="remotePageUsername"/>
<textbox id="remotePageUsername"
required="true"
oninput="wdw_addressbooksAdd.remotePageTextboxInput();"/>
......@@ -203,7 +203,7 @@
<vbox id="searchTerms" flex="3" persist="height">
<vbox>
<hbox align="center" flex="1">
<label value="&abSearchHeading.label;" accesskey="&abSearchHeading.accesskey;" control="abPopup"/>
<label id="addressbookMenulistLabel" value="&abSearchHeading.label;" accesskey="&abSearchHeading.accesskey;" control="abPopup"/>
<menulist id="addressbookMenulist" flex="1">
<menupopup id="addressbookMenupopup"/>
</menulist>
......@@ -240,14 +240,14 @@
</columns>
<rows>
<row id="nameRow" align="center">
<label value="&namePage.name.label;" control="namePageName"/>
<label id="namePageNameLabel" value="&namePage.name.label;" control="namePageName"/>
<textbox id="namePageName"
required="true"
oninput="wdw_addressbooksAdd.checkRequired();"/>
</row>
<separator class="groove-thin"/>
<row id="colorRow" align="center">
<label value="&namePage.color.label;" control="cardbook-color"/>
<label id="serverColorLabel" value="&namePage.color.label;" control="cardbook-color"/>
<hbox align="center">
<html:input id="serverColorInput"
class="small-margin"
......@@ -256,7 +256,7 @@
</row>
<separator class="groove-thin"/>
<row id="vcardVersionRow" align="center">
<label value="&namePage.vCardVersion.label;" control="vCardVersionPageName"/>
<label id="vCardVersionPageNameLabel" value="&namePage.vCardVersion.label;" control="vCardVersionPageName"/>
<hbox align="center" flex="1">
<menulist id="vCardVersionPageName" onpopuphiding="wdw_addressbooksAdd.vCardHidingMenu(this);">
<menupopup id="vCardVersionPageNameMenupopup"/>
......@@ -265,24 +265,24 @@
</row>
<separator class="groove-thin" hidden="true"/>
<row id="dateFormatRow" align="center" hidden="true">
<label control="dateFormatMenuList" hidden="true"/>
<label id="dateFormatMenuListLabel" control="dateFormatMenuList" hidden="true"/>
<menulist id="dateFormatMenuList" hidden="true">
<menupopup id="dateFormatMenuPopup"/>
</menulist>
</row>
<separator class="groove-thin" hidden="true"/>
<row id="URLRow" align="center" hidden="true">
<label control="URLPageName" hidden="true"/>
<label id="URLPageNameLabel" control="URLPageName" hidden="true"/>
<textbox id="URLPageName" hidden="true"/>
</row>
<separator class="groove-thin"/>
<row id="readonlyRow" align="center">
<label value="&namePage.readonly.label;" control="readonlyPageName"/>
<label id="readonlyPageNameLabel" value="&namePage.readonly.label;" control="readonlyPageName"/>
<checkbox id="readonlyPageName"/>
</row>
<separator class="groove-thin"/>
<row id="urnuuidRow" align="center">
<label value="&namePage.urnuuid.label;" control="urnuuidPageName"/>
<label id="urnuuidPageNameLabel" value="&namePage.urnuuid.label;" control="urnuuidPageName"/>
<checkbox id="urnuuidPageName"/>
</row>
</rows>
......@@ -312,14 +312,14 @@
</columns>
<rows id="namesRows">
<row id="headersRow">
<label value="&namePage.selected.label;"/>
<label flex="1" value="&namePage.name.label;"/>
<label value="&namePage.color.label;"/>
<label value="&namePage.vCardVersion.label;"/>
<label hidden="true"/>
<label hidden="true"/>
<label value="&namePage.readonly.label;"/>
<label value="&namePage.urnuuid.label;"/>
<label id="namesPageSelectedLabel" value="&namePage.selected.label;"/>
<label id="namesPageNameLabel" flex="1" value="&namePage.name.label;"/>
<label id="namesPageColorLabel" value="&namePage.color.label;"/>
<label id="namesPageVCardVersionLabel" value="&namePage.vCardVersion.label;"/>
<label id="namesPageDateFormatLabel" hidden="true"/>
<label id="namesPageURLLabel" hidden="true"/>
<label id="namesPageReadonlyLabel" value="&namePage.readonly.label;"/>
<label id="namesPageUrnuuidLabel" value="&namePage.urnuuid.label;"/>
</row>
</rows>
</grid>
......
......@@ -42,6 +42,7 @@
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
<script src="chrome://cardbook/content/cardbookClipboard.js"/>
<script src="chrome://cardbook/content/cardbookUtils.js"/>
<script src="chrome://cardbook/content/cardbookNotifications.js"/>
<script src="chrome://cardbook/content/cardbookDates.js"/>
<script src="chrome://cardbook/content/cardbookElementTools.js"/>
<script src="chrome://cardbook/content/cardbookTypes.js"/>
......@@ -68,8 +69,8 @@
<menuitem id="deleteImageCard" label="&deleteImageCardLabel;" oncommand="wdw_imageEdition.deleteImageCard();"/>
</menupopup>
<menupopup id="availableCardsTreeContextMenu" onpopupshowing="return cardbookUtils.displayColumnsPicker();">
<menuitem id="appendlistavailableCardsTreeMenu" label="&appendlistTreeLabel;" oncommand="wdw_cardEdition.modifyLists(this);"/>
<menupopup id="availableCardsTreeContextMenu" onpopupshowing="wdw_cardEdition.availableCardsTreeContextShowing(event);">
<menuitem id="appendlistavailableCardsTreeMenu" label="&appendContactLabel;" oncommand="wdw_cardEdition.modifyLists(this);"/>
</menupopup>
<menupopup id="addedCardsTreeContextMenu" onpopupshowing="return cardbookUtils.displayColumnsPicker();">
......@@ -334,26 +335,32 @@
</hbox>
<hbox flex="1">
<vbox flex="1">
<groupbox id="addEmailGroupbox">
<caption label="&addEmailGroupboxLabel;" class="header"/>
<textbox id="addEmailGroupboxInput" flex="1" oninput="wdw_cardEdition.noValidateEmailAddress();"/>
</groupbox>
<groupbox id="availableCardsGroupbox" flex="1">
<caption label="&availableCardsGroupboxLabel;" class="header"/>
<textbox id="searchAvailableCardsInput" type="search"
oncommand="wdw_cardEdition.searchAvailableCards(null);"/>
<tree id="availableCardsTree" context="availableCardsTreeContextMenu" class="cardbookTreeClass cardbookAccountTreeClass" flex="1" enableColumnDrag="true"
hidecolumnpicker="false" persist="height sortDirection sortResource" sortDirection="ascending" sortResource="availableCardsName"
onclick="wdw_cardEdition.sortTrees(event, 'availableCards');">
<treecols id="availableCardsTreeCols">
<treecol id="availableCardsName" label="&nameLabel;" flex="1" persist="width ordinal hidden" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsUid" label="&uidLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsFn" label="&fnLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsLastname" label="&lastnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsFirstname" label="&firstnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
</treecols>
<treechildren id="availableCardsTreeChildren" ondblclick="wdw_cardEdition.modifyLists(this);"/>
</tree>
<hbox flex="1" ondragover="event.preventDefault();" ondrop="wdw_cardEdition.dragCards(event, 'availableCardsTree');">
<tree id="availableCardsTree" context="availableCardsTreeContextMenu" class="cardbookTreeClass cardbookAccountTreeClass" flex="1" enableColumnDrag="true"
hidecolumnpicker="false" persist="height sortDirection sortResource" sortDirection="ascending" sortResource="availableCardsName"
onclick="wdw_cardEdition.sortTrees(event, 'availableCards');">
<treecols id="availableCardsTreeCols">
<treecol id="availableCardsName" label="&nameLabel;" flex="1" persist="width ordinal hidden" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsUid" label="&uidLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsFn" label="&fnLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsLastname" label="&lastnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="availableCardsFirstname" label="&firstnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
</treecols>
<treechildren id="availableCardsTreeChildren" ondblclick="wdw_cardEdition.modifyLists(this);" ondragstart="wdw_cardEdition.startDrag(event, this);"/>
</tree>
</hbox>
</groupbox>
</vbox>
<vbox flex="1" align="center">
......@@ -369,26 +376,31 @@
<vbox flex="1">
<groupbox id="addedCardsGroupbox2" flex="1">
<caption label="&addedCardsGroupboxLabel;" class="header"/>
<tree id="addedCardsTree" context="addedCardsTreeContextMenu" class="cardbookTreeClass cardbookAccountTreeClass" flex="1" enableColumnDrag="true"
hidecolumnpicker="false" persist="height sortDirection sortResource" sortDirection="ascending" sortResource="addedCardsName"
onclick="wdw_cardEdition.sortTrees(event, 'addedCards');">
<treecols id="addedCardsTreeCols">
<treecol id="addedCardsName" label="&nameLabel;" flex="1" persist="width ordinal hidden" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsUid" label="&uidLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsFn" label="&fnLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsLastname" label="&lastnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsFirstname" label="&firstnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
</treecols>
<treechildren id="addedCardsTreeChildren" ondblclick="wdw_cardEdition.modifyLists(this);"/>
</tree>
<hbox flex="1" ondragover="event.preventDefault();" ondrop="wdw_cardEdition.dragCards(event, 'addedCardsTree');">
<tree id="addedCardsTree" context="addedCardsTreeContextMenu" class="cardbookTreeClass cardbookAccountTreeClass" flex="1" enableColumnDrag="true"
hidecolumnpicker="false" persist="height sortDirection sortResource" sortDirection="ascending" sortResource="addedCardsName"
onclick="wdw_cardEdition.sortTrees(event, 'addedCards');">
<treecols id="addedCardsTreeCols">
<treecol id="addedCardsName" label="&nameOrEmailLabel;" flex="1" persist="width ordinal hidden" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsUid" label="&uidLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsFn" label="&fnLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsLastname" label="&lastnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="addedCardsFirstname" label="&firstnameLabel;" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left" class="sortDirectionIndicator" sortDirection="ascending"/>
</treecols>
<treechildren id="addedCardsTreeChildren" ondblclick="wdw_cardEdition.modifyLists(this);" ondragstart="wdw_cardEdition.startDrag(event, this);"/>
</tree>
</hbox>
</groupbox>
</vbox>
</hbox>
</vbox>
<vbox>
<notificationbox id="resultNotifications" flex="1"/>
</vbox>
</vbox>
<spacer id="firstTabSpacer" flex="100"/>
</tabpanel>
......
......@@ -11,6 +11,8 @@ if ("undefined" == typeof(wdw_imageEdition)) {
}
var wdw_imageEdition = {
windowId: 0,
writeImageToFile: function (aFile, aDataValue, aExtension) {
// remove an existing image (overwrite)
......@@ -28,16 +30,24 @@ if ("undefined" == typeof(wdw_imageEdition)) {
},
getEditionPhotoTempFile: function (aExtension) {
var myFile = Services.dirsvc.get("TmpD", Components.interfaces.nsIFile);
myFile.append("cardbook");
var myFile = cardbookUtils.getTempFile("cardbook");
if (!myFile.exists() || !myFile.isDirectory()) {
// read and write permissions to owner and group, read-only for others.
myFile.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o774);
}
myFile.append(wdw_imageEdition.windowId);
myFile.append(cardbookUtils.getUUID() + "." + aExtension);
return myFile;
},
purgeEditionPhotoTempFile: function () {
var myFile = cardbookUtils.getTempFile("cardbook");
myFile.append(wdw_imageEdition.windowId);
if (myFile.exists()) {
myFile.remove(true);
}
},
clearImageCard: function () {
document.getElementById('defaultCardImage').src = "";
document.getElementById('imageForSizing').src = "";
......
......@@ -823,13 +823,18 @@ if ("undefined" == typeof(cardbookTypes)) {
var addedCards = [];
if (aCard.version == "4.0") {
for (var i = 0; i < aCard.member.length; i++) {
var uid = aCard.member[i].replace("urn:uuid:", "");
if (cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+uid]) {
var cardFound = cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+uid];
if (cardFound.isAList) {
addedCards.push([cardbookUtils.getName(cardFound), [""], cardFound.dirPrefId+"::"+cardFound.uid]);
} else {
addedCards.push([cardbookUtils.getName(cardFound), cardFound.emails, cardFound.dirPrefId+"::"+cardFound.uid]);
if (aCard.member[i].startsWith("mailto:")) {
var email = aCard.member[i].replace("mailto:", "");
addedCards.push(["", [email.toLowerCase()], ""]);
} else {
var uid = aCard.member[i].replace("urn:uuid:", "");
if (cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+uid]) {
var cardFound = cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+uid];
if (cardFound.isAList) {
addedCards.push([cardbookUtils.getName(cardFound), [""], cardFound.dirPrefId+"::"+cardFound.uid]);
} else {
addedCards.push([cardbookUtils.getName(cardFound), cardFound.emails, cardFound.dirPrefId+"::"+cardFound.uid]);
}
}
}
}
......@@ -842,12 +847,17 @@ if ("undefined" == typeof(cardbookTypes)) {
var header = aCard.others[i].substr(0,localDelim1);
var trailer = aCard.others[i].substr(localDelim1+1,aCard.others[i].length);
if (header == memberCustom) {
if (cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+trailer.replace("urn:uuid:", "")]) {
var cardFound = cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+trailer.replace("urn:uuid:", "")];
if (cardFound.isAList) {
addedCards.push([cardbookUtils.getName(cardFound), [""], cardFound.dirPrefId+"::"+cardFound.uid]);
} else {
addedCards.push([cardbookUtils.getName(cardFound), cardFound.emails, cardFound.dirPrefId+"::"+cardFound.uid]);
if (trailer.startsWith("mailto:")) {
var email = trailer.replace("mailto:", "");
addedCards.push(["", [email.toLowerCase()], ""]);
} else {
if (cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+trailer.replace("urn:uuid:", "")]) {
var cardFound = cardbookRepository.cardbookCards[aCard.dirPrefId+"::"+trailer.replace("urn:uuid:", "")];
if (cardFound.isAList) {
addedCards.push([cardbookUtils.getName(cardFound), [""], cardFound.dirPrefId+"::"+cardFound.uid]);
} else {
addedCards.push([cardbookUtils.getName(cardFound), cardFound.emails, cardFound.dirPrefId+"::"+cardFound.uid]);
}
}
}
}
......
......@@ -1468,48 +1468,6 @@ if ("undefined" == typeof(cardbookUtils)) {
return dataForExport;
},
getSelectedColumnsForList: function (aTree) {
var myTreeName = aTree.id.replace("Tree", "");
var listOfUid = [];
var numRanges = aTree.view.selection.getRangeCount();
var start = new Object();
var end = new Object();
for (var i = 0; i < numRanges; i++) {
aTree.view.selection.getRangeAt(i,start,end);
for (var j = start.value; j <= end.value; j++){
listOfUid.push([aTree.view.getCellText(j, {id: myTreeName + "Id"}), aTree.view.getCellText(j, {id: myTreeName + "Name"}), j]);
}
}
return listOfUid;
},
getSelectedCardsForList: function (aTree) {
var myTreeName = aTree.id.replace("Tree", "");
var listOfUid = [];
var numRanges = aTree.view.selection.getRangeCount();
var start = new Object();
var end = new Object();
for (var i = 0; i < numRanges; i++) {
aTree.view.selection.getRangeAt(i,start,end);
for (var j = start.value; j <= end.value; j++){
listOfUid.push(aTree.view.getCellText(j, {id: myTreeName + "Uid"}));
}
}
return listOfUid;
},
setSelectedCardsForList: function (aTree, aListOfUid) {
var myTreeName = aTree.id.replace("Tree", "");
for (let i = 0; i < aTree.view.rowCount; i++) {
for (let j = 0; j < aListOfUid.length; j++) {
if (aTree.view.getCellText(i, {id: myTreeName + "Id"}) == aListOfUid[j]) {
aTree.view.selection.rangedSelect(i,i,true);
break;
}
}
}
},
getSelectedCards: function () {
var myTree = document.getElementById('cardsTree');
var listOfSelectedCard = [];
......@@ -1961,14 +1919,6 @@ if ("undefined" == typeof(cardbookUtils)) {
return myFile;
},
purgeEditionPhotoTempFile: function () {
var myFile = Services.dirsvc.get("TmpD", Components.interfaces.nsIFile);
myFile.append("cardbook");
if (myFile.exists()) {
myFile.remove(true);
}
},
getFileExtension: function (aFile) {
var myFileArray = aFile.split("/");
var myFileArray1 = myFileArray[myFileArray.length-1].split("\\");
......@@ -2187,10 +2137,15 @@ if ("undefined" == typeof(cardbookUtils)) {
recursiveList.push(aList.fn);
if (aList.version == "4.0") {
for (var k = 0; k < aList.member.length; k++) {
var uid = aList.member[k].replace("urn:uuid:", "");
if (cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid]) {
var myTargetCard = cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid];
_getEmails(myTargetCard);
if (aList.member[k].startsWith("mailto:")) {
var email = aList.member[k].replace("mailto:", "");
emailResult.push(["", [email.toLowerCase()]]);
} else {
var uid = aList.member[k].replace("urn:uuid:", "");
if (cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid]) {
var myTargetCard = cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid];
_getEmails(myTargetCard);
}
}
}
} else if (aList.version == "3.0") {
......@@ -2201,9 +2156,15 @@ if ("undefined" == typeof(cardbookUtils)) {
var header = aList.others[k].substr(0,localDelim1);
var trailer = aList.others[k].substr(localDelim1+1,aList.others[k].length);
if (header == memberCustom) {
if (cardbookRepository.cardbookCards[aList.dirPrefId+"::"+trailer.replace("urn:uuid:", "")]) {
var myTargetCard = cardbookRepository.cardbookCards[aList.dirPrefId+"::"+trailer.replace("urn:uuid:", "")];
_getEmails(myTargetCard);
if (trailer.startsWith("mailto:")) {
var email = trailer.replace("mailto:", "");
emailResult.push(["", [email.toLowerCase()]]);
} else {
var uid = trailer.replace("urn:uuid:", "");
if (cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid]) {
var myTargetCard = cardbookRepository.cardbookCards[aList.dirPrefId+"::"+uid];
_getEmails(myTargetCard);
}
}
}
}
......
......@@ -167,10 +167,10 @@ if ("undefined" == typeof(wdw_csvTranslator)) {
},
displayListTrees: function (aTreeName) {
var availableCardsTreeView = {
var columnsTreeView = {
get rowCount() { return wdw_csvTranslator.cardbookeditlists[aTreeName].length; },
isContainer: function(idx) { return false },
canDrop: function(idx) { return (aTreeName == "addedColumns") },
canDrop: function(idx) { return true },
cycleHeader: function(idx) { return false },
isEditable: function(idx, column) { return false },
getCellText: function(idx, column) {
......@@ -182,7 +182,22 @@ if ("undefined" == typeof(wdw_csvTranslator)) {
}
}
}
document.getElementById(aTreeName + 'Tree').view = availableCardsTreeView;
document.getElementById(aTreeName + 'Tree').view = columnsTreeView;
},
getSelectedColumnsForList: function (aTree) {
var myTreeName = aTree.id.replace("Tree", "");
var listOfUid = [];
var numRanges = aTree.view.selection.getRangeCount();
var start = new Object();
var end = new Object();
for (var i = 0; i < numRanges; i++) {
aTree.view.selection.getRangeAt(i,start,end);
for (var j = start.value; j <= end.value; j++){
listOfUid.push([aTree.view.getCellText(j, {id: myTreeName + "Id"}), aTree.view.getCellText(j, {id: myTreeName + "Name"}), j]);
}
}
return listOfUid;
},
modifyLists: function (aMenuOrTree) {
......@@ -199,8 +214,8 @@ if ("undefined" == typeof(wdw_csvTranslator)) {
}
var myAvailableColumnsTree = document.getElementById('availableColumnsTree');
var myAddedColumnsTree = document.getElementById('addedColumnsTree');
var myAvailableColumns = cardbookUtils.getSelectedColumnsForList(myAvailableColumnsTree);
var myAddedColumns = cardbookUtils.getSelectedColumnsForList(myAddedColumnsTree);
var myAvailableColumns = wdw_csvTranslator.getSelectedColumnsForList(myAvailableColumnsTree);
var myAddedColumns = wdw_csvTranslator.getSelectedColumnsForList(myAddedColumnsTree);
switch (myAction) {
case "appendlistavailableColumnsTree":
for (var i = 0; i < myAvailableColumns.length; i++) {
......@@ -271,35 +286,36 @@ if ("undefined" == typeof(wdw_csvTranslator)) {
listOfUid.push(j+"::"+myId);
}
}
aEvent.dataTransfer.setData("text/plain", myTree.id+"::"+listOfUid.join("@@@@@"));
aEvent.dataTransfer.setData("text/plain", listOfUid.join("@@@@@"));
}
catch (e) {
wdw_cardbooklog.updateStatusProgressInformation("wdw_csvTranslator.startDrag error : " + e, "Error");
}
},
dragCards: function (aEvent) {
var myTree = document.getElementById('addedColumnsTree');
var myTarget = myTree.treeBoxObject.getRowAt(aEvent.clientX, aEvent.clientY);
dragCards: function (aEvent, aTreeName) {
var myData = aEvent.dataTransfer.getData("text/plain");
var localDelim1 = myData.indexOf("::",0);
var myTreeSource = myData.substr(0,localDelim1);
var myColumns = myData.substr(localDelim1+2,myData.length).split("@@@@@");
var myColumns = myData.split("@@@@@");
if (myTreeSource == "addedColumnsTree") {
if (aTreeName == "availableColumnsTree") {
for (var i = myColumns.length-1; i >= 0; i--) {
var myTempArray = myColumns[i].split("::");
var myIndex = myTempArray[0];
wdw_csvTranslator.cardbookeditlists.addedColumns.splice(myIndex,1);
wdw_csvTranslator.cardbookeditlists.addedColumns.splice(myTempArray[0], 1);
}
} else if (aTreeName == "addedColumnsTree") {
var myTree = document.getElementById('addedColumnsTree');
var myTarget = myTree.treeBoxObject.getRowAt(aEvent.clientX, aEvent.clientY);
for (var i = 0; i < myColumns.length; i++) {
var myTempArray = myColumns[i].split("::");
var myValue = myTempArray[1];
if (myTarget == -1) {
wdw_csvTranslator.cardbookeditlists.addedColumns.push([myValue, wdw_csvTranslator.getTranslatedField(myValue)]);
} else {
wdw_csvTranslator.cardbookeditlists.addedColumns.splice(myTarget, 0, [myValue, wdw_csvTranslator.getTranslatedField(myValue)]);
myTarget++;
}
}
}
for (var i = 0; i < myColumns.length; i++) {
var myTempArray = myColumns[i].split("::");
var myValue = myTempArray[1];
wdw_csvTranslator.cardbookeditlists.addedColumns.splice(myTarget, 0, [myValue, wdw_csvTranslator.getTranslatedField(myValue)]);
myTarget++;
}
wdw_csvTranslator.displayListTrees("addedColumns");
},
......
......@@ -53,13 +53,15 @@
<vbox flex="1">
<groupbox id="availableColumnsGroupbox" flex="1">
<caption id="availableColumnsGroupboxLabel" class="header"/>
<tree id="availableColumnsTree" class="cardbookTreeClass" flex="1" hidecolumnpicker="true">
<treecols id="availableColumnsTreeCols">
<treecol id="availableColumnsId" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left"/>
<treecol id="availableColumnsName" flex="1" persist="width ordinal hidden" style="text-align:left" hideheader="true"/>
</treecols>
<treechildren id="availableColumnsTreeChildren" ondblclick="wdw_csvTranslator.modifyLists(this);" ondragstart="wdw_csvTranslator.startDrag(event, this);"/>
</tree>
<hbox flex="1" ondragover="event.preventDefault();" ondrop="wdw_csvTranslator.dragCards(event, 'availableColumnsTree');">
<tree id="availableColumnsTree" class="cardbookTreeClass" flex="1" hidecolumnpicker="true">
<treecols id="availableColumnsTreeCols">
<treecol id="availableColumnsId" flex="1" persist="width ordinal hidden" hidden="true" style="text-align:left"/>
<treecol id="availableColumnsName" flex="1" persist="width ordinal hidden" style="text-align:left" hideheader="true"/>
</treecols>
<treechildren id="availableColumnsTreeChildren" ondblclick="wdw_csvTranslator.modifyLists(this);" ondragstart="wdw_csvTranslator.startDrag(event, this);"/>
</tree>
</hbox>
</groupbox>
</vbox>
<vbox flex="1" align="center">
......@@ -79,13 +81,15 @@
<vbox flex="1">
<groupbox id="addedColumnsGroupbox" flex="1">
<caption id="addedColumnsGroupboxLabel" class="header"/>
<tree id="addedColumnsTree" class="cardbookTreeClass" flex="1" hidecolumnpicker="true">
<treecols id="addedColumnsTreeCols">
<treecol id="addedColumnsId" flex="1" persist="width ordinal hidden" hidden="true"/>
<treecol id="addedColumnsName" flex="1" persist="width ordinal hidden" style="text-align:left" hideheader="true"/>
</treecols>
<treechildren id="addedColumnsTreeChildren" ondblclick="wdw_csvTranslator.modifyLists(this);" ondragstart="wdw_csvTranslator.startDrag(event, this);" ondrop="wdw_csvTranslator.dragCards(event);"/>
</tree>
<hbox flex="1" ondragover="event.preventDefault();" ondrop="wdw_csvTranslator.dragCards(event, 'addedColumnsTree');">
<tree id="addedColumnsTree" class="cardbookTreeClass" flex="1" hidecolumnpicker="true">
<treecols id="addedColumnsTreeCols">
<treecol id="addedColumnsId" flex="1" persist="width ordinal hidden" hidden="true"/>
<treecol id="addedColumnsName" flex="1" persist="width ordinal hidden" style="text-align:left" hideheader="true"/>
</treecols>
<treechildren id="addedColumnsTreeChildren" ondblclick="wdw_csvTranslator.modifyLists(this);" ondragstart="wdw_csvTranslator.startDrag(event, this);"/>
</tree>
</hbox>
</groupbox>
</vbox>
<vbox id="foundColumnsVBox" flex="1">
......
......@@ -79,10 +79,15 @@ if ("undefined" == typeof(cardbookListConversion)) {
this.recursiveList.push(names.value[i]);
if (myCard.version == "4.0") {
for (var k = 0; k < myCard.member.length; k++) {