From 31cdf8968d265c127832cc2aedd1131094dba01c Mon Sep 17 00:00:00 2001
From: hahn <hahn@AAE49.campus.unibe.ch>
Date: Fri, 2 May 2014 16:57:51 +0200
Subject: [PATCH] - change of config keys "ssh" --> "url" and "keyfile" -->
 "auth" (this requires to edit the project config files on server)

---
 config/lang/de.json                              |  2 +-
 config/lang/en.json                              |  2 +-
 public_html/deployment/classes/project.class.php | 14 +++++++-------
 public_html/deployment/classes/sws.class.php     | 10 +++++-----
 public_html/deployment/classes/vcs.git.class.php |  8 ++++----
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/config/lang/de.json b/config/lang/de.json
index 5f18339c..6c7373f9 100644
--- a/config/lang/de.json
+++ b/config/lang/de.json
@@ -242,7 +242,7 @@
     "repository-access-browser": "Browserzugriff auf das Repo",
     "repository-url": "URL zum Repository",
     "repository-urlwebgui": "URL zur Web GUI des Repositorys",
-    "repository-privkey": "Dateiname zum SSH-Private-Key",
+    "repository-privkey": "Authentifizierung/ Dateiname zum SSH-Private-Key",
     "revision": "Revision",
     "rollback": "Rollback",
     "rollback-hint": "Rollback der Phase [%s] auf Version [%s]",
diff --git a/config/lang/en.json b/config/lang/en.json
index 35ac3d3b..2bd2e203 100644
--- a/config/lang/en.json
+++ b/config/lang/en.json
@@ -244,7 +244,7 @@
     "repository-access-browser": "Browser access to sources",
     "repository-url": "URL to repository",
     "repository-urlwebgui": "URL zur Web GUI des Repositorys",
-    "repository-privkey": "Dateiname zum SSH-Private-Key",
+    "repository-privkey": "Authentication/ filename of ssh private key",
     "revision": "Revision",
     "rollback": "Rollback",
     "rollback-hint": "Rollback of phase [%s] to version [%s]",
diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php
index fb2f3bd4..7ae645a4 100644
--- a/public_html/deployment/classes/project.class.php
+++ b/public_html/deployment/classes/project.class.php
@@ -1600,7 +1600,7 @@ class project {
             "build" => array(
                 "type" => "",
                 "ssh" => "",
-                "keyfile" => "",
+                "auth" => "",
                 "webaccess" => "",
             ),
             "phases" => array(
@@ -2188,7 +2188,7 @@ class project {
                 <div class="details">
                     '.$sRepoBar.'<br>
                     <a href="#h3repo" class="scroll-link">' . t("repositoryinfos") . '</a><br>
-                    <strong>'. $this->_aPrjConfig["build"]["type"].'</strong> '.preg_replace('/.*\@(.*):.*/','($1)',$this->_aPrjConfig["build"]["ssh"]).'<br>
+                    <strong>'. $this->_aPrjConfig["build"]["type"].'</strong> '.preg_replace('/.*\@(.*):.*/','($1)',$this->_aPrjConfig["build"]["url"]).'<br>
                 </div>
                 <div>
                     <img src="/deployment/images/process/bg_vcs.png" alt="'.t("versioncontrol").'">
@@ -2351,9 +2351,9 @@ class project {
                     ),
                     'input' . $i++ => array(
                         'type' => 'text',
-                        'name' => 'build[ssh]',
+                        'name' => 'build[url]',
                         'label' => t("repository-url"),
-                        'value' => $this->_aPrjConfig["build"]["ssh"],
+                        'value' => $this->_aPrjConfig["build"]["url"],
                         // 'required' => 'required',
                         'validate' => 'isastring',
                         'size' => 100,
@@ -2361,9 +2361,9 @@ class project {
                     ),
                     'input' . $i++ => array(
                         'type' => 'text',
-                        'name' => 'build[keyfile]',
-                        'label' => t("repository-privkey"),
-                        'value' => $this->_aPrjConfig["build"]["keyfile"],
+                        'name' => 'build[auth]',
+                        'label' => t("repository-auth"),
+                        'value' => $this->_aPrjConfig["build"]["auth"],
                         // 'required' => 'required',
                         'validate' => 'isastring',
                         'size' => 100,
diff --git a/public_html/deployment/classes/sws.class.php b/public_html/deployment/classes/sws.class.php
index 21b9f8f5..64ef3261 100644
--- a/public_html/deployment/classes/sws.class.php
+++ b/public_html/deployment/classes/sws.class.php
@@ -34,7 +34,7 @@
  * - configuration: option area
  * - configuration: examples of a class + of actions
  * 
- * @version 0.05
+ * @version 0.06
  * @author Axel Hahn
  * @link http://www.axel-hahn.de/php_sws
  * @license GPL
@@ -103,7 +103,7 @@ class sws {
      * version
      * @var string 
      */
-    private $_sVersion = "0.05&nbsp;(beta)";
+    private $_sVersion = "0.06&nbsp;(beta)";
 
     /**
      * title
@@ -410,7 +410,7 @@ class sws {
                     $RefClass["actions"][$sAction]['active']=$bActive;
                     $RefClass["actions"][$sAction]['phpdoc']=$sComment;
                     $RefClass["actions"][$sAction]['params']=$aParams;
-                    $RefClass["actions"][$sAction]['value']=($bActive && count($this->_aArgs))?$this->_aParams["args"]:false;
+                    $RefClass["actions"][$sAction]['value']=($bActive && array_key_exists("args", $this->_aParams))?$this->_aParams["args"]:'';
                     
                     if($sAction==="__construct"){
                         $RefClass["actions"][$sAction]['value']=(array_key_exists("init", $this->_aParams))?$this->_aParams["init"]:'';
@@ -678,7 +678,7 @@ class sws {
                     . 'h2{margin: 3em 0 1em;  }'
                     . 'h3,h4{margin: 0;}'
                     . 'fieldset{border: 1px solid rgba(0,0,0,0.2); background: rgba(0,0,0,0.05); }'
-                    . 'input {border: 2px solid #ddd; padding: 0.3em; border-radius: 0.5em; color: #348; font-size: 100%;}' 
+                    . 'input {border: 0px solid #ccc; padding: 0.1em; border-radius: 0.2em; color: #348; font-size: 100%;}' 
                     . 'label{width: 10em; float: left; text-align: right;}'
                     . 'ul{padding-left: 0; margin: 0; border-radius: 0.5em;}'
                     . 'ul ul{margin: 1em;}'
@@ -761,7 +761,7 @@ class sws {
                             if (document.getElementById(sIdPrefix+arguments[i])
                             && document.getElementById(sIdPrefix+arguments[i]).value
                             ){
-                                sUrl+="&"+arguments[i]+"="+escape(document.getElementById(sIdPrefix+arguments[i]).value);
+                                sUrl+="&"+arguments[i]+"="+document.getElementById(sIdPrefix+arguments[i]).value;
                             }
                         }
                         document.getElementById(sIdPrefix+"url").value=sUrl;
diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php
index 894dbf13..5e167636 100644
--- a/public_html/deployment/classes/vcs.git.class.php
+++ b/public_html/deployment/classes/vcs.git.class.php
@@ -53,7 +53,7 @@ class vcs implements iVcs {
     public function setConfig($aRepoConfig=array()){
         
         // checks
-        foreach(array("type", "ssh") as $key){
+        foreach(array("type", "url") as $key){
             if (!array_key_exists($key, $aRepoConfig)){
                 die("ERROR: key $key does not exist in config <pre>". print_r($aRepoConfig, true)."</pre>");
             }
@@ -69,10 +69,10 @@ class vcs implements iVcs {
         $this->_aCfg=$aRepoConfig;
         
         // define temp dir
-        $this->_sTempDir=$this->_aCfg["ssh"];
+        $this->_sTempDir=$this->_aCfg["url"];
         $this->_sTempDir=preg_replace('/[\@\.\:\/]/', '_', $this->_sTempDir);
         $this->_sTempDir=(getenv("temp")?getenv("temp"):"/tmp").'/checkout_vcsgit_'. $this->_sTempDir . "/";
-        $this->_sKeyfile = $this->_aCfg["appRootDir"] . "/" . $this->_aCfg["keyfile"];
+        $this->_sKeyfile = $this->_aCfg["appRootDir"] . "/" . $this->_aCfg["auth"];
         $this->_sWrapper = $this->_aCfg["appRootDir"] . "/shellscripts/gitsshwrapper.sh";
         
         return $this->_aCfg=$aRepoConfig;
@@ -198,7 +198,7 @@ class vcs implements iVcs {
      * return url to vcs sources
      */
     public function getUrl() {
-        return $this->_aCfg["ssh"];
+        return $this->_aCfg["url"];
     }
 
     /**
-- 
GitLab