Add files via upload

This commit is contained in:
Andrius Pratusis 2018-02-25 20:33:07 +02:00 committed by GitHub
parent 1cd2434054
commit ce4331e224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,17 +8,29 @@ tinymce.PluginManager.add('paypal', function(editor, url) {
editor.windowManager.open({ editor.windowManager.open({
title: 'Paypal Bludit plugin', title: 'Paypal Bludit plugin',
body: [ body: [
// If you and only you will use this plugin comment out email and currency rows below. Define e.data.email and e.data.currency variable in onsubmit method
{type: 'textbox', name: 'email', label: 'Your Paypal email'}, {type: 'textbox', name: 'email', label: 'Your Paypal email'},
{type: 'textbox', name: 'title', label: 'Title'}, {type: 'textbox', name: 'title', label: 'Title'},
{type: 'textbox', name: 'price', label: 'Price'}, {type: 'textbox', name: 'price', label: 'Price'},
{type: 'textbox', name: 'currency', label: 'Currency'}, {type: 'textbox', name: 'currency', label: 'Currency'},
{type: 'textbox', name: 'description', label: 'Short description'},
{type: 'textbox', name: 'url', label: 'Redirect to url after payment'} {type: 'textbox', name: 'url', label: 'Redirect to url after payment'}
], ],
onsubmit: function(e) { onsubmit: function(e) {
// Insert content when the window form is submitted // Insert content when the window form is submitted
if(e.data.email!=="" && e.data.title!=="" && e.data.price!=="" && e.data.currency!=="" && e.data.url!=="" && e.data.description!==""){
var button="<form action='https://www.paypal.com/cgi-bin/webscr' method='post'><input type='hidden' name='business' value='"+e.data.email+"'><input type='hidden' name='cmd' value='_xclick'><input type='hidden' name='item_name' value='"+e.data.title+"'><input type='hidden' name='amount' value='"+e.data.price+"'><input type='hidden' name='currency_code' value='"+e.data.currency+"'><input type='hidden' name='return' value='"+e.data.url+"'><input type='image' name='submit' border='0'src='https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif' alt='Buy Now'>"; var button="<form action='https://www.paypal.com/cgi-bin/webscr' method='post' onsubmit=return(unescape('return.value'));><input type='hidden' name='business' value='"+e.data.email+"'><input type='hidden' name='cmd' value='_xclick'><input type='hidden' name='item_name' value='"+e.data.title+"'><input type='hidden' name='amount' value='"+e.data.price+"'><input type='hidden' name='currency_code' value='"+e.data.currency+"'><input style='color:white;' type='hidden' name='return' value='"+e.data.url+"'><input type='image' name='submit' border='0'src='https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' alt='PayPal Acceptance'>";
editor.insertContent("<p>Product: "+e.data.title+"</p><br>");
editor.insertContent("<p>Description: "+e.data.description+"</p><br>");
editor.insertContent("<p>Price: "+e.data.price+""+e.data.currency+"</p><br>");
editor.insertContent(button); editor.insertContent(button);
change;
}
else{
alert("Error: You must fill in all of the fields :(");
}
} }
}); });
} }