<commit_before>/**
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.

 * The Apereo Foundation licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**	
 * 
 * template management, javascript for the management of the templates in the file area and their creation
 *
 * @author <NAME>
 * @version 1.0
 * @package
 */

if(typeof(String.prototype.trim) === "undefined")
{
    String.prototype.trim = function() 
    {
        return String(this).replace(/^\s+|\s+$/g, '');
    };
}
var active_div="";

var edit_window_open = new Array();

/**
 * 
 * Function url return
 * This function sorts out the URL depending on whether the htaccess if off or on
 * @param string url = the extra part of the url to make this URL from
 * @param string parameter - the template id
 * @version 1.0
 * @author <NAME>
 */

function url_return(url,parameter){

    switch (url) {

        case "edit":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
        case "edithtml":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "preview":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "play":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "properties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "folderproperties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "workspaceproperties":
            if (site_apache == "true") {

                return url;

            } else {

                return url + ".php"

            }
        case "publishproperties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;


        default:
            break;

    }
}


/* 
 * Function template toggle
 * This function sorts out the display and hiding of the blank templates side of the screen
 * @param string tag = the div to display
 * @version 1.0
 * @author <NAME>
 */

function template_toggle(tag){

    var temp = document.getElementById(tag);
    var butt = document.getElementById(tag+'_button');

    if((temp.style.display=="none")||(temp.style.display=="")){
        temp.style.display="block";	
				butt.style.display="none";
    }else{
        temp.style.display="none";
				butt.style.display="";
    }	

}

// Function toggle (obsolete) ********** CHECK ***************
//
// open and close template areas when creating a new one


function toggle(tag){

    if(document.getElementById(tag).style.display=="none"){		
        document.getElementById(tag).style.display="block";
    }else{
        document.getElementById(tag).style.display="none";<commit_msg>Fix #506, easier than I thought without jQuery<commit_after>/**
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.

 * The Apereo Foundation licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**	
 * 
 * template management, javascript for the management of the templates in the file area and their creation
 *
 * @author <NAME>
 * @version 1.0
 * @package
 */

if(typeof(String.prototype.trim) === "undefined")
{
    String.prototype.trim = function() 
    {
        return String(this).replace(/^\s+|\s+$/g, '');
    };
}
var active_div="";

var edit_window_open = new Array();

/**
 * 
 * Function url return
 * This function sorts out the URL depending on whether the htaccess if off or on
 * @param string url = the extra part of the url to make this URL from
 * @param string parameter - the template id
 * @version 1.0
 * @author <NAME>
 */

function url_return(url,parameter){

    switch (url) {

        case "edit":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
        case "edithtml":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "preview":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "play":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "properties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "folderproperties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;
        case "workspaceproperties":
            if (site_apache == "true") {

                return url;

            } else {

                return url + ".php"

            }
        case "publishproperties":
            if (site_apache == "true") {

                return url + "_" + parameter;

            } else {

                return url + ".php?template_id=" + parameter;

            }
            break;


        default:
            break;

    }
}


/* 
 * Function template toggle
 * This function sorts out the display and hiding of the blank templates side of the screen
 * @param string tag = the div to display
 * @version 1.0
 * @author <NAME>
 */

function template_toggle(tag){

    var temp = document.getElementById(tag);
    var butt = document.getElementById(tag+'_button');

    if((temp.style.display=="none")||(temp.style.display=="")){
        temp.style.display="block";	
				butt.style.display="none";
				temp.querySelector('input[name="filename"]').focus();
    }else{
        temp.style.display="none";
				butt.style.display="";
    }	

}

// Function toggle (obsolete) ********** CHECK ***************
//
// open and close template areas when creating a new one


function toggle(tag){

    if(document.getElementById(tag).style.display=="none"){		
        document.getElementById(tag).style.display="block";
    }else{
        document.getElementById(tag).style.display="none";
{'fraction_non_alphanumeric': 0.11770146837784715, 'fraction_numerical': 0.0026592669672794544, 'mean_word_length': 1.9272419627749577, 'pattern_counts': {'":': 16, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2356898', 'n_tokens_mistral': 2368, 'n_tokens_neox': 2211, 'n_words': 737}