Guest User

CKEDITOR 4 Paypal Insert Plugin paypal.js

a guest
Aug 5th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* This is my paypal.js code */
  2. (function()
  3. {
  4.     var paypalButtonData = {};
  5.  
  6.     CKEDITOR.dialog.add( 'paypalChooseButton', function( editor )
  7.     {
  8.         var lang = editor.lang.paypal;
  9.  
  10.         return {
  11.             title     : CKEDITOR.env.ie ? lang.dlgTitle : lang.title,
  12.             minWidth  : 300,
  13.             minHeight : 250,
  14.             contents  : [
  15.                 {
  16.                     id: 'paypal1',
  17.                     label: '',
  18.                     title: '',
  19.                     expand: false,
  20.                     padding: 0,
  21.                     elements: [
  22.                         {
  23.                             type: 'select',
  24.                             id: 'CKpaypal-currency',
  25.                             label: lang.labelButtontype + ' *',
  26.                             items: [ ['Please select one:', ''],['Single Item', 'paypalCreateSingleButton'],['Multi Choice Button', 'paypalCreateMultiButton']],
  27.                             validate: function()
  28.                             {
  29.                                 if( this.getValue() === '' )
  30.                                 {
  31.                                     document.getElementById( 'CKpaypal-validationMessages' ).innerHTML = lang.validatecurrency;
  32.                                     return false;
  33.                                 };
  34.                             },
  35.                             commit: function()
  36.                             {
  37.                                 paypalButtonData.buttonType = this.getValue();
  38.                             }
  39.                         },
  40.                         {
  41.                             type: 'html',
  42.                             html: '<div id="CKpaypal-validationMessages" style="color:red;font-weight:bold;margin-top:20px;"></div>'
  43.                         }
  44.                     ]
  45.                 }
  46.             ],
  47.             onOk: function()
  48.             {
  49.                 this.commitContent();
  50.  
  51.                 console.log( paypalButtonData );
  52.                 editor.openDialog( paypalButtonData.buttonType );
  53.                 return;
  54.             },
  55.             onShow: function()
  56.             {
  57.                 paypalButtonData = {};
  58.                 document.getElementById( 'CKpaypal-validationMessages' ).innerHTML = '';
  59.                 return;
  60.             }
  61.         };
  62.  
  63.     });
  64.  
  65. })();
Add Comment
Please, Sign In to add comment