BVB Source Codes

Jie Yang v0.6.3 article system Show fck_flash.js Source code

Return Download Jie Yang v0.6.3 article system: download fck_flash.js Source code - Download Jie Yang v0.6.3 article system Source code - Type:.js
  1. ?*
  2.  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  3.  * Copyright (C) 2003-2008 Frederico Caldeira Knabben
  4.  *
  5.  * == BEGIN LICENSE ==
  6.  *
  7.  * Licensed under the terms of any of the following licenses at your
  8.  * choice:
  9.  *
  10.  *  - GNU General Public License Version 2 or later (the "GPL")
  11.  *    http://www.gnu.org/licenses/gpl.html
  12.  *
  13.  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  14.  *    http://www.gnu.org/licenses/lgpl.html
  15.  *
  16.  *  - Mozilla Public License Version 1.1 or later (the "MPL")
  17.  *    http://www.mozilla.org/MPL/MPL-1.1.html
  18.  *
  19.  * == END LICENSE ==
  20.  *
  21.  * Scripts related to the Flash dialog window (see fck_flash.html).
  22.  */
  23.  
  24. var dialog              = window.parent ;
  25. var oEditor             = dialog.InnerDialogLoaded() ;
  26. var FCK                 = oEditor.FCK ;
  27. var FCKLang             = oEditor.FCKLang ;
  28. var FCKConfig   = oEditor.FCKConfig ;
  29. var FCKTools    = oEditor.FCKTools ;
  30.  
  31. //#### Dialog Tabs
  32.  
  33. // Set the dialog tabs.
  34. dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ;
  35.  
  36. if ( FCKConfig.FlashUpload )
  37.         dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
  38.  
  39. if ( !FCKConfig.FlashDlgHideAdvanced )
  40.         dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ;
  41.  
  42. // Function called when a dialog tag is selected.
  43. function OnDialogTabChange( tabCode )
  44. {
  45.         ShowE('divInfo'         , ( tabCode == 'Info' ) ) ;
  46.         ShowE('divUpload'       , ( tabCode == 'Upload' ) ) ;
  47.         ShowE('divAdvanced'     , ( tabCode == 'Advanced' ) ) ;
  48. }
  49.  
  50. // Get the selected flash embed (if available).
  51. var oFakeImage = dialog.Selection.GetSelectedElement() ;
  52. var oEmbed ;
  53.  
  54. if ( oFakeImage )
  55. {
  56.         if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') )
  57.                 oEmbed = FCK.GetRealElement( oFakeImage ) ;
  58.         else
  59.                 oFakeImage = null ;
  60. }
  61.  
  62. window.onload = function()
  63. {
  64.         // Translate the dialog box texts.
  65.         oEditor.FCKLanguageManager.TranslatePage(document) ;
  66.  
  67.         // Load the selected element information (if any).
  68.         LoadSelection() ;
  69.  
  70.         // Show/Hide the "Browse Server" button.
  71.         GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ;
  72.  
  73.         // Set the actual uploader URL.
  74.         if ( FCKConfig.FlashUpload )
  75.                 GetE('frmUpload').action = FCKConfig.FlashUploadURL ;
  76.  
  77.         dialog.SetAutoSize( true ) ;
  78.  
  79.         // Activate the "OK" button.
  80.         dialog.SetOkButton( true ) ;
  81.  
  82.         SelectField( 'txtUrl' ) ;
  83. }
  84.  
  85. function LoadSelection()
  86. {
  87.         if ( ! oEmbed ) return ;
  88.  
  89.         GetE('txtUrl').value    = GetAttribute( oEmbed, 'src', '' ) ;
  90.         GetE('txtWidth').value  = GetAttribute( oEmbed, 'width', '' ) ;
  91.         GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ;
  92.  
  93.         // Get Advances Attributes
  94.         GetE('txtAttId').value          = oEmbed.id ;
  95.         GetE('chkAutoPlay').checked     = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ;
  96.         GetE('chkLoop').checked         = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ;
  97.         GetE('chkMenu').checked         = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ;
  98.         GetE('cmbScale').value          = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ;
  99.  
  100.         GetE('txtAttTitle').value               = oEmbed.title ;
  101.  
  102.         if ( oEditor.FCKBrowserInfo.IsIE )
  103.         {
  104.                 GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ;
  105.                 GetE('txtAttStyle').value = oEmbed.style.cssText ;
  106.         }
  107.         else
  108.         {
  109.                 GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ;
  110.                 GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ;
  111.         }
  112.  
  113.         UpdatePreview() ;
  114. }
  115.  
  116. //#### The OK button was hit.
  117. function Ok()
  118. {
  119.         if ( GetE('txtUrl').value.length == 0 )
  120.         {
  121.                 dialog.SetSelectedTab( 'Info' ) ;
  122.                 GetE('txtUrl').focus() ;
  123.  
  124.                 alert( oEditor.FCKLang.DlgAlertUrl ) ;
  125.  
  126.                 return false ;
  127.         }
  128.  
  129.         oEditor.FCKUndo.SaveUndoStep() ;
  130.         if ( !oEmbed )
  131.         {
  132.                 oEmbed          = FCK.EditorDocument.createElement( 'EMBED' ) ;
  133.                 oFakeImage  = null ;
  134.         }
  135.         UpdateEmbed( oEmbed ) ;
  136.  
  137.         if ( !oFakeImage )
  138.         {
  139.                 oFakeImage      = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ;
  140.                 oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ;
  141.                 oFakeImage      = FCK.InsertElement( oFakeImage ) ;
  142.         }
  143.  
  144.         oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ;
  145.  
  146.         return true ;
  147. }
  148.  
  149. function UpdateEmbed( e )
  150. {
  151.         SetAttribute( e, 'type'                 , 'application/x-shockwave-flash' ) ;
  152.         SetAttribute( e, 'pluginspage'  , 'http://www.macromedia.com/go/getflashplayer' ) ;
  153.  
  154.         SetAttribute( e, 'src', GetE('txtUrl').value ) ;
  155.         SetAttribute( e, "width" , GetE('txtWidth').value ) ;
  156.         SetAttribute( e, "height", GetE('txtHeight').value ) ;
  157.  
  158.         // Advances Attributes
  159.  
  160.         SetAttribute( e, 'id'   , GetE('txtAttId').value ) ;
  161.         SetAttribute( e, 'scale', GetE('cmbScale').value ) ;
  162.  
  163.         SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
  164.         SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ;
  165.         SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ;
  166.  
  167.         SetAttribute( e, 'title'        , GetE('txtAttTitle').value ) ;
  168.  
  169.         if ( oEditor.FCKBrowserInfo.IsIE )
  170.         {
  171.                 SetAttribute( e, 'className', GetE('txtAttClasses').value ) ;
  172.                 e.style.cssText = GetE('txtAttStyle').value ;
  173.         }
  174.         else
  175.         {
  176.                 SetAttribute( e, 'class', GetE('txtAttClasses').value ) ;
  177.                 SetAttribute( e, 'style', GetE('txtAttStyle').value ) ;
  178.         }
  179. }
  180.  
  181. var ePreview ;
  182.  
  183. function SetPreviewElement( previewEl )
  184. {
  185.         ePreview = previewEl ;
  186.  
  187.         if ( GetE('txtUrl').value.length > 0 )
  188.                 UpdatePreview() ;
  189. }
  190.  
  191. function UpdatePreview()
  192. {
  193.         if ( !ePreview )
  194.                 return ;
  195.  
  196.         while ( ePreview.firstChild )
  197.                 ePreview.removeChild( ePreview.firstChild ) ;
  198.  
  199.         if ( GetE('txtUrl').value.length == 0 )
  200.                 ePreview.innerHTML = ' ' ;
  201.         else
  202.         {
  203.                 var oDoc        = ePreview.ownerDocument || ePreview.document ;
  204.                 var e           = oDoc.createElement( 'EMBED' ) ;
  205.  
  206.                 SetAttribute( e, 'src', GetE('txtUrl').value ) ;
  207.                 SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ;
  208.                 SetAttribute( e, 'width', '100%' ) ;
  209.                 SetAttribute( e, 'height', '100%' ) ;
  210.  
  211.                 ePreview.appendChild( e ) ;
  212.         }
  213. }
  214.  
  215. // <embed id="ePreview" src="fck_flash/claims.swf" width="100%" height="100%" style="visibility:hidden" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
  216.  
  217. function BrowseServer()
  218. {
  219.         OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ;
  220. }
  221.  
  222. function SetUrl( url, width, height )
  223. {
  224.         GetE('txtUrl').value = url ;
  225.  
  226.         if ( width )
  227.                 GetE('txtWidth').value = width ;
  228.  
  229.         if ( height )
  230.                 GetE('txtHeight').value = height ;
  231.  
  232.         UpdatePreview() ;
  233.  
  234.         dialog.SetSelectedTab( 'Info' ) ;
  235. }
  236.  
  237. function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
  238. {
  239.         switch ( errorNumber )
  240.         {
  241.                 case 0 :        // No errors
  242.                         alert( 'Your file has been successfully uploaded' ) ;
  243.                         break ;
  244.                 case 1 :        // Custom error
  245.                         alert( customMsg ) ;
  246.                         return ;
  247.                 case 101 :      // Custom warning
  248.                         alert( customMsg ) ;
  249.                         break ;
  250.                 case 201 :
  251.                         alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
  252.                         break ;
  253.                 case 202 :
  254.                         alert( 'Invalid file type' ) ;
  255.                         return ;
  256.                 case 203 :
  257.                         alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
  258.                         return ;
  259.                 case 500 :
  260.                         alert( 'The connector is disabled' ) ;
  261.                         break ;
  262.                 default :
  263.                         alert( 'Error on file upload. Error number: ' + errorNumber ) ;
  264.                         return ;
  265.         }
  266.  
  267.         SetUrl( fileUrl ) ;
  268.         GetE('frmUpload').reset() ;
  269. }
  270.  
  271. var oUploadAllowedExtRegex      = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ;
  272. var oUploadDeniedExtRegex       = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ;
  273.  
  274. function CheckUpload()
  275. {
  276.         var sFile = GetE('txtUploadFile').value ;
  277.  
  278.         if ( sFile.length == 0 )
  279.         {
  280.                 alert( 'Please select a file to upload' ) ;
  281.                 return false ;
  282.         }
  283.  
  284.         if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
  285.                 ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
  286.         {
  287.                 OnUploadCompleted( 202 ) ;
  288.                 return false ;
  289.         }
  290.  
  291.         return true ;
  292. }
  293.  
downloadfck_flash.js Source code - Download Jie Yang v0.6.3 article system Source code
Related Source Codes/Software:
Jilin classification information release system v5.0 trial version - A ready-made classifieds site publishing system, h... 2016-09-21
Linyi CMS v6.5 market classification information - A. supply and demand information function: informa... 2016-09-21
Tesco discount net SQL version - And presentations, faster. 2016-09-21
- electronic enterprise website management system In a fully functional version - Super suitable for enterprise agents build a corpo... 2016-09-21
Rio mesh network hard disk system v3.0 - System functions: 1, increase the progress of Asp... 2016-09-21
Classified information network business in suzhou - Overall module: classification of supply and deman... 2016-09-21
NPOINT virtual host v1.7.0 formal version management system - The system main function is introduced 2016-09-21
IDC sales web site - Beautiful IDC sales web site source code 2016-09-21
Oo 126 CMS movie site system - This procedure ASP + ACC/ASP + SQL, using new kern... 2016-09-21
Pcook CMS bubble guest v3.0 SDCMS version - Developed by Asp+Access, and meet the needs of sma... 2016-09-21
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top