Author: vdegtyarev Date: Wed Nov 30 08:15:21 2016 New Revision: 1772001 URL: http://svn.apache.org/viewvc?rev=1772001&view=rev Log: Merged revision(s) 1771997 from openmeetings/application/branches/3.2.x: OPENMEETINGS-1513 is fixed. Installer Converters page is improved to check that installed converter tools or not.
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard$ParamsStep3.html openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard$ParamsStep3.html URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard%24ParamsStep3.html?rev=1772001&r1=1772000&r2=1772001&view=diff ============================================================================== --- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard$ParamsStep3.html (original) +++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard$ParamsStep3.html Wed Nov 30 08:15:21 2016 @@ -23,66 +23,45 @@ <fieldset class="ui-widget-content" id="userConf1"> <legend class="ui-widget-header"><wicket:message key="install.wizard.params.step3.converters"/></legend> <ul class="paramList"> - <li><label wicket:for="swfZoom"><wicket:message key="install.wizard.params.step3.swfZoom"/></label> + <li><label wicket:for="swfZoom"><wicket:message key="install.wizard.params.step3.swfZoom"/> + <span class="info-title" wicket:message="title:install.wizard.params.step3.swfZoom.text"/> + </label> <input wicket:id="swfZoom" wicket:message="title:install.wizard.params.step3.swfZoom.title" type="text" /> - <p> - <i> - <wicket:message key="install.wizard.params.step3.swfZoom.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> - </i> - </p> </li> - <li><label wicket:for="swfJpegQuality"><wicket:message key="install.wizard.params.step3.swfJpegQuality"/></label> + <li><label wicket:for="swfJpegQuality"><wicket:message key="install.wizard.params.step3.swfJpegQuality"/> + <span class="info-title" wicket:message="title:install.wizard.params.step3.swfJpegQuality.text"/> + </label> <input wicket:id="swfJpegQuality" wicket:message="title:install.wizard.params.step3.swfJpegQuality.title" type="text" /> - <p> - <i> - <wicket:message key="install.wizard.params.step3.swfJpegQuality.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> - </i> - </p> </li> - <li><label wicket:for="swfPath"><wicket:message key="install.wizard.params.step3.swfPath"/></label> + <li> + <label wicket:for="swfPath"><wicket:message key="install.wizard.params.step3.swfPath"/> + <span class="info-title" wicket:message="title:install.wizard.params.step3.swfPath.text"/> + </label> <input wicket:id="swfPath" - wicket:message="title:install.wizard.params.step3.swfPath.title" type="text" /> - <p> - <i> - <wicket:message key="install.wizard.params.step3.swfPath.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> - </i> - </p> + <button class="formelement" wicket:id="validateSwf"><wicket:message key="install.wizard.db.step.check"/></button> </li> <li><label wicket:for="imageMagicPath"><wicket:message key="install.wizard.params.step3.imageMagicPath"/></label> <input wicket:id="imageMagicPath" wicket:message="title:install.wizard.params.step3.imageMagicPath.title" type="text" /> + <button class="formelement" wicket:id="validateImageMagic"><wicket:message key="install.wizard.db.step.check"/></button> <p> <i> <wicket:message key="install.wizard.params.step3.imageMagicPath.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> </i> </p> </li> <li><label wicket:for="ffmpegPath"><wicket:message key="install.wizard.params.step3.ffmpegPath"/></label> <input wicket:id="ffmpegPath" wicket:message="title:install.wizard.params.step3.ffmpegPath.title" type="text" /> + <button class="formelement" wicket:id="validateFfmpeg"><wicket:message key="install.wizard.db.step.check"/></button> <p> <i> <wicket:message key="install.wizard.params.step3.ffmpegPath.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> </i> </p> </li> @@ -90,22 +69,24 @@ <input wicket:id="soxPath" wicket:message="title:install.wizard.params.step3.soxPath.title" type="text" /> + <button class="formelement" wicket:id="validateSox"><wicket:message key="install.wizard.db.step.check"/></button> <p> <i> <wicket:message key="install.wizard.params.step3.soxPath.text"/> - <wicket:message key="install.wizard.params.step3.seeAlso"/> <a - href="http://openmeetings.apache.org/installation.html" - target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> </i> </p> </li> - <li><label wicket:for="officePath"><wicket:message key="install.wizard.params.step3.officePath"/></label> + <li><label wicket:for="officePath"><wicket:message key="install.wizard.params.step3.officePath"/> + <span class="info-title" wicket:message="title:install.wizard.params.step3.officePath.text"/> + </label> <input wicket:id="officePath" wicket:message="title:install.wizard.params.step3.officePath.title" type="text" /> + <button class="formelement" wicket:id="validateOffice"><wicket:message key="install.wizard.db.step.check"/></button> + </li> + <li> <p> <i> - <wicket:message key="install.wizard.params.step3.officePath.text"/> <wicket:message key="install.wizard.params.step3.seeAlso"/> <a href="http://openmeetings.apache.org/installation.html" target="_blank"><wicket:message key="install.wizard.params.step3.installation"/></a> Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java?rev=1772001&r1=1772000&r2=1772001&view=diff ============================================================================== --- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java (original) +++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java Wed Nov 30 08:15:21 2016 @@ -40,11 +40,14 @@ import java.util.Locale; import java.util.Map; import org.apache.openmeetings.cli.ConnectionPropertiesPatcher; +import org.apache.openmeetings.core.converter.GenerateSWF; import org.apache.openmeetings.db.dao.label.LabelDao; import org.apache.openmeetings.installation.ImportInitvalues; import org.apache.openmeetings.installation.InstallationConfig; import org.apache.openmeetings.util.ConnectionProperties; import org.apache.openmeetings.util.ConnectionProperties.DbType; +import org.apache.openmeetings.util.process.ConverterProcessResult; +import org.apache.openmeetings.util.process.ProcessHelper; import org.apache.openmeetings.util.OmFileHelper; import org.apache.openmeetings.web.app.Application; import org.apache.openmeetings.web.app.WebSession; @@ -70,7 +73,11 @@ import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.util.string.Strings; import org.apache.wicket.util.time.Duration; +import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; +import org.artofsolving.jodconverter.office.OfficeException; +import org.artofsolving.jodconverter.office.OfficeManager; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; import org.springframework.orm.jpa.LocalEntityManagerFactoryBean; @@ -78,6 +85,7 @@ import org.springframework.web.context.s import com.googlecode.wicket.jquery.core.JQueryBehavior; import com.googlecode.wicket.jquery.core.Options; +import com.googlecode.wicket.jquery.ui.form.button.AjaxButton; import com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton; import com.googlecode.wicket.jquery.ui.widget.progressbar.ProgressBar; import com.googlecode.wicket.jquery.ui.widget.wizard.AbstractWizard; @@ -147,6 +155,14 @@ public class InstallWizard extends Abstr protected boolean closeOnFinish() { return false; } + + private static String getPath(String path, String app) { + if (!"".equals(path) && !path.endsWith(File.separator)) { + path += File.separator; + } + path += app; + return path; + } private abstract class BaseStep extends DynamicWizardStep { private static final long serialVersionUID = 1L; @@ -474,19 +490,108 @@ public class InstallWizard extends Abstr private final class ParamsStep3 extends BaseStep { private static final long serialVersionUID = 1L; - + private final TextField<String> ffmpegPath; + private final TextField<String> imageMagicPath; + private final TextField<String> soxPath; + private final TextField<String> swfPath; + private final TextField<String> officePath; + private final String regex = "\\r\\n|\\r|\\n"; + private boolean isAllChecked = false; public ParamsStep3() { super(paramsStep2); add(new TextField<Integer>("swfZoom").setRequired(true).add(range(50, 600))); add(new TextField<Integer>("swfJpegQuality").setRequired(true).add(range(1, 100))); - add(new TextField<String>("swfPath")); - add(new TextField<String>("imageMagicPath")); - add(new TextField<String>("ffmpegPath")); - add(new TextField<String>("soxPath")); - add(new TextField<String>("officePath")); + add(swfPath = new TextField<String>("swfPath")); + add(new AjaxButton("validateSwf") { + private static final long serialVersionUID = 1L; + @Override + protected void onSubmit(AjaxRequestTarget target, Form<?> form) { + checkToolPath(swfPath, new String[] {InstallWizard.getPath(swfPath.getValue(), "pdf2swf" + GenerateSWF.execExt), "--version"}); + target.add(getFeedbackPanel()); + } + }); + add(imageMagicPath = new TextField<String>("imageMagicPath")); + add(new AjaxButton("validateImageMagic") { + private static final long serialVersionUID = 1L; + @Override + protected void onSubmit(AjaxRequestTarget target, Form<?> form) { + checkToolPath(imageMagicPath, new String[] {InstallWizard.getPath(imageMagicPath.getValue(), "convert" + GenerateSWF.execExt), "-version"}); + target.add(getFeedbackPanel()); + } + }); + add(ffmpegPath = new TextField<String>("ffmpegPath")); + add(new AjaxButton("validateFfmpeg") { + private static final long serialVersionUID = 1L; + @Override + protected void onSubmit(AjaxRequestTarget target, Form<?> form) { + checkToolPath(ffmpegPath, new String[] {InstallWizard.getPath(ffmpegPath.getValue(), "ffmpeg" + GenerateSWF.execExt), "-version"}); + target.add(getFeedbackPanel()); + } + }); + add(soxPath = new TextField<String>("soxPath")); + add(new AjaxButton("validateSox") { + private static final long serialVersionUID = 1L; + @Override + protected void onSubmit(AjaxRequestTarget target, Form<?> form) { + checkToolPath(soxPath, new String[] {InstallWizard.getPath(soxPath.getValue(), "sox" + GenerateSWF.execExt), "--version"}); + target.add(getFeedbackPanel()); + } + }); + add(officePath = new TextField<String>("officePath")); + add(new AjaxButton("validateOffice") { + private static final long serialVersionUID = 1L; + @Override + protected void onSubmit(AjaxRequestTarget target, Form<?> form) { + checkOfficePath(); + target.add(getFeedbackPanel()); + } + }); + } + + private boolean checkToolPath(TextField<String> path, String[] args) { + ConverterProcessResult result = ProcessHelper.executeScript(path.getInputName() + " path:: '" + path.getValue() + "'", args); + if (!result.isOk()) { + path.error(result.getError().replaceAll(regex, "")); + } + return result.isOk(); + } + + private boolean checkOfficePath() { + String err = ""; + try { + DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration(); + if (!Strings.isEmpty(officePath.getValue())) { + configuration.setOfficeHome(officePath.getValue()); + } + OfficeManager officeManager = configuration.buildOfficeManager(); + try { + officeManager.start(); + } catch (OfficeException ex) { + err = ex.getMessage().replaceAll(regex, ""); + } finally { + officeManager.stop(); + } + } catch (Exception ex) { + err = ex.getMessage().replaceAll(regex, ""); + } + if (!err.isEmpty()) { + officePath.error(err); + } + return err.isEmpty(); } + private boolean checkAllPath() { + boolean result = checkToolPath(swfPath, new String[] {InstallWizard.getPath(swfPath.getValue(), "pdf2swf" + GenerateSWF.execExt), "--version"}); + result = checkToolPath(imageMagicPath, new String[] {InstallWizard.getPath(imageMagicPath.getValue(), "convert" + GenerateSWF.execExt), "-version"}) && result; + result = checkToolPath(ffmpegPath, new String[] {InstallWizard.getPath(ffmpegPath.getValue(), "ffmpeg" + GenerateSWF.execExt), "-version"}) && result; + result = checkToolPath(soxPath, new String[] {InstallWizard.getPath(soxPath.getValue(), "sox" + GenerateSWF.execExt), "--version"}) && result; + result = checkOfficePath() && result; + isAllChecked = true; + return result; + } + + @Override public boolean isLastStep() { return false; @@ -494,12 +599,17 @@ public class InstallWizard extends Abstr @Override public IDynamicWizardStep next() { + if (!isAllChecked) { + if (!checkAllPath()) { + return this; + } + } return paramsStep4; } @Override public boolean isLastAvailable() { - return true; + return isAllChecked; } @Override Modified: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css?rev=1772001&r1=1772000&r2=1772001&view=diff ============================================================================== --- openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css (original) +++ openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css Wed Nov 30 08:15:21 2016 @@ -527,6 +527,14 @@ select.messages.selector { font-style: italic; white-space: normal; } +.info-title { + background-image: url(images/information.png); + background-repeat: no-repeat; + width: 16px; + height: 16px; + display: inline-block; + margin-left: 10px; +} .invisible-form-component { position: absolute; top: -9999px;