Commit 9451b879 authored by CardBook's avatar CardBook

version 26.9

parent 5f9c9b78
......@@ -600,7 +600,13 @@ if ("undefined" == typeof(wdw_cardEdition)) {
var aFollowLink = false;
cardbookUtils.displayCard(aCard, aReadOnly, aFollowLink);
// specific
document.getElementById('noteTextBox').removeAttribute('readonly');
document.getElementById('noteTextBox').value = aCard.note;
document.getElementById('categoriesTextBox').removeAttribute('readonly');
document.getElementById('categoriesTextBox').value = cardbookUtils.formatCategories(aCard.categories);
wdw_cardEdition.loadCategories(aCard.categories);
document.getElementById('photoExtensionTextBox').value = aCard.photo.extension;
if (!aReadOnly) {
cardbookTypes.display40(aCard.version);
......
......@@ -5,7 +5,8 @@ if ("undefined" == typeof(cardbookElementTools)) {
var cardbookElementTools = {
deleteRowsType: function (aType) {
cardbookElementTools.deleteRows(aType + 'Groupbox');
cardbookElementTools.deleteRows(aType + 'classicalGroupbox');
cardbookElementTools.deleteRows(aType + 'modernGroupbox');
},
deleteRows: function (aObjectName) {
......@@ -59,6 +60,58 @@ if ("undefined" == typeof(cardbookElementTools)) {
return aHBox;
},
addGrid: function (aType, aParent) {
var aGrid = document.createElement('grid');
aParent.appendChild(aGrid);
aGrid.setAttribute('id', aType + '_grid');
aGrid.setAttribute('flex', '1');
return aGrid;
},
addGridColumns: function (aType, aParent, aParameters) {
var aGridColumns = document.createElement('columns');
aParent.appendChild(aGridColumns);
aGridColumns.setAttribute('id', aType + '_gridColumns');
for (var prop in aParameters) {
aGridColumns.setAttribute(prop, aParameters[prop]);
}
return aGridColumns;
},
addGridRows: function (aType, aParent, aParameters) {
var aGridRows = document.createElement('rows');
aParent.appendChild(aGridRows);
aGridRows.setAttribute('id', aType + '_gridRows');
for (var prop in aParameters) {
aGridRows.setAttribute(prop, aParameters[prop]);
}
return aGridRows;
},
addGridColumn: function (aType, aIndex, aParent, aParameters) {
var aGridColumn = document.createElement('column');
aParent.appendChild(aGridColumn);
aGridColumn.setAttribute('id', aType + '_' + aIndex + '_gridColumn');
for (var prop in aParameters) {
aGridColumn.setAttribute(prop, aParameters[prop]);
}
return aGridColumn;
},
addGridRow: function (aType, aIndex, aParent, aParameters) {
var aGridRow = document.createElement('row');
aParent.appendChild(aGridRow);
aGridRow.setAttribute('id', aType + '_' + aIndex + '_gridRow');
for (var prop in aParameters) {
aGridRow.setAttribute(prop, aParameters[prop]);
}
return aGridRow;
},
addKeyTextbox: function (aParent, aId, aValue, aParameters, aVersion, aIndex) {
var myKexTextBox = cardbookElementTools.addTextbox(aParent, aId, aValue, aParameters);
myKexTextBox.version = aVersion;
......
......@@ -669,18 +669,22 @@ if ("undefined" == typeof(cardbookTypes)) {
if (aCardValue.join(" ") == "") {
return;
}
var strBundle = document.getElementById("cardbook-strings");
var aOrigBox = document.getElementById(aType + 'Groupbox');
var panesView = cardbookPreferences.getStringPref("extensions.cardbook.panesView");
var aOrigBox = document.getElementById(aType + panesView + 'Groupbox');
if (aIndex == 0) {
cardbookElementTools.addCaption(aType, aOrigBox);
}
var aRow = document.createElement('row');
aOrigBox.appendChild(aRow);
aRow.setAttribute('id', aType + '_' + aIndex + '_row');
aRow.setAttribute('flex', '1');
aRow.setAttribute('align', 'start');
var aGrid = cardbookElementTools.addGrid(aType, aOrigBox);
var aGridColumns = cardbookElementTools.addGridColumns(aType, aGrid, {flex: '1'});
cardbookElementTools.addGridColumn(aType, 0, aGridColumns);
cardbookElementTools.addGridColumn(aType, 1, aGridColumns);
cardbookElementTools.addGridColumn(aType, 2, aGridColumns);
cardbookElementTools.addGridColumn(aType, 3, aGridColumns, {flex: '1'});
var aGridRows = cardbookElementTools.addGridRows(aType, aGrid);
var aRow = cardbookElementTools.addGridRow(aType, aIndex, aGridRows, {align: 'start'});
var myInputTypes = [];
myInputTypes = cardbookUtils.getOnlyTypesFromTypes(aInputTypes);
var myDisplayedTypes = [];
......
......@@ -789,7 +789,7 @@ if ("undefined" == typeof(cardbookUtils)) {
clearCard: function () {
var fieldArray = [ "fn", "lastname", "firstname", "othername", "prefixname", "suffixname", "nickname", "gender",
"bday", "birthplace", "anniversary", "deathdate", "deathplace", "note", "mailer", "geo", "sortstring", "class1", "tz",
"bday", "birthplace", "anniversary", "deathdate", "deathplace", "mailer", "geo", "sortstring", "class1", "tz",
"agent", "key", "prodid", "uid", "version", "dirPrefId", "cardurl", "rev", "etag", "others", "vcard",
"photolocalURI", "logolocalURI", "soundlocalURI", "photoURI", "logoURI", "soundURI" ];
for (var i = 0; i < fieldArray.length; i++) {
......@@ -797,6 +797,15 @@ if ("undefined" == typeof(cardbookUtils)) {
document.getElementById(fieldArray[i] + 'TextBox').value = "";
}
}
var fieldArray = [ "note" ];
for (var i = 0; i < fieldArray.length; i++) {
if (document.getElementById(fieldArray[i] + 'modernTextBox')) {
document.getElementById(fieldArray[i] + 'modernTextBox').value = "";
}
if (document.getElementById(fieldArray[i] + 'classicalTextBox')) {
document.getElementById(fieldArray[i] + 'classicalTextBox').value = "";
}
}
cardbookElementTools.deleteRows('orgRows');
......@@ -822,18 +831,13 @@ if ("undefined" == typeof(cardbookUtils)) {
displayCard: function (aCard, aReadOnly, aFollowLink) {
var fieldArray = [ "fn", "lastname", "firstname", "othername", "prefixname", "suffixname", "nickname",
"birthplace", "deathplace", "note", "mailer", "geo", "sortstring",
"birthplace", "deathplace", "mailer", "geo", "sortstring",
"class1", "tz", "agent", "key", "prodid", "uid", "version", "dirPrefId", "cardurl", "rev", "etag" ];
for (var i = 0; i < fieldArray.length; i++) {
if (document.getElementById(fieldArray[i] + 'TextBox') && aCard[fieldArray[i]]) {
document.getElementById(fieldArray[i] + 'TextBox').value = aCard[fieldArray[i]];
if (aReadOnly) {
document.getElementById(fieldArray[i] + 'TextBox').setAttribute('readonly', 'true');
if (fieldArray[i] === "note") {
var re = /[\n\u0085\u2028\u2029]|\r\n?/;
var noteArray = aCard[fieldArray[i]].split(re);
document.getElementById(fieldArray[i] + 'TextBox').setAttribute('rows', noteArray.length);
}
} else {
document.getElementById(fieldArray[i] + 'TextBox').removeAttribute('readonly');
}
......@@ -883,13 +887,6 @@ if ("undefined" == typeof(cardbookUtils)) {
wdw_imageEdition.displayImageCard(aCard, !aReadOnly);
wdw_cardEdition.display40(aCard.version, aReadOnly);
document.getElementById('categoriesTextBox').value = cardbookUtils.formatCategories(aCard.categories);
if (aReadOnly) {
document.getElementById('categoriesTextBox').setAttribute('readonly', 'true');
} else {
document.getElementById('categoriesTextBox').removeAttribute('readonly');
}
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
if (aReadOnly) {
......@@ -921,9 +918,13 @@ if ("undefined" == typeof(cardbookUtils)) {
};
for (var i in nullableFields) {
var found = false;
var found1 = false;
var found2 = false;
for (var j = 0; j < nullableFields[i].length; j++) {
var row = document.getElementById(nullableFields[i][j] + 'Row');
var textbox = document.getElementById(nullableFields[i][j] + 'TextBox');
var textbox1 = document.getElementById(nullableFields[i][j] + 'classicalTextBox');
var textbox2 = document.getElementById(nullableFields[i][j] + 'modernTextBox');
var label = document.getElementById(nullableFields[i][j] + 'Label');
if (textbox) {
var myTestValue = "";
......@@ -955,6 +956,66 @@ if ("undefined" == typeof(cardbookUtils)) {
}
}
}
if (textbox1) {
var myTestValue = "";
if (textbox1.value) {
myTestValue = textbox1.value;
} else {
myTestValue = textbox1.getAttribute('value');
}
if (myTestValue != "") {
if (row) {
row.removeAttribute('hidden');
}
if (textbox1) {
textbox1.removeAttribute('hidden');
}
if (label) {
label.removeAttribute('hidden');
}
found1 = true;
} else {
if (row) {
row.setAttribute('hidden', 'true');
}
if (textbox1) {
textbox1.setAttribute('hidden', 'true');
}
if (label) {
label.setAttribute('hidden', 'true');
}
}
}
if (textbox2) {
var myTestValue = "";
if (textbox2.value) {
myTestValue = textbox2.value;
} else {
myTestValue = textbox2.getAttribute('value');
}
if (myTestValue != "") {
if (row) {
row.removeAttribute('hidden');
}
if (textbox2) {
textbox2.removeAttribute('hidden');
}
if (label) {
label.removeAttribute('hidden');
}
found2 = true;
} else {
if (row) {
row.setAttribute('hidden', 'true');
}
if (textbox2) {
textbox2.setAttribute('hidden', 'true');
}
if (label) {
label.setAttribute('hidden', 'true');
}
}
}
}
if (cardbookRepository.customFields[i]) {
for (var j = 0; j < cardbookRepository.customFields[i].length; j++) {
......@@ -973,6 +1034,22 @@ if ("undefined" == typeof(cardbookUtils)) {
groupbox.setAttribute('hidden', 'true');
}
}
var groupbox1 = document.getElementById(i + 'classicalGroupbox');
if (groupbox1) {
if (found1) {
groupbox1.removeAttribute('hidden');
} else {
groupbox1.setAttribute('hidden', 'true');
}
}
var groupbox2 = document.getElementById(i + 'modernGroupbox');
if (groupbox2) {
if (found2) {
groupbox2.removeAttribute('hidden');
} else {
groupbox2.setAttribute('hidden', 'true');
}
}
}
var groupbox = document.getElementById('orgGroupbox');
......@@ -982,15 +1059,15 @@ if ("undefined" == typeof(cardbookUtils)) {
groupbox.setAttribute('hidden', 'true');
}
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
var box = document.getElementById(typesList[i] + 'Groupbox');
if (document.getElementById(typesList[i] + '_0_valueBox')) {
box.removeAttribute('hidden');
} else {
box.setAttribute('hidden', 'true');
}
}
// test var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
// test for (var i in typesList) {
// test var box = document.getElementById(typesList[i] + panesView + 'Groupbox');
// test if (document.getElementById(typesList[i] + '_0_valueBox')) {
// test box.removeAttribute('hidden');
// test } else {
// test box.setAttribute('hidden', 'true');
// test }
// test }
},
setCalculatedFieldsWithoutRev: function(aCard) {
......
......@@ -84,6 +84,10 @@ if ("undefined" == typeof(ovl_cardbookLayout)) {
document.getElementById("resultsSplitterModern").hidden=false;
document.getElementById("resultsSplitterClassical").hidden=true;
}
if (cardbookRepository.cardbookCards[document.getElementById('dirPrefIdTextBox').value+"::"+document.getElementById('uidTextBox').value]) {
var myCard = cardbookRepository.cardbookCards[document.getElementById('dirPrefIdTextBox').value+"::"+document.getElementById('uidTextBox').value];
wdw_cardbook.displayCard(myCard);
}
}
}
......
......@@ -216,6 +216,26 @@
</hbox>
</groupbox>
</hbox>
<hbox flex="1">
<groupbox id="categoriesclassicalGroupbox">
<caption label="&categoriesGroupboxLabel;" class="header"/>
<hbox flex="1">
<image id="dummyCatclassicalPrefBox" class="cardbookNoPrefStarClass"/>
<textbox id="categoriesclassicalTextBox" flex="1"/>
</hbox>
</groupbox>
</hbox>
<hbox flex="1">
<groupbox id="noteclassicalGroupbox" flex="1">
<caption label="&noteTabLabel;" class="header"/>
<hbox flex="1">
<image id="dummyNoteclassicalPrefBox" class="cardbookNoPrefStarClass"/>
<vbox flex="1">
<textbox id="noteclassicalTextBox" multiline="true"/>
</vbox>
</hbox>
</groupbox>
</hbox>
</vbox>
<vbox id="imageBox" align="center" width="170px">
<hbox align="center" height="170px">
......@@ -223,35 +243,32 @@
<image id="defaultCardImage"/>
</hbox>
</vbox>
<vbox align="center" flex="1">
<groupbox id="emailclassicalGroupbox" flex="1"/>
<groupbox id="telclassicalGroupbox" flex="1"/>
<groupbox id="adrclassicalGroupbox" flex="1"/>
<groupbox id="imppclassicalGroupbox" flex="1"/>
<groupbox id="urlclassicalGroupbox" flex="1"/>
</vbox>
</hbox>
<hbox align="center" flex="1">
<vbox flex="1">
<groupbox id="categoriesGroupbox">
<groupbox id="categoriesmodernGroupbox">
<caption label="&categoriesGroupboxLabel;" class="header"/>
<hbox flex="1">
<image id="dummyCatPrefBox" class="cardbookNoPrefStarClass"/>
<textbox id="categoriesTextBox" flex="1"/>
<image id="dummyCatmodernPrefBox" class="cardbookNoPrefStarClass"/>
<textbox id="categoriesmodernTextBox" flex="1"/>
</hbox>
</groupbox>
</vbox>
</hbox>
<hbox flex="1">
<vbox flex="1">
<grid align="center" flex="1">
<columns>
<column/>
<column/>
<column/>
<column flex="1"/>
</columns>
<rows>
<groupbox id="emailGroupbox" flex="1"/>
<groupbox id="telGroupbox" flex="1"/>
<groupbox id="adrGroupbox" flex="1"/>
<groupbox id="imppGroupbox" flex="1"/>
<groupbox id="urlGroupbox" flex="1"/>
</rows>
</grid>
<groupbox id="emailmodernGroupbox" flex="1"/>
<groupbox id="telmodernGroupbox" flex="1"/>
<groupbox id="adrmodernGroupbox" flex="1"/>
<groupbox id="imppmodernGroupbox" flex="1"/>
<groupbox id="urlmodernGroupbox" flex="1"/>
</vbox>
</hbox>
<hbox id="listGroupbox" flex="1">
......@@ -268,12 +285,12 @@
</vbox>
</hbox>
<hbox flex="1">
<groupbox id="noteGroupbox" flex="1">
<groupbox id="notemodernGroupbox" flex="1">
<caption label="&noteTabLabel;" class="header"/>
<hbox flex="1">
<image id="dummyNotePrefBox" class="cardbookNoPrefStarClass"/>
<image id="dummyNotemodernPrefBox" class="cardbookNoPrefStarClass"/>
<vbox flex="1">
<textbox id="noteTextBox" multiline="true"/>
<textbox id="notemodernTextBox" multiline="true"/>
</vbox>
</hbox>
</groupbox>
......
......@@ -89,7 +89,7 @@ if ("undefined" == typeof(ovl_synchro)) {
prefs.setCharPref("accountsShown", "all");
prefs.setCharPref("accountShown", "");
prefs.setCharPref("uncategorizedCards", "");
prefs.setCharPref("addonVersion", "26.8");
prefs.setCharPref("addonVersion", "26.9");
},
lEventTimerSync : { notify: function(lTimerSync) {
......
......@@ -161,7 +161,8 @@ if ("undefined" == typeof(wdw_cardbook)) {
clearCard: function () {
cardbookUtils.clearCard();
document.getElementById('categoriesTextBox').value = "";
document.getElementById('categoriesclassicalTextBox').value = "";
document.getElementById('categoriesmodernTextBox').value = "";
cardbookUtils.adjustFields();
},
......@@ -170,6 +171,14 @@ if ("undefined" == typeof(wdw_cardbook)) {
cardbookUtils.displayCard(aCard, true, true);
document.getElementById('vcardTextBox').value = cardbookUtils.cardToVcardData(aCard, false);
document.getElementById('vcardTextBox').setAttribute('readonly', 'true');
var panesView = cardbookPreferences.getStringPref("extensions.cardbook.panesView");
document.getElementById('categories' + panesView + 'TextBox').value = cardbookUtils.formatCategories(aCard.categories);
document.getElementById('categories' + panesView + 'TextBox').setAttribute('readonly', 'true');
document.getElementById('note' + panesView + 'TextBox').value = aCard.note;
document.getElementById('note' + panesView + 'TextBox').setAttribute('readonly', 'true');
var re = /[\n\u0085\u2028\u2029]|\r\n?/;
var noteArray = aCard.note.split(re);
document.getElementById('note' + panesView + 'TextBox').setAttribute('rows', noteArray.length);
cardbookUtils.adjustFields();
},
......
......@@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>cardbook@vigneau.philippe</em:id>
<em:name>CardBook</em:name>
<em:version>26.8</em:version>
<em:version>26.9</em:version>
<em:type>2</em:type>
<em:description>vCard Address Book</em:description>
<em:creator>Philippe Vigneau</em:creator>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment