Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/ckeditor/plugins/my_document/dialogs/document.js
Show All 12 Lines | |||||
if ( dialog.getContentElement( 'page1', 'cmbTarget' ).getValue() == 'popup' ) { | if ( dialog.getContentElement( 'page1', 'cmbTarget' ).getValue() == 'popup' ) { | ||||
$element.show(); | $element.show(); | ||||
} | } | ||||
else { | else { | ||||
$element.hide(); | $element.hide(); | ||||
} | } | ||||
}; | }; | ||||
var makeRelativeUrl = function ($url) { | |||||
if ( $url.indexOf(':/') == -1 && path.slice(0, 2) != '//' ) { | |||||
return $url; | |||||
} | |||||
var $link = document.createElement('a'); | |||||
$link.href = $url; | |||||
return $link.pathname; | |||||
}; | |||||
var parseLink = function( editor ) { | var parseLink = function( editor ) { | ||||
var retval = { | var retval = { | ||||
documentUrl: '', | documentUrl: '', | ||||
documentTitle: '', | documentTitle: '', | ||||
target: '', | target: '', | ||||
iconType: 'none', | iconType: 'none', | ||||
iconUrl: '' | iconUrl: '' | ||||
▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Line(s) | |||||
onOk : function() { | onOk : function() { | ||||
var data = {}, | var data = {}, | ||||
editor = this.getParentEditor(); | editor = this.getParentEditor(); | ||||
this.commitContent( data ); | this.commitContent( data ); | ||||
var $filename = data.documentUrl.slice(data.documentUrl.lastIndexOf('\/') + 1); | var $filename = data.documentUrl.slice(data.documentUrl.lastIndexOf('\/') + 1); | ||||
var $icon_url = CKEDITOR.basePath.split('/'); | var $icon_url = makeRelativeUrl(CKEDITOR.basePath).split('/'); | ||||
$icon_url.splice($icon_url.length - 3); // remove "/core/ckeditor/" | $icon_url.splice($icon_url.length - 3); // remove "/core/ckeditor/" | ||||
$icon_url = $icon_url.join('/') + editor.config.documentIconsUrl; | $icon_url = $icon_url.join('/') + editor.config.documentIconsUrl; | ||||
var $icon_image = ''; | var $icon_image = ''; | ||||
var $image_tag = data.iconType; | var $image_tag = data.iconType; | ||||
if (data.iconType == 'other') { | if (data.iconType == 'other') { | ||||
Show All 11 Lines | |||||
var $new_html = '<a href="' + data.documentUrl + '" id="Doc_|_' + $filename + '_|_' + $image_tag + '" alt="' + data.documentTitle + '">' + $icon_image + data.documentTitle + '</a> '; | var $new_html = '<a href="' + data.documentUrl + '" id="Doc_|_' + $filename + '_|_' + $image_tag + '" alt="' + data.documentTitle + '">' + $icon_image + data.documentTitle + '</a> '; | ||||
} | } | ||||
editor.insertHtml($new_html); | editor.insertHtml($new_html); | ||||
} | } | ||||
}; | }; | ||||
} | } | ||||
); | ); | ||||
No newline at end of file |