/*
 * Copyright 2009 Kantega AS
 *
 * Licensed 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.
 */

package no.kantega.publishing.api.taglibs.mini;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

public class HeaderDependenciesTag extends SimpleTagSupport {

    @Override
    public void doTag() throws JspException, IOException {
        PageContext pageContext = (PageContext) getJspContext();
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        JspWriter out = pageContext.getOut();

        out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getContextPath()+"/admin/css/jquery-ui-1.8.1.custom.css\">");
        out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getContextPath()+"/admin/css/jquery-ui-additions.css\">");
        out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+request.getContextPath()+"/admin/css/miniaksess.css\">");
        out.write("<script type=\"text/javascript\" src=\""+request.getContextPath()+"/admin/js/common.js\"></script>");
        out.write("<script type=\"text/javascript\" src=\""+request.getContextPath()+"/admin/js/editcontext.jjs\"></script>");
        out.write("<script type=\"text/javascript\" src=\""+ request.getContextPath()+"/aksess/tiny_mce_3_3_6/tiny_mce.js\"></script>");
    }
}

@@ -651,16 +651,123 @@
 ini;%0D%0A%0D%0A
+import no.kantega.publishing.admin.AdminRequestParameters;%0D%0Aimport no.kantega.publishing.common.Aksess;%0D%0A%0D%0A
 import j
@@ -1746,32 +1746,592 @@
 sess.css%5C%22%3E%22);%0D%0A
+        out.write(%22%3Cscript type=%5C%22text/javascript%5C%22%3E%5Cn%22 +%0D%0A                %22        var properties = %7B%5Cn%22 +%0D%0A                %22            contextPath : '%22+((HttpServletRequest) pageContext.getRequest()).getContextPath()+%22',%5Cn%22 +%0D%0A                %22            debug : %22+Aksess.isJavascriptDebugEnabled()+%22,%5Cn%22 +%0D%0A                %22            contentRequestHandler : '%22+ Aksess.CONTENT_REQUEST_HANDLER+%22',%5Cn%22 +%0D%0A                %22            thisId : '%22+ AdminRequestParameters.THIS_ID+%22'%5Cn%22 +%0D%0A                %22        %7D%5Cn%22 +%0D%0A                %22    %3C/script%3E%22);%0D%0A
         out.writ

Set Javascript properties in MiniAksess mode.