Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Boostrap theme #14

Open
wants to merge 20 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5948c48
Create new Bootstrap theme branch.
adrian-crum Oct 28, 2014
e605251
MacroScreenViewHandler.java improvement: get macro library locations …
adrian-crum Oct 30, 2014
bc1d653
Small fixup for my last commit.
adrian-crum Oct 30, 2014
bd56ba4
Added new Visual Theme resource types to seed data.
adrian-crum Oct 30, 2014
33d151f
Fix ClassCastException.
adrian-crum Oct 30, 2014
6a9b5a0
Some preliminary changes in preparation for the Bootstrap theme - htt…
adrian-crum Nov 25, 2014
b6b0a43
Added the Bootstrap theme. All Bootstrap artifacts are contained in t…
adrian-crum Nov 25, 2014
0037d3d
Bootstrap theme - updated js file.
adrian-crum Nov 25, 2014
9bf0ab4
Bootstrap theme - fixed some invalid seed data.
adrian-crum Nov 27, 2014
bea0895
Bootstrap theme - applied latest patches from Jira issue.
adrian-crum Nov 29, 2014
7faa8d6
Bootstrap theme - applied latest patches from Jira issue.
adrian-crum Dec 6, 2014
ea2db54
Added patch file to assist with merging branch to trunk.
adrian-crum May 19, 2015
2634681
Change btn-sm to btn-xs for buttons regarding calendar and field look…
adrian-crum May 19, 2015
9eb360b
fix paginate issue JIRA-OFBIZ-6326
JulienNicolas37 May 30, 2015
504753d
Application menu and sub menu style modifications
JulienNicolas37 Jun 3, 2015
acc4a23
Resolves OFBIZ-6452 - Lookup buttons in forms not displaying properly…
Jun 13, 2015
69bd300
Resolves OFBIZ-6452 - Lookup buttons in forms not displaying properly…
Jun 13, 2015
7ccf3b5
Various styling issues, including pagination issue OFBIZ-6326
Jun 13, 2015
cabbde8
Resolves OFBIZ-6455:Change code in htmlFormMacroLibrary.ftl, specific…
Jun 13, 2015
48cd801
Removes lookupField_patch.patch, it was committed in r1685212
JacquesLeRoux Feb 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions BranchMergeToTrunk.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Index: .
===================================================================
--- . (revision 1680319)
+++ . (working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
Merged /ofbiz/branches/boostrap_theme:r1641659
Index: framework/common/widget/CommonScreens.xml
===================================================================
--- framework/common/widget/CommonScreens.xml (revision 1680314)
+++ framework/common/widget/CommonScreens.xml (working copy)
@@ -191,6 +191,7 @@
<set field="appbarTemplateLocation" from-field="layoutSettings.VT_NAV_TMPLT_LOC[0]" />
<set field="appbarOpenTemplateLocation" from-field="layoutSettings.VT_NAV_OPEN_TMPLT[0]" />
<set field="appbarCloseTemplateLocation" from-field="layoutSettings.VT_NAV_CLOSE_TMPLT[0]" />
+ <set field="appheaderTemplate" from-field="layoutSettings.VT_NAV_APPHDR_LOC[0]"/>
<set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" />
<set field="layoutSettings.suppressTab" value="ofbizsetup"/><!-- diseable ofbiz setup by default -->
</actions>
Index: framework/widget/src/org/ofbiz/widget/model/MenuFactory.java
===================================================================
--- framework/widget/src/org/ofbiz/widget/model/MenuFactory.java (revision 1680329)
+++ framework/widget/src/org/ofbiz/widget/model/MenuFactory.java (working copy)
@@ -88,6 +88,16 @@
}

public static ModelMenu getMenuFromLocation(String resourceName, String menuName) throws IOException, SAXException, ParserConfigurationException {
+ Map<String, ModelMenu> modelMenuMap = getMenusFromLocation(resourceName);
+ ModelMenu modelMenu = modelMenuMap.get(menuName);
+ if (modelMenu == null) {
+ throw new IllegalArgumentException("Could not find menu with name [" + menuName + "] in location [" + resourceName + "]");
+ }
+ return modelMenu;
+ }
+
+ public static Map<String, ModelMenu> getMenusFromLocation(String resourceName) throws IOException, SAXException,
+ ParserConfigurationException {
Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName);
if (modelMenuMap == null) {
URL menuFileUrl = FlexibleLocation.resolveLocation(resourceName);
@@ -100,11 +110,6 @@
if (UtilValidate.isEmpty(modelMenuMap)) {
throw new IllegalArgumentException("Could not find menu file in location [" + resourceName + "]");
}
-
- ModelMenu modelMenu = modelMenuMap.get(menuName);
- if (modelMenu == null) {
- throw new IllegalArgumentException("Could not find menu with name [" + menuName + "] in location [" + resourceName + "]");
- }
- return modelMenu;
+ return modelMenuMap;
}
}
Index: framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java
===================================================================
--- framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java (revision 1680314)
+++ framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java (working copy)
@@ -273,6 +273,7 @@
StringBuilder sb = new StringBuilder("End Menu Widget ");
sb.append(menu.getBoundaryCommentName());
parameters.put("boundaryComment", sb.toString());
+ parameters.put("style", menu.getMenuContainerStyle(context));
}
try {
executeMacro(writer, "renderMenuEnd", parameters);
Index: framework/widget/templates/htmlMenuMacroLibrary.ftl
===================================================================
--- framework/widget/templates/htmlMenuMacroLibrary.ftl (revision 1680314)
+++ framework/widget/templates/htmlMenuMacroLibrary.ftl (working copy)
@@ -31,7 +31,7 @@
<ul>
</#macro>

-<#macro renderMenuEnd boundaryComment="">
+<#macro renderMenuEnd boundaryComment="" style="">
</ul>
</li>
</ul>
4 changes: 4 additions & 0 deletions framework/common/data/CommonTypeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ under the License.
<Enumeration enumId="VT_NAV_CLOSE_TMPLT" description="Closing Navigation Template Location" enumTypeId="VT_RES_TYPE" sequenceId="14"/>
<Enumeration enumId="VT_MSG_TMPLT_LOC" description="Main Messages Template Location" enumTypeId="VT_RES_TYPE" sequenceId="15"/>
<Enumeration enumId="VT_SCREENSHOT" description="Theme Preview Screenshot" enumTypeId="VT_RES_TYPE" sequenceId="16"/>
<Enumeration enumId="VT_SCRN_MACRO_LIB" description="Theme Screen Macro Library Location" enumTypeId="VT_RES_TYPE" sequenceId="17"/>
<Enumeration enumId="VT_FORM_MACRO_LIB" description="Theme Form Macro Library Location" enumTypeId="VT_RES_TYPE" sequenceId="18"/>
<Enumeration enumId="VT_TREE_MACRO_LIB" description="Theme Tree Macro Library Location" enumTypeId="VT_RES_TYPE" sequenceId="19"/>
<Enumeration enumId="VT_MENU_MACRO_LIB" description="Theme Menu Macro Library Location" enumTypeId="VT_RES_TYPE" sequenceId="20"/>

<VisualThemeSet visualThemeSetId="BACKOFFICE" description="Themes to be used for backoffice applications"/>
<VisualThemeSet visualThemeSetId="ECOMMERCE" description="Themes to be used for ECommerce applications"/>
Expand Down
7 changes: 5 additions & 2 deletions framework/common/widget/CommonScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ under the License.
<set field="appbarTemplateLocation" from-field="layoutSettings.VT_NAV_TMPLT_LOC[0]" />
<set field="appbarOpenTemplateLocation" from-field="layoutSettings.VT_NAV_OPEN_TMPLT[0]" />
<set field="appbarCloseTemplateLocation" from-field="layoutSettings.VT_NAV_CLOSE_TMPLT[0]" />
<set field="appheaderTemplate" from-field="layoutSettings.VT_NAV_APPHDR_LOC[0]"/>
<set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" />
<set field="layoutSettings.suppressTab" value="ofbizsetup"/><!-- diseable ofbiz setup by default -->
</actions>
Expand Down Expand Up @@ -395,14 +396,16 @@ under the License.
<set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>

<set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" default-value="component://common/webcommon/includes/messages.ftl"/>
<set field="lookupBodyTemplateLocation" from-field="layoutSettings.VT_LKUP_TEMP_LOC[0]" default-value="component://common/webcommon/includes/lookup.ftl"/>
<set field="lookupFooterTemplateLocation" from-field="layoutSettings.VT_LKUP_FOOTER_LOC[0]" default-value="component://common/webcommon/includes/lookupFooter.ftl"/>
</actions>
<widgets>
<section>
<condition>
<if-compare value="layer" operator="not-equals" field="parameters.presentation"/>
</condition>
<widgets>
<platform-specific><html><html-template location="component://common/webcommon/includes/lookup.ftl" /></html></platform-specific>
<platform-specific><html><html-template location="${lookupBodyTemplateLocation}" /></html></platform-specific>
</widgets>
</section>
<platform-specific><html><html-template location="${messagesTemplateLocation}"/></html></platform-specific>
Expand Down Expand Up @@ -431,7 +434,7 @@ under the License.
<if-compare value="layer" operator="not-equals" field="parameters.presentation"/>
</condition>
<widgets>
<platform-specific><html><html-template location="component://common/webcommon/includes/lookupFooter.ftl"/></html></platform-specific>
<platform-specific><html><html-template location="${lookupFooterTemplateLocation}"/></html></platform-specific>
</widgets>
</section>
</widgets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public void renderMenuClose(Appendable writer, Map<String, Object> context, Mode
StringBuilder sb = new StringBuilder("End Menu Widget ");
sb.append(menu.getBoundaryCommentName());
parameters.put("boundaryComment", sb.toString());
parameters.put("style", menu.getMenuContainerStyle(context));
}
try {
executeMacro(writer, "renderMenuEnd", parameters);
Expand Down
29 changes: 29 additions & 0 deletions framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.xml.parsers.ParserConfigurationException;

import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
Expand Down Expand Up @@ -116,4 +117,32 @@ public static ModelMenu getMenuFromLocation(String resourceName, String menuName
}
return modelMenu;
}

public static Map<String, ModelMenu> getMenusFromLocation(String resourceName)
throws IOException, SAXException, ParserConfigurationException {
Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName);
if (modelMenuMap == null) {
synchronized (MenuFactory.class) {
modelMenuMap = menuLocationCache.get(resourceName);
if (modelMenuMap == null) {
long startTime = System.currentTimeMillis();
URL menuFileUrl = null;
menuFileUrl = FlexibleLocation.resolveLocation(resourceName);
if (menuFileUrl == null) {
throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName);
}
Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true);
modelMenuMap = readMenuDocument(menuFileDoc, resourceName);
menuLocationCache.put(resourceName, modelMenuMap);
double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0;
Debug.logInfo("Got " + modelMenuMap.size() + " screens in " + totalSeconds + "s from: " + menuFileUrl.toExternalForm(), module);
}
}
}

if (modelMenuMap.isEmpty()) {
throw new IllegalArgumentException("Could not find menu file with name [" + resourceName + "]");
}
return modelMenuMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import java.io.IOException;
import java.io.Writer;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -29,8 +31,13 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.collections.MapStack;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceUtil;
import org.ofbiz.webapp.view.AbstractViewHandler;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.ofbiz.widget.form.FormStringRenderer;
Expand All @@ -54,7 +61,67 @@ public void init(ServletContext context) throws ViewHandlerException {
this.servletContext = context;
}

public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
private ScreenStringRenderer loadRenderers(HttpServletRequest request, HttpServletResponse response,
Map<String, Object> context, Writer writer) throws GeneralException, TemplateException, IOException {
String screenMacroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer");
String formMacroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".formrenderer");
String treeMacroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".treerenderer");
String menuMacroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".menurenderer");
Map<String, Object> userPreferences = UtilGenerics.cast(context.get("userPreferences"));
if (userPreferences != null) {
String visualThemeId = (String) userPreferences.get("VISUAL_THEME");
if (visualThemeId != null) {
LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher");
Map<String, Object> serviceCtx = dispatcher.getDispatchContext().makeValidContext("getVisualThemeResources",
ModelService.IN_PARAM, context);
serviceCtx.put("visualThemeId", visualThemeId);
Map<String, Object> serviceResult = dispatcher.runSync("getVisualThemeResources", serviceCtx);
if (ServiceUtil.isSuccess(serviceResult)) {
Map<String, List<String>> themeResources = UtilGenerics.cast(serviceResult.get("themeResources"));
List<String> resourceList = UtilGenerics.cast(themeResources.get("VT_SCRN_MACRO_LIB"));
if (resourceList != null && !resourceList.isEmpty()) {
String macroLibraryPath = resourceList.get(0);
if (macroLibraryPath != null) {
screenMacroLibraryPath = macroLibraryPath;
}
}
resourceList = UtilGenerics.cast(themeResources.get("VT_FORM_MACRO_LIB"));
if (resourceList != null && !resourceList.isEmpty()) {
String macroLibraryPath = resourceList.get(0);
if (macroLibraryPath != null) {
formMacroLibraryPath = macroLibraryPath;
}
}
resourceList = UtilGenerics.cast(themeResources.get("VT_TREE_MACRO_LIB"));
if (resourceList != null && !resourceList.isEmpty()) {
String macroLibraryPath = resourceList.get(0);
if (macroLibraryPath != null) {
treeMacroLibraryPath = macroLibraryPath;
}
}
resourceList = UtilGenerics.cast(themeResources.get("VT_MENU_MACRO_LIB"));
if (resourceList != null && !resourceList.isEmpty()) {
String macroLibraryPath = resourceList.get(0);
if (macroLibraryPath != null) {
menuMacroLibraryPath = macroLibraryPath;
}
}
}
}
}
ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName()
+ ".name"), screenMacroLibraryPath);
FormStringRenderer formStringRenderer = new MacroFormRenderer(formMacroLibraryPath, request, response);
context.put("formStringRenderer", formStringRenderer);
TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(treeMacroLibraryPath, writer);
context.put("treeStringRenderer", treeStringRenderer);
MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(menuMacroLibraryPath, request, response);
context.put("menuStringRenderer", menuStringRenderer);
return screenStringRenderer;
}

public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request,
HttpServletResponse response) throws ViewHandlerException {
try {
Writer writer = response.getWriter();

Expand All @@ -74,28 +141,15 @@ public void render(String name, String page, String info, String contentType, St
// to speed up output.
writer = new StandardCompress().getWriter(writer, null);
}
ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"));
ScreenRenderer screens = new ScreenRenderer(writer, null, screenStringRenderer);
screens.populateContextForRequest(request, response, servletContext);
String macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".formrenderer");
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
FormStringRenderer formStringRenderer = new MacroFormRenderer(macroLibraryPath, request, response);
screens.getContext().put("formStringRenderer", formStringRenderer);
}
macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".treerenderer");
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(macroLibraryPath, writer);
screens.getContext().put("treeStringRenderer", treeStringRenderer);
}
macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".menurenderer");
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(macroLibraryPath, request, response);
screens.getContext().put("menuStringRenderer", menuStringRenderer);
}
screens.getContext().put("simpleEncoder", StringUtil.getEncoder(UtilProperties.getPropertyValue("widget", getName() + ".encoder")));
screenStringRenderer.renderScreenBegin(writer, screens.getContext());
MapStack<String> context = MapStack.create();
ScreenRenderer.populateContextForRequest(context, null, request, response, servletContext);
ScreenStringRenderer screenStringRenderer = loadRenderers(request, response, context, writer);
ScreenRenderer screens = new ScreenRenderer(writer, context, screenStringRenderer);
context.put("screens", screens);
context.put("simpleEncoder", StringUtil.getEncoder(UtilProperties.getPropertyValue("widget", getName() + ".encoder")));
screenStringRenderer.renderScreenBegin(writer, context);
screens.render(page);
screenStringRenderer.renderScreenEnd(writer, screens.getContext());
screenStringRenderer.renderScreenEnd(writer, context);
writer.flush();
} catch (TemplateException e) {
Debug.logError(e, "Error initializing screen renderer", module);
Expand Down
2 changes: 1 addition & 1 deletion framework/widget/templates/htmlMenuMacroLibrary.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ under the License.
<ul>
</#macro>

<#macro renderMenuEnd boundaryComment="">
<#macro renderMenuEnd boundaryComment="" style="">
</ul>
</li>
</ul>
Expand Down
Loading