Rtf control for DB text field- any elegant solution

47 views
Skip to first unread message

Dejan D

unread,
May 6, 2024, 6:58:22 PMMay 6
to Jam.py Users Mailing List
Dean, I am translating my project Multimedia Clinic, which does 16 specialties of medicine, uploading from Ct, MRI, US to the database, actually the whole hospital with warehouses, etc. I have come to terms with not being able to get the functionality I have in my Clarion11 project, but I would only ask you about the possibility of rtf control in large text fields in the database. I need it for writing medical reports. Thanks for the comment. Dejan D.

Pozdrav iz Beograda

Dean D. Babic

unread,
May 7, 2024, 2:09:58 AMMay 7
to Jam.py Users Mailing List

Fabio Lenzarini

unread,
May 7, 2024, 8:08:02 AMMay 7
to Jam.py Users Mailing List
Hi Dejan, 
something like this?

2024-05-07 14_06_30-Clipboard.png

Fabio Lenzarini

unread,
May 12, 2024, 5:46:34 AMMay 12
to Jam.py Users Mailing List
Hi Dejan
Sorry for the delay, but I have a lot of work and private life saturates the rest of the time :-)
Is all done with Tini.

If you look at the links Draze attached, you should be able to do it.

What can't you do?

If you have any problems, please write, putting your code, we will see if we can correct it.

Then I can post examples of mine.

this is the template

<div class="task_documents-edit">
    <div class="form-body">
        <div class="edit-body"></div>
    <div>
        <table class="table-fixed" style="margin-top:1em; min-height:400px;">
<!--            <table style="min-height:400px; width: 100%;"> -->
                <tr>
                    <td id="left-panel" class="td-panel" style="min-height:400px; width: 50%; padding-right: 10px" valign=TOP>
        <div>
            <b>Functional</b>
        <textarea id="task_documents_text" style="height:400px"></textarea>
        </div>              
                    </td>
                    <td id="right-panel" class="td-panel" style="min-height:400px; width: 50%; padding-right: 10px" valign=TOP>
        <div>
            <b>Technical</b>
        <textarea id="task_documents_tech_text" style="height:400px"></textarea>
        </div>
                    </td>
                </tr>
            </table>
</div>
        <div class="edit-detail"></div>
    </div>
    <div class="form-footer">
        <button type="button" id="ok-btn" class="btn btn-ary expanded-btn">
            <i class="icon-ok"></i> OK<small class="muted">&nbsp;[Ctrl+Enter]</small>
        </button>
        <button type="button" id="cancel-btn" class="btn expanded-btn">
            <i class="icon-remove"></i> Annulla
        </button>
    </div>
</div>


this the code on the form

let table_height;
let table_width;

function on_view_form_created(item) {
    table_height = item.table_options.height;
   
    if (item.view_options.parms) {
        item.view_options.title += " - Project: " + item.view_options.parms[2] + " - Task: " + item.view_options.parms[3];
    }
   
    // child grid
    let grid_height;
    if (!item.lookup_field) {
       
        item.table_options.height -= table_height / 2;
    item.documents_chapters = task.documents_chapters.copy();
    item.documents_chapters.paginate = false;
    item.documents_chapters.create_table(item.view_form.find('.view-detail'), {
    height: table_height / 2,
    summary_fields: ['chapter'],
    order_by : ['chapter'],
    on_dblclick: function() {
    documents_chapters(item);
    }
    });
    item.table_options.multiselect = true;
    }    
   
    // new subtask button
    var subtask_btn = item.add_view_button('New chapter');
    subtask_btn.click(function() { new_documents_chapters(item) });  
   
    // all subtask button
    var allsubtask_btn = item.add_view_button('All chapters');
    allsubtask_btn.click(function() { all_documents_chapters(item) });    
   
   
    // show editor
    var editor_btn = item.add_view_button('Editor');
    editor_btn.click(function() { editor(item) });  
   
   
}

function editor(item) {
$(document).ready(function() {
$("#txtEditor").Editor();
});
}

function on_edit_form_shown(item) {
   
    item.edit_form.find("#item_text").show();
   
tinymce.init({
selector: '#task_documents_text',

        plugins: [
          'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
          'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
          'media', 'table', 'emoticons', 'template', 'help'
        ],
        toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | ' +
          'bullist numlist outdent indent | link image | print preview media fullscreen | ' +
          'forecolor backcolor emoticons | help',
        menu: {
          favs: { title: 'My Favorites', items: 'code visualaid | searchreplace | emoticons' }
        },
        menubar: 'favs file edit view insert format tools table help',

setup: function (editor) {
editor.on('init', function () {
editor.setContent(item.text.value);
})
}  
});

tinymce.init({
selector: '#task_documents_tech_text',
setup: function (editor) {
editor.on('init', function () {
editor.setContent(item.tech_text.value);
});
}
});
}

function on_edit_form_close_query(item) {
tinymce.remove("#task_documents_text");
tinymce.remove("#task_documents_tech_text");
}

function on_before_post(item) {
item.text.value = tinymce.get('task_documents_text').getContent();
item.tech_text.value = tinymce.get('task_documents_tech_text').getContent();
}

// Open Project Task
function documents_chapters(item) {
var child_table = task.documents_chapters.copy();

child_table.set_where( {id: item.documents_chapters.id.value});
child_table.set_order_by(['chapter']);
child_table.view_options.parms = [item.id.value,
                                item.project_task.value];
child_table.view(task.forms_container); // full screen
}

function new_documents_chapters(item) {
    var child_table = task.documents_chapters.copy();
    child_table.open({ open_empty: true });
    child_table.append_record();
    child_table.task_document.value = item.id.value;
    child_table.task_document.lookup_value = item.document.value;
}

// all sub Task
function all_documents_chapters(item) {
var child_table = task.documents_chapters.copy();

child_table.set_where( {task_document: item.id.value});
child_table.set_order_by(['chapter']);
child_table.view_options.parms = [item.id.value,
                                item.document.value];
child_table.view(task.forms_container); // full screen
}

// display child
function on_after_scroll(item) {
if (!item.lookup_field)
{
if (item.view_form && item.view_form.length)
{
if (item.rec_count)
{
item.documents_chapters.set_where({task_document: item.id.value});
item.documents_chapters.set_order_by(['chapter']);
item.documents_chapters.open(true);

// set_grid(item, item);
}
else
{
    item.documents_chapters.close();
}
}
}
}

Johnny Pedersen

unread,
May 14, 2024, 3:26:09 PMMay 14
to Fabio Lenzarini, Jam.py Users Mailing List
This is interesting. How did you do this? And what editor is it? It seems not to be TinyMCE.

--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/a13a8b09-a834-43d9-ae24-de653599ba0dn%40googlegroups.com.

Dean D. Babic

unread,
May 14, 2024, 11:58:36 PMMay 14
to Jam.py Users Mailing List
Fabio is using development v7....

Reply all
Reply to author
Forward
0 new messages