Skip to content

Commit

Permalink
fixed LDEV-1354
Browse files Browse the repository at this point in the history
  • Loading branch information
isapir committed Jul 10, 2017
1 parent c07f2f7 commit 10e8e9a
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 116 deletions.
44 changes: 10 additions & 34 deletions core/src/main/cfml/context/admin/admin_layout.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
else homeQS="";
</cfscript>
<cfset request.mode="full">

<cfcontent reset="yes" /><!DOCTYPE HTML>
<!--[if lt IE 9]> <style> body.full #header #logo.sprite { background-image: url(resources/img/server-lucee-small.png.cfm); background-position: 0 0; margin-top: 16px; } </style> <![endif]--> <!--- remove once IE9 is the min version to be supported !--->
<cfoutput>
Expand Down Expand Up @@ -117,51 +117,27 @@
</table>
</div>

<!--- TODO: move to reusable script in /res/js/admin.js !--->
<script src="../res/js/util.min.js.cfm"></script>
<script>
var getDomObject = function( obj ) { // returns the element if it is an object, or finds the object by id */
if ( typeof obj == 'string' || obj instanceof String )
return document.getElementById( obj );
return obj;
}
var selectText = function( obj ) {
if ( document.selection ) {
var range = document.body.createTextRange();
range.moveToElementText( getDomObject( obj ) );
range.select();
} else if ( window.getSelection ) {
var range = document.createRange();
range.selectNode( getDomObject( obj ) );
window.getSelection().addRange( range );
}
}
$( function(){
$(function(){
$( '.coding-tip-trigger-#request.adminType#' ).click(
function(){
$('.coding-tip-trigger-#request.adminType#').click(
function(){
var $this = $(this);
$this.next( '.coding-tip-#request.adminType#' ).slideDown();
$this.next('.coding-tip-#request.adminType#').slideDown();
$this.hide();
}
);
$( '.coding-tip-#request.adminType# code' ).click(
function(){
selectText(this);
$('.coding-tip-#request.adminType# code').click(
function(){
__LUCEE.util.selectText(this);
}
).prop("title", "Click to select the text");
});
</script>

<cfif isDefined( "Request.htmlBody" )>#Request.htmlBody#</cfif>
<cfif isDefined("Request.htmlBody")>#Request.htmlBody#</cfif>
</body>
</html>
</cfoutput>
Expand Down
88 changes: 41 additions & 47 deletions core/src/main/cfml/context/res/js/util.js
Original file line number Diff line number Diff line change
@@ -1,107 +1,101 @@
/*! LUCEE.util version 1.0 */
/*! LUCEE.util version 1.1 */

var __LUCEE = __LUCEE || {};


__LUCEE.util = {
__LUCEE.util = {

getCookie: function( name, def ) {
getCookie: function(name, def) {

var cookies = document.cookie.split( '; ' );
var cookies = document.cookie.split('; ');
var len = cookies.length;
var parts;

for ( var i=0; i<len; i++ ) {
for (var i=0; i<len; i++) {

parts = cookies[ i ].split( '=' );
parts = cookies[i].split('=');

if ( parts[ 0 ] == name )
return unescape( parts[ 1 ] );
if (parts[0] == name)
return unescape(parts[1]);
}

return def;
}

, getCookieNames: function() {
,getCookieNames: function() {

var result = [];
var cookies = document.cookie.split( '; ' );
var cookies = document.cookie.split('; ');
var len = cookies.length;
var parts;

for ( var i=0; i<len; i++ ) {
for (var i=0; i<len; i++) {

parts = cookies[ i ].split( '=' );
result.push( parts[ 0 ] );
parts = cookies[i].split('=');
result.push(parts[0]);
}

return result;
}

, setCookie: function( name, value, expires ) {
,setCookie: function(name, value, expires) {

document.cookie = name + "=" + escape( value ) + ( (expires) ? "; expires=" + expires.toGMTString() : "" ) + "; path=/";
document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + "; path=/";
}

, removeCookie: function( name ) {
,removeCookie: function(name) {

__LUCEE.util.setCookie( name, "", new Date( 0 ) );
__LUCEE.util.setCookie(name, "", new Date(0));
}

, getDomObject: function( obj ) { // returns the element if it is an object, or finds the object by id */
,getDomObject: function(obj) { // returns the element if it is an object, or finds the object by id */

if ( typeof obj == 'string' || obj instanceof String )
return document.getElementById( obj );
if (typeof obj == 'string' || obj instanceof String)
return document.getElementById(obj);

return obj;
}

, hasClass: function( obj, cls ) {
,hasClass: function(obj, cls) {

obj = __LUCEE.util.getDomObject( obj );
return ( obj.className.indexOf( cls ) > -1 );
obj = __LUCEE.util.getDomObject(obj);
return (obj.className.indexOf(cls) > -1);
}

, addClass: function( obj, cls ) {
,addClass: function(obj, cls) {

if ( __LUCEE.util.hasClass( obj, cls ) )
if (__LUCEE.util.hasClass(obj, cls))
return;

obj = __LUCEE.util.getDomObject( obj );
obj = __LUCEE.util.getDomObject(obj);
obj.className += " " + cls;
}

, removeClass: function( obj, cls ) {
,removeClass: function(obj, cls) {

obj = __LUCEE.util.getDomObject( obj );
obj.className = obj.className.replace( cls, "" );
obj = __LUCEE.util.getDomObject(obj);
obj.className = obj.className.replace(cls, "");
}

, toggleClass: function( obj, cls ) {
,toggleClass: function(obj, cls) {

obj = __LUCEE.util.getDomObject( obj );
var Util = __LUCEE.util;
obj = Util.getDomObject(obj);

if ( __LUCEE.util.hasClass( obj, cls ) )
__LUCEE.util.removeClass( obj, cls );
if (Util.hasClass(obj, cls))
Util.removeClass(obj, cls);
else
__LUCEE.util.addClass( obj, cls );
Util.addClass(obj, cls);

return ( __LUCEE.util.hasClass( obj, cls ) );
return (Util.hasClass(obj, cls));
}

, selectText: function( id ) {
,selectText: function(id) {

if ( document.selection ) {
if (window.getSelection) {

var range = document.body.createTextRange();
range.moveToElementText( getDomObject( obj ) );
range.select();
} else if ( window.getSelection ) {
window.getSelection().selectAllChildren(__LUCEE.util.getDomObject(id));
}
}

var range = document.createRange();
range.selectNodeContents( getDomObject( obj ) );
window.getSelection().removeAllRanges();
window.getSelection().addRange( range );
}
}
};
4 changes: 2 additions & 2 deletions core/src/main/cfml/context/res/js/util.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 18 additions & 31 deletions core/src/main/java/resource/context/admin/debug/Modern.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

<cfset this.allSections = this.buildSectionStruct()>
<cfset var isExecOrder = this.isSectionOpen( "ExecOrder" )>

<cfif isExecOrder>

<cfset querySort(pages,"id","asc") />
Expand All @@ -141,11 +141,11 @@
,microsecond:"µs"
,nanosecond:"ns"
} />

<cfset var ordermap={}>
<cfloop query="#arguments.debugging.history#">
<cfif !structkeyExists(ordermap, arguments.debugging.history.id)><cfset ordermap[ arguments.debugging.history.id ]=structCount(ordermap)+1></cfif>
</cfloop>
</cfloop>
<cfset var prettify=structKeyExists(arguments.custom,'timeformat') and arguments.custom.timeformat EQ "natural">
</cfsilent>
<cfif arguments.context EQ "web">
Expand Down Expand Up @@ -532,7 +532,7 @@
</tr>
</table>
</cfif>

<!--- Dumps --->
<cfif dumps.recordcount>

Expand All @@ -541,7 +541,7 @@

<div class="section-title">Dumps</div>


<table>

<cfset renderSectionHeadTR( sectionId, "#dumps.recordcount# Dump#( dumps.recordcount GT 1 ) ? 's' : ''#" )>
Expand All @@ -567,7 +567,7 @@
</tr>
</table>
</cfif>


<!--- Queries --->
<cfif queries.recordcount>
Expand All @@ -591,8 +591,8 @@

<tr>
<td id="-lucee-debug-#sectionId#" class="#isOpen ? '' : 'collapsed'#">


<table><tr><td>
<b>General</b>
<table class="details">
Expand Down Expand Up @@ -622,7 +622,7 @@
<th>Datasource</th>
<th>Source</th>
<cfif hasCachetype><th>Cache Type</th></cfif>

</tr>
<tr>
<th></th>
Expand Down Expand Up @@ -671,7 +671,7 @@
<cfset local.arrLenN = arrayLen( arr )>
<cfif arrLenN>
<tr class="red">
<td colspan="7">
<td colspan="7">
Unused:
<cfloop from="1" to="#arrLenN#" index="local.ii">
#arr[ ii ]# <cfif ii LT arrLenN>, </cfif>
Expand Down Expand Up @@ -772,8 +772,8 @@


<script>
<cfset this.includeFileInline( "/lucee/res/js/util.min.js" )>
<cfset this.includeInline( "/lucee/res/js/util.min.js" )>

var __LUCEE = __LUCEE || {};

__LUCEE.debug = {
Expand Down Expand Up @@ -821,20 +821,7 @@
return !isOpen; // returns true if section is open after the operation
}

, selectText: function( id ) {

if ( document.selection ) {

var range = document.body.createTextRange();
range.moveToElementText( document.getElementById( id ) );
range.select();
} else if ( window.getSelection ) {

var range = document.createRange();
range.selectNode( document.getElementById( id ) );
window.getSelection().addRange( range );
}
}
, selectText: __LUCEE.util.selectText
};
</script>

Expand Down Expand Up @@ -870,7 +857,7 @@
if ( !arguments.prettify ) {
return NumberFormat( arguments.time / 1000000, ",0.000" );
}

// display 0 digits right to the point when more or equal to 100ms
if ( arguments.time >= 100000000 )
return int( arguments.time / 1000000 );
Expand All @@ -885,7 +872,7 @@

// display 3 digits right to the point
return ( int( arguments.time / 1000 ) / 1000 );

}


Expand All @@ -902,10 +889,10 @@
return arguments.size & 'B';
}

/** reads the file contents and writes it to the output stream */
function includeInline(filename) cachedWithin=createTimeSpan(0,1,0,0) {

function includeFileInline( filename ) cachedWithin=createTimeSpan(0, 1, 0, 0) {

echo( fileRead( expandPath( arguments.filename ) ) );
echo(fileRead(expandPath(arguments.filename)));
}

</cfscript>
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="core" basedir="." name="Lucee" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

<property name="version" value="5.2.3.8-SNAPSHOT"/>
<property name="version" value="5.2.3.9-SNAPSHOT"/>

<path id="maven-ant-tasks.classpath" path="../ant/lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>5.2.3.8-SNAPSHOT</version>
<version>5.2.3.9-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 10e8e9a

Please sign in to comment.