<commit_before><%@ page import="org.opencms.jsp.*" %><%
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
%>

function SetAttribute( element, attName, attValue )
{
   if ( attValue == null || attValue.length == 0 )
      element.removeAttribute( attName, 0 ) ;         // 0 : Case Insensitive
   else
      element.setAttribute( attName, attValue, 0 ) ;  // 0 : Case Insensitive
}

function GetAttribute( element, attName, valueIfNull )
{
   var oAtt = element.attributes[attName] ;

   if ( oAtt == null || !oAtt.specified )
      return valueIfNull ? valueIfNull : '' ;

   var oValue = element.getAttribute( attName, 2 ) ;

   if ( oValue == null )
      oValue = oAtt.nodeValue ;

   return ( oValue == null ? valueIfNull : oValue ) ;
}

<%= cms.getContent("/system/workplace/resources/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js") %>
/**
 * The JavaScript functions of this file serve as an interface between the API of the TinyMCE and the gallery dialog.<p>
 *
 * Following function needs to be provided by the gallery dialog:<p>
 * 
 * boolean setDataInEditor()<p>
 * 
 * This should check if further user input is required and other wise set the selected resource via the provided functions <code>setLink</code> and <code>setImage</code>.<p>
 * Returning <code>true</code> when all data has been set and the dialog should be closed.<p>
 */
/* absolute path to the JSP that displays the image in original size */
var vfsPopupUri = "<%= cms.link("/system/workplace/editors/fckeditor/plugins/ocmsimage/popup.html") %>";
var showSelect = "true";

/** The editor frame. */
var parentDialog=window.parent;

// remove loading overlay and get editor reference
/** The editor instance. */
var editor=parentDialog.tinymce.activeEditor;
var tinymce = parentDialog.tinymce;

/** The fck editor configuration. */
var editorConfig= {};

/* Absolute path to the JSP that displays the image in original size. */
var imagePopupUri = "<%= cms.link("/system/workplace/editors/fckeditor/plugins/ocmsimage/popup.html") %>";

// some string constants

/** Link id prefix. */
var LINK_PREFIX='limg_';
/** Copyright span id prefix. */
var COPY_PREFIX='cimg_';
/** Subtitle span prefix. */
var SUB_PREFIX='simg_'
/** Enhancement span id prefix. */
var ENHANCE_PREFIX='aimg_';



/**
 * Function will be triggered by the editor dialog OK button. 
 * Will check if current gallery state allows closing and sets the selected resource parameters.<p>
 * 
 * @return <code>true</code> to close the dialog
 */
var Ok =function(){
    return setDataInEditor();
}

/**
 * Closes the dialog without setting any data.<p>
 */
function closeDialog(){
   tinyMCEPopup.close();
}

/**
 * Triggers the OK action.<p>
 * 
 * @return void
 */
function dialogOk(){
//    parentDialog.Ok();
}

function enableDialogOk(enabled){
}

function _selectionHasAncestorNode(nodeName) {
   return _selectionMoveToAncestorNode(nodeName) != null; 
}

function _selectionMoveToAncestorNode(nodeName) {

   var node = editor.selection.getNode();
   return editor.dom.getParent(node, nodeName);
}

function _selectionSelectNode(node) {
   editor.selection.select(node);
}

function _editorExecuteUnlink() {
   editor.execCommand("unlink", false, null);
}

function _selectionDelete() {
   editor.selection.getNode().parentNode = null; 
}

function _editorDocumentCreateElement(nodeName) {
   return parentDialog.document.createElement(nodeName);
}

function _selectSubNode(nodeName, node) {
   if (node.tagName == 'IMG') {
      return node;
   }
   subnodes = editor.dom.select('img', node);
   if (subnodes.length == 0) {
      return null;
   }
   return subnodes[0];
}

function _editorInsertElement(element) {
   // hack to get at the DOM node of the inserted element: add a CSS class, then 
   // use it later to find the node again 
   var cls = editor.dom.uniqueId("cmsInserted");
   editor.dom.addClass(element, cls);
   var html = editor.dom.getOuterHTML(element);
   editor.selection.setContent(html);
   var node = editor.dom.select('.'+cls, editor.selection.getNode())[0];
   editor.dom.removeClass(node, cls);
   return node; 
}

function _editorCreateLink(target) {
   editor.execCommand("mceInsertLink", false, target);
   return editor.selection.getNode();
}

function _editorInsertHtml(html) {
   editor.execCommand("mceInsertContent", false, html);
}

/**
 * Returns if a text part has been selected by the user.<p>
 * <commit_msg>Fixed problem with gallery integrator for TinyMCE.<commit_after><%@ page import="org.opencms.jsp.*" %><%
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
%>

function SetAttribute( element, attName, attValue )
{
   if ( attValue == null || attValue.length == 0 )
      element.removeAttribute( attName, 0 ) ;         // 0 : Case Insensitive
   else
      element.setAttribute( attName, attValue, 0 ) ;  // 0 : Case Insensitive
}

function GetAttribute( element, attName, valueIfNull )
{
   var oAtt = element.attributes[attName] ;

   if ( oAtt == null || !oAtt.specified )
      return valueIfNull ? valueIfNull : '' ;

   var oValue = element.getAttribute( attName, 2 ) ;

   if ( oValue == null )
      oValue = oAtt.nodeValue ;

   return ( oValue == null ? valueIfNull : oValue ) ;
}

<%= cms.getContent("/system/workplace/resources/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js") %>
/**
 * The JavaScript functions of this file serve as an interface between the API of the TinyMCE and the gallery dialog.<p>
 *
 * Following function needs to be provided by the gallery dialog:<p>
 * 
 * boolean setDataInEditor()<p>
 * 
 * This should check if further user input is required and other wise set the selected resource via the provided functions <code>setLink</code> and <code>setImage</code>.<p>
 * Returning <code>true</code> when all data has been set and the dialog should be closed.<p>
 */
/* absolute path to the JSP that displays the image in original size */
var vfsPopupUri = "<%= cms.link("/system/workplace/editors/fckeditor/plugins/ocmsimage/popup.html") %>";
var showSelect = "true";

/** The editor frame. */
var parentDialog=window.parent;

// remove loading overlay and get editor reference
/** The editor instance. */
var editor=parentDialog.tinymce.activeEditor;
var tinymce = parentDialog.tinymce;

/** The fck editor configuration. */
var editorConfig= {};

/* Absolute path to the JSP that displays the image in original size. */
var imagePopupUri = "<%= cms.link("/system/workplace/editors/fckeditor/plugins/ocmsimage/popup.html") %>";

// some string constants

/** Link id prefix. */
var LINK_PREFIX='limg_';
/** Copyright span id prefix. */
var COPY_PREFIX='cimg_';
/** Subtitle span prefix. */
var SUB_PREFIX='simg_'
/** Enhancement span id prefix. */
var ENHANCE_PREFIX='aimg_';



/**
 * Function will be triggered by the editor dialog OK button. 
 * Will check if current gallery state allows closing and sets the selected resource parameters.<p>
 * 
 * @return <code>true</code> to close the dialog
 */
var Ok =function(){
    return setDataInEditor();
}

/**
 * Closes the dialog without setting any data.<p>
 */
function closeDialog(){
   tinyMCEPopup.close();
}

/**
 * Triggers the OK action.<p>
 * 
 * @return void
 */
function dialogOk(){
//    parentDialog.Ok();
}

function enableDialogOk(enabled){
}

function _selectionHasAncestorNode(nodeName) {
   return _selectionMoveToAncestorNode(nodeName) != null; 
}

function _selectionMoveToAncestorNode(nodeName) {

   var node = editor.selection.getNode();
   return editor.dom.getParent(node, nodeName);
}

function _selectionSelectNode(node) {
   editor.selection.select(node);
}

function _editorExecuteUnlink() {
   editor.execCommand("unlink", false, null);
}

function _selectionDelete() {
   editor.selection.getNode().parentNode = null; 
}

function _editorDocumentCreateElement(nodeName) {
   return parentDialog.document.createElement(nodeName);
}

function _selectSubNode(nodeName, node) {
   if (node.tagName == 'IMG') {
      return node;
   }
   subnodes = editor.dom.select('img', node);
   if (subnodes.length == 0) {
      return null;
   }
   return subnodes[0];
}

function _editorInsertElement(element) {
   // hack to get at the DOM node of the inserted element: add a CSS class, then 
   // use it later to find the node again 
   var cls = editor.dom.uniqueId("cmsInserted");
   editor.dom.addClass(element, cls);
   var html = editor.dom.getOuterHTML(element);
   editor.selection.setContent(html);
   var node = editor.dom.select('.'+cls, editor.selection.getNode())[0];
   editor.dom.removeClass(node, cls);
   return node; 
}

function _editorCreateLink(target) {
   var linkAttrs = {href: target};
   linkAttrs["class"] = 'cmsInsertedLink';
   editor.execCommand("mceInsertLink", false, linkAttrs);
   var selectionNode = editor.selection.getNode();
   var result = editor.dom.select(".cmsInsertedLink", selectionNode)[0];
   editor.dom.removeClass(result, "cmsInsertedLink");
   return result; 
}

function _editorInsertHtml(html) {
   editor.execCommand("mceInsertContent", false, html);
}

/**
 * Returns if a text part has been selected by the user.<p>
 * 
{'fraction_non_alphanumeric': 0.12692517749863463, 'fraction_numerical': 0.002075368651010377, 'mean_word_length': 4.041850220264317, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2658680', 'n_tokens_mistral': 2836, 'n_tokens_neox': 2802, 'n_words': 793}