Source

main / Source / WebService / Web.Admin / Views / Home / Index.cshtml

Full commit
Naethra D ba1cb57 













































































































@model DataUp.Web.Admin.ViewModel.RepositoryListViewModel
@{
    ViewBag.Title = "Repository Details";
    ViewContext.FormContext = new FormContext();
}
<script type="text/javascript">
    $(function () {
        $(".btnEdit").bind("click", function (event) {
            var formReference = $(this).parents("form");
            var action = formReference.attr("action");
            event.preventDefault();
            $('#frmRepository').validate();

            if ($('#frmRepository').valid()) {
                var repoId = $('#repositoryId').val();
                var name = $("#repositoryName").val();
                var typeId = $("#repositoryTypeId").val();
                var identifierUrl = $("#identifierUrl").val();
                var postFileUrl = $("#postFileUrl").val();
                var username = $("#userName").val();
                var password = $("#passWord").val();
                var userAgreement = $("#userAgreement").val();

                $.post('/Home/Validate', { repositoryName: name, repositoryId: repoId, repositoryTypeId: typeId }, function (value) {
                    if (value === "True") {
                        $.post('/Home/Add', { RepositoryId: repoId, RepositoryName: name, SelectedRepositoryTypeId: typeId, IdentifierUrl: identifierUrl, PostFileUrl: postFileUrl, UserName: username, Password: password, UserAgreement: userAgreement }, function (returnedList) {
                            $("#documentList").html(returnedList);
                            $('.savedSuccessfullydiv').html('');
                            $('.savedSuccessfullydiv').html("Saved successfully");
                            $("#successfullySavedPopup").show(); 
                           
                            $('#repositoryId').val('0');
                            $(".editListPopUp").hide();
                            $('#detailsError').hide();
                        });
                    }
                    else {
                        $('#detailsError').show();
                    }
                });
            }
        });

        $('.editRepository input[type=button][value=cancel]').click(function () {
            $("#editRepositoryPopup").hide();
        });

        $('.addRepository input[type=button][value=cancel]').click(function () {
            $("#addRepositoryPopup").hide();
        });
        $(".popupButton").live("click", function () {
            $("#successfullySavedPopup").hide(); 
        
    });
        $(".editReposLink").live("click", function () {
            var Id = $(this).siblings('input[type=hidden]').val();
            $('#repositoryId').val(Id);
            var formReference = $(this).parents("form");
            var action = formReference.attr("action");

            $.post(action, { repositoryId: Id }, function (returnedList) {
                $("#editRepoPopUp").html(returnedList);
                $(".editListPopUp").show();
                admin.validateType($('#repositoryTypeId'));
            });
            $('#detailsError').hide();
        });

        $(".deleteReposLink").live("click", function () {
            var Id = $(this).next('input[type=hidden]').val();
            if (confirm($(this).attr("errormessage").replace("\\n", "\n"))) {
                var formReference = $(this).parents("form");
                var action = formReference.attr("action");

                $.post(action, { repositoryId: Id }, function (returnedList) {
                    $("#documentList").html(returnedList);
                });
            }
        });
    });

</script>
<div id="documentList">
    @{Html.RenderPartial("_RepositoryList", Model);}
</div>
<div id="editRepositoryPopup" class="popupWraper editListPopUp" style="display: none">
    <div class="popupHolder repositoryPopup editRepository">
        <h2>
            REPOSITORY DETAILS</h2>
        <div class="headLine">
        </div>
        @{
            var model = new DataUp.Web.Admin.ViewModel.RepositoryViewModel();
            if (Model.RepositoriesList.Count > 0)
            {
                model.RepositoryTypes = Model.RepositoriesList[0].RepositoryTypes;
            }
        }
        <div id='editRepoPopUp'>
            @{
                Html.RenderPartial("_Edit", model);
            }
        </div>
        <div class="btnHolder">
            <input type="submit" value="SAVE" class="btnEdit " />
            <input type="button" class="btnCancel" value="cancel" />
        </div>
        <div id="detailsError" class="mandatory paddingTop5px" style="display: none">
            The Repository Name exists. Please try again.</div>
    </div>
</div>