芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/mod/lti/amd/build/cartridge_registration_form.min.js
define(["jquery","core/ajax","core/notification","mod_lti/tool_type","mod_lti/events","mod_lti/keys","core/str"],function(a,b,c,d,e,f,g){var h={CARTRIDGE_URL:"#cartridge-url",CONSUMER_KEY:"#registration-key",SHARED_SECRET:"#registration-secret",REGISTRATION_FORM:"#cartridge-registration-form",REGISTRATION_SUBMIT_BUTTON:"#cartridge-registration-submit",REGISTRATION_CANCEL_BUTTON:"#cartridge-registration-cancel"},i=function(){return a(h.REGISTRATION_FORM).attr("data-cartridge-url")},j=function(){return a(h.REGISTRATION_SUBMIT_BUTTON)},k=function(){return a(h.REGISTRATION_CANCEL_BUTTON)},l=function(){return a(h.CONSUMER_KEY).val()},m=function(){return a(h.SHARED_SECRET).val()},n=function(){j().addClass("loading")},o=function(){j().removeClass("loading")},p=function(){return j().hasClass("loading")},q=function(){if(p())return!1;var b=i();if(""===b)return!1;n();var f=l(),h=m(),j=d.create({cartridgeurl:b,key:f,secret:h});return j.done(function(){g.get_string("successfullycreatedtooltype","mod_lti").done(function(b){a(document).trigger(e.NEW_TOOL_TYPE),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION),a(document).trigger(e.REGISTRATION_FEEDBACK,{message:b})}).fail(c.exception)}).fail(function(){g.get_string("failedtocreatetooltype","mod_lti").done(function(b){a(document).trigger(e.NEW_TOOL_TYPE),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION),a(document).trigger(e.REGISTRATION_FEEDBACK,{message:b,error:!0})}).fail(c.exception)}).always(function(){o()}),j},r=function(){var b=a(h.REGISTRATION_FORM);b.submit(function(a){a.preventDefault(),q()});var c=k();c.click(function(b){b.preventDefault(),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION)}),c.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||a.keyCode!=f.ENTER&&a.keyCode!=f.SPACE||(a.preventDefault(),c.click())})};return{init:function(){r()}}});