Merge pull request #134 from niphlod/issue/admin_refactor
first step to a nicer code style of admin
This commit is contained in:
@@ -1770,4 +1770,3 @@ def git_push():
|
|||||||
session.flash = T("Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.")
|
session.flash = T("Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.")
|
||||||
redirect(URL('site'))
|
redirect(URL('site'))
|
||||||
return dict(app=app, form=form)
|
return dict(app=app, form=form)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
'%Y-%m-%d': '%d/%m/%Y',
|
'%Y-%m-%d': '%d/%m/%Y',
|
||||||
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
|
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
|
||||||
'(requires internet access)': '(requires internet access)',
|
'(requires internet access)': '(requires internet access)',
|
||||||
|
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||||
'(something like "it-it")': '(qualcosa simile a "it-it")',
|
'(something like "it-it")': '(qualcosa simile a "it-it")',
|
||||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||||
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': "ATTENZIONE: L'accesso richiede una connessione sicura (HTTPS) o l'esecuzione di web2py in locale (connessione su localhost)",
|
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': "ATTENZIONE: L'accesso richiede una connessione sicura (HTTPS) o l'esecuzione di web2py in locale (connessione su localhost)",
|
||||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTZIONE: NON ESEGUIRE PIÙ TEST IN PARALLELO (I TEST NON SONO "THREAD SAFE")',
|
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTZIONE: NON ESEGUIRE PIÙ TEST IN PARALLELO (I TEST NON SONO "THREAD SAFE")',
|
||||||
'ATTENTION: you cannot edit the running application!': "ATTENZIONE: non puoi modificare l'applicazione correntemente in uso ",
|
'ATTENTION: you cannot edit the running application!': "ATTENZIONE: non puoi modificare l'applicazione correntemente in uso ",
|
||||||
|
'Autocomplete Python Code': 'Autocomplete Python Code',
|
||||||
'Available databases and tables': 'Database e tabelle disponibili',
|
'Available databases and tables': 'Database e tabelle disponibili',
|
||||||
'back': 'indietro',
|
'back': 'indietro',
|
||||||
'cache': 'cache',
|
'cache': 'cache',
|
||||||
@@ -113,10 +115,12 @@
|
|||||||
'Edit': 'modifica',
|
'Edit': 'modifica',
|
||||||
'Edit application': 'Modifica applicazione',
|
'Edit application': 'Modifica applicazione',
|
||||||
'edit controller': 'modifica controller',
|
'edit controller': 'modifica controller',
|
||||||
|
'edit controller:': 'edit controller:',
|
||||||
'Edit current record': 'Modifica record corrente',
|
'Edit current record': 'Modifica record corrente',
|
||||||
'edit profile': 'modifica profilo',
|
'edit profile': 'modifica profilo',
|
||||||
'Edit This App': 'Modifica questa applicazione',
|
'Edit This App': 'Modifica questa applicazione',
|
||||||
'edit views:': 'modifica viste (view):',
|
'edit views:': 'modifica viste (view):',
|
||||||
|
'Editing bigul': 'Editing bigul',
|
||||||
'Editing file "%s"': 'Modifica del file "%s"',
|
'Editing file "%s"': 'Modifica del file "%s"',
|
||||||
'Editing Language file': 'Modifica file linguaggio',
|
'Editing Language file': 'Modifica file linguaggio',
|
||||||
'Enterprise Web Framework': 'Enterprise Web Framework',
|
'Enterprise Web Framework': 'Enterprise Web Framework',
|
||||||
@@ -140,6 +144,8 @@
|
|||||||
'file saved on %(time)s': "file salvato nell'istante %(time)s",
|
'file saved on %(time)s': "file salvato nell'istante %(time)s",
|
||||||
'file saved on %s': 'file salvato: %s',
|
'file saved on %s': 'file salvato: %s',
|
||||||
'filter': 'filter',
|
'filter': 'filter',
|
||||||
|
'Find Next': 'Find Next',
|
||||||
|
'Find Previous': 'Find Previous',
|
||||||
'Frames': 'Frames',
|
'Frames': 'Frames',
|
||||||
'Functions with no doctests will result in [passed] tests.': 'I test delle funzioni senza "doctests" risulteranno sempre [passed].',
|
'Functions with no doctests will result in [passed] tests.': 'I test delle funzioni senza "doctests" risulteranno sempre [passed].',
|
||||||
'Get from URL:': 'Get from URL:',
|
'Get from URL:': 'Get from URL:',
|
||||||
@@ -177,15 +183,16 @@
|
|||||||
'License for': 'Licenza relativa a',
|
'License for': 'Licenza relativa a',
|
||||||
'loading...': 'caricamento...',
|
'loading...': 'caricamento...',
|
||||||
'locals': 'locals',
|
'locals': 'locals',
|
||||||
'login': 'accesso',
|
|
||||||
'Login': 'Accesso',
|
'Login': 'Accesso',
|
||||||
|
'login': 'accesso',
|
||||||
'Login to the Administrative Interface': "Accesso all'interfaccia amministrativa",
|
'Login to the Administrative Interface': "Accesso all'interfaccia amministrativa",
|
||||||
'Logout': 'uscita',
|
'Logout': 'uscita',
|
||||||
'Main Menu': 'Menu principale',
|
'Main Menu': 'Menu principale',
|
||||||
|
'Manage': 'Manage',
|
||||||
'Menu Model': 'Menu Modelli',
|
'Menu Model': 'Menu Modelli',
|
||||||
'merge': 'unisci',
|
'merge': 'unisci',
|
||||||
'models': 'modelli',
|
|
||||||
'Models': 'Modelli',
|
'Models': 'Modelli',
|
||||||
|
'models': 'modelli',
|
||||||
'Modules': 'Moduli',
|
'Modules': 'Moduli',
|
||||||
'modules': 'moduli',
|
'modules': 'moduli',
|
||||||
'new application "%s" created': 'creata la nuova applicazione "%s"',
|
'new application "%s" created': 'creata la nuova applicazione "%s"',
|
||||||
@@ -198,6 +205,7 @@
|
|||||||
'NO': 'NO',
|
'NO': 'NO',
|
||||||
'No databases in this application': 'Nessun database presente in questa applicazione',
|
'No databases in this application': 'Nessun database presente in questa applicazione',
|
||||||
'no match': 'nessuna corrispondenza',
|
'no match': 'nessuna corrispondenza',
|
||||||
|
'online designer': 'online designer',
|
||||||
'or alternatively': 'or alternatively',
|
'or alternatively': 'or alternatively',
|
||||||
'Or Get from URL:': 'Or Get from URL:',
|
'Or Get from URL:': 'Or Get from URL:',
|
||||||
'or import from csv file': 'oppure importa da file CSV',
|
'or import from csv file': 'oppure importa da file CSV',
|
||||||
@@ -206,6 +214,7 @@
|
|||||||
'Overwrite installed app': 'sovrascrivi applicazione installata',
|
'Overwrite installed app': 'sovrascrivi applicazione installata',
|
||||||
'Pack all': 'crea pacchetto',
|
'Pack all': 'crea pacchetto',
|
||||||
'Pack compiled': 'crea pacchetto del codice compilato',
|
'Pack compiled': 'crea pacchetto del codice compilato',
|
||||||
|
'Pack custom': 'Pack custom',
|
||||||
'pack plugin': 'crea pacchetto del plugin',
|
'pack plugin': 'crea pacchetto del plugin',
|
||||||
'PAM authenticated user, cannot change password here': 'utente autenticato tramite PAM, impossibile modificare password qui',
|
'PAM authenticated user, cannot change password here': 'utente autenticato tramite PAM, impossibile modificare password qui',
|
||||||
'password changed': 'password modificata',
|
'password changed': 'password modificata',
|
||||||
@@ -217,15 +226,19 @@
|
|||||||
'Plural-Forms:': 'Plural-Forms:',
|
'Plural-Forms:': 'Plural-Forms:',
|
||||||
'Powered by': 'Powered by',
|
'Powered by': 'Powered by',
|
||||||
'previous 100 rows': '100 righe precedenti',
|
'previous 100 rows': '100 righe precedenti',
|
||||||
'private files': 'private files',
|
|
||||||
'Private files': 'Private files',
|
'Private files': 'Private files',
|
||||||
|
'private files': 'private files',
|
||||||
'Query:': 'Richiesta (query):',
|
'Query:': 'Richiesta (query):',
|
||||||
|
'Rapid Search': 'Rapid Search',
|
||||||
'record': 'record',
|
'record': 'record',
|
||||||
'record does not exist': 'il record non esiste',
|
'record does not exist': 'il record non esiste',
|
||||||
'record id': 'ID del record',
|
'record id': 'ID del record',
|
||||||
'register': 'registrazione',
|
'register': 'registrazione',
|
||||||
'reload': 'reload',
|
'reload': 'reload',
|
||||||
|
'Reload routes': 'Reload routes',
|
||||||
'Remove compiled': 'rimozione codice compilato',
|
'Remove compiled': 'rimozione codice compilato',
|
||||||
|
'Replace': 'Replace',
|
||||||
|
'Replace All': 'Replace All',
|
||||||
'request': 'request',
|
'request': 'request',
|
||||||
'Resolve Conflict file': 'File di risoluzione conflitto',
|
'Resolve Conflict file': 'File di risoluzione conflitto',
|
||||||
'response': 'response',
|
'response': 'response',
|
||||||
@@ -237,6 +250,8 @@
|
|||||||
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Run tests in this file (to run all files, you may also use the button labelled 'test')",
|
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Run tests in this file (to run all files, you may also use the button labelled 'test')",
|
||||||
'Running on %s': 'Running on %s',
|
'Running on %s': 'Running on %s',
|
||||||
'Save': 'Save',
|
'Save': 'Save',
|
||||||
|
'Save file:': 'Save file:',
|
||||||
|
'Save file: %s': 'Save file: %s',
|
||||||
'Save via Ajax': 'Save via Ajax',
|
'Save via Ajax': 'Save via Ajax',
|
||||||
'Saved file hash:': 'Hash del file salvato:',
|
'Saved file hash:': 'Hash del file salvato:',
|
||||||
'selected': 'selezionato',
|
'selected': 'selezionato',
|
||||||
@@ -245,23 +260,24 @@
|
|||||||
'shell': 'shell',
|
'shell': 'shell',
|
||||||
'Site': 'sito',
|
'Site': 'sito',
|
||||||
'some files could not be removed': 'non è stato possibile rimuovere alcuni files',
|
'some files could not be removed': 'non è stato possibile rimuovere alcuni files',
|
||||||
|
'Start searching': 'Start searching',
|
||||||
'Start wizard': 'start wizard',
|
'Start wizard': 'start wizard',
|
||||||
'state': 'stato',
|
'state': 'stato',
|
||||||
'static': 'statico',
|
'static': 'statico',
|
||||||
'Static': 'Static',
|
'Static': 'Static',
|
||||||
'Static files': 'Files statici',
|
'Static files': 'Files statici',
|
||||||
'Stylesheet': 'Foglio di stile (stylesheet)',
|
'Stylesheet': 'Foglio di stile (stylesheet)',
|
||||||
'submit': 'invia',
|
|
||||||
'Submit': 'Submit',
|
'Submit': 'Submit',
|
||||||
|
'submit': 'invia',
|
||||||
'Sure you want to delete this object?': 'Vuoi veramente cancellare questo oggetto?',
|
'Sure you want to delete this object?': 'Vuoi veramente cancellare questo oggetto?',
|
||||||
'table': 'tabella',
|
'table': 'tabella',
|
||||||
'test': 'test',
|
'test': 'test',
|
||||||
'Testing application': 'Test applicazione in corsg',
|
'Testing application': 'Test applicazione in corsg',
|
||||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La richiesta (query) è una condizione come ad esempio "db.tabella1.campo1==\'valore\'". Una condizione come "db.tabella1.campo1==db.tabella2.campo2" produce un "JOIN" SQL.',
|
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La richiesta (query) è una condizione come ad esempio "db.tabella1.campo1==\'valore\'". Una condizione come "db.tabella1.campo1==db.tabella2.campo2" produce un "JOIN" SQL.',
|
||||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
|
|
||||||
'the application logic, each URL path is mapped in one exposed function in the controller': 'logica dell\'applicazione, ogni percorso "URL" corrisponde ad una funzione esposta da un controller',
|
'the application logic, each URL path is mapped in one exposed function in the controller': 'logica dell\'applicazione, ogni percorso "URL" corrisponde ad una funzione esposta da un controller',
|
||||||
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
|
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
|
||||||
'the data representation, define database tables and sets': 'rappresentazione dei dati, definizione di tabelle di database e di "set" ',
|
'the data representation, define database tables and sets': 'rappresentazione dei dati, definizione di tabelle di database e di "set" ',
|
||||||
|
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
|
||||||
'The presentations layer, views are also known as templates': 'The presentations layer, views are also known as templates',
|
'The presentations layer, views are also known as templates': 'The presentations layer, views are also known as templates',
|
||||||
'the presentations layer, views are also known as templates': 'Presentazione dell\'applicazione, viste (views, chiamate anche "templates")',
|
'the presentations layer, views are also known as templates': 'Presentazione dell\'applicazione, viste (views, chiamate anche "templates")',
|
||||||
'There are no controllers': 'Non ci sono controller',
|
'There are no controllers': 'Non ci sono controller',
|
||||||
@@ -273,8 +289,8 @@
|
|||||||
'There are no translators, only default language is supported': 'Non ci sono traduzioni, viene solo supportato il linguaggio di base',
|
'There are no translators, only default language is supported': 'Non ci sono traduzioni, viene solo supportato il linguaggio di base',
|
||||||
'There are no views': 'Non ci sono viste ("view")',
|
'There are no views': 'Non ci sono viste ("view")',
|
||||||
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
|
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
|
||||||
'these files are served without processing, your images go here': 'questi files vengono serviti così come sono, le immagini vanno qui',
|
|
||||||
'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
|
'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
|
||||||
|
'these files are served without processing, your images go here': 'questi files vengono serviti così come sono, le immagini vanno qui',
|
||||||
'This is the %(filename)s template': 'Questo è il template %(filename)s',
|
'This is the %(filename)s template': 'Questo è il template %(filename)s',
|
||||||
'Ticket': 'Ticket',
|
'Ticket': 'Ticket',
|
||||||
'Ticket ID': 'Ticket ID',
|
'Ticket ID': 'Ticket ID',
|
||||||
@@ -322,8 +338,8 @@
|
|||||||
'Version %s.%s.%s (%s) %s': 'Version %s.%s.%s (%s) %s',
|
'Version %s.%s.%s (%s) %s': 'Version %s.%s.%s (%s) %s',
|
||||||
'versioning': 'sistema di versioni',
|
'versioning': 'sistema di versioni',
|
||||||
'Versioning': 'Versioning',
|
'Versioning': 'Versioning',
|
||||||
'view': 'vista',
|
|
||||||
'View': 'Vista',
|
'View': 'Vista',
|
||||||
|
'view': 'vista',
|
||||||
'Views': 'viste',
|
'Views': 'viste',
|
||||||
'views': 'viste',
|
'views': 'viste',
|
||||||
'Web Framework': 'Web Framework',
|
'Web Framework': 'Web Framework',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
function prepareDataForSave(name,data) {
|
function prepareDataForSave(name, data) {
|
||||||
var obj = new Object();
|
var obj = new Object();
|
||||||
obj.Name = name;
|
obj.Name = name;
|
||||||
obj.Data = data;
|
obj.Data = data;
|
||||||
@@ -7,35 +7,37 @@ function prepareDataForSave(name,data) {
|
|||||||
|
|
||||||
function prepareMultiPartPOST(data) {
|
function prepareMultiPartPOST(data) {
|
||||||
// var boundary = 'sPlItME' + Math.floor(Math.random()*10000);
|
// var boundary = 'sPlItME' + Math.floor(Math.random()*10000);
|
||||||
var boundary = '' + Math.floor(Math.random()*10000);
|
var boundary = '' + Math.floor(Math.random() * 10000);
|
||||||
var reqdata = '--' + boundary + '\r\n';
|
var reqdata = '--' + boundary + '\r\n';
|
||||||
//console.log(data.length);
|
//console.log(data.length);
|
||||||
for (var i=0;i < data.length;i++) {
|
for(var i = 0; i < data.length; i++) {
|
||||||
reqdata += 'content-disposition: form-data; name="';
|
reqdata += 'content-disposition: form-data; name="';
|
||||||
reqdata += data[i].Name + '"';
|
reqdata += data[i].Name + '"';
|
||||||
reqdata += "\r\n\r\n" ;
|
reqdata += "\r\n\r\n";
|
||||||
reqdata += data[i].Data;
|
reqdata += data[i].Data;
|
||||||
reqdata += "\r\n" ;
|
reqdata += "\r\n";
|
||||||
reqdata += '--' + boundary + '\r\n';
|
reqdata += '--' + boundary + '\r\n';
|
||||||
}
|
}
|
||||||
return new Array(reqdata,boundary);
|
return new Array(reqdata, boundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_error() {
|
function on_error() {
|
||||||
jQuery("input[name='saved_on']").attr('style','background-color:red');
|
jQuery("input[name='saved_on']").attr('style', 'background-color:red');
|
||||||
jQuery("input[name='saved_on']").val('communication error');
|
jQuery("input[name='saved_on']").val('communication error');
|
||||||
}
|
}
|
||||||
|
|
||||||
function doHighlight(highlight) {
|
function doHighlight(highlight) {
|
||||||
// Put the cursor at the offending line:
|
// Put the cursor at the offending line:
|
||||||
editor.setCursor({line:highlight.lineno-1,
|
editor.setCursor({
|
||||||
ch:highlight.offset+1});
|
line: highlight.lineno - 1,
|
||||||
}
|
ch: highlight.offset + 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function doClickSave() {
|
function doClickSave() {
|
||||||
var currentTabID = '#' + jQuery('#edit_placeholder div.tab-pane.active').attr('id');
|
var currentTabID = '#' + jQuery('#edit_placeholder div.tab-pane.active').attr('id');
|
||||||
var editor = jQuery (currentTabID + ' textarea').data('editor');
|
var editor = jQuery(currentTabID + ' textarea').data('editor');
|
||||||
var data = editor.getValue();
|
var data = editor.getValue();
|
||||||
var dataForPost = prepareMultiPartPOST(new Array(
|
var dataForPost = prepareMultiPartPOST(new Array(
|
||||||
prepareDataForSave('data', data),
|
prepareDataForSave('data', data),
|
||||||
@@ -45,7 +47,7 @@ function doClickSave() {
|
|||||||
jQuery(currentTabID + " input[name='saved_on']").val()),
|
jQuery(currentTabID + " input[name='saved_on']").val()),
|
||||||
prepareDataForSave('saved_on',
|
prepareDataForSave('saved_on',
|
||||||
jQuery(currentTabID + " input[name='saved_on']").val()),
|
jQuery(currentTabID + " input[name='saved_on']").val()),
|
||||||
prepareDataForSave('from_ajax','true')));
|
prepareDataForSave('from_ajax', 'true')));
|
||||||
// console.info(area.textarea.value);
|
// console.info(area.textarea.value);
|
||||||
jQuery(currentTabID + " input[name='saved_on']").attr('style',
|
jQuery(currentTabID + " input[name='saved_on']").attr('style',
|
||||||
'background-color:yellow');
|
'background-color:yellow');
|
||||||
@@ -53,57 +55,60 @@ function doClickSave() {
|
|||||||
currentUrl = jQuery(currentTabID + ' form').attr('action');
|
currentUrl = jQuery(currentTabID + ' form').attr('action');
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
contentType: 'multipart/form-data;boundary="'
|
contentType: 'multipart/form-data;boundary="' + dataForPost[1] + '"',
|
||||||
+ dataForPost[1] + '"',
|
|
||||||
url: currentUrl,
|
url: currentUrl,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: dataForPost[0],
|
data: dataForPost[0],
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('web2py-component-location',
|
xhr.setRequestHeader('web2py-component-location',
|
||||||
document.location);
|
document.location);
|
||||||
xhr.setRequestHeader('web2py-component-element',
|
xhr.setRequestHeader('web2py-component-element',
|
||||||
'doClickSave');
|
'doClickSave');
|
||||||
},
|
},
|
||||||
success: function(json,text,xhr){
|
success: function (json, text, xhr) {
|
||||||
jQuery(editor).data('saved', true); // Set as saved
|
jQuery(editor).data('saved', true); // Set as saved
|
||||||
editor.on("change", store_changes_function); // Re-enable change watcher
|
editor.on("change", store_changes_function); // Re-enable change watcher
|
||||||
// reenable disabled submit button
|
// reenable disabled submit button
|
||||||
var t=jQuery("input[name='save']");
|
var t = jQuery("input[name='save']");
|
||||||
t.attr('class','');
|
t.attr('class', '');
|
||||||
t.attr('disabled','');
|
t.attr('disabled', '');
|
||||||
try {
|
try {
|
||||||
if (json.error) {
|
if(json.error) {
|
||||||
window.location.href=json.redirect;
|
window.location.href = json.redirect;
|
||||||
} else {
|
} else {
|
||||||
// console.info( json.file_hash );
|
// console.info( json.file_hash );
|
||||||
jQuery(currentTabID + " input[name='file_hash']").val(json.file_hash);
|
jQuery(currentTabID + " input[name='file_hash']").val(json.file_hash);
|
||||||
jQuery(currentTabID + " input[name='saved_on']").val(json.saved_on);
|
jQuery(currentTabID + " input[name='saved_on']").val(json.saved_on);
|
||||||
if (json.highlight) {
|
if(json.highlight) {
|
||||||
doHighlight(json.highlight);
|
doHighlight(json.highlight);
|
||||||
} else {
|
} else {
|
||||||
jQuery(currentTabID + " input[name='saved_on']").attr('style','background-color:#99FF99');
|
jQuery(currentTabID + " input[name='saved_on']").attr('style', 'background-color:#99FF99');
|
||||||
//jQuery(".flash").delay(1000).fadeOut('slow');
|
//jQuery(".flash").delay(1000).fadeOut('slow');
|
||||||
}
|
}
|
||||||
// console.info(jQuery("input[name='file_hash']").val());
|
// console.info(jQuery("input[name='file_hash']").val());
|
||||||
var output = '<b>exposes:</b> ';
|
var output = '<b>exposes:</b> ';
|
||||||
for ( var i in json.functions) {
|
for(var i in json.functions) {
|
||||||
output += ' <a target="_blank" href="/' + json.application + '/' + json.controller + '/' + json.functions[i] + '">' + json.functions[i] + '</a>,';
|
output += ' <a target="_blank" href="/' + json.application + '/' + json.controller + '/' + json.functions[i] + '">' + json.functions[i] + '</a>,';
|
||||||
}
|
}
|
||||||
if(output!='<b>exposes:</b> ') {
|
if(output != '<b>exposes:</b> ') {
|
||||||
jQuery(currentTabID + " .exposed").html( output.substring(0, output.length-1));
|
jQuery(currentTabID + " .exposed").html(output.substring(0, output.length - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) { on_error();}
|
} catch(e) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(json) { on_error(); }
|
error: function (json) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActiveEditor() {
|
function getActiveEditor() {
|
||||||
var currentTabID = '#' + jQuery('#edit_placeholder div.tab-pane.active').attr('id');
|
var currentTabID = '#' + jQuery('#edit_placeholder div.tab-pane.active').attr('id');
|
||||||
var editor = jQuery (currentTabID + ' textarea').data('editor');
|
var editor = jQuery(currentTabID + ' textarea').data('editor');
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +123,7 @@ function getSelectionRange() {
|
|||||||
|
|
||||||
function doToggleBreakpoint(filename, url, sel) {
|
function doToggleBreakpoint(filename, url, sel) {
|
||||||
var editor = getActiveEditor();
|
var editor = getActiveEditor();
|
||||||
if (sel==null) {
|
if(sel == null) {
|
||||||
// use cursor position to determine the breakpoint line
|
// use cursor position to determine the breakpoint line
|
||||||
// (gutter already tell us the selected line)
|
// (gutter already tell us the selected line)
|
||||||
sel = getSelectionRange();
|
sel = getSelectionRange();
|
||||||
@@ -130,87 +135,97 @@ function doToggleBreakpoint(filename, url, sel) {
|
|||||||
prepareDataForSave('data', sel['data'])));
|
prepareDataForSave('data', sel['data'])));
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
contentType: 'multipart/form-data;boundary="'+dataForPost[1]+'"',
|
contentType: 'multipart/form-data;boundary="' + dataForPost[1] + '"',
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: dataForPost[0],
|
data: dataForPost[0],
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('web2py-component-location',
|
xhr.setRequestHeader('web2py-component-location',
|
||||||
document.location);
|
document.location);
|
||||||
xhr.setRequestHeader('web2py-component-element',
|
xhr.setRequestHeader('web2py-component-element',
|
||||||
'doSetBreakpoint');},
|
'doSetBreakpoint');
|
||||||
success: function(json,text,xhr){
|
},
|
||||||
|
success: function (json, text, xhr) {
|
||||||
// show flash message (if any)
|
// show flash message (if any)
|
||||||
var flash=xhr.getResponseHeader('web2py-component-flash');
|
var flash = xhr.getResponseHeader('web2py-component-flash');
|
||||||
if (flash) {
|
if(flash) {
|
||||||
jQuery('.flash').html(decodeURIComponent(flash))
|
jQuery('.flash').html(decodeURIComponent(flash))
|
||||||
.append('<a href="#" class="close">×</a>')
|
.append('<a href="#" class="close">×</a>')
|
||||||
.slideDown();
|
.slideDown();
|
||||||
}
|
} else jQuery('.flash').hide();
|
||||||
else jQuery('.flash').hide();
|
|
||||||
try {
|
try {
|
||||||
if (json.error) {
|
if(json.error) {
|
||||||
window.location.href=json.redirect;
|
window.location.href = json.redirect;
|
||||||
} else {
|
} else {
|
||||||
if (json.ok==true) {
|
if(json.ok == true) {
|
||||||
// mark the breakpoint if ok=True
|
// mark the breakpoint if ok=True
|
||||||
editor.setGutterMarker(json.lineno-1, "breakpoints", makeMarker());
|
editor.setGutterMarker(json.lineno - 1, "breakpoints", makeMarker());
|
||||||
} else if (json.ok==false) {
|
} else if(json.ok == false) {
|
||||||
// remove mark if ok=False
|
// remove mark if ok=False
|
||||||
editor.setGutterMarker(json.lineno-1, "breakpoints", null);
|
editor.setGutterMarker(json.lineno - 1, "breakpoints", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) { on_error(); }
|
} catch(e) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(json) { on_error(); }
|
error: function (json) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// on load, update all breakpoints markers:
|
// on load, update all breakpoints markers:
|
||||||
|
|
||||||
function doListBreakpoints(filename, url, editor) {
|
function doListBreakpoints(filename, url, editor) {
|
||||||
var dataForPost = prepareMultiPartPOST(new Array(
|
var dataForPost = prepareMultiPartPOST(new Array(
|
||||||
prepareDataForSave('filename', filename)
|
prepareDataForSave('filename', filename)
|
||||||
));
|
));
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
contentType: 'multipart/form-data;boundary="'+dataForPost[1]+'"',
|
contentType: 'multipart/form-data;boundary="' + dataForPost[1] + '"',
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: dataForPost[0],
|
data: dataForPost[0],
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('web2py-component-location',
|
xhr.setRequestHeader('web2py-component-location',
|
||||||
document.location);
|
document.location);
|
||||||
xhr.setRequestHeader('web2py-component-element',
|
xhr.setRequestHeader('web2py-component-element',
|
||||||
'doListBreakpoints');},
|
'doListBreakpoints');
|
||||||
success: function(json,text,xhr){
|
},
|
||||||
|
success: function (json, text, xhr) {
|
||||||
try {
|
try {
|
||||||
if (json.error) {
|
if(json.error) {
|
||||||
window.location.href=json.redirect;
|
window.location.href = json.redirect;
|
||||||
} else {
|
} else {
|
||||||
var editor = getActiveEditor();
|
var editor = getActiveEditor();
|
||||||
for (i in json.breakpoints) {
|
for(i in json.breakpoints) {
|
||||||
lineno = json.breakpoints[i];
|
lineno = json.breakpoints[i];
|
||||||
// mark the breakpoint if ok=True
|
// mark the breakpoint if ok=True
|
||||||
editor.setGutterMarker(lineno-1, "breakpoints",makeMarker());
|
editor.setGutterMarker(lineno - 1, "breakpoints", makeMarker());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) { on_error(); }
|
} catch(e) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(json) { on_error(); }
|
error: function (json) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeMarker() {
|
function makeMarker() {
|
||||||
var marker = document.createElement("div");
|
var marker = document.createElement("div");
|
||||||
marker.style.color = "#822";
|
marker.style.color = "#822";
|
||||||
marker.innerHTML = "●";
|
marker.innerHTML = "●";
|
||||||
marker.className = "breakpoint";
|
marker.className = "breakpoint";
|
||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function keepalive(url) {
|
function keepalive(url) {
|
||||||
@@ -218,39 +233,44 @@ function keepalive(url) {
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
success: function(){},
|
success: function () {},
|
||||||
error: function(x) { on_error(); } });
|
error: function (x) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_file (url) {
|
function load_file(url) {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
url: url,
|
url: url,
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
success: function(json){
|
success: function (json) {
|
||||||
if (typeof(json['plain_html']) !== undefined) {
|
if(typeof (json['plain_html']) !== undefined) {
|
||||||
if (jQuery('#' + json['id']).length === 0 || json['force'] === true) {
|
if(jQuery('#' + json['id']).length === 0 || json['force'] === true) {
|
||||||
// Create a tab and put the code in it
|
// Create a tab and put the code in it
|
||||||
var tab_header = '<li><a href="#'+json['id']+'" data-toggle="tab">'+json['filename']+'<button type="button" class="close">×</button></a></li>';
|
var tab_header = '<li><a href="#' + json['id'] + '" data-toggle="tab">' + json['filename'] + '<button type="button" class="close">×</button></a></li>';
|
||||||
var tab_body = '<div id="' + json['id'] + '" class="tab-pane fade in " >' + json['plain_html'] + '</div>';
|
var tab_body = '<div id="' + json['id'] + '" class="tab-pane fade in " >' + json['plain_html'] + '</div>';
|
||||||
if (json['force'] === false) {
|
if(json['force'] === false) {
|
||||||
jQuery('#filesTab').append(jQuery(tab_header));
|
jQuery('#filesTab').append(jQuery(tab_header));
|
||||||
jQuery('#myTabContent').append(jQuery(tab_body));
|
jQuery('#myTabContent').append(jQuery(tab_body));
|
||||||
} else {
|
} else {
|
||||||
jQuery('#' + json['id']).html(jQuery(tab_body));
|
jQuery('#' + json['id']).html(jQuery(tab_body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jQuery("a[href='#" + json['id'] + "']" ).click();
|
jQuery("a[href='#" + json['id'] + "']").click();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(x) { on_error(); }
|
error: function (x) {
|
||||||
|
on_error();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_font(editor, incr) {
|
function set_font(editor, incr) {
|
||||||
var fontSize = '';
|
var fontSize = '';
|
||||||
if (incr !== 0) {
|
if(incr !== 0) {
|
||||||
fontSize = parseInt(jQuery(editor.getWrapperElement()).css('font-size'));
|
fontSize = parseInt(jQuery(editor.getWrapperElement()).css('font-size'));
|
||||||
fontSize = fontSize + incr + "px";
|
fontSize = fontSize + incr + "px";
|
||||||
}
|
}
|
||||||
@@ -259,4 +279,3 @@ function set_font(editor, incr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template_js = '<p class="repo-name">{{{a_tag}}}</p><small>{{address}}</small>';
|
var template_js = '<p class="repo-name">{{{a_tag}}}</p><small>{{address}}</small>';
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -38,10 +38,10 @@
|
|||||||
<link rel="stylesheet" href="{{=cm}}/addon/dialog/dialog.css">
|
<link rel="stylesheet" href="{{=cm}}/addon/dialog/dialog.css">
|
||||||
<script src="{{=cm}}/addon/selection/active-line.js"></script>
|
<script src="{{=cm}}/addon/selection/active-line.js"></script>
|
||||||
<script src="{{=cm}}/emmet.min.js"></script>
|
<script src="{{=cm}}/emmet.min.js"></script>
|
||||||
<script language="Javascript" type="text/javascript" src="{{=URL('static','js/ajax_editor.js')}}"></script>
|
<script src="{{=URL('static','js/ajax_editor.js')}}"></script>
|
||||||
<link rel="stylesheet" href="{{=URL('static/css','typeahead.js-bootstrap.css')}}">
|
<link rel="stylesheet" href="{{=URL('static/css','typeahead.js-bootstrap.css')}}">
|
||||||
<link rel="stylesheet" href="{{=URL('static/css','web2py-codemirror.css')}}">
|
<link rel="stylesheet" href="{{=URL('static/css','web2py-codemirror.css')}}">
|
||||||
<script language="Javascript" type="text/javascript">
|
<script type="text/javascript">
|
||||||
var current_theme = "web2py"; //Default theme
|
var current_theme = "web2py"; //Default theme
|
||||||
var current_font_incr = 0; // Default font-size, 0 means don't set
|
var current_font_incr = 0; // Default font-size, 0 means don't set
|
||||||
jQuery(document).on('shown click', 'a[data-toggle="tab"]', function (e) {
|
jQuery(document).on('shown click', 'a[data-toggle="tab"]', function (e) {
|
||||||
|
|||||||
@@ -151,4 +151,3 @@
|
|||||||
</div> <!-- /sidebar -->
|
</div> <!-- /sidebar -->
|
||||||
</div> <!-- /row-fluid
|
</div> <!-- /row-fluid
|
||||||
<!-- end "site" block -->
|
<!-- end "site" block -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user