<commit_before>Ext.define("adnat.view.Util", {
    extend: 'Ext.Panel',
    xtype: 'util',
    requires: [
        'Ext.TitleBar'
    ],
    config: {
        id: 'util',
        title: 'Utility',
        iconCls: 'info',
        styleHtmlContent: true,
        scrollable: true,
        /*
         
         listeners: {
         show: function() {
         adnat.app.getController('UtilController').update(event);
         },
         painted: function() {
         adnat.app.getController('UtilController').update(event);
         },
         hide: function() {
         }
         },
         */
        items: [
            {
                docked: 'top',
                xtype: 'titlebar',
                title: 'Utility'
            },
            {
                xtype: 'button',
                margin: '40px',
                text: 'Show Information',
                ui: 'normal',
                handler: function() {
                    var online =
                            'The application is in <i>'
                            + (window.navigator.onLine ? "online" : "offline")
                            + '</i> mode.'
                            ;

                    var lastSyncedMessage = null;
                    var ls = AppSettings.getLastSynced();
                    if (ls === null) {
                        lastSyncedMessage = 'Has not been synced to server';
                    } else {
                        lsDate = new Date();
                        lsDate.setTime(ls);
                        lastSyncedMessage = 'Last synced to server on <br>' + lsDate.toISOString();
                    }

                    var lastUpdatedMessage = null;
                    var lu = AppSettings.getLastUpdated();
                    if (lu === null) {
                        lastUpdatedMessage = 'Has no last updated response';
                    } else {
                                      luDate = new Date();
                        luDate.setTime(lu);
                        lastUpdatedMessage = 'Last assessment response on <br>' + luDate.toISOString();
                    }

                    Ext.Msg.alert("Information",
                            online
                            + "<p>"
                            + 'Current date and time is <br>' + new Date().toISOString()
                            + "<p>"
                            + lastSyncedMessage
                            + "<p>"
                            + lastUpdatedMessage
                            );
                }
            },
            {
                xtype: 'button',
                margin: '40px',
                text: 'Sync to Server Now',
                ui: 'normal',
                handler: function() {
                    Ext.Viewport.mask({xtype: 'loadmask', indicator: false, message: 'Submitting...'});
                    score();
                    var task = Ext.create('Ext.util.DelayedTask', function() {
                        var gs = getGeneralScore();
                        var ps = getPsychScore();
                        postAssessment(ps, gs, true); //force to send regardless of state.  anytime after scoring is _really_ done
                        Ext.Viewport.unmask();
                    });
                    task.delay(1900);
                }
            }, {
                xtype: 'button',
                margin: '40px',
                text: 'Delete All of My Responses',
                ui: 'decline',
                handler: function() {
                    Ext.Msg.confirm(
                            "Confirmation", "Are you sure you want to delete all of your answers? <br><i>This action can not be undone</i>",
                            function(answer) {
                                if (answer === 'yes') {
                                    Ext.getStore('Responses').deleteAllRecords();
                                    AppSettings.clearLastUpdated();
                                    location.reload();
                                }
                            }
                    );
                }
            },
            {
                xtype: 'button',
                margin: '40px',
                text: 'Reset Application',
                ui: 'decline',
                handler: function() {
                    Ext.Msg.confirm(
                            "Confirmation", "Are you sure you want to delete all of your data and logout? <br><i>This action can not be undone</i>",
                            function(answer) {
                                if (answer === 'yes') {
                                    window.localStorage.clear()
                                    location.reload();
                                }
                            }
                    );
                }
            },
            {
                xtype: 'button',
                margin: '40px',
                text: 'Logout',
                ui: 'normal',
                handler: function() {
                    Ext.Msg.confirm(
                            "Confirmation", "Would you like to logout of the ADNAT application?",
                            function(answer) {
                                if (answer === 'yes') {
                                    window.localStorage.clear()
                                    location.reload();
                                }
                            }
                    );
                }
            }

        ]
    }
});<commit_msg>clean up util tab<commit_after>Ext.define("adnat.view.Util", {
    extend: 'Ext.Panel',
    xtype: 'util',
    requires: [
        'Ext.TitleBar'
    ],
    config: {
        id: 'util',
        title: 'Utility',
        iconCls: 'info',
        styleHtmlContent: true,
        scrollable: true,
        /*
         
         listeners: {
         show: function() {
         adnat.app.getController('UtilController').update(event);
         },
         painted: function() {
         adnat.app.getController('UtilController').update(event);
         },
         hide: function() {
         }
         },
         */
        items: [
            {
                docked: 'top',
                xtype: 'titlebar',
                title: 'ADNAT Utilities'
            },
            {
                xtype: 'button',
                margin: '60 60 8 60px',
                text: 'Submit My Survey Now',
                instructions: 'Login to take ADNAT',
                ui: 'action',
                handler: function() {
                    Ext.Viewport.mask({xtype: 'loadmask', indicator: false, message: 'Submitting...'});
                    score();
                    var task = Ext.create('Ext.util.DelayedTask', function() {
                        var gs = getGeneralScore();
                        var ps = getPsychScore();
                        postAssessment(ps, gs, true); //force to send regardless of state.  anytime after scoring is _really_ done
                        Ext.Viewport.unmask();
                    });
                    task.delay(1900);
                }
            },
            {
                margin: '0 60 0 60px',
                html: [
                    "<div class=\"centered\">",
                    "Submit your survey to the ADNAT site for review.",
                    "</div>"
                ].join("")
            },
            {
                xtype: 'button',
                margin: '60 60 8 60px',
                text: 'Show Information',
                ui: 'action',
                handler: function() {
                    var online =
                            'The application is in <i>'
                            + (window.navigator.onLine ? "online" : "offline")
                            + '</i> mode.'
                            ;

                    var lastSyncedMessage = null;
                    var ls = AppSettings.getLastSynced();
                    if (ls === null) {
                        lastSyncedMessage = 'Has not been synced to server';
                    } else {
                        lsDate = new Date();
                        lsDate.setTime(ls);
                        lastSyncedMessage = 'Last synced to server on <br>' + lsDate.toISOString();
                    }

                    var lastUpdatedMessage = null;
                    var lu = AppSettings.getLastUpdated();
                    if (lu === null) {
                        lastUpdatedMessage = 'Has no last updated response';
                    } else {
                        luDate = new Date();
                        luDate.setTime(lu);
                        lastUpdatedMessage = 'Last assessment response on <br>' + luDate.toISOString();
                    }

                    Ext.Msg.alert("Information",
                            online
                            + "<p>"
                            + 'Current date and time is <br>' + new Date().toISOString()
                            + "<p>"
                            + lastSyncedMessage
                            + "<p>"
                            + lastUpdatedMessage
                            );
                }
            },
            {
                margin: '0 60 0 60px',
                html: [
                    "<div class=\"centered\">",
                    "Show system information for technical support.",
                    "</div>"
                ].join("")
            },
            {
                xtype: 'button',
                margin: '60 60 8 60px',
                text: 'Delete All of My Responses',
                ui: 'decline',
                handler: function() {
                    Ext.Msg.confirm(
                            "Confirmation", "Are you sure you want to delete all of your answers? <br><i>This action can not be undone</i>",
                            function(answer) {
                                if (answer === 'yes') {
                                    Ext.getStore('Responses').deleteAllRecords();
                                    AppSettings.clearLastUpdated();
                                    location.reload();
                                }
                            }
                    );
                }
            },
            {
                margin: '0 60 0 60px',
                html: [
                    "<div class=\"centered\">",
                    "Delete all of your answers and start the the survey over.",
                    "</div>"
                ].join("")
            },
            {
                xtype: 'button',
                margin: '60 60 8 60px',
                text: 'Logout',
                ui: 'decline',
                handler: function() {
                    Ext.Msg.confirm(
                            "Confirmation", "Are you sure you want to delete all of your data and logout? <br><i>This action can not be undone</i>",
                            function(answer) {
                                if (answer === 'yes') {
                                    window.localStorage.clear()
                                    location.reload();
                                }
                            }
                    );
                }
            },
            {
                margin: '0 60 0 60px',
                html: [
                    "<div class=\"centered\">",
                    "Clear all data from the device, logout and reset the application.",
                    "</div>"
                ].join("")
            },
        ]
    }
});
{'fraction_non_alphanumeric': 0.10180722891566266, 'fraction_numerical': 0.006024096385542169, 'mean_word_length': 0.8019848038455575, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7009793', 'n_tokens_mistral': 2734, 'n_tokens_neox': 2492, 'n_words': 630}