1WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}} 2; 3try { 4/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-item/file-item.soy' */ 5// This file was automatically generated from file-item.soy. 6// Please don't edit this file by hand. 7 8/** 9 * @fileoverview Templates in namespace Confluence.Templates.File. 10 */ 11 12if (typeof Confluence == 'undefined') { var Confluence = {}; } 13if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 14if (typeof Confluence.Templates.File == 'undefined') { Confluence.Templates.File = {}; } 15 16 17Confluence.Templates.File.fileDialogListItem = function(opt_data, opt_ignored) { 18 return '<li class="attached-file loading" data-attachment-id="' + soy.$$escapeHtml(opt_data.file.id) + '" data-owner-id="' + soy.$$escapeHtml(opt_data.file.ownerId) + '" data-file-name="' + soy.$$escapeHtml(opt_data.file.fileName) + '"><div class="file-container" title="' + soy.$$escapeHtml(opt_data.tooltip) + '" id="' + soy.$$escapeHtml(opt_data.file.id) + '" aria-label="' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + ((opt_data.file.isImage) ? '<img class="thumbnail hidden" src="' + soy.$$escapeHtml(opt_data.file.nonceUrl) + '"><p class="hidden image-preview-throbber"> </p>' : (opt_data.file.isPreviewable) ? '<span class="thumbnail ' + soy.$$escapeHtml(opt_data.file.iconClass) + '" role="img"><i class="aui-icon confluence-icon-size-48 ' + soy.$$escapeHtml(opt_data.file.iconAUIClass) + '">' + soy.$$escapeHtml('File') + '</i></span><p class="hidden image-preview-throbber"> </p>' : '<span class="thumbnail ' + soy.$$escapeHtml(opt_data.file.iconClass) + '" role="img"><i class="aui-icon confluence-icon-size-48 ' + soy.$$escapeHtml(opt_data.file.iconAUIClass) + '">' + soy.$$escapeHtml('File') + '</i></span>') + '</div>' + ((opt_data.file.isImage || opt_data.file.isPreviewable) ? '<a href="' + soy.$$escapeHtml(opt_data.file.downloadUrl) + '" class="abs-icon zoom" role="button" tabindex="0" aria-pressed="false" aria-label="' + soy.$$escapeHtml('Zoom') + ' ' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + soy.$$escapeHtml('Zoom') + '</a>' : '') + '<i class="abs-icon select" role="checkbox" aria-checked="false" tabindex="0" aria-label="' + soy.$$escapeHtml('Select') + ' ' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + soy.$$escapeHtml('Select') + '</i><span class="caption filename" title="' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + soy.$$filterNoAutoescape(opt_data.highlightedImageNameContent) + '</span>' + ((opt_data.highlightedParentTitleContent) ? '<span class="caption owner-title" title="' + soy.$$escapeHtml(opt_data.file.parentTitle) + '">' + soy.$$filterNoAutoescape(opt_data.highlightedParentTitleContent) + '</span>' : '') + '</li>'; 19}; 20if (goog.DEBUG) { 21 Confluence.Templates.File.fileDialogListItem.soyTemplateName = 'Confluence.Templates.File.fileDialogListItem'; 22} 23 24 25Confluence.Templates.File.fileDialogListItemPlaceHolder = function(opt_data, opt_ignored) { 26 return '<li class="attached-file loading" data-attachment-id="' + soy.$$escapeHtml(opt_data.file.id) + '" data-file-name="' + soy.$$escapeHtml(opt_data.file.fileName) + '"><div class="file-container" title="' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + ((opt_data.file.isImage && opt_data.file.url) ? '<img class="thumbnail" src="' + soy.$$escapeHtml(opt_data.file.url) + '">' : '<span class="thumbnail"><i class="aui-icon confluence-icon-size-48 ' + soy.$$escapeHtml(opt_data.file.iconClass) + '">File</i></span>') + '<div id="docs-progress-bar-' + soy.$$escapeHtml(opt_data.file.fileId) + '" class="aui-progress-indicator"><span class="aui-progress-indicator-value"></span></div><div class="overlay"></div><i class="aui-icon aui-icon-small aui-iconfont-close-dialog abs-icon cancel">Cancel</i></div><span class="caption filename" title="' + soy.$$escapeHtml(opt_data.file.fileName) + '">' + soy.$$escapeHtml(opt_data.file.fileName) + '</span><span class="caption owner-title hidden" title=""></span></li>'; 27}; 28if (goog.DEBUG) { 29 Confluence.Templates.File.fileDialogListItemPlaceHolder.soyTemplateName = 'Confluence.Templates.File.fileDialogListItemPlaceHolder'; 30} 31 32}catch(e){WRMCB(e)}; 33; 34try { 35/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-item/file-item-model.js' */ 36define("confluence-editor/files/file-item/file-item-model",["backbone","confluence/legacy","confluence/api/constants","ajs"],function(e,c,f,d){return e.Model.extend({defaults:{id:-1,ownerId:-1,fileName:"",nonceUrl:"",isImage:!1,isFilePlaceHolder:!1,isSelect:!1,thumbnailUrl:"",downloadUrl:""},initialize:function(){var a=this;
36this._findDownloadUrl();this._findThumbnailUrl();this.findMetadata();this.findVersion();this.findContainer();this.set("fileName",this.getFileName());this.set("nonceUrl",this.getNonceUrl()); 37this.set("isImage",this.isImage());this.set("isPreviewable",this.isPreviewable());this.get("isFilePlaceHolder")&&this.set("id",this.get("fileId"));this.listenTo(this,"change:link",function(){a.set("nonceUrl",a.getNonceUrl());a._findDownloadUrl()});this.set("iconAUIClass",this._parseFileNameToAuiIconClass(this.get("fileName")))},isImage:function(){return this.get("isImage")?!0:!!this.get("thumbnailUrl")},isPreviewable:function(){return"application/pdf"===(this.get("niceType")||"").toLocaleLowerCase()|| 38this.isImage()},getFileName:function(){return this.get("fileName")||this.get("title")||""},getDestinationUrl:function(){return d.REST.wikiLink(this.attributes).destination},getNonceUrl:function(){var a=this.get("thumbnailUrl");if(0<=a.indexOf("modificationDate"))return a;var b=this.get("lastModifiedDate"),b=b?b.date:+new Date,b=encodeURIComponent(b);a&&(a+=(a.indexOf("?")+1?"&":"?")+"nonce="+b);return a},getRelativeUrl:function(a){var b=a;if(!a)return a;0===a.indexOf(c.getBaseUrl())&&(b=a.replace(c.getBaseUrl(), 39""));return f.CONTEXT_PATH+b},_findThumbnailUrl:function(){var a=this.get("_links");!this.get("thumbnailUrl")&&(a&&a.thumbnail)&&this.set("thumbnailUrl",this.getRelativeUrl(a.thumbnail))},_findDownloadUrl:function(){var a=this.get("_links");!this.get("downloadUrl")&&a&&this.set("downloadUrl",this.getRelativeUrl(a.download))},findMetadata:function(){var a=this.get("metadata");!this.get("contentType")&&a&&(this.set("niceType",a.mediaType),this.set("contentType",a.mediaType))},findVersion:function(){var a= 40this.get("version");!this.get("versionNumber")&&a&&this.set("versionNumber",a.number)},findContainer:function(){var a=this.get("container");a&&(-1===this.get("ownerId")&&this.set("ownerId",a.id),this.get("parentTitle")||this.set("parentTitle",a.title))},_getFileExtension:function(a){return a.substr(a.lastIndexOf(".")+1)},_parseFileNameToAuiIconClass:function(a){return d.Confluence.FileTypesUtils.getAUIIconFromExt(this._getFileExtension(a))}})}); 41require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-item/file-item-model","Confluence.Editor.FileDialog.FileItemModel"); 42}catch(e){WRMCB(e)}; 43; 44try { 45/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-item/file-item-view.js' */ 46define("confluence-editor/files/file-item/file-item-view","backbone confluence/templates confluence/highlighter raphael underscore wrm jquery".split(" "),function(f,g,h,i,d,j,c){return f.View.extend({template:g.File.fileDialogListItem,model:null,initialize:function(a){var b=this;this.eventListener=a.eventListener;this.model=a.model;this.showContainerInfo=a.showContainerInfo;this.highlighter=a.highlighter;this.listenTo(this.model,"change:isSelect",function(){b.$el.toggleClass("selected",b.model.get("isSelect")); 47b.$el.find(".select").attr("aria-checked",b.model.get("isSelect"))})},render:function(){var a=this.highlighter||new h,b=this.model.get("space"),e=this.model.getFileName(),a={file:this.model.attributes,tooltip:this.showContainerInfo&&b?e+" ("+b.name+")":e,highlightedImageNameContent:a.highlight(e),highlightedParentTitleContent:this.showContainerInfo?a.highlight(this.model.get("container").title):null};this.$el=c(this.template(a));this.el=this.$el[0];this.delegateEvents();this.$el.find(".file-container").tooltip({aria:true}); 48this.$el.attr("data-destination",this.model.getDestinationUrl());this.model.get("isImage")?this._renderLoadingSpinner():this.$el.removeClass("loading");this.model.get("isPreviewable")&&this._renderPreviewButton();return this},_renderPreviewButton:function(){this.$(".zoom").on("keydown click",d.bind(function(a){if(!(a.type==="keydown"&&a.key!=="Enter"&&a.key!==" ")){a.preventDefault();a={src:this.model.get("downloadUrl"),thumbnail:this.model.get("nonceUrl")||this.model.get("downloadUrl"),type:this.model.get("contentType"), 49rank:0,title:this.model.getFileName(),id:this.model.get("id"),ownerId:this.model.get("ownerId"),version:this.model.get("versionNumber")};this._setupAndShowPreviewer(a)}},this))},_setupAndShowPreviewer:function(a){var b=d.bind(function(a,b){this.loader=require("cp/confluence/file-preview-loader");var c=this.loader.setupPreviewForSingleFile([a],b);c.on("fv.open",b.openPreviewCallback);c.on("fv.close",b.closePreviewCallback);c.open();c.showFileWhere()},this);if(!this.dfd)this.dfd=j.require("wr!com.atlassian.confluence.plugins.confluence-previews:confluence-previews-resources"); 50this.dfd.then(d.partial(b,a,{viewMode:"simple",openPreviewCallback:function(){c("#insert-image-dialog").hide();c(".aui-blanket").hide()},closePreviewCallback:function(){c("#insert-image-dialog").show();c(".aui-blanket").show()}}))}
50,_renderLoadingSpinner:function(){var a=this,b=this.$el.find(".image-preview-throbber").removeClass("hidden"),c=i.spinner(b[0],8,"#666"),d=this.$el.find("img").on("load",function(){c();b.remove();d.removeClass("hidden");a.$el.removeClass("loading")})}})}); 51require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-item/file-item-view","Confluence.Editor.FileDialog.FileItemView"); 52}catch(e){WRMCB(e)}; 53; 54try { 55/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-item/file-placeholder-view.js' */ 56define("confluence-editor/files/file-item/file-placeholder-view",["backbone","confluence/templates","underscore","ajs","jquery"],function(b,d,e,f,g){return b.View.extend({model:null,template:d.File.fileDialogListItemPlaceHolder,initialize:function(a){this.model=a.model;this.eventListener=a.eventListener;this.eventListener.on("file.placeholder.process",e.bind(this._setUploadInProgress,this))},events:{"click .cancel":"_cancelUpload"},render:function(){this.$el=g(this.template({file:this.model.attributes})); 57this.el=this.$el[0];this.delegateEvents();return this},_setUploadInProgress:function(a,b){var c=this.$el.find("#docs-progress-bar-"+b||"");c.length&&(1===a&&this.$(".cancel").hide(),c.show(),f.progressBars.update(c,a))},_cancelUpload:function(){this.eventListener.trigger("uploadingfile.cancelled",this.model.get("fileId"))}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-item/file-placeholder-view","Confluence.Editor.FileDialog.FilePlaceHolderView"); 58}catch(e){WRMCB(e)}; 59; 60try { 61/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-list/file-list-collection.js' */ 62define("confluence-editor/files/file-list/file-list-collection",["backbone","confluence-editor/files/file-item/file-item-model","underscore"],function(c,d,e){return c.Collection.extend({model:d,clearSelection:function(){this.each(function(a){a.get("isSelect")&&a.set("isSelect",!1)});this.trigger("clear.selection")},getAllSelectItems:function(){return this.filter(function(a){return a.get("isSelect")})},setSelection:function(a){e.each(a,function(a){return a.set("isSelect",!0)})},resetFiles:function(a){this.reset(); 63for(var b=0;b<a.length;b++)this.addFile(a[b])},addFile:function(a){a=this.add(a);this.trigger("add-file",a.at(a.length-1))},removeFile:function(a){this.remove(a);this.trigger("remove-file",a)},replaceFile:function(a,b){this.remove(a);this.add(b);this.trigger("replace-file",a,b)}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-list/file-list-collection","Confluence.Editor.FileDialog.FileListCollection"); 64}catch(e){WRMCB(e)}; 65; 66try { 67/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-list/file-list-view.js' */ 68define("confluence-editor/files/file-list/file-list-view","backbone confluence-editor/files/file-item/file-item-view confluence-editor/files/file-item/file-item-model confluence-editor/files/file-item/file-placeholder-view confluence/api/constants jquery".split(" "),function(f,g,h,i,j,c){return f.View.extend({eventListener:null,events:{click:"_clearSelection","click li.attached-file":"_clickItem","keydown li.attached-file":"_clickItem","dblclick li.attached-file":"_doubleClickItem"},initialize:function(a){var b= 69this;this.collection=a.collection;if(a.eventListener){this.eventListener=a.eventListener;this.listenTo(this.eventListener,"uploadingfile.completed",this._addUploadedFile);this.listenTo(this.eventListener,"uploadingfile.cancelled",this._cancelUploadingFile)}this.listenTo(this.collection,"reset",this._clearFileList);this.listenTo(this.collection,"add-file",this._renderNewItem);this.listenTo(this.collection,"remove-file",this._removeItem);this.listenTo(this.collection,"replace-file",this._replaceItem); 70this.listenTo(this.collection,"change:isSelect",function(){this.context.setSelectItems(this.collection.getAllSelectItems())});this.listenTo(this.collection,"change:link",function(a){b.collection.removeFile(a);b.collection.addFile(a)});this.updateDialogContext(a.context);this.updatePanelContext(a.panelContext)},_addUploadedFile:function(a,b){var d=this;c.get(j.CONTEXT_PATH+"/rest/api/content/"+b+"?expand=version,container,space").done(function(b){var b=new h(b),c=d.collection.get(a);c||(c=d.collection.findWhere({fileName:b.get("fileName")}
70)); 71c?d.collection.replaceFile(c,b):d.collection.addFile(b)})},_cancelUploadingFile:function(a){(a=this.collection.get(a))&&(a.get("previousUploadedFile")?this.collection.replaceFile(a,a.get("previousUploadedFile")):this.collection.removeFile(a))},render:function(){return this},resetFileList:function(a,b){b=b||{};this.$el.find(".loading-message").addClass("hidden");this.$el.find(".no-files").remove();this.collection.resetFiles(a);this.collection.length===0&&this.$fileList.before(c("<p></p>").addClass("no-files").text(this.noFileMessage)); 72b.shouldClearSelection&&this.collection.clearSelection();this._checkError(b.errors);this.$el.sizeToFit()},_getViewFromModel:function(a){return a.get("isFilePlaceHolder")?(new i({model:a,eventListener:this.eventListener})).render():(new g({model:a,showContainerInfo:this.showContainerInfo,highlighter:this.highlighter,eventListener:this.eventListener})).render()},_renderNewItem:function(a){if(this.$fileList&&this.$fileList.length){var b=this._getViewFromModel(a);this.$fileList.prepend(b.el);a.get("isFilePlaceHolder")|| 73a.set("isSelect",true)}},_removeItem:function(a){if(this.$fileList&&this.$fileList.length)(a=this._getDomElementByFileName(a.get("fileName")))&&a.remove()},_replaceItem:function(a,b){if(this.$fileList&&this.$fileList.length){var c=this._getViewFromModel(b),e=this._getDomElementByFileName(a.get("fileName"));e&&e.length?e.replaceWith(c.el):this.$fileList.prepend(c.el);b.set("isSelect",true)}},_getDomElementByFileName:function(a){var b=null;this.$fileList.find("li").each(function(){var d=c(this);d.attr("data-file-name")=== 74a&&(b=d)});return b},updatePanelContext:function(a){if(a){this.panelContext=a;this.errors=this.panelContext.errors||[];this.$el=this.fileContainer=this.panelContext.fileContainer;this.el=this.$el[0];this.$fileList=this.$el.find(".file-list");this.delegateEvents();this.noFileMessage=this.panelContext.noFileMessage;this.showContainerInfo=this.panelContext.showContainerInfo;this.highlighter=this.panelContext.highlighter;this.displayErrors=this.panelContext.displayErrors}},updateDialogContext:function(a){if(a){this.context= 75a;this.contextOptions=this.context.options}},_checkError:function(a){(a=a||[])&&a.length&&this.displayErrors(a)},_clearSelection:function(a){a=a&&c(a.target);if(!a||!a.hasClass("close-tip")){this.collection.clearSelection();this.$el.find(".current").removeClass("current")}},_clearFileList:function(){this.$fileList&&this.$fileList.empty()},_clickItem:function(a){if(!(a.type==="keydown"&&a.key!=="Enter"&&a.key!==" ")){a.stopPropagation();a.preventDefault();var b=c(a.target);if(!b.closest(".zoom").length){a.isTrigger|| 76this.$fileList.find(".current").removeClass("current");a=b.closest("li").attr("data-attachment-id");(a=this.collection.get(a))&&!a.get("isFilePlaceHolder")&&a.set("isSelect",!a.get("isSelect"))}}},_doubleClickItem:function(a){var a=c(a.target).closest("li"),b=a.attr("data-attachment-id");if((b=this.collection.get(b))&&!b.get("isFilePlaceHolder")){a.click();this.context.insert()}}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-list/file-list-view","Confluence.Editor.FileDialog.FileListView"); 77}catch(e){WRMCB(e)}; 78; 79try { 80/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/base-panel/base-panel-view.js' */ 81define("confluence-editor/files/base-panel/base-panel-view",["backbone","ajs","jquery"],function(b,a,c){return b.View.extend({context:null,cssContainer:"",cssPanel:"",textErrorSearch:"Error searching for attachments from Confluence. The server may be unavailable.",textErrorRetrieving:"Error retrieving attachments from Confluence. The server may be unavailable.",textDefaultErrorMessage:"Could not upload the file to Confluence. The server may be unavailable.",textUploading:"Image uploading...",initialize:function(){},createPanel:function(d){this.context= 82d;this.render();var a=this;if(d=this.context.getPanel(this.panelId))d.onselect=function(){a.context.clearSelection();a.focus&&a.focus()}},render:function(){return this},getPanelElement:function(){return c(this.cssPanel,this.context.baseElement)},getContainer:function(){return c(this.cssContainer)},getForm:function(){return c("form",this.getPanelElement())},clearContainer:function(){var a=this.getContainer();a.find(".loading-message").removeClass("hidden");a.find(".warning").addClass("hidden")},clearErrors:function(){this.messenger.clearMessages()}, 83displayErrors:function(a){this.uploader.displayErrors(a);this.getContainer().sizeToFit()},getNoFileContainer:function(){return this.getPanelElement().find(".no-files")},getFileListContainer:function(){return this.getPanelElement().find("ul.file-list")}})}); 84require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/base-panel/base-panel-view","Confluence.Editor.FileDialog.BasePanel",function(){var b=require("underscore"),a=require("backbone");require("confluence/legacy").Editor.FileDialog.eventListener=b.extend({},a.Events)}); 85}catch(e){WRMCB(e)}; 86; 87try { 88/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/attachments-panel/attachments-panel.soy' */ 89// This file was automatically generated from attachments-panel.soy. 90// Please don't edit this file by hand. 91 92/** 93 * @fileoverview Templates in namespace Confluence.Templates.File. 94 */ 95 96if (typeof Confluence == 'undefined') { var Confluence = {}; } 97if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 98if (typeof Confluence.Templates.File == 'undefined') { Confluence.Templates.File = {}; } 99 100 101Confluence.Templates.File.uploadFileForm = function(opt_data, opt_ignored) { 102 return '' + ((opt_data.hasAttachPermission) ? '<div id="upload-attachment">' + ((opt_data.isNonSupportDragDrop) ? '<form action="' + soy.$$escapeHtml("") + '/pages/attachfile.action" method="post" enctype="multipart/form-data">' : '<form>') + '<button id="upload-files-button" class="aui-button upload-files"><span class="file-upload-icon aui-icon aui-icon-small aui-iconfont-upload"></span> ' + soy.$$escapeHtml('Upload files') + ((opt_data.isNonSupportDragDrop) ? '<input name="file_0" type="file" class="upfile invisible">' : '') + '</button>' + ((opt_data.isNonSupportDragDrop) ? '<input type="hidden" name="minorEdit_0" value="true" /><input type="hidden" name="atl_token" value="' + soy.$$escapeHtml(opt_data.atlToken) + '" />' : '') + '</form>' + ((opt_data.isNonSupportDragDrop) ? '<div class="upload-in-progress hidden">' + soy.$$escapeHtml('Image uploading...') + '</div>' : '') + '</div>' : '') + ((opt_data.hasAttachPermission) ? '<div class="divider"></div>' : ''); 103}; 104if (goog.DEBUG) { 105 Confluence.Templates.File.uploadFileForm.soyTemplateName = 'Confluence.Templates.File.uploadFileForm'; 106} 107 108 109Confluence.Templates.File.attachedFilesPanel = function(opt_data, opt_ignored) { 110 return '<div id="attached-files" class="scroll-wrapper">' + aui.message.warning({title: '', closeable: 'true', content: ''}) + '<div class="loading-message hidden">' + soy.$$escapeHtml('Loading...') + '</div><ul class="file-list"></ul></div>'; 111}; 112if (goog.DEBUG) { 113 Confluence.Templates.File.attachedFilesPanel.soyTemplateName = 'Confluence.Templates.File.attachedFilesPanel'; 114} 115 116}catch(e){WRMCB(e)}; 117; 118try { 119/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/attachments-panel/attachments-panel-view.js' */ 120define("confluence-editor/files/attachments-panel/attachments-panel-view","confluence-editor/files/file-list/file-list-view confluence-editor/files/file-item/file-item-model confluence-editor/files/file-list/file-list-collection confluence-editor/files/base-panel/base-panel-view confluence/templates confluence/legacy confluence/api/constants ajs confluence/meta underscore window jquery".split(" "),function(n,i,o,j,k,p,l,e,h,m,f,g){return j.extend({id:"attachments",panelId:"",cssPanel:".attachments-panel", 121cssContainer:"#attached-files",textNoFileMessage:"There are no files attached to this page.",textPanelTitle:"Attached to this page",initialize:function(a){j.prototype.initialize.call(this);this.eventListener=a.eventListener;this.context=null;this.collection=new o;this.fileListView=new n({collection:this.collection,eventListener:this.eventListener});this.xhrCount=0},render:function(){var a=this;this.eventListener.trigger("AttachmentsPanelView.render",this);this.fileListView.updateDialogContext(this.context);
122this.panelId=this.context.addPanel(this.textPanelTitle,this.getPanel(),"attachments-panel");this.el=this.getPanelElement();this.$el=g(this.el);this.delegateEvents();this.fileListView.updatePanelContext({fileContainer:this.getContainer(),noFileMessage:this.textNoFileMessage,showContainerInfo:false,errors:[],displayErrors:function(b){a.uploader.clearErrors();a.uploader.displayErrors(b)}});this.uploader=this.getUploaderController(this.context);this.messenger=this.uploader.getMessageHandler();this.collection.reset(); 123this._canAttachFiles()?this.refresh({shouldClearSelection:true}):this.refresh({errors:["You\u0027ll need to ask permission to insert files here."],shouldClearSelection:true});return this},getPanel:function(){return k.File.uploadFileForm({isNonSupportDragDrop:!this._hasXhrSupport(),atlToken:h.get("atl-token"),hasAttachPermission:this._canAttachFiles()})+k.File.attachedFilesPanel()},_overideUploaderClientForNonDragDropSupport:function(){var a=this;return{onUploadSuccess:function(b){for(var c=0;c<b.length;c++){var d= 124b[c].id,e=a.collection.get(d);e&&a.collection.removeFile(e);g.get(l.CONTEXT_PATH+"/rest/api/content/"+d+"?expand=version,container,space").done(function(b){b=new i(b);a.collection.addFile(b)})}},pack:function(){a.getContainer().sizeToFit()},getDefaultErrorMessage:function(){return a.textDefaultErrorMessage},getDefaultUploadingMessage:function(){return a.textUploading},displayErrors:function(b){this.getMessageHandler().displayMessages(b);a._showErrorIconInMessageBox();this.pack()}}},getUploaderController:function(){return p.AttachmentUploader({baseElement:this.getPanelElement()}, 125m.bind(this._overideUploaderClientForNonDragDropSupport,this))},refresh:function(a){var b=this,c=a.shouldClearSelection?this.getPanelElement().find(".loading-message"):false,d=this.xhrCount=this.xhrCount+1;e.getJSONWrap({url:this._getUrlREST(),messageHandler:this.messenger,loadingElement:c,errorMessage:this.textErrorRetrieving,successCallback:function(c){if(d===b.xhrCount){a.data=c;b._onSuccessLoadFiles(a)}},errorCallback:m.bind(this._onErrorLoadFiles,this)})},_onSuccessLoadFiles:function(a){this.fileListView.resetFileList(a.data.results, 126a)},_onErrorLoadFiles:function(){this._showErrorIconInMessageBox()},_showErrorIconInMessageBox:function(){var a=this.messenger.getMessageContainer().find("ul");a.toggleClass("one-message",a.find("li").length===1)},setUploadInProgress:function(a,b){this.eventListener.trigger("file.placeholder.process",a,b)},attachmentUploaded:function(a,b){this.eventListener.trigger("uploadingfile.completed",a,b)},attachmentUploadingCancelled:function(a){this.eventListener.trigger("uploadingfile.cancelled",a)},_hasXhrSupport:function(){var a, 127b;try{a=new XMLHttpRequest;b=!(!a.sendAsBinary&&!a.upload)&&!(g.browser.mozilla&&g.browser.version.indexOf("1.9.1")>-1)}catch(c){b=false}return b},addPreviewImage:function(a){if(f.File&&f.FileReader&&f.FileList&&f.Blob){var b=this;a.isImage=a.nativeFile&&a.nativeFile.type&&this._isImageType(a.nativeFile.type);if(a.isImage&&a.nativeFile.size<5242880){var c=new FileReader;c.onload=function(){b._addFilePlaceHolderToCollection(a,c.result)};c.readAsDataURL(a.nativeFile)}else this._addFilePlaceHolderToCollection(a, 128null)}},_addFilePlaceHolderToCollection:function(a,b){var c=null,d=this.collection.findWhere({fileName:a.name});if(d){this.collection.removeFile(d);d.get("isFilePlaceHolder")?d.get("previousUploadedFile")&&(c=d.get("previousUploadedFile")):c=d}c=new i({isFilePlaceHolder:true,fileName:a.name,fileId:a.id,fileNative:a.nativeFile,url:b||"",isImage:a.isImage,niceType:a.isImage?"Image":"",fileType:a.nativeFile.type,thumbnailUrl:b||"",previousUploadedFile:c});this.collection.addFile(c)},_isImageType:function(a){return e.Confluence.FileTypesUtils.isImage(a)}, 129_canAttachFiles:function(){return h.getBoolean("can-attach-files")},_getUrlREST:function(){var a=parseInt(h.get("attachment-source-content-id"),10);return l.CONTEXT_PATH+"/rest/api/content/"+a+"/child/attachment?expand=version,container,space"},focus:function(){this.collection.clearSelection()}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/attachments-panel/attachments-panel-view","Confluence.Editor.FileDialog.AttachmentsPanelView"); 130}catch(e){WRMCB(e)}; 131; 132try { 133/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/external-panel/external-panel.soy' */ 134// This file was automatically generated from external-panel.soy. 135// Please don't edit this file by hand. 136 137/** 138 * @fileoverview Templates in namespace Confluence.Templates.File. 139 */ 140 141if (typeof Confluence == 'undefined') { var Confluence = {}; } 142if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 143if (typeof Confluence.Templates.File == 'undefined') { Confluence.Templates.File = {}; } 144 145 146Confluence.Templates.File.webPanel = function(opt_data, opt_ignored) { 147 return '<div class="insert-web-image"><form id="insert-web-image-form" action="#" class="aui"><fieldset class="inline"><div class="web-image-input"><label for="insert-web-image-image-url" id="insert-web-image-image-url-label">' + soy.$$escapeHtml('Image URL:') + '</label><input type="text" class="text image-url" id="insert-web-image-image-url" name="insert-web-image-image-url"></div><input type="submit" class="image-preview aui-button" value="' + soy.$$escapeHtml('Preview') + '"></fieldset></form><p class="faraway image-preview-area"></p><p class="hidden image-preview-error">' + soy.$$escapeHtml('This image couldn\x27t be loaded for preview. Please check the URL.') + '</p><p class="hidden image-preview-throbber"> </p></div>'; 148}; 149if (goog.DEBUG) { 150 Confluence.Templates.File.webPanel.soyTemplateName = 'Confluence.Templates.File.webPanel'; 151} 152 153}catch(e){WRMCB(e)}; 154; 155try { 156/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/external-panel/external-panel-view.js' */ 157define("confluence-editor/files/external-panel/external-panel-view",["confluence-editor/files/base-panel/base-panel-view","confluence/templates","jquery","raphael","ajs"],function(c,e,d,f,g){return c.extend({id:"external",panelId:"",cssPanel:".web-image-panel",cssContainer:".insert-web-image",textPanelTitle:"Images from the web",template:e.File.searchPanel,events:{"submit form":"_submit","keyup input.image-url":"_checkAllowInsert","click input.image-url":"_checkAllowInsert", 158"blur input.image-url":"_checkAllowInsert"},initialize:function(){c.prototype.initialize.call(this);this.context=null;this.token=0}
158,render:function(){this.panelId=this.context.addPanel(this.textPanelTitle,this.getPanel(),"web-image-panel");this.container=this.getContainer();this.preview=this.container.find(".image-preview-area");this.throbber=this.container.find(".image-preview-throbber");this.killSpinner=null;this.error=this.container.find(".image-preview-error")},focus:function(){this._getImageInput().focus(); 159this._checkAllowInsert()},getPanel:function(){this.$el=d(e.File.webPanel());this.el=this.$el[0];this.delegateEvents();return this.el},_getImageInput:function(){return d("input.image-url",this.context.baseElement)},_submit:function(b){b.preventDefault();b.stopPropagation();var a=this,b=this._getImageInput().val();if("http://"===b)return!1;this.token++;var c=this.token;this.preview.addClass("faraway").html("");this.throbber.removeClass("hidden");this.killSpinner||(this.killSpinner=f.spinner(this.throbber[0], 16060,"#666"));this.error.addClass("hidden");d("<img>").on("load",function(){if(c===a.token){a.killSpinner();a.killSpinner=null;a.throbber.addClass("hidden");a.preview.removeClass("faraway");a._checkAllowInsert()}}).on("error",function(){if(c===a.token){a.killSpinner();a.killSpinner=null;a.throbber.addClass("hidden");a.error.removeClass("hidden");a._checkAllowInsert()}}).appendTo(this.preview).attr("src",b)},_checkAllowInsert:function(){var b=this.$el.find("input.image-url").val();this.context.setSelectItems(""!== 161b&&"http://"!==b?b:[])}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/external-panel/external-panel-view","Confluence.Editor.FileDialog.ExternalPanelView"); 162}catch(e){WRMCB(e)}; 163; 164try { 165/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/search-panel/search-panel.soy' */ 166// This file was automatically generated from search-panel.soy. 167// Please don't edit this file by hand. 168 169/** 170 * @fileoverview Templates in namespace Confluence.Templates.File. 171 */ 172 173if (typeof Confluence == 'undefined') { var Confluence = {}; } 174if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 175if (typeof Confluence.Templates.File == 'undefined') { Confluence.Templates.File = {}; } 176 177 178Confluence.Templates.File.searchPanel = function(opt_data, opt_ignored) { 179 return '<div class="search-panel-wrapper"><div id="search-image"><form class="aui search-form" id="search-image-form" action="#"><fieldset class="inline"><div class="search-input"><label for="search-image" class="assistive">' + soy.$$escapeHtml('Search') + '</label><input autofocus type="text" class="text search-image-text" size="50" autocomplete="off" aria-label="' + soy.$$escapeHtml('Search') + '"></div><select class="search-space select" id="search-image-space-select" aria-label="' + soy.$$escapeHtml('Search space') + '"><option value="">' + soy.$$escapeHtml('All Spaces') + '</option><option value="' + soy.$$escapeHtml(opt_data.spaceKey) + '">' + soy.$$escapeHtml(opt_data.spaceName) + '</option></select><button type="submit" class="aui-button search-button">' + soy.$$escapeHtml('Search') + '</button></fieldset></form></div><div id="searched-images" class="scroll-wrapper"><div class="loading-message hidden">' + soy.$$escapeHtml('Searching...') + '</div><ul class="file-list"></ul></div></div>'; 180}; 181if (goog.DEBUG) { 182 Confluence.Templates.File.searchPanel.soyTemplateName = 'Confluence.Templates.File.searchPanel'; 183} 184 185}catch(e){WRMCB(e)}; 186; 187try { 188/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/search-panel/search-panel-view.js' */ 189define("confluence-editor/files/search-panel/search-panel-view","confluence-editor/files/file-item/file-item-model confluence-editor/files/file-list/file-list-view confluence-editor/files/file-list/file-list-collection confluence-editor/files/base-panel/base-panel-view confluence/templates confluence/meta confluence/defaults confluence/highlighter confluence/api/constants underscore ajs jquery".split(" "),function(n,h,i,d,j,e,k,l,m,f,g,c){return d.extend({id:"search",panelId:"",cssPanel:".search-panel", 190cssContainer:"#searched-images",template:j.File.searchPanel,events:{"submit form":"_submit"},initialize:function(){d.prototype.initialize.call(this);this.context=null;this.collection=new i;this.fileListView=new h({collection:this.collection})},getPanel:function(){this.$el=c(this.template({spaceKey:e.get("space-key"),spaceName:e.get("space-name")}));this.el=this.$el[0];this.delegateEvents();return this.el},render:function(){this.fileListView.updateDialogContext(this.context);
190this.panelId=this.context.addPanel("Search on other pages", 191this.getPanel(),"search-panel");this.fileListView.updatePanelContext({fileContainer:this.getContainer(),noFileMessage:"No search results found.",showContainerInfo:true})},_submit:function(a){a.preventDefault();a.stopPropagation();if(this._getQuery()){this.clearContainer();this.collection.reset();this._loadImages().then(f.bind(this._onSuccessLoadFiles,this),f.bind(this._onErrorLoadFiles,this))}},_loadImages:function(){var a=this.getForm().find(".search-space").val(),b=this._getQuery(), 192b='(title ~ "'+b+'*" OR parent.title ~ "'+b+'*") AND type = attachment';a&&a!==""&&(b=b+(" AND space.key = "+a));return c.ajax({type:"GET",dataType:"json",url:m.CONTEXT_PATH+"/rest/api/search",data:{cql:b,expand:"content.version,content.container,content.space",limit:k.maxResults}})},_onSuccessLoadFiles:function(a){a=a.results.map(function(a){return a.content});this.fileListView.highlighter=new l(this._getQuery().split(" "));this.fileListView.resetFileList(a,{shouldClearSelection:true})},_onErrorLoadFiles:function(){var a= 193this.getContainer();a.find(".loading-message").addClass("hidden");a.append(c("<p class='warning'>"+c(this.textErrorSearch).text()+"</p>"))},_getSearchText:function(){return c("input.search-image-text",this.getForm())},_getQuery:function(){return this._getSearchText().val()||""},focus:function(){this.collection.clearSelection();this._getSearchText().focus()}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/search-panel/search-panel-view","Confluence.Editor.FileDialog.SearchPanelView"); 194}catch(e){WRMCB(e)}; 195; 196try { 197/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-dialog/file-dialog.soy' */ 198// This file was automatically generated from file-dialog.soy. 199// Please don't edit this file by hand. 200 201/** 202 * @fileoverview Templates in namespace Confluence.Templates.File. 203 */ 204 205if (typeof Confluence == 'undefined') { var Confluence = {}; } 206if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 207if (typeof Confluence.Templates.File == 'undefined') { Confluence.Templates.File = {}; } 208 209 210Confluence.Templates.File.helpLink = function(opt_data, opt_ignored) { 211 return '<div class="dialog-help-link"><a href="' + soy.$$escapeHtml("https://docs.atlassian.com/confluence/docs-102/Display+Files+and+Images") + '" target="_blank">' + soy.$$escapeHtml('Help') + '</a></div>'; 212}; 213if (goog.DEBUG) { 214 Confluence.Templates.File.helpLink.soyTemplateName = 'Confluence.Templates.File.helpLink'; 215} 216 217}catch(e){WRMCB(e)}; 218; 219try { 220/* module-key = 'com.atlassian.confluence.editor:panel-components', location = 'files/file-dialog/file-dialog-view.js' */ 221define("confluence-editor/files/file-dialog/file-dialog-view","backbone ajs confluence/dialog confluence/templates underscore jquery document window".split(" "),function(m,f,k,n,h,e,j,o){function l(a,d){d.forEach(function(b){a.forEach(function(a){a(b)})})}return m.View.extend({dialogId:"insert-image-dialog",ESC_KEY_CODE:27,width:840,height:530,initialize:function(a){this.urlExternalImg="";this.selectItems=[];this.submitCallback=a.submitCallback;this.cancelCallback=a.cancelCallback;var d=a.beforeShowListeners|| 222[],b,c;if(d&&(!d.subscribe||!d.unsubscribe)){b=d.push;c=[];Object.assign(d,{push:function(){var a=Array.prototype.slice.apply(arguments);b.apply(d,a);l(c,a)},subscribe:function(a){c.push(a);l([a],d)},unsubscribe:function(){c.length=0}})}this.beforeShowListeners=d;this.panelComponents=a.panelComponents},render:function(){this._createDialog();this.clearSelection();e(j).on("keydown.insert-image",h.bind(this._onNavigationByKey,this));return this},_createDialog:function(){var a=new (k.confluenceDialog|| 223k)(this.width,this.height,this.dialogId),d="Insert files and images",b="Insert";this.dialog=a;a.addHeader(d);a.addButton(b,h.bind(this._submitDialog,this),"insert");a.addCancel("Close",h.bind(this._killDialog,this));this.el=a.popup.element;this.$el=e(this.el);this.baseElement=this.el;this.$el.attr("data-tab-default","0");this.$insertButton=this.$el.find(".dialog-button-panel .insert");e("#"+this.dialogId+" .dialog-components .dialog-title").prepend(n.File.helpLink()); 224this.$el.find(".dialog-button-panel").append(e("<div></div>").addClass("dialog-tip").html("Hint: type \u0022\u003cstrong\u003e!\u003c/strong\u003e\u0022 in the Editor to insert attached images on the page."));this._createPanels();this.beforeShowListeners.subscribe(function(a){typeof a==="function"&&a()});f.debug(this.beforeShowListeners.length+" beforeShow listeners registered.");e(j).on("hideLayer",h.bind(function(c,b,d){if(!(b!=="popup"||d!==a.popup)){d.remove();this.teardown();typeof this.cancelCallback==="function"&&this.cancelCallback()}},this));f.bind("remove.dialog", 225h.bind(function(a,b){b.dialog.id===this.dialog.id&&this.teardown()},this));a.show();return a},_createPanels:function(){var a=this;e.each(this.panelComponents,function(){this&&typeof this.createPanel==="function"&&this.createPanel(a)})},teardown:function(){e(j).unbind(".insert-image");e(".tipsy").remove();this.undelegateEvents();this.beforeShowListeners.unsubscribe()},_killDialog:function(){this.dialog.remove();this.clearSelection();typeof this.cancelCallback==="function"&&this.cancelCallback()},_submitDialog:function(){var a= 226{url:this.urlExternalImg,contentId:f.Meta.get("attachment-source-content-id"),selectItems:this.selectItems};this.dialog.remove();typeof this.submitCallback==="function"&&this.submitCallback(a)}
226,setSelectItems:function(a){if(typeof a==="string"){this.urlExternalImg=a;this.selectItems=[]}else{this.urlExternalImg="";this.selectItems=a}a=this.selectItems.length>0||this.urlExternalImg;if(this.$insertButton){this.$insertButton.prop("disabled",!a);this.$insertButton.attr("aria-disabled",!a)}},clearSelection:function(){this.setSelectItems([])}, 227insert:function(){this.$insertButton&&(!this.$insertButton.is(":disabled")||!this.$insertButton.attr("aria-disabled"))&&this.$insertButton.click()},addPanel:function(a,d,b,c){var e=this.dialog.getPage(0).panel.length;this.dialog.addPanel(a,d,b,c);return e},getPanel:function(a){return this.dialog.getPanel(a)},_onNavigationByKey:function(a){if(!e("#"+this.dialog.id).is(":hidden")){var d=this.dialog.getCurrentPanel().body,b=d.find(".attached-file");if(!(b.length===0||e(j.activeElement).is("input[type=text], select, button"))){var c= 228o.tinymce.VK;switch(a.which){case c.LEFT:case c.UP:case c.RIGHT:case c.DOWN:var f=a.which,g;g=b.filter(".current");g.length||(g=b.filter(".selected"));if(g.length){g=b.index(g);var h=b.length,i={};i[c.LEFT]=-1;i[c.RIGHT]=1;i[c.UP]=-4;i[c.DOWN]=4;c=g+(i[f]?i[f]:0);b=b.eq(c<0||c>=h?g:c)}else b=b.first();b.parent().find("li.attached-file.current").removeClass("current");b.addClass("current");b.length&&d.find(".scroll-wrapper").simpleScrollTo(b);a.stopPropagation();return false;case c.SPACEBAR:d.find("li.attached-file.current").click(); 229a.stopPropagation();return false;case c.ENTER:this.insert();a.stopPropagation();return false}}}}})});require("confluence/module-exporter").exportModuleAsGlobal("confluence-editor/files/file-dialog/file-dialog-view","Confluence.Editor.FileDialog.FileDialogView"); 230}catch(e){WRMCB(e)};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.