X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.js;h=7fb250149b0fc6ae7ac74bbb25283b4a4c3f1932;hb=f85be296b9862788320bc90ae34eb2c8c0db4b9e;hp=b43028fb8becbb306158ce503ac95d48a8e5d26b;hpb=083f2ba7e28210418de923821d02781996444212;p=kivitendo-erp.git diff --git a/js/kivi.js b/js/kivi.js index b43028fb8..7fb250149 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -337,7 +337,8 @@ namespace("kivi", function(ns) { extraPlugins: 'inline_resize', toolbar: buttons, disableAutoInline: true, - title: false + title: false, + disableNativeSpellChecker: false }; config.height = $e.height(); @@ -468,6 +469,9 @@ namespace("kivi", function(ns) { // - dialog: an optional object of options passed to the $.dialog() call // - load: an optional function that is called after the content has been loaded successfully (only if an AJAX call is made) ns.popup_dialog = function(params) { + if (kivi.Materialize) + return kivi.Materialize.popup_dialog(params); + var dialog; params = params || { }; @@ -672,6 +676,29 @@ namespace("kivi", function(ns) { $input.prop('selectionStart', position); $input.prop('selectionEnd', position); }; + + ns._shell_escape = function(str) { + if (str.match(/^[a-zA-Z0-9.,_=+/-]+$/)) + return str; + + return "'" + str.replace(/'/, "'\\''") + "'"; + }; + + ns.call_as_curl = function(params) { + params = params || {}; + var uri = document.documentURI.replace(/\?.*/, ''); + var command = ['curl', '--user', kivi.myconfig.login + ':SECRET', '--request', params.method || 'POST'] + + $(params.data || []).each(function(idx, elt) { + command = command.concat([ '--form-string', elt.name + '=' + (elt.value || '') ]); + }); + + command.push(uri); + + return $.map(command, function(elt, idx) { + return kivi._shell_escape(elt); + }).join(' '); + }; }); kivi = namespace('kivi');