Explorar el Código

Merge branch 'issue-2629_configmgr_save_as_button_2' of https://github.com/garonsky/HPCC-Platform into garonsky-issue-2629_configmgr_save_as_button_2

Conflicts:
	esp/files/scripts/configmgr/navtree.js

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman hace 13 años
padre
commit
391cbc4714

+ 13 - 1
esp/files/configmgr.html

@@ -213,7 +213,18 @@ body {
       .yui-skin-sam .yui-dt tr.outoffocus td {
       background-color: #D0D0D0;
       }
-      
+
+      .yui-button#saveasbutton button {
+      background: url(/esp/files/img/saveasimg.gif) center center no-repeat;
+      width: 2em;
+      text-indent: -4em;
+      text-align:justify;
+      overflow: hidden;
+      padding: 0 .75em;
+      *margin-left: 4em;   /* IE only */
+      *padding: 0 1.75em;  /* IE only */
+      }
+
       .yui-button#savebutton button {
       background: url(/esp/files/img/save.gif) center center no-repeat;
       width: 2em;
@@ -662,6 +673,7 @@ You need to have Javascript enabled in order to use ConfigMgr. Please enable Jav
       <div id="envctrls">
         <input id="ReadWrite" type="checkbox" name="ReadWrite" value="false" onclick="setReadWrite(this.checked)"/>Write Access&nbsp;
         <input type="button" id='savebutton' class='yui-button savebutton' name="savebutton" title="Save Environment" />
+        <input type="button" id='saveasbutton' class='yui-button saveasbutton' name="saveasbutton" title="Save Environment As" />
         <input type="button" id='validatebutton' class='yui-button validatebutton' name="validatebutton" title="Validate Environment" />
         <input type="button" id='openbutton' class='yui-button openbutton' name="openbutton" title="Open Environment" />
         <input type="button" id='wizardbutton' class='yui-button wizardbutton' name="wizardbutton" title="Wizard" />

+ 1 - 0
esp/files/img/CMakeLists.txt

@@ -21,6 +21,7 @@ FOREACH( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/collapse.gif
     ${CMAKE_CURRENT_SOURCE_DIR}/expand.gif
     ${CMAKE_CURRENT_SOURCE_DIR}/save.gif
+    ${CMAKE_CURRENT_SOURCE_DIR}/saveasimg.gif
     ${CMAKE_CURRENT_SOURCE_DIR}/cloud.jpg
     ${CMAKE_CURRENT_SOURCE_DIR}/wizard.gif
     ${CMAKE_CURRENT_SOURCE_DIR}/tooltip.jpg

BIN
esp/files/img/saveasimg.gif


+ 9 - 7
esp/files/scripts/configmgr/navtree.js

@@ -32,6 +32,7 @@
         function fnce() {
           var oPushButton3 = new YAHOO.widget.Button("validatebutton", { onclick: { fn: validateEnvironment} });
           var oPushButton2 = new YAHOO.widget.Button("savebutton", { onclick: { fn: saveEnvironment} });
+          var oPushButton6 = new YAHOO.widget.Button("saveasbutton", { onclick: { fn: saveEnvironmentAs} });
           var oPushButton4 = new YAHOO.widget.Button("openbutton", { onclick: { fn: displayOpenEnvDialog} });
           var oPushButton5 = new YAHOO.widget.Button("wizardbutton", { onclick: { fn: invokeWizard} });
 
@@ -805,7 +806,7 @@ function createNavigationTree(navTreeData) {
       saveAndUnlockEnv();
     else if (menuItemName === 'Save Environment')
       saveEnvironment();
-    else if (menuItemName === 'Save Environment As...') {
+    else if (menuItemName === 'Save Environment As') {
       saveEnvironmentAs();
     }
     else if (menuItemName == 'Copy Hardware To')
@@ -1295,7 +1296,8 @@ function createNavigationTree(navTreeData) {
         for (iGroup = 0; iGroup < groups.length; iGroup++) {
           if (typeof (groups[iGroup]) !== 'undefined')
             for (i = 0; i < groups[iGroup].length; i++)
-            groups[iGroup][i].cfg.setProperty("disabled", true);
+            if (groups[iGroup][i].element.innerText != "Save Environment As")
+              groups[iGroup][i].cfg.setProperty("disabled", true);
         }
       }
 
@@ -1862,7 +1864,7 @@ function saveEnvironment(saveas) {
           if (xmlargs.length > 0) {
             var xmlargs1 = xmlargs[1].split(/<\/XmlArgs>/g);
             if (xmlargs1.length > 0 && xmlargs1[0].length > 0 && xmlargs1[0].charAt(0) != '<') {
-              promptValidationErrs(xmlargs1[0]);
+              alert(xmlargs1[0]);
             }
           }
 
@@ -1940,12 +1942,15 @@ copyHWSWTo = function (menuItemName, IsHW)
 }
 
 function saveEnvironmentAs() {
+  getWaitDlg().show();
+
   var handleCancel = function() {
     getWaitDlg().hide();
     top.document.envSaveAsDialog.hide();
   }
 
   var handleOk = function() {
+    getWaitDlg().hide();
     loadAndCheckFileNames('3');
   };
 
@@ -3515,8 +3520,6 @@ function updateEnvCtrls(flag) {
   if (flag) {
     Dom.removeClass(sbtn, "yui-button-disabled");
     Dom.removeClass(vbtn, "yui-button-disabled");
-    document.getElementById('savebutton-button').disabled = false;
-    document.getElementById('validatebutton-button').disabled = false;
     document.getElementById('savebutton').disabled = false;
     document.getElementById('validatebutton').disabled = false;
     document.getElementById('ReadWrite').checked = true;
@@ -3524,8 +3527,6 @@ function updateEnvCtrls(flag) {
   else {
     Dom.addClass(sbtn, "yui-button-disabled");
     Dom.addClass(vbtn, "yui-button-disabled");
-    document.getElementById('savebutton-button').disabled = true;
-    document.getElementById('validatebutton-button').disabled = true;
     document.getElementById('savebutton').disabled = true;
     document.getElementById('validatebutton').disabled = true;
     document.getElementById('ReadWrite').checked = false;
@@ -4921,6 +4922,7 @@ function callHtmlSummaryPage()
   {
     document.getElementById('ReadWrite').disabled = true;
     document.getElementById('savebutton').disabled = true;
+    document.getElementById('saveasbutton').disabled = false;
     document.getElementById('validatebutton').disabled = true;
   }
   

+ 6 - 5
esp/services/WsDeploy/WsDeployService.cpp

@@ -912,10 +912,11 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
         else
         {
           CWsDeployFileInfo* fi = m_pService->getFileInfo(envSaveAs, true);
-          StringBuffer sbUser, sbIp, sbXml, sbErrMsg;
-          if ((fi->isLocked(sbUser, sbIp) && m_userWithLock.length() != 0 && m_userIp.length() != 0 &&
-               !strcmp(m_userWithLock.str(), sbUser.str()) && !strcmp(m_userIp.str(), sbIp.str())) ||
-               (!fi->isLocked(sbUser, sbIp) && m_userWithLock.length() != 0 && m_userIp.length() != 0))
+          StringBuffer sbUser, sbIp, sbXml;
+
+          if ( fi->isLocked(sbUser, sbIp) == true)
+            throw MakeStringException(-1, "%s is locked by another user. File not saved.", envSaveAs);
+          if (isLocked(sbUser,sbIp) == true)  // if we are in write only mode then save the working environment
             toXML(&m_Environment->getPTree(), sbXml);
           else
             toXML(&m_constEnvRdOnly->getPTree(), sbXml);
@@ -927,7 +928,6 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
 
           if (m_userWithLock.length() != 0 && m_userIp.length() != 0)
           {
-            unlockEnvironment(&context, &req.getReqInfo(), "", sbErrMsg);
             if (sbErrMsg.length())
             {
               resp.setXmlArgs(sbErrMsg.str());
@@ -5654,6 +5654,7 @@ void CWsDeployFileInfo::saveEnvironment(IEspContext* pContext, IConstWsDeployReq
       }
       else if (saveAs)
       {
+        setSkipNotification(true);
         pEnvRoot.setown(&m_constEnvRdOnly->getPTree());
         validateEnv(m_constEnvRdOnly, false);
       }