diff --git a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.desc.xml deleted file mode 100644 index f83874aaa6..0000000000 --- a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.desc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - Javascript Debugger - Javascript Debugger - /api/javascript/debugger - admin - \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.html.ftl deleted file mode 100644 index 5e70fac3c4..0000000000 --- a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.get.html.ftl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Alfresco Javascript Debugger - - - -
- - - - - - -
AlfrescoAlfresco Javascript Debugger
Alfresco ${server.edition} v${server.version} -
Currently <#if visible>enabled<#else>disabled. - -
-
- - \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.desc.xml deleted file mode 100644 index be8dffd065..0000000000 --- a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.desc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - Javascript Debugger Maintenance - Javascript Debugger Maintenance - /api/javascript/debugger?active={active?} - admin - \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.html.ftl deleted file mode 100644 index 5e70fac3c4..0000000000 --- a/config/alfresco/templates/webscripts/org/alfresco/jsdebugger.post.html.ftl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Alfresco Javascript Debugger - - - -
- - - - - - -
AlfrescoAlfresco Javascript Debugger
Alfresco ${server.edition} v${server.version} -
Currently <#if visible>enabled<#else>disabled. - -
-
- - \ No newline at end of file diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index 3b1e1091ff..1c6f9aa32d 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -141,10 +141,10 @@ - + - + diff --git a/source/java/org/alfresco/repo/web/scripts/AlfrescoRhinoScriptDebugger.java b/source/java/org/alfresco/repo/web/scripts/AlfrescoRhinoScriptDebugger.java new file mode 100644 index 0000000000..eaa65c820b --- /dev/null +++ b/source/java/org/alfresco/repo/web/scripts/AlfrescoRhinoScriptDebugger.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.web.scripts; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.web.scripts.AlfrescoScriptDebugger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mozilla.javascript.ContextFactory; +import org.mozilla.javascript.tools.debugger.Dim; +import org.mozilla.javascript.tools.debugger.SwingGui; + + +/** + * Alfresco implementation of Rhino JavaScript debugger + * + * Provides support for authenticated access to object inspection. + * + * @author davidc + */ +public class AlfrescoRhinoScriptDebugger extends AlfrescoScriptDebugger +{ + private static final Log logger = LogFactory.getLog(AlfrescoRhinoScriptDebugger.class); + + // Logger + private ContextFactory factory = null; + private SwingGui gui = null; + + + @Override + protected void initDebugger() + { + dim = new AlfrescoDim(); + } + + @Override + public void start() + { + if (logger.isDebugEnabled()) + { + activate(); + show(); + } + } + + + public static class AlfrescoDim extends Dim + { + /* (non-Javadoc) + * @see org.mozilla.javascript.tools.debugger.Dim#objectToString(java.lang.Object) + */ + @Override + public String objectToString(final Object arg0) + { + // execute command in context of currently selected user + return AuthenticationUtil.runAs(new RunAsWork() + { + @SuppressWarnings("synthetic-access") + public String doWork() throws Exception + { + return AlfrescoDim.super.objectToString(arg0); + } + }, AuthenticationUtil.getSystemUserName()); + } + } +} diff --git a/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebugger.java b/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebugger.java deleted file mode 100644 index 3aaa395bdd..0000000000 --- a/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebugger.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.repo.web.scripts.bean; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.repo.jscript.AlfrescoRhinoScriptDebugger; -import org.alfresco.web.scripts.DeclarativeWebScript; -import org.alfresco.web.scripts.WebScriptRequest; -import org.alfresco.web.scripts.Status; - - -/** - * Javascript Debugger - * - * @author davidc - */ -public class JavascriptDebugger extends DeclarativeWebScript -{ - // dependencies - private AlfrescoRhinoScriptDebugger debugger; - - /** - * @param ticketComponent - */ - public void setDebugger(AlfrescoRhinoScriptDebugger debugger) - { - this.debugger = debugger; - } - - - /* (non-Javadoc) - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status) - { - // construct model - Map model = new HashMap(7, 1.0f); - model.put("visible", debugger.isVisible()); - return model; - } - -} diff --git a/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebuggerPost.java b/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebuggerPost.java deleted file mode 100644 index 21c0a927d1..0000000000 --- a/source/java/org/alfresco/repo/web/scripts/bean/JavascriptDebuggerPost.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.repo.web.scripts.bean; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.repo.jscript.AlfrescoRhinoScriptDebugger; -import org.alfresco.web.scripts.DeclarativeWebScript; -import org.alfresco.web.scripts.WebScriptRequest; -import org.alfresco.web.scripts.Status; - - -/** - * Javascript Debugger - * - * @author davidc - */ -public class JavascriptDebuggerPost extends DeclarativeWebScript -{ - // dependencies - private AlfrescoRhinoScriptDebugger debugger; - - /** - * @param ticketComponent - */ - public void setDebugger(AlfrescoRhinoScriptDebugger debugger) - { - this.debugger = debugger; - } - - - /* (non-Javadoc) - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status) - { - String visibleStr = req.getParameter("visible"); - boolean visible = Boolean.valueOf(visibleStr); - - if (visible) - { - debugger.show(); - } - else - { - debugger.hide(); - } - - Map model = new HashMap(7, 1.0f); - model.put("visible", debugger.isVisible()); - return model; - } - -}