Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk
This commit is contained in:
@@ -38,6 +38,6 @@ It can be used to create or update the following details for an Agreement:
|
||||
|
||||
== How do I copy an existing agreement?
|
||||
. Find the agreement that needs to be copied
|
||||
. Click on the Agreement Id <<true_a_id_howdo_a_how_do_i_edit_an_agreement, How do it?>>
|
||||
. Click on the Agreement Id <<_how_do_i_edit_an_agreement, How do it?>>
|
||||
. The 'Edit Agreement' screen will be displayed
|
||||
. At the bottom of the screen press the 'Copy' in the 'Copy Agreement' window (NOTE: The default tick boxes will copy the agreement terms, products and party. If not required then click on the boxes to stop them being copied)
|
||||
|
||||
@@ -39,5 +39,5 @@ Currently these are limited to the following:
|
||||
|
||||
== How do I edit an agreement item?
|
||||
. Select the agreement item to be updated by clicking on the Agreement Item Id
|
||||
. The 'Edit Agreement Item' screen is displayed <<true_a_id_howdo_a_how_do_i_edit_an_agreement, How do it?>>
|
||||
. The 'Edit Agreement Item' screen is displayed <<_how_do_i_edit_an_agreement, How do it?>>
|
||||
. Update the fields required (NOTE: Additional details can be updated by selecting the Promotions, Terms, Product, Party or Geo sub menus)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*******************************************************************************/
|
||||
package org.apache.ofbiz.base.util;
|
||||
|
||||
import org.apache.ofbiz.widget.model.ThemeFactory;
|
||||
import org.jsoup.parser.ParseError;
|
||||
import org.jsoup.parser.Parser;
|
||||
|
||||
@@ -28,9 +29,12 @@ import javax.xml.stream.events.EndElement;
|
||||
import javax.xml.stream.events.StartElement;
|
||||
import javax.xml.stream.events.XMLEvent;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -39,6 +43,7 @@ public final class UtilHtml {
|
||||
private static final String MODULE = UtilHtml.class.getName();
|
||||
private static final Parser JSOUP_HTML_PARSER = createJSoupHtmlParser();
|
||||
private static final String[] TAG_SHOULD_CLOSE_LIST = new String[]{"div"};
|
||||
private static List<String> visualThemeBasePathsName;
|
||||
private UtilHtml() { }
|
||||
|
||||
private static Parser createJSoupHtmlParser() {
|
||||
@@ -110,7 +115,33 @@ public final class UtilHtml {
|
||||
return errorList;
|
||||
}
|
||||
|
||||
public static void logFormattedError(String content, String location, String error, String module) {
|
||||
Debug.logError("[Parsing " + location + "] " + error, module);
|
||||
public static List<String> getVisualThemeFolderNamesToExempt() {
|
||||
if (visualThemeBasePathsName == null) {
|
||||
try {
|
||||
List<File> xmlThemes = ThemeFactory.getThemeXmlFiles();
|
||||
visualThemeBasePathsName = new ArrayList<>();
|
||||
String themePathKey = File.separator + "themes" + File.separator;
|
||||
String pluginPathKey = File.separator + "plugins" + File.separator;
|
||||
for (File xmlTheme : xmlThemes) {
|
||||
String path = xmlTheme.toURI().toURL().toString();
|
||||
if (path.indexOf(themePathKey) > 0) {
|
||||
path = path.substring(path.indexOf(themePathKey) + 8);
|
||||
} else if (path.indexOf(pluginPathKey) > 0) {
|
||||
path = path.substring(path.indexOf(pluginPathKey) + 9);
|
||||
}
|
||||
path = path.substring(0, path.indexOf(File.separator));
|
||||
if (!path.contains("common-theme") && !path.contains("ecommerce")) {
|
||||
visualThemeBasePathsName.add(File.separator + path + File.separator);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Debug.logError(e, MODULE);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(visualThemeBasePathsName);
|
||||
}
|
||||
|
||||
public static void logHtmlWarning(String content, String location, String error, String module) {
|
||||
Debug.logWarning("[Parsing " + location + "] " + error, module);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,14 +269,17 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
stringWriter.close();
|
||||
|
||||
if (Debug.verboseOn()) {
|
||||
// check for unclosed tags
|
||||
List<String> errorList = UtilHtml.hasUnclosedTag(data);
|
||||
if (UtilValidate.isNotEmpty(errorList)) {
|
||||
errorList.forEach(a -> UtilHtml.logFormattedError(data, location, a, MODULE));
|
||||
// check with JSoup Html Parser
|
||||
List<ParseError> errList = UtilHtml.validateHtmlFragmentWithJSoup(data);
|
||||
if (UtilValidate.isNotEmpty(errList)) {
|
||||
errList.forEach(a -> UtilHtml.logFormattedError(data, location, a.toString(), MODULE));
|
||||
List<String> themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt();
|
||||
if (!themeBasePathsToExempt.stream().anyMatch(location::contains)) {
|
||||
// check for unclosed tags
|
||||
List<String> errorList = UtilHtml.hasUnclosedTag(data);
|
||||
if (UtilValidate.isNotEmpty(errorList)) {
|
||||
errorList.forEach(a -> UtilHtml.logHtmlWarning(data, location, a, MODULE));
|
||||
// check with JSoup Html Parser
|
||||
List<ParseError> errList = UtilHtml.validateHtmlFragmentWithJSoup(data);
|
||||
if (UtilValidate.isNotEmpty(errList)) {
|
||||
errList.forEach(a -> UtilHtml.logHtmlWarning(data, location, a.toString(), MODULE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -18,8 +18,12 @@
|
||||
*******************************************************************************/
|
||||
package org.apache.ofbiz.widget.renderer.html;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.base.util.UtilHtml;
|
||||
import org.apache.ofbiz.base.util.UtilHttp;
|
||||
import org.apache.ofbiz.widget.model.ModelWidget;
|
||||
|
||||
@@ -73,7 +77,25 @@ public class HtmlWidgetRenderer {
|
||||
}
|
||||
|
||||
public static String formatBoundaryComment(String boundaryType, String widgetType, String widgetName) {
|
||||
return "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + WHITE_SPACE;
|
||||
String boundaryComment = "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + WHITE_SPACE;
|
||||
if (!Debug.verboseOn()) {
|
||||
return boundaryComment;
|
||||
}
|
||||
List<String> themeBasePathsToExempt = UtilHtml.getVisualThemeFolderNamesToExempt();
|
||||
if (!themeBasePathsToExempt.stream().anyMatch(widgetName::contains)) {
|
||||
// add additional visual label for non-theme ftl
|
||||
switch (boundaryType) {
|
||||
case "End":
|
||||
String fileName = widgetName.substring(widgetName.lastIndexOf(File.separator) + 1);
|
||||
return "</div><div class='info-overlay'><span class='info-overlay-item'>"
|
||||
+ fileName
|
||||
+ "</span></div></div>" + boundaryComment;
|
||||
default:
|
||||
return boundaryComment + "<div class='info-container'><div class='info-content'>";
|
||||
}
|
||||
} else {
|
||||
return boundaryComment;
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatBoundaryJsComment(String boundaryType, String widgetType, String widgetName) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
.info-container {
|
||||
display: grid;
|
||||
}
|
||||
.info-overlay {
|
||||
color: rgb(165, 42, 42);
|
||||
justify-items: center;
|
||||
z-index: 10;
|
||||
border: 2px dashed rgba(236, 198, 48, 0.7);
|
||||
transition: .5s ease-out;
|
||||
}
|
||||
.info-content,
|
||||
.info-overlay {
|
||||
grid-area: 1 / 1;
|
||||
}
|
||||
.info-overlay-item {
|
||||
height: 50%;
|
||||
background: rgba(255, 213, 70);
|
||||
border: 2px dashed rgba(236, 198, 48);
|
||||
}
|
||||
@@ -39,6 +39,14 @@ $(document).ready(function() {
|
||||
ajaxAutoCompleteDropDown();
|
||||
// bindObservers will add observer on passed html section when DOM is ready.
|
||||
bindObservers("body");
|
||||
// fadeout info-overlay labels
|
||||
setTimeout(function(){
|
||||
$('.info-overlay').fadeOut(1000, function(){
|
||||
$('.info-container').contents().unwrap();
|
||||
$('.info-content').contents().unwrap();
|
||||
$('.info-overlay').delay(1000).remove();
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
/* bindObservers function contains the code of adding observers and it can be called for specific section as well
|
||||
|
||||
@@ -76,6 +76,7 @@ under the License.
|
||||
<!--Css styles: don't load them since they differ depending on theme -->
|
||||
<property name="VT_STYLESHEET['add']" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.css"/>
|
||||
<property name="VT_STYLESHEET['add']" value="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.css"/>
|
||||
<property name="VT_STYLESHEET['add']" value="/common/css/info.css"/>
|
||||
</theme-properties>
|
||||
|
||||
<templates><!-- Freemarker template use by this theme to render widget model-->
|
||||
|
||||
Reference in New Issue
Block a user