diff options
author | Jannik Schönartz | 2017-03-22 17:12:52 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-03-22 17:12:52 +0100 |
commit | eade9d466c9e3be2be4753ee4367356b356d2dc4 (patch) | |
tree | eb6c6205b2e916a2b4e17290a536b0fb1cba76bf /modules-available/locationinfo | |
parent | Merge branch 'location-info-panel' of git.openslx.org:openslx-ng/slx-admin in... (diff) | |
download | slx-admin-eade9d466c9e3be2be4753ee4367356b356d2dc4.tar.gz slx-admin-eade9d466c9e3be2be4753ee4367356b356d2dc4.tar.xz slx-admin-eade9d466c9e3be2be4753ee4367356b356d2dc4.zip |
Backend credentials translation added. Bugfix: Checkboxes instead of bs switches were shown in the server settings
Diffstat (limited to 'modules-available/locationinfo')
5 files changed, 46 insertions, 10 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index 725b4436..b8aa44a0 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -4,7 +4,7 @@ class Coursebackend_Dummy extends CourseBackend { public function setCredentials($json,$location,$serverID) { $x = $json; - $this->pw = $x['password_str']; + $this->pw = $x['password']; if ($this->pw == "mfg") { $this->error = false; @@ -29,8 +29,7 @@ class Coursebackend_Dummy extends CourseBackend { public function getCredentials(){ $options = ["opt1", "opt2", "opt3", "opt4", "opt5", "opt6", "opt7", "opt8"]; - $credentials = ["username" => ["string", "This is a helptext.", false],"password_str"=>["string", "SOME SECRET PW U WILL NEVER KNOW!", true],"password int"=>["int", "INT PW", true],"option"=>[$options, "OMG WHAT THE", false], "CheckTheBox" => ["bool", "Test with a cb", false], - "CB2 t" => ["bool", "Second checkbox test", false]]; + $credentials = ["username" => "string","password"=>"password","integer"=>"int","option"=>$options,"CheckTheBox" =>"bool","CB2 t" =>"bool"]; return $credentials; } diff --git a/modules-available/locationinfo/lang/de/dummy.json b/modules-available/locationinfo/lang/de/dummy.json new file mode 100644 index 00000000..f68fb869 --- /dev/null +++ b/modules-available/locationinfo/lang/de/dummy.json @@ -0,0 +1,14 @@ +{ + "username": "Benutzer", + "username_title": "Das ist halt ein Username feld..", + "password": "Passwort 1", + "password_title": "Bla passwort bla bla", + "integer": "Zahl", + "integer_title": "Ein Zahlen felde?!", + "option": "Irgendein Array", + "option_title": "LALALA Hilfs- Text bla bla", + "CheckTheBox": "CheckBox", + "CheckTheBox_title": "Die checkbox ist ein wenig nutzlos", + "CB2 t": "Eine andere cb", + "CB2 t_title": ":P Diese checkbox ist super secret." +} diff --git a/modules-available/locationinfo/lang/en/dummy.json b/modules-available/locationinfo/lang/en/dummy.json new file mode 100644 index 00000000..800fd80b --- /dev/null +++ b/modules-available/locationinfo/lang/en/dummy.json @@ -0,0 +1,14 @@ +{ + "username": "Username", + "username_title": "A fkn username field", + "password": "Password 1", + "password_title": "Password 1 title alalala :D", + "integer": "A integer value", + "integer_title": "What is this for?!", + "option": "Option Array", + "option_title": "LALALA OPtion title bla bla", + "CheckTheBox": "CheckBox", + "CheckTheBox_title": "Check this if you are bored", + "CB2 t": "Another cb", + "CB2 t_title": "meeh fk it. This cb does nothing. :P" +} diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 6490e722..df11f8a9 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -517,14 +517,16 @@ class Page_LocationInfo extends Page $counter = 0; foreach ($credentials as $key => $value) { $credential['uid'] = $counter; - $credential['name'] = $key; - $credential['type'] = $value[0]; - $credential['title'] = $value[1]; + $credential['name'] = Dictionary::translateFile($s, $key);; + $credential['type'] = $value; + $credential['title'] = Dictionary::translateFile($s, $key."_title"); if (Property::getPasswordFieldType() === 'text') { $credential['mask'] = false; } else { - $credential['mask'] = $value[2]; + if ($value == "password") { + $credential['mask'] = true; + } } if ($backend['typ'] == $dbresult['servertype']) { diff --git a/modules-available/locationinfo/templates/server-settings.html b/modules-available/locationinfo/templates/server-settings.html index 641873ef..a2bbdf8f 100644 --- a/modules-available/locationinfo/templates/server-settings.html +++ b/modules-available/locationinfo/templates/server-settings.html @@ -107,14 +107,21 @@ $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label>{{name}}</label></div>\ <div class="col-md-7">\ - <input required class="form-control" id="input-{{uid}}" {{#mask}}type="password"{{/mask}}{{^mask}}type="text"{{/mask}} name="{{uid}}" value="{{value}}" form="settingsForm"></div>\ + <input required class="form-control" id="input-{{uid}}" type="text" name="{{uid}}" value="{{value}}" form="settingsForm"></div>\ <div class="col-md-2"><a class="btn btn-default" id="help-{{uid}}" title="{{title}}"><span class="glyphicon glyphicon-question-sign"></span></a></div>\ </div></div>'); } else if ("{{type}}" == "int") { $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label>{{name}}</label></div>\ <div class="col-md-7">\ - <input required class="form-control" id="input-{{uid}}" {{#mask}}type="password" pattern="[0-9]*"{{/mask}}{{^mask}}type="number"{{/mask}} name="{{uid}}" value="{{value}}" form="settingsForm"></div>\ + <input required class="form-control" id="input-{{uid}}" type="number" name="{{uid}}" value="{{value}}" form="settingsForm"></div>\ + <div class="col-md-2"><a class="btn btn-default" id="help-{{uid}}" title="{{title}}"><span class="glyphicon glyphicon-question-sign"></span></a></div>\ + </div></div>'); + } else if ("{{type}}" == "password") { + $("#credentials-list").append('<div class="list-group-item"><div class="row">\ + <div class="col-md-3"><label>{{name}}</label></div>\ + <div class="col-md-7">\ + <input required class="form-control" id="input-{{uid}}" {{#mask}}type="password"{{/mask}}{{^mask}}type="text"{{/mask}} name="{{uid}}" value="{{value}}" form="settingsForm"></div>\ <div class="col-md-2"><a class="btn btn-default" id="help-{{uid}}" title="{{title}}"><span class="glyphicon glyphicon-question-sign"></span></a></div>\ </div></div>'); } else if ("{{type}}" == "bool") { @@ -124,7 +131,7 @@ <input class="bs-switch" id="input-{{uid}}" type="checkbox" name="{{uid}}" value="true" form="settingsForm" {{#value}}checked{{/value}}></div>\ <div class="col-md-2"><a class="btn btn-default" id="help-{{uid}}" title="{{title}}"><span class="glyphicon glyphicon-question-sign"></span></a></div>\ </div></div>'); - $('#bs-{{uid}}').bootstrapSwitch({ + $('#input-{{uid}}').bootstrapSwitch({ size: "small" }); } else if ("{{type}}" == "array") { |