Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

CKEditor goes into read only mode - RapidSpell Web ASP.NET - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
avsln
#1 Posted : Tuesday, February 25, 2014 10:16:21 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
I have a plugin for RapidSpell on my toolbar in CKEditor 4. The text area that CKEditor is converting to a Rich Text box is located on an MVC partial page. Our functionality is designed so that when the user clicks save, it saves the data and redraws the editor so that the user can enter more data.

Everything works fine until I use the spellchecker. Once I click on the spell checker and click Save, when the app redraws the CKEditor, it sets it to read only mode. When we click on any of the toolbar items that actually interact with the text area (select all, spell check etc.) it goes into a read-write mode again.

I tried using other toolbar items alone before clicking save and this behaviour does not occur. So I am thinking something in the plugin mechanism is holding on to the editor. Has anyone experienced this? What can I do to get it working as expected again.
Jim
#2 Posted : Wednesday, February 26, 2014 1:17:25 AM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Sorry the only way we can help is with a page that reproduces it please.

Thanks
Jim

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


avsln
#3 Posted : Wednesday, February 26, 2014 2:43:25 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Jim,

How do I send you the code. There seems to be no option for attaching files. Also my code is dependant on a lot of database pieces. Do you just want the UI code?
avsln
#4 Posted : Wednesday, February 26, 2014 3:32:12 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Here are copies of my files. Please let me know if you need something more. I can also give you the code for my plugin if you need it.

Index.cshtml
Code:
@model Bts.Claimtrak.Models.Claim.Note.INoteIndexViewModel

<script type="text/javascript" src="/Library/Scripts/ckeditor4/ckeditor.js"></script>
<script type="text/javascript" src="/Library/Scripts/ckeditor4/adapters/jquery.js"></script>
<script src='@Url.Content("/library/Scripts/keyoti/RapidSpell-DIALOG.js")'></script>
<script src='@Url.Content("/library/Scripts/keyoti/RapidSpell-AYT.js")'></script>
<script src='@Url.Content("/Library/Scripts/ckeditor4/plugins/spell/plugin.js")'></script>

@{
    if(Model.ClaimNumber != null)
    {
        ViewBag.Title = Model.ClaimNumber + "-" + Model.InsuredName;
    }
}

<div id="claimNotes" class="tabified">
    @section contentHeader {
    @if (Model.ClaimId != Guid.Empty)
    {
        <h1>@Model.ClaimNumber - @Model.InsuredName</h1>
    }
    <div id="tabClaimNotes">
    <ul>
        <li><a href="#tabs-1">Notes</a></li>
     
        <li><a href="#tabs-2">History</a></li>
    </ul>
    </div>
    }
   
   
   
    @if (Model.ClaimId == Guid.Empty)
    {
        <script>
            ShowPageError("Claim not found.");
        </script>
    }
    else
    {
        <div id="tabs-1">
            <div id="noteCompanyId" style="display:none;">@ViewBag.CompanyId</div>
            <div id="NoteHeader" style="display:none;">
                <div id="createTitle" style="width:40%; cursor:pointer;"><i id="createTitleIcon" class="fa fa-caret-down" style="float:left;margin:.2em .3em 0 0;"></i><h2><b>Create Note</b></h2></div>
                <hr />
            </div>
            @Html.HiddenFor(model=>model.ClaimNumber)
            @Html.HiddenFor(model => model.ClaimId)
           @Html.HiddenFor(model => model.LineOfBusinessId)
            <div id="CreateNote" style="min-height:25em;">
               <img src="/library/images/indicator.gif" title="processing" />
            </div>
           
            <br />
            <br />
            <div id="ViewNotes" style="min-height:25em;">
               @Html.Partial("ViewNotes", Model.ClaimNotes)
                @*<img src="/library/images/indicator.gif" title="processing" />  *@
            </div>
        </div>
       
       
        <div id="tabs-2">
            <div id="divHistoryTab" style="min-height:300px;" >
                <div id="divClaimNoteHistory">
                    <img src="/library/images/indicator.gif" title="processing" /> 
                </div>
                  
                <div style="margin-left:5px">
                    <a href="#" id="btnExportHistory" class="excelIcon" title="Export to Excel"></a>
                </div>
            </div>
        </div>
       
    }
</div>
<script type="text/javascript">

    $(function () {
        if ('@Model.ClaimId' != '@Guid.Empty')
        {
            $("#tabClaimNotes").tabs({ panelContainer: "#claimNotes" });

            ShowCreateNote('@Model.ClaimId', '@ViewBag.CompanyId', '@Model.LineOfBusinessId');
 
            //History
            RefreshClaimHistory();

        }
        $("#btnExportHistory").click(function (event) {
            event.preventDefault();

            var jsonObject = GetColumnFilters(historySettings);
           
            var dateRangeFrom = $("#history_range_from_1").val();
            var dateRangeTo = $("#history_range_to_1").val();

            jsonObject[4] = dateRangeFrom;
            jsonObject[5] = dateRangeTo;

            var jsonStringObject = JSON.stringify(jsonObject);
            jsonStringObject = jsonStringObject.replace(/&+/g, "-ampersand-");
            var filterString = "";
            var url = "/Claim/Claim/ExportHistory?id=@Model.ClaimId&filterString=" + filterString + "&jsonObject=" + jsonStringObject;

            window.location.href = url;
        });


        $("#createTitle").click(function () {
            if ($("#createTitleIcon").hasClass("fa-caret-down")) {
                $("#CreateNote").hide();
                $("#createTitleIcon").removeClass("fa-caret-down");
                $("#createTitleIcon").addClass("fa-caret-right");
                ResizeNoteGrid(450);
            }
            else if ($("#createTitleIcon").hasClass("fa-caret-right")) {
                $("#CreateNote").show();
                $("#createTitleIcon").removeClass("fa-caret-right");
                $("#createTitleIcon").addClass("fa-caret-down");
                ResizeNoteGrid(250);
            }
        });

       
        $(window).on('mouseenter', 'div.dataTables_scrollBody', function () {
            $('div.modalPopup').draggable('destroy');
        }).on('mouseleave', 'div.dataTables_scrollBody', function () {
            $('div.modalPopup').draggable();
        });


    });
 

    function LoadClaimHistorySuccess(result) {
        $("#divClaimNoteHistory").html("");
        $("#divClaimNoteHistory").html(result);
    }

    function RefreshClaimHistory() {
       
        var id = $("#ClaimId").val();

        $.ajax({
            url: '@Url.Action("ClaimHistory", "Claim")',
            data: { claimId: id },
            type: 'Get',
            cache: false,
            success: LoadClaimHistorySuccess,
            error: function (request, status, error) {
                ShowPageError("");
            }
        });
    }


    function ShowCreateNote(ClaimId, CompanyId, LobId) {
        if (LobId == undefined) {
            LobId = $("#LineOfBusinessId").val();
        }
        $.ajax({
            url: '@Url.Action("CreateNote", "Note")',
            data: { claimId: ClaimId, lobId: LobId, companyId: CompanyId },
             type: 'Get',
             success: LoadCreateNote,
             error: function (request, status, error) {
                 $("#CreateNote").html("");
             }
         });
    }

    function LoadCreateNote(result) {
        $("#NoteHeader").show();
        $("#CreateNote").html(result);
    }


    function RefreshNoteGrid(ClaimId, CompanyId) {
        $("#ViewNotes").html("<img src=\"/library/images/indicator.gif\" title=\"processing\" />");
        $.ajax({
            url: '@Url.Action("ViewNotes", "Note")',
            data: { claimId: ClaimId, companyId: CompanyId },
            type: 'Get',
            success: function (result) {
                $("#ViewNotes").html(result);
            },
            error: function (request, status, error) {
                $("#ViewNotes").html("");
            }
        });
    }
   
</script>

Below is the CreateNote.cshtml page
Code:
@model IFormViewModel<Bts.Claimtrak.Models.Claim.Note.ICreateNoteViewModel>


<script src='@Url.Content("/library/Scripts/jquery.validate.min.js")' type="text/javascript"></script>
<script src='@Url.Content("/library/Scripts/jquery.validate.unobtrusive.min.js")' type="text/javascript"></script>
<script src='@Url.Content("/Library/Scripts/Claim/Notes.js")'></script>

@if (Model.Model.NoteTypes.Count() > 0) //only load if note types are available
{

    <div id="noteEntryForm" class="form" style="margin-right: 20px; width: 100%">
        @using (Html.BeginForm("SaveNote", "Note", FormMethod.Post, new { id = "formCreateNote" }))
        {
            @Html.ValidationSummary(true)
            @Html.HiddenFor(model => model.Model.ClaimId)
            @Html.HiddenFor(model => model.Model.CompanyId)
            @Html.Hidden("ApplyCopyTo")
            <section id="Note" style="width: 100%;">


                <table style="width: 100%; margin: 0 1em 0 1em;">
                    <tr>
                        <td style="width: 10%">@Model.GetLabel("NoteTypeId", true)</td>
                        <td style="width: 15%;">@Html.CWSDropDownListFor(model => model.Model.NoteTypeId, new SelectList(Model.Model.NoteTypes, "Id", "Name", Model.Model.NoteTypeId), "Select Note Type", new { style = "width:15em;", onChange = "CheckTitle();" }, includeValidation: true, validationMsgBelow: true)</td>
                        <td style="width: 10%;">@Model.GetLabel("Title", new { id = "noteTitleLabel", style = "display:none;text-align:right;padding-right:.8em;" })</td>
                        <td style="width: 40%;">@Html.CWSTextBoxFor(model => model.Model.Title, new { style = "width:25em;display:none" }, includeValidation: true, validationMsgBelow: true)</td>
                    </tr>
                </table>

            </section>
           
            <div id="noteTextContainer" style="padding-top: .5em; width: 98%">
                @Html.TextAreaFor(model => model.Model.NoteText)
            </div>
            <div id="noteError" class="error" style="display: none; margin-left: 10px;"></div>
            <br />
            <div style="float: left; padding-left: 10px; width: 70%; text-align: left;">
                <span onclick="OpenCopyForm();" class="fakeBtn" style="margin-right: .5em;"><i id="copyIcon" class="fa fa-files-o padLR2"></i>Copy Note</span>
                <span onclick="OpenDocumentsForm();" class="fakeBtn"><i id="addDocument" class="fa fa-file-o padLR2"></i>Add Document </span>
            </div>
            <div style="float: right; padding-right: 10px; width: 25%; text-align: right;">
                <img id="savingNote" src="/library/images/indicator.gif" title="processing" style="display: none;" />
                <input id="saveNote" type="submit" value="Save" style="margin-right: .3em;" onclick="needToConfirm = false;" />
                <input id="cancelNote" type="button" value="Cancel" onclick="CancelNote();" />
            </div>
        }
        <br />
        <br />
        <hr />
    </div>
    <div id="divCopyNote" class="modalPopup radius5px " style="text-align: left; width: 50em;">
        <div class="processingIcon" id="processingDiv"> </div>
    </div>
    <div id="divAddDocuments" class="modalPopup radius5px " style="text-align: left; width: 50em;">
        <div class="processingIcon" id="processingDivDocs"> </div>
    </div>
}




<script type="text/javascript">
    var needToConfirm = true;
    var hasText = false;
    var userDictionaryFile;
    var dictionaryFolder;

    $(function () {

        if ('@Model.Model.NoteTypes.Count()' > 0) {
            var toolbarType = 'Full';

            if ('@Model.Model.companyRTE' != null && '@Model.Model.companyRTE' != '') {
                toolbarType = '@Model.Model.companyRTE';
            }

            $("#Model_NoteText").ckeditor({
                    toolbar: toolbarType,
                    width: '99%'
                });
        }
        else {
            $("#NoteHeader").hide();
            $("#CreateNote").hide();
            ResizeNoteGrid(450);
        }

        window.onbeforeunload = confirmExit;

        rapidSpell.setParameterValue("default", "IgnoreXML", true);
        rapidSpell.setParameterValue("default", "ConsiderationRange", 500);
        rapidSpell.setParameterValue("default", "SuggestionsMethod", "HASHING_SUGGESTIONS");
        rapidSpell.setParameterValue("default", "IncludeUserDictionaryInSuggestions", true);
        rapidSpell.setParameterValue("default", "TextComponentInterface", "Standard");

        $.ajax({
            url: '@Url.Action("GetDictionaryInfo", "Note")',
            type: 'Get',
            success: function (result) {
                userDictionaryFile = result.userId;
                dictionaryFolder = result.dictionaryFolder;
                var userDictionary = dictionaryFolder + '\\' + userDictionaryFile + '-dictionary.txt';
                rapidSpell.setParameterValue('default', 'UserDictionaryFile', userDictionary);
            }
        });

        var editor = $('#Model_NoteText').ckeditorGet();
        editor.on('key', function (ev) {
            if (!hasText) {
                hasText = true;
                $("#noteError").hide();
                $("#noteTextContainer").removeClass("input-validation-error");
            }

        });




        $("#formCreateNote").submit(function () {
            var noteValid = ValidateNote();
            if (noteValid) {
                $("#noteError").hide();
                $("#noteTextContainer").removeClass("input-validation-error");
            }
            else {
                $("#noteError").show();
                $("#noteTextContainer").addClass("input-validation-error");
            }
            var action = this.action;
            var method = this.method;
            if ($(this).valid() && noteValid) {
                if ($("#ApplyCopyTo").val() != '') {
                    $("<div title=\"Warning\">Claims have been selected for note copy.<br>Once saved this cannot be undone. <br><br>Linked documents will not be copied.</div>").dialog({
                        resizable: false,
                        height: 200,
                        width: 325,
                        modal: true,
                        dialogClass: 'claimtrakWarning',
                        buttons: {
                            "OK": function () {
                                $(this).dialog("close");
                                SaveNote(action, method);
                            },
                            "Cancel": function () {
                                $(this).dialog("close");
                            }
                        }
                    });
                }
                else {
                    SaveNote(action, method);
                }

            }
            return false;
        });


    });



    function SaveNote(action, method) {
        $("#savingNote").show();
        $("#saveNote").attr("disabled", "disabled");
        $("#cancelNote").attr("disabled", "disabled");
        $.ajax({
            url: action,
            type: method,
            dataType: "json",
            data: $("#formCreateNote").serialize(),
            success: function (result) {
                if (result.note != undefined) {

                    AddNewNote(result.note);
                    $("#noteEntryForm").hide();
                    var editor = $('#Model_NoteText').ckeditorGet();
                    editor.destroy();
                    $("#CreateNote").html("<img src=\"/library/images/indicator.gif\" title=\"processing\" />");

                    RefreshClaimHistory();
                    ShowCreateNote('@Model.Model.ClaimId', '@Model.Model.CompanyId');
                }
                if (result.url != undefined) {
                    window.location = result.url;

                    return false;
                }

                if (result.error != undefined) {
                    ShowPageError(result.error);
                    $("#savingNote").hide();
                    $("#saveNote").removeAttr("disabled");
                    $("#cancelNote").removeAttr("disabled");
                    needToConfirm = true;
                    return false;
                }
            },
            error: function (result) {
                ShowPageError("");
                $("#savingNote").hide();
                $("#saveNote").removeAttr("disabled");
                $("#cancelNote").removeAttr("disabled");
                needToConfirm = true;
            }

        });
    }

    function ValidateNote() {
        if ($("#Model_NoteText").val() == "") {
            $("#noteError").text("Note text is required.");
            return false;
        }
        return true;
    }

    function confirmExit() {
        if (needToConfirm) {
            var editor = $('#Model_NoteText').ckeditorGet();
            needToConfirm = editor.checkDirty();
            if (needToConfirm) {
                return "Any changes will be lost.";

            }
        }

    }
    function CheckTitle() {
        var noteTypeId = $("#Model_NoteTypeId").val();
        if (noteTypeId == '') {
            $("#noteTitleLabel").hide();
            $("#Model_Title").val("");
            $("#Model_Title").hide();
        }
        else {
            $.ajax({
                url: '@Url.Action("AllowTitle", "Note")/',
                async: false,
                data: { noteTypeId: $("#Model_NoteTypeId").val() },
                type: 'Get',
                success: function (result) {
                    if (result != true) {
                        $("#noteTitleLabel").hide();
                        $("#Model_Title").val("");
                        $("#Model_Title").hide();
                    }
                    else {
                        $("#Model_Title").show();
                        $("#noteTitleLabel").show();
                        $("#noteTitleLabel").addClass("editor-label");

                    }
                }
            });
        }
    }


    function OpenCopyForm() {
        if ($("#ApplyCopyTo").val() == '' || $("#AssociatedClaimNumbers").val() == '') {
            GetAssociatedClaims();
        }
        else {
            $("#divCopyNote").popup(true);
        }
    }
    function GetAssociatedClaims() {
        var claimNum = $("#ClaimNumber").val();
        var companyId = '@Model.Model.CompanyId';
        $.ajax({
            url: '@Url.Action("AssociatedClaims", "Note")',
            data: { claimNumber: claimNum, companyId: '@Model.Model.CompanyId' },
            type: 'Get',
            success: function (result) {
                $("#divCopyNote").html(result);
            }
        });

        $("#divCopyNote").popup(true);
    }

    function CancelNote() {
        var editor = $('#Model_NoteText').ckeditorGet();
        if (editor.checkDirty()) {
            var moveOn = confirm("Are you sure you want to cancel this entry?  Any changes will be lost.");
            if (moveOn != true) {
                return false;
            }
        }
        $("#Model_Title").val("");
        $("#Model_NoteTypeId").val("");
        $("#noteTitleLabel").hide();
        $("#Model_Title").hide();
        $("#Model_NoteText").val("");
        $("#Model_NoteTypeId").toggleClass("input-validation-error", false);
        $("span[data-valmsg-for='Model.NoteTypeId']").toggleClass("field-validation-valid", true);
        $("#noteError").hide();
        $("#noteTextContainer").removeClass("input-validation-error");

    }

</script>


ViewNotes.cshtml

[code]@model IQueryable<Bts.Claimtrak.Models.Claim.Note.INoteTableViewModel>


<script type="text/javascript" src='@Url.Content("/Library/Scripts/Claim/Notes.js")'></script>
<script type="text/javascript" src="/Library/Scripts/CWS-Functions.js"></script>
<script type="text/javascript" src="/Library/Scripts/jquery.dataTables.plugIns.js"></script>

<div id="AllNotes" style="overflow: auto; visibility: hidden;">
<table id="notes" cellspacing="0" cellpadding="0" class="table table-striped">
<thead>
<tr>
<th>Note Date</th>
<th>Author</th>
<th>Note Type</th>
<th>Note </th>
<th>Links</th>@*For attachments*@
<th></th>
</tr>
<tr id="filterRow" class="filterRow" style="display: none;">
<th></th>
<th>Search Author</th>
<th>Search Note Type</th>
<th>Search Note</th>
<th>Links</th>
@*For attachments*@
<th></th>
</tr>
</thead>
<tfoot style="display: table-header-group;">
<tr>
</tr>
</tfoot>
<tbody>
@foreach (var note in Model)
{
var fullnote = note.Body.Trim();
<tr>
<td>@note.DateCreated</td>
<td>@note.Author</td>
<td id="divEditNoteType-@note.Id">
<div style="width: 90%; float: left;">@note.NoteType</div>
@if (note.UserCanModify)
{
<div style="width: 10%; float: right;" title="Edit Note Type"><span id="btnEditNoteType-@note.Id" class="editItemSM" style="padding-left:.2em;cursor:pointer;color:#FF720D;float:right;" onclick="EditNoteType('@note.Id','@note.NoteTypeId')"></span></div>
}
</td>
<td style="width: 40%" class="noWrap">@*adding title to note body *@
@if (note.Title != "" && note.Title != null)
{
fullnote = "<span class=\"titleText\">" + note.Title + "</span><br>" + note.Body;
}
<div class="noteBody fullNote newNote" id="Note-@note.Id">@Html.Raw(fullnote)</div>
<div id="btnExpandNote-@note.Id" class="expandNoteButton" style="visibility:hidden;" onclick="ShowHideNote('@note.Id')"> </div>

</td>
@if (note.HasDocuments)
{
<td>
<div title="Documents"><span id="btnDocuments-@note.Id" style="padding-left:.2em;cursor:pointer;color:#FF720D;" onclick="ShowLinks('@note.Id');"><i style="color: gray; font-size: 17px;" class="fa fa-file"></i></span><span style="display: none">@note.HasDocuments</span></div>
</td>
}
else
{
<td>
<div title="Add Documents"><span id="btnDocument-@note.Id" style="padding-left:.2em;cursor:pointer;color:#FF720D;" onclick="ShowLinks('@note.Id');"><i style="color: black; font-size: 17px;" class="fa fa-file-o"></i></span><span style="display: none">@note.HasDocuments</span></div>
</td>
}
<td>@note.Id</td>
</tr>
}
</tbody>

</table>
@Html.Hidden("notesExpanded", "false")
@Html.Hidden("modifiedColumn")
</div>
<p>
 
<a href="#" id="btnExportPdf" class="pdfIcon" title="Export to PDF"></a>
</p>
<div id="divEditNoteType" class="modalPopup radius5px " style="text-align: left;">
<div class="processingIcon" id="processingDiv"> </div>
</div>
<div id="divDocumentLinks" class="modalPopup radius5px" style="text-align: left;">
<div class="processingIcon" id="processingDivLinks"> </div>
</div>
<script type="text/javascript">
var oTable;
var noteSettings;
//$("#AllNotes").hide();
$(function () {
//if ($.browser.msie && 8 == parseInt($.browser.version)) {
// $(function () {
// var $ss = $('#fontawesome-css');
// $ss[0].href = $ss[0].href;
// });
//}

//Change HTML Table to DataTable
oTable = $("#notes").dataTable({
"fnDrawCallback": function (oSettings) {
$("#AllNotes").css("visibility", "visible");
ResizeDataTableWrapper("AllNotes", "notes", .98);
noteSettings = oSettings;
CreateNoteExpand();
},
"oLanguage": {
"sInfoFiltered": "<b>(filtered from _MAX_ total records)</b>"
},
"bProcessing": true,
"bColumnFilters": true,
"bSortCellsTop": true,
"aaSorting": [[0, "desc"]],
"bScrollInfinite": true,
"bScrollCollapse": false,
"sScrollY": "250px",
"bAutoWidth": false,
"aoColumns": [
/*Date*/ { "sWidth": "22%" },
/*Author*/ { "sWidth": "18%", "bSearchable": true },
/*Note Type Edit { "sWidth": "2%", "sType": "html", "bSearchable": false, "bSortable": false },*/
/*Note Type*/ { "sWidth": "15%", "sType": "html" },
/*Note*/ { "sWidth": "35%", "sType": "html" },
/*Attachment*/ { "bSortable": false, "sWidth": "8%" },
/*NoteId*/ { "bVisible": false }
],
"iDisplayLength": 25,
"sDom": '<"toolbar">if<"showFilters"><"expandCollapseNote">rt<"bottom"p><"clear">'
}).columnFilter({
sPlaceHolder: "head:after",
bUseColVis: true,
aoColumns: [

{ type: "date-range", sRangeFormat: "{from} to {to}" },
{ type: "multi-select" },
{ type: "multi-select" },
{ type: "text-delay", iMaxLenght: 64 },
{
type: "multi-select",
values: ["True", "False"] // Options to display in multi-select as True or False are technically invisible in the grid.
},
null,
null
]

});
oTable.fnFilter($(".dataTables_filter :input").val(), null, false, false); //make filtering use exact match

$("div.toolbar").html('<span class=\'tableTitle\'>Historical Notes</span>');
$("div.showFilters").html('<i class="fa fa-filter" style="color:#404040"></i><span id=\'lnkShowFilters\' style=\'padding-left:.6em\' onclick=\'ShowFilters()\'>Show Column Filters</span>')
$("div.expandCollapseNote").html('<span id=\'lnkExpandAll\' style=\'padding-left:.6em\' >Expand All Notes</span>')
//$("div.expandCollapseNote").html('<i class="fa fa-plus-circle fa-lg" style="color:#404040"></i><span id=\'lnkExpandAll\' style=\'padding-left:.6em\' >Expand All Notes</span>')
$("div.expandCollapseNote").click(function () {
ExpandOrCollapse();
});

$(window).resize(function () {
ResizeDataTableWrapper("AllNotes", "notes", .98);
oTable.fnAdjustColumnSizing();
});

$("#btnExportPdf").click(function (event) {
event.preventDefault();

var claimid = $("#ClaimId").val();
var jsonObject = GetColumnFilters(noteSettings);
var x = jsonObject.length;

var dateRangeFrom = $("#notes_range_from_0").val();
var dateRangeTo = $("#notes_range_to_0").val();
jsonObject[5] = dateRangeFrom;
jsonObject[6] = dateRangeTo;

var jsonStringObject = JSON.stringify(jsonObject);
jsonStringObject = jsonStringObject.replace(/&+/g, "-ampersand-");
jsonStringObject = jsonStringObject.replace(/#+/g, "-hashpound-");

var filterString = $(".dataTables_filter :input").val();
filterString = filterString.replace(/&+/g, "-ampersand-");

var url = "/Claim/Note/Export?filterString=" + filterString + "&jsonObject=" + jsonStringObject + "&claimId=" + claimid;

window.location.href = url;
});
});


function ResizeNoteGrid(gridHeight) {
$(".dataTables_scrollBody").height(gridHeight);
}


function EditNoteType(noteId, noteTypeId) {
//get table row by col noteId value
var colIndex = oTable.fnFindCellRowIndexes(noteId);
$("#modifiedColumn").val(colIndex);

var company = $("#noteCompanyId").text();
if ($("#noteIdEditForm").length > 0) {
var openNoteId = $("#noteIdEditForm").text();
$("#divEditNoteType-" + openNoteId).closest("tr").removeClass("editMode");
}
var LOBID = $("#LineOfBusinessId").val();

$("#divEditNoteType-" + noteId).closest("tr").addClass("editMode");
$("#divEditNoteType").load('@Url.Action("EditNoteType", "Note")/?noteId=' + noteId + "&companyId=" + company + "¬eTypeId=" + noteTypeId + "&lobId=" + LOBID);
$("#divEditNoteType").popup(true);
}

function RefreshEditRow(noteRow) {
//Update NoteType and EditIcon columns
var row = $("#modifiedColumn").val();
var noteType = "<div style=\"width:90%;float:left;\">" + noteRow.NoteType + "</div>";
$("#divEditNoteType-" + noteRow.Id).closest("tr").removeClass("editMode");
if (noteRow.UserCanModify) {
noteType += "<div style=\"width:10%;float:right;\" title=\"Edit Note Type\"><span id=\"btnEditNoteType-" + noteRow.Id + "\" class=\"editItemSM\" style=\"padding-left:.2em;cursor:pointer;color:#FF720D;float:right;\" onclick=\"EditNoteType('" + noteRow.Id + "\','" + noteRow.NoteTypeId + "')\"></span></div>";
}

//update record
oTable.fnUpdate(noteType, row, 2);
//remove filters
fnResetAllFilters(oTable);

RedrawTableFilters();

oTable.fnDraw();
RefreshClaimHistory();
}

function AddNewNote(note) {
//format date from millisecond value to date format for notes grid.
@*var dateMilliseconds = note.DateCreated.replace("/", "").replace("Date", "").replace("(", "").replace(")", "");
dateMilliseconds = dateMilliseconds.replace("/", "");
var noteDate = CreateDateFromMilliseconds(dateMilliseconds, true);
noteDate = noteDate + " " + '@ViewBag.UserTimezone';*@

//create edit icon if applicable
var noteType = "<div style=\"width:90%;float:left;\">" + note.NoteType + "</div>";
if (note.UserCanModify) {
noteType += "<div style=\"width:10%;float:right;\" title=\"Edit Note Type\"><span id=\"btnEditNoteType-" + note.Id + "\" class=\"editItemSM\" style=\"padding-left:.2em;cursor:pointer;color:#FF720D;float:right;\" onclick=\"EditNoteType('" + note.Id + "\','" + note.NoteTypeId + "')\"></span></div>";
}

//create note column
var noteBody = "";
var fullnote = note.Body;
if (note.Title != "" && note.Title != null) {
fullnote = "<span class=\"titleText\">" + note.Title + "</span><br>" + note.Body;
}
noteBody = "<div class=\"noteBody fullNote newNote\" id=\"Note-" + note.Id + "\">" + fullnote + "</div>";
noteBody += "<div id=\"btnExpandNote-" + note.Id + "\" class=\"expandNoteButton\" style=\"visibility:hidden;\" onclick=\"ShowHideNote('" + note.Id + "')\">  </div>";

var noteDocumentBody = '';
if (note.HasDocuments == true) {
noteDocumentBody = '<div title="Documents"><span id="btnDocuments-' + note.Id + '" style="padding-left:.2em;cursor:pointer;color:#FF720D;" onclick="ShowLinks(\'' + note.Id + '\');"><i...
Jim
#5 Posted : Wednesday, February 26, 2014 4:47:23 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Thanks, I will need the plugin code as I need to run it.

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


avsln
#6 Posted : Wednesday, February 26, 2014 4:49:24 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Here is the plugin code

Code:
CKEDITOR.plugins.add('spell',
    {
        init: function (editor) {
            editor.addCommand('spell', {
                exec: function (editor) {
                    rapidSpell.ayt_aytEnabled = false;
                    spell('cke_contents_Model_NoteText', 'dialog');
                }
            });

            editor.ui.addButton('spell', {
                label: 'Spell Check',
                command: 'spell',
                icon: this.path + 'icons/spell.png'
            });
        }
    });

function spell(id, mode) {
    var ifr = document.getElementsByClassName('cke_wysiwyg_frame cke_reset')[0];
    ifr.setAttribute('id', id + '_ifr');
    ifr.id = id + '_ifr';

    if (mode == 'dialog')
        rapidSpell.dialog_spellCheck(true, ifr.id);
    else
        rapidSpell.ayt_spellCheck(ifr.id);
}
Jim
#7 Posted : Wednesday, February 26, 2014 5:27:11 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Sorry, I just noticed your first post today where you say it uses a lot of DB code. Please send me something simple that I can run. Would be great if you could upload a project to dropbox or email a project to me at support at keyoti.com

Thanks
Jim

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


avsln
#8 Posted : Wednesday, February 26, 2014 6:24:49 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Unfortunately our company blocks access to any file sharing website. So I cannot upload any code to Dropbox or anything like that.

You should be able to replace the Save functions in my code with something generic that simulates a save and replicate the functionality I hope.
Jim
#9 Posted : Wednesday, February 26, 2014 7:01:52 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Please email it to me at support at keyoti.com

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


avsln
#10 Posted : Wednesday, February 26, 2014 7:04:50 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Let me check with my manager about the policy on letting us email out the code in this fashion. Also please note that this is an application with a lot of security and roles built into it. So you will not be able to run the entire site without the full database some supporting databases as well. How will you be able to manage that?
Jim
#11 Posted : Wednesday, February 26, 2014 7:11:09 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
What I suggest is creating a new project, set it up to reproduce the issue and then send that. Sorry I'm not trying to be difficult, and I know devs hate hearing the phrase "send a project that reproduces it", but I really need to work with it to help you. For instance I don't know what you mean by 'redraws the editor', so seeing it in action, and working with the code would allow me to resolve it for you.
Thanks

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


avsln
#12 Posted : Wednesday, February 26, 2014 7:13:43 PM
Rank: Member

Groups: Registered

Joined: 2/12/2014
Posts: 20
Ok. I will try to do that and hope to give you something pretty soon.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.