X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.js;h=7fb250149b0fc6ae7ac74bbb25283b4a4c3f1932;hb=93f4876585007a50a0821ebe499a4153930ddc7d;hp=005cdd0e682f3f9baa380d9f4b8e253cdf3ae90a;hpb=6c90631576a61bfe8ee843d8f454d5759a2a5bb0;p=kivitendo-erp.git diff --git a/js/kivi.js b/js/kivi.js index 005cdd0e6..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(); @@ -675,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');