Browse Source

Merge branch 'gh2333a' of https://github.com/wangkx/HPCC-Platform into wangkx-gh2333a

Conflicts:
	esp/scm/ws_smc.ecm

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 years ago
parent
commit
a7d7ecbbcf

+ 3 - 0
build-config.h.cmake

@@ -90,3 +90,6 @@
     #cmakedefine BUILD_LEVEL "${BUILD_LEVEL}"
 #endif
 
+#ifndef USE_RESOURCE
+    #cmakedefine USE_RESOURCE "${USE_RESOURCE}"
+#endif

+ 1 - 0
cmake_modules/commonSetup.cmake

@@ -69,6 +69,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   option(DOCS_DRUPAL "Create Drupal HTML Docs" OFF)
   option(DOCS_EPUB "Create EPUB Docs" OFF)
   option(DOCS_MOBI "Create Mobi Docs" OFF)
+  option(USE_RESOURCE "Use resource download in ECLWatch" OFF)
   
   if ( USE_XALAN AND USE_LIBXSLT )
       set(USE_XALAN OFF)

+ 45 - 21
esp/eclwatch/ws_XSLT/hpccresourcelist.xslt

@@ -54,27 +54,51 @@
       </head>
       <body class="yui-skin-sam" onload="nof5();onLoad()">
         <form id="HPCCResourceForm" name="HPCCResourceForm" >
-          <xsl:choose>
-            <xsl:when test="not(HPCCResourceRepositories/HPCCResourceRepository[1])">
-              <br/><br/>No resource found from your installation.<br/><br/>
-              <xsl:if test="string-length(PortalURL)">
-                <br/>You may visit <a href="{PortalURL}" target="_blank">
-                  <xsl:value-of select="PortalURL"/>
-                </a> for resources.
-              </xsl:if>
-            </xsl:when>
-            <xsl:otherwise>
-              <br/>
-              <b>Click a link below to download a version from your installation.
-              <xsl:if test="string-length(PortalURL)">
-                <br/>You may visit <a href="{PortalURL}" target="_blank">
-                <xsl:value-of select="PortalURL"/>
-                </a> for other versions.
-              </xsl:if>
-              </b><br/><br/>
-              <xsl:apply-templates/>
-            </xsl:otherwise>
-          </xsl:choose>
+            <xsl:choose>
+                <xsl:when test="UseResource = 0">
+                    <xsl:choose>
+                        <xsl:when test="string-length(PortalURL)">
+                            Please visit <a href="{PortalURL}" target="_blank">
+                              <xsl:value-of select="PortalURL"/>
+                            </a> for resources.
+                        </xsl:when>
+                        <xsl:otherwise>
+                            No web link is configured for downloading resources.
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="not(HPCCResourceRepositories/HPCCResourceRepository[1])">
+                            <br/><br/>No resource found from your installation.<br/><br/>
+                            <xsl:choose>
+                                <xsl:when test="string-length(PortalURL)">
+                                <br/>You may visit <a href="{PortalURL}" target="_blank">
+                                    <xsl:value-of select="PortalURL"/>
+                                </a> for resources.
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    No web link is configured for downloading resource.
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <br/>
+                            <b>
+                                Click a link below to download a version from your installation.
+                                <xsl:if test="string-length(PortalURL)">
+                                    <br/>You may visit <a href="{PortalURL}" target="_blank">
+                                        <xsl:value-of select="PortalURL"/>
+                                    </a> for other versions.
+                                </xsl:if>
+                            </b>
+                            <br/>
+                            <br/>
+                            <xsl:apply-templates/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
         </form>
       </body>
     </html>

+ 2 - 1
esp/scm/ws_smc.ecm

@@ -256,6 +256,7 @@ BrowseResourcesResponse
     string PortalURL;
     string NetAddress;
     int OS;
+    [min_ver("1.13")] bool UseResource;
     ESParray<ESPstruct HPCCResourceRepository> HPCCResourceRepositories;
 };
 
@@ -290,7 +291,7 @@ RoxieControlCmdResponse
     ESParray<ESPstruct RoxieControlEndpointInfo, Endpoint> Endpoints;
 };
 
-ESPservice [noforms, version("1.12"), default_client_version("1.12"), exceptions_inline("./smc_xslt/exceptions.xslt"), use_method_name] WsSMC
+ESPservice [noforms, version("1.13"), default_client_version("1.13"), exceptions_inline("./smc_xslt/exceptions.xslt"), use_method_name] WsSMC
 {
     ESPmethod Index(SMCIndexRequest, SMCIndexResponse);
     ESPmethod [resp_xsl_default("/esp/xslt/index.xslt")] Activity(ActivityRequest, ActivityResponse);

+ 2 - 0
esp/services/ws_smc/CMakeLists.txt

@@ -57,6 +57,8 @@ include_directories (
          ./../../smc/SMCLib 
          ./../../bindings/SOAP/xpp 
          ./../../../system/security/LdapSecurity
+         ${CMAKE_BINARY_DIR}
+         ${CMAKE_BINARY_DIR}/oss
     )
 
 # NOTE - this should not be needed, it's the result of poor encapsulation and using CLdapSecManager directly 

+ 12 - 0
esp/services/ws_smc/ws_smcService.cpp

@@ -18,6 +18,8 @@
 
 #pragma warning (disable : 4786)
 
+#include "build-config.h"
+
 #ifdef _USE_OPENLDAP
 #include "ldapsecurity.ipp"
 #endif
@@ -1262,6 +1264,8 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_SMC_ACCESS_DENIED, "Failed to Browse Resources. Permission denied.");
 
+        double version = context.getClientVersion();
+
         Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
         Owned<IConstEnvironment> constEnv = factory->openEnvironmentByFile();
 
@@ -1283,6 +1287,13 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
         if (m_PortalURL.length() > 0)
             resp.setPortalURL(m_PortalURL.str());
 
+#ifndef USE_RESOURCE
+        if (version > 1.12)
+            resp.setUseResource(false);
+#else
+        if (version > 1.12)
+            resp.setUseResource(true);
+
         //Now, get a list of resources stored inside the ESP box
         IArrayOf<IEspHPCCResourceRepository> resourceRepositories;
 
@@ -1400,6 +1411,7 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
 
         if (resourceRepositories.ordinality())
             resp.setHPCCResourceRepositories(resourceRepositories);
+#endif
     }
     catch(IException* e)
     {

+ 20 - 2
esp/services/ws_smc/ws_smcService.hpp

@@ -73,9 +73,20 @@ private:
 
 class CWsSMCSoapBindingEx : public CWsSMCSoapBinding
 {
+    StringBuffer m_portalURL;
 public:
     CWsSMCSoapBindingEx(){}
-    CWsSMCSoapBindingEx(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL):CWsSMCSoapBinding(cfg, bindname, procname){}
+    CWsSMCSoapBindingEx(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL):CWsSMCSoapBinding(cfg, bindname, procname)
+    {
+        if (!procname || !*procname)
+            return;
+
+        StringBuffer xpath;
+        xpath.appendf("Software/EspProcess[@name='%s']/@portalurl", procname);
+        const char* portalURL = cfg->queryProp(xpath.str());
+        if (portalURL && *portalURL)
+            m_portalURL.append(portalURL);
+    }
 
     virtual ~CWsSMCSoapBindingEx(){}
 
@@ -96,9 +107,16 @@ public:
         IPropertyTree *folder = ensureNavFolder(data, "Clusters", NULL, NULL, false, 1);
         ensureNavLink(*folder, "Activity", "/WsSMC/Activity", "Display Activity on all target clusters in an environment", NULL, NULL, 1);
         ensureNavLink(*folder, "Scheduler", "/WsWorkunits/WUShowScheduled", "Access the ECL Scheduler to view and manage scheduled workunits or events", NULL, NULL, 2);
-
+#ifndef USE_RESOURCE
+        if (m_portalURL.length() > 0)
+        {
+            IPropertyTree *folderTools = ensureNavFolder(data, "Resources", NULL, NULL, false, 8);
+            ensureNavLink(*folderTools, "Browse", "/WsSMC/BrowseResources", "Browse a list of resources available for download, such as the ECL IDE, documentation, examples, etc. These are only available if optional packages are installed on the ESP Server.", NULL, NULL, 1);
+        }
+#else
         IPropertyTree *folderTools = ensureNavFolder(data, "Resources", NULL, NULL, false, 8);
         ensureNavLink(*folderTools, "Browse", "/WsSMC/BrowseResources", "Browse a list of resources available for download, such as the ECL IDE, documentation, examples, etc. These are only available if optional packages are installed on the ESP Server.", NULL, NULL, 1);
+#endif
     }
     virtual void getNavSettings(int &width, bool &resizable, bool &scroll)
     {