function getDefaultContentTypeValues()

in tree/master/cloud/src/solution/Microsoft.Legal.MatterCenter.Web/wwwroot/app/matter/createMatter.controller.js [2432:2639]


            function getDefaultContentTypeValues(contentTypeValue) {
                var returnedValue;
                switch (contentTypeValue) {
                    case "contenttypes":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("contenttypes" == contentTypeValue) {
                                    if (-1 == arrContents.indexOf(arrContentTypes[nCount].documentTemplates)) {
                                        arrContents.push(arrContentTypes[nCount].documentTemplates);
                                        var additionalMatterPropSettingName = configs.taxonomy.matterProvisionExtraPropertiesContentType;
                                        var temp = arrContentTypes[nCount];
                                        if (temp[additionalMatterPropSettingName] && temp[additionalMatterPropSettingName] != "") {
                                            if (-1 == arrContents.indexOf(temp[additionalMatterPropSettingName])) {
                                                arrContents.push(temp[additionalMatterPropSettingName]);
                                                cm.matterAdditionalFieldsContentTypeName = temp[additionalMatterPropSettingName];
                                            }
                                        }
                                    }

                                    var arrAssociatedDocumentTemplates = arrContentTypes[nCount].documentTemplateNames.split(";");
                                    for (var iIterator = 0; iIterator < arrAssociatedDocumentTemplates.length; iIterator++) {
                                        if (-1 == arrContents.indexOf(arrAssociatedDocumentTemplates[iIterator])) {
                                            arrContents.push(arrAssociatedDocumentTemplates[iIterator]);
                                        }
                                    }
                                }
                            }
                        }
                        returnedValue = arrContents;
                        break;
                    case "defaultcontenttype":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("defaultcontenttype" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].documentTemplates;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level1Name":

                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level1Name" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelOneTermName;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level1Id":

                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level1Id" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelOneTermId;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;

                    case "level2Name":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level2Name" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelTwoTermName;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level2Id":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level2Id" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelTwoTermId;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level3Name":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level3Name" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelThreeTermName;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level3Id":

                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level3Id" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelThreeId;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level4Name":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level4Name" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelFourTermName;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level4Id":

                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level4Id" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelFourId;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level5Name":
                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level5Name" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelFiveTermName;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;
                    case "level5Id":

                        var oPageOneData = JSON.parse(localStorage.oPageOneData), nCount = 0, nLength, arrContentTypes, arrContents = [], defaultContentType = "";
                        if (oPageOneData && oPageOneData.oSelectedDocumentTypeLawTerms) {
                            arrContentTypes = oPageOneData.oSelectedDocumentTypeLawTerms;
                            nLength = arrContentTypes.length;
                            for (nCount = 0; nCount < nLength; nCount++) {
                                if ("level5Id" == contentTypeValue) {
                                    if (arrContentTypes[nCount].primaryMatterType === true) {
                                        defaultContentType = arrContentTypes[nCount].levelFiveId;
                                    }
                                }
                            }
                        }
                        returnedValue = defaultContentType;
                        break;

                }
                return returnedValue;
            }