Changeset 6722b7


Ignore:
Timestamp:
Nov 28, 2012, 9:53:13 AM (9 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
49c74e
Parents:
8aa4c2
Message:

slightly fixed, but still broken in multiple contexts (cleanup required)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • content/vI_storage.js

    r8aa4c2 r6722b7  
    6565            Log.debug("awSetInputAndPopupValue '" + inputElem.id + "'");
    6666            storage.original_functions.awSetInputAndPopupValue(inputElem, inputValue, popupElem, popupValue, rowNumber);
    67             storage.updateVIdentityFromStorage(inputElem);
     67            storage.updateVIdentityFromStorage(inputElem, document);
    6868        }
    6969    },
     
    7373        if (!element || ! element.id.match(/^addressCol2*/)) return;
    7474        Log.debug("awOnBlur '" + element.id + "'");
    75         storage.updateVIdentityFromStorage(element);
     75        storage.updateVIdentityFromStorage(element, document);
    7676        storage.focusedElement = null;
    7777    },
     
    8484    awPopupOnCommand : function (element) {
    8585        Log.debug("awPopupOnCommand '" + element.id + "'");
    86         storage.updateVIdentityFromStorage(document.getElementById(element.id.replace(/^addressCol1/,"addressCol2")));
     86        storage.updateVIdentityFromStorage(document.getElementById(element.id.replace(/^addressCol1/,"addressCol2")), document);
    8787        if (element.selectedItem.getAttribute("value") == "addr_reply") // if reply-to is manually entered disable AutoReplyToSelf
    8888            document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel").setAttribute("hidden", "true");
     
    145145   
    146146    firstUsedInputElement : null,   // this stores the first Element for which a Lookup in the Storage was successfull
    147     updateVIdentityFromStorage: function(inputElement) {
     147    updateVIdentityFromStorage: function(inputElement, refdocument) {
    148148        if (!vI.vIprefs.get("storage"))
    149149            { Log.debug("Storage deactivated"); return; }
    150150        Log.debug("updateVIdentityFromStorage()");
    151 //      error: document is null in following line -- XXXXXXXXX
    152         try {
    153           var recipientType = document.getElementById(inputElement.id.replace(/^addressCol2/,"addressCol1"))
     151    Log.debug(refdocument);
     152    Log.debug(refdocument.id);
     153    var recipientType = refdocument.getElementById(inputElement.id.replace(/^addressCol2/,"addressCol1"))
    154154            .selectedItem.getAttribute("value");
    155         }
    156         catch(e) {
    157           Log.debug("#### something went wrong, document seems to be null\n");
    158           Log.debug("inputElement.id " + inputElement.id);
    159           return;
    160         }
    161         var row = inputElement.id.replace(/^addressCol2#/,"")
     155
     156    var row = inputElement.id.replace(/^addressCol2#/,"")
    162157        if (recipientType == "addr_reply" || recipientType == "addr_followup" || storage.__isDoBcc(row)) {
    163158            // reset firstUsedInputElement if recipientType was changed (and don't care about doBcc fields)
     
    180175        // firstUsedInputElement was set before and we are not editing the same
    181176        var isNotFirstInputElement = (storage.firstUsedInputElement && storage.firstUsedInputElement != inputElement)
    182         var currentIdentity = document.getElementById("virtualIdentityExtension_msgIdentityClone").identityData
     177        var currentIdentity = refdocument.getElementById("virtualIdentityExtension_msgIdentityClone").identityData
    183178        var storageResult = storage._rdfDatasourceAccess.updateVIdentityFromStorage(inputElement.value, recipientType,
    184             currentIdentity, document.getElementById("virtualIdentityExtension_msgIdentityClone").vid, isNotFirstInputElement, window);
     179            currentIdentity, refdocument.getElementById("virtualIdentityExtension_msgIdentityClone").vid, isNotFirstInputElement, window);
    185180       
    186181        if (storageResult.identityCollection.number == 0) return; // return if there was no match
     
    193188            for (var j = 0; j < storageResult.identityCollection.number; j++) {
    194189                Log.debug("updateVIdentityFromStorage adding: " + storageResult.identityCollection.identityDataCollection[j].combinedName);
    195                 let menuItem = document.getElementById("virtualIdentityExtension_msgIdentityClone")
     190                let menuItem = refdocument.getElementById("virtualIdentityExtension_msgIdentityClone")
    196191                  .addIdentityToCloneMenu(storageResult.identityCollection.identityDataCollection[j])
    197192                if (!newMenuItem) newMenuItem = menuItem;
     
    200195        if (storageResult.result == "accept") {
    201196            Log.debug("updateVIdentityFromStorage selecting: " + storageResult.identityCollection.identityDataCollection[0].combinedName);
    202             document.getElementById("virtualIdentityExtension_msgIdentityClone").selectedMenuItem = newMenuItem;
    203             if (document.getElementById("virtualIdentityExtension_msgIdentityClone").vid)
     197            refdocument.getElementById("virtualIdentityExtension_msgIdentityClone").selectedMenuItem = newMenuItem;
     198            if (refdocument.getElementById("virtualIdentityExtension_msgIdentityClone").vid)
    204199                vI.StorageNotification.info(storage.stringBundle.GetStringFromName("vident.smartIdentity.vIStorageUsage") + ".");
    205200        }
     
    207202   
    208203    __isDoBcc : function(row) {
    209         var recipientType = awGetPopupElement(row).selectedItem.getAttribute("value");
     204        var recipientType = storage.awGetPopupElement(row).selectedItem.getAttribute("value");
    210205        if (recipientType != "addr_bcc" || !getCurrentIdentity().doBcc) return false
    211206
     
    213208
    214209        for (var index = 0; index < doBccArray.count; index++ ) {
    215             if (doBccArray.StringAt(index) == awGetInputElement(row).value) {
     210            if (doBccArray.StringAt(index) == storage.awGetInputElement(row).value) {
    216211                Log.debug("ignoring doBcc field '" +
    217212                    doBccArray.StringAt(index));
Note: See TracChangeset for help on using the changeset viewer.