PageSourceSearch

https://portalestudenti.collegioeinaudi.it/apps/V3.1/shared-static/custom/js/util.js?v=1790296439

js collegioeinaudi.it collected 2026-09-25 00:34:10 UTC 9,534 bytes, 253 lines download raw bytes

1var Util = {
2    request: function (method, uri, data) {
3        if (!method) {
4            console.error('Function request missing argument (1)');
5            return;
6        }
7
8        if (!uri) {
9            console.error('Function request missing argument (2)');
10            return;
11        }
12
13        if(typeof data == "undefined"){ data = null; }
14
15        var url = uri;
16        if (uri.indexOf("http") == "-1") {  
17            if(typeof appJson != "undefined"){
18                var lastchar = "";
19                //if(appJson.webpath_root.substr(appJson.webpath_root.length - 1) != "/"){ lastchar = "/"; }
20                if(appJson.webpath_root.substr(appJson.webpath_root.length - 1) != "/" && uri.substr(0, 1) != "/"){ lastchar = "/"; }
21                url = appJson.webpath_root + lastchar + uri;
22            } else {
23                url = uri;
24            }
25        }
26
27        var config = {};
28        if(method == "get"){
29            config = {method: method, url: url, params: data};
30        } else if(method == "post"){
31            config = {method: method, url: url, data: data};
32        } else if(method == "postdownload"){
33            config = {method: "post", url: url, data: data, responseType: 'blob'};
34        }
35        
36        return axios(config)
37        .catch(function (error) {
38            if(error.response.data.error == "Expired token"){
39                // Portarlo alla login
40                swal({
41                    type: 'error',
42                    title: "Sessione scaduta",
43                    //html: '<pre style="text-align:left;font-size:60%">'+JSON.stringify(error, undefined, 4)+'</pre>',
44                    html: 'La tua sessione è scaduta. Devi effettuare un nuovo accesso',
45                    showCancelButton: false,
46                    allowEscapeKey: false,
47                    allowOutsideClick: false,
48                    confirmButtonColor: '#0073b7',
49                    confirmButtonText: 'Procedi'
50                }).then(function (result) {
51                    if (result) {
52                        window.sessionStorage.clear();
53                        //window.location.href = "./index.php";
54                    }
55                }).catch(swal.noop);
56
57            } else {
58
59                swal({
60                    type: 'error',
61                    title: "Errore generico!",
62                    //html: '<pre style="text-align:left;font-size:60%">'+JSON.stringify(error, undefined, 4)+'</pre>',
63                    html: 'Si &egrave; verificato un errore. Si prega di riprovare pi&ugrave; tardi',
64                    showCancelButton: false,
65                    confirmButtonColor: '#0073b7',
66                    confirmButtonText: 'Ritorna alla Home'
67                }).then(function (result) {
68                    if (result) {
69                        window.location.href = "./index.php";
70                    }
71                }).catch(swal.noop);
72            }
73            App.loading = false;
74        });
75    },
76    getLang: function (lang, code) {
77        if (!lang) {
78            console.error('Function getLang missing argument (1)');
79            App.loading = false;
80            return;
81        }
82
83        if (!code) {
84            console.error('Function getLang missing argument (2)');
85            App.loading = false;
86            return;
87        }
88
89        return Util.request("post", '/index.php/util/dictionary', {
90            p_lang: lang, 
91            p_code: code,
92            p_cfg_ente: App.$store.getters.getConfigDolObject
93        });
94    },
95    loadContainerTemplate: function (container, mainParams, path) {
96        if (!container) {
97            console.error('Function loadContainerTemplate missing argument (1)');
98            App.loading = false;
99            return;
100        }
101        if(typeof mainParams == "undefined"){ mainParams = null; }
102        if(typeof path == "undefined"){ path = './index.php/load-container'; }
103        
104        Util.request("get", path,  {
105            p_code: container
106        })
107        .then(function (response) {
108            var rs = response.data;
109            if(rs.status == "KO"){
110                App.loading = false;
111                swal({
112                    type: 'error',
113                    title: "Errore generico",
114                    html: '<strong>fn loadContainerTemplate: </strong>'+rs.error
115                }).catch(swal.noop);
116                return;
117            }
118
119            if (rs.data) {
120                $("#"+rs.data.el).html(rs.data.content);
121                if(typeof mainParams  === 'object'){
122                    App.$store.commit("paramsMainObject", mainParams );
123                }
124                App.pageView = "Default";
125                App.containerView = "Default";
126                App.containerView = container;
127            }
128        });
129    },
130    loadPageTemplate: function (page, pageParams, folder, path) {
131        if (!page) {
132            console.error('Function loadPageTemplate missing argument (1)');
133            App.loading = false;
134            return;
135        }
136        if(typeof pageParams == "undefined"){ pageParams = null; }
137        if(typeof folder == "undefined"){ folder = page.toLowerCase(); }
138        if(typeof path == "undefined"){ 
139            path = '/index.php/load-page';
140            if(typeof appJson != "undefined"){
141                path = appJson.webpath_root + '/index.php/load-page';
142            }
143        }
144
145        Util.request("get", path, {
146            p_code: page,
147            p_folder: folder
148        })
149        .then(function (response) {
150            var rs = response.data;
151            if(rs.status == "KO"){
152                App.loading = false;
153                swal({
154                    type: 'error',
155                    title: "Errore generico",
156                    html: '<strong>fn loadPageTemplate: </strong>'+rs.error
157                }).catch(swal.noop);
158                return;
159            }
160
161            if (rs.data) {
162                $("#"+rs.data.el).html(rs.data.content);
163                if(typeof pageParams  === 'object'){
164                    App.$store.commit("paramsPageObject", pageParams );
165                }
166                App.pageView = "Default";
167                App.pageView = page;
168            }
169        });
170    },
171    loadPageData: function (self, oRs) {
172        var consolidata = (typeof oRs.data.consolidata != "undefined")?oRs.data.consolidata:'';
173        var aFormData = oRs.data.aFormData;
174        var aLOVs = oRs.data.aLOVs;
175
176        // LOV
177        for (var property2 in aLOVs) {
178            self.$set(self.lovs, property2, aLOVs[property2]);
179        }
180
181        // Formdata
182        if(Object.keys(aFormData).length > 0) {
183
184            for (var property in aFormData) {
185                var prop = property, val = aFormData[property];
186                if(prop.charAt(0) == "@") {
187                    val = Util.formatDate(aFormData[property]);
188                    prop = property.replace("@", "");
189                }
190                self.$set(self.form, prop, val);
191            }
192        }
193
194        // Confdata
195        if(typeof oRs.data.aConfData != "undefined") {
196            var aConfData = oRs.data.aConfData;
197            if(Object.keys(aConfData).length > 0) {
198
199                for (var property in aConfData) {
200                    var prop = property, val = aConfData[property];
201                    self.$set(self.confpage, prop, val);
202                }
203            }
204        }
205
206        // consolidata
207        if(consolidata == "S" && self.$store.getters.getAppObject.level == "DOL" && (self.codpage != "RIEPILOGO" && self.codpage != "RIEPILOGO_STAMPA") ){
208            if(self.codpage == "PREFERENZA_ALLOGGIO") self.consolidato = true;
209            if(self.codpage == "SERVIZI_RICHIESTI"){
210                // Solo per la pagina servizi
211                Vue.nextTick(function () {
212                    $(".dati-pagina .dati-pratica:checkbox:checked").attr("disabled", true);
213                });
214            } else {
215                Vue.nextTick(function () {
216                    $(".dati-pagina :input").attr("disabled", true);
217                    $("button[data-toggle='collapse']").attr("disabled", false);
218                });
219            }
220        }
221    },
222    createDownloadFile: function (oRs) {
223        var fileName = oRs.headers['content-disposition'].replace(/attachment; filename=/g, '');
224        fileName = fileName.substring(0, fileName.length - 1);
225        var urlHref = window.URL.createObjectURL(new Blob([oRs.data]));
226        var link = document.createElement('a');
227        link.href = urlHref;
228        link.setAttribute('download', fileName);
229        document.body.appendChild(link);
230        link.click();
231    },
232    getParamByName: function (param) {
233        param = param.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
234        var regex = new RegExp("[\\?&]" + param + "=([^&#]*)"),
235            results = regex.exec(location.search);
236        return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
237    },
238    formatDate: function (value, strFormat) {
239        if (value && value != null) {
240            strFormat = strFormat || 'DD/MM/YYYY';
241            return moment(String(value)).format(strFormat);
242        }
243    },
244    createUUID: function () {
245        var dt = new Date().getTime();
246        var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
247            var r = (dt + Math.random()*16)%16 | 0;
248            dt = Math.floor(dt/16);
249            return (c=='x' ? r :(r&0x3|0x8)).toString(16);
250        });
251        return uuid;
252    }
253};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.