diff options
author | Jannik Schönartz | 2017-03-19 05:31:25 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-03-19 05:31:25 +0100 |
commit | a8ae9f36c627e0db82b24a3833fccefa04c215cd (patch) | |
tree | 6c3f46b590a8a93f046ff70742a75b342816077c /modules-available | |
parent | SetCredentials error message is no longer ignored. (diff) | |
download | slx-admin-a8ae9f36c627e0db82b24a3833fccefa04c215cd.tar.gz slx-admin-a8ae9f36c627e0db82b24a3833fccefa04c215cd.tar.xz slx-admin-a8ae9f36c627e0db82b24a3833fccefa04c215cd.zip |
Locationinfo: admin-panel: Fixed a Bug where a space in a credentialname caused errors. Changes the checkbox to bs-switch.
Diffstat (limited to 'modules-available')
3 files changed, 15 insertions, 6 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index e6ba0fe8..725b4436 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -29,7 +29,8 @@ 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]]; + $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]]; return $credentials; } diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index dec022b2..ec024f48 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -119,8 +119,10 @@ class Page_LocationInfo extends Page $tmptypeArray = $backend->getCredentials(); $credentialsJson = array(); + $counter = 0; foreach ($tmptypeArray as $key => $value) { - $credentialsJson[$key] = Request::post($key); + $credentialsJson[$key] = Request::post($counter); + $counter++; } if ($serverid == 0) { Database::exec('INSERT INTO `setting_location_info` (servername, serverurl, servertype, credentials) VALUES (:name, :url, :type, :credentials)', @@ -460,7 +462,10 @@ class Page_LocationInfo extends Page $credentials = $backendInstance->getCredentials(); $backend['credentials'] = array(); + + $counter = 0; foreach ($credentials as $key => $value) { + $credential['uid'] = $counter; $credential['name'] = $key; $credential['type'] = $value[0]; $credential['title'] = $value[1]; @@ -496,6 +501,8 @@ class Page_LocationInfo extends Page } $backend['credentials'][] = $credential; + + $counter++; } $serverBackends[] = $backend; } diff --git a/modules-available/locationinfo/templates/server-settings.html b/modules-available/locationinfo/templates/server-settings.html index f7aa2af8..b42f4c15 100644 --- a/modules-available/locationinfo/templates/server-settings.html +++ b/modules-available/locationinfo/templates/server-settings.html @@ -83,25 +83,26 @@ $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label title="{{title}}">{{name}}</label></div>\ <div class="col-md-8">\ - <input required class="form-control" {{#mask}}type="password"{{/mask}}{{^mask}}type="text"{{/mask}} name="{{name}}" value="{{value}}" form="settingsForm">\ + <input required class="form-control" {{#mask}}type="password"{{/mask}}{{^mask}}type="text"{{/mask}} name="{{uid}}" value="{{value}}" form="settingsForm">\ </div></div></div>'); } else if ("{{type}}" == "int") { $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label title="{{title}}">{{name}}</label></div>\ <div class="col-md-8">\ - <input required class="form-control" {{#mask}}type="password" pattern="[0-9]*"{{/mask}}{{^mask}}type="number"{{/mask}} name="{{name}}" value="{{value}}" form="settingsForm">\ + <input required class="form-control" {{#mask}}type="password" pattern="[0-9]*"{{/mask}}{{^mask}}type="number"{{/mask}} name="{{uid}}" value="{{value}}" form="settingsForm">\ </div></div></div>'); } else if ("{{type}}" == "bool") { $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label title="{{title}}">{{name}}</label></div>\ <div class="col-md-8">\ - <input class="form-control" type="checkbox" name="{{name}}" value="true" form="settingsForm" {{#value}}checked{{/value}}>\ + <input class="bs-switch" id="bs-{{uid}}" type="checkbox" name="{{uid}}" value="true" form="settingsForm" {{#value}}checked{{/value}}>\ </div></div></div>'); + $('#bs-{{uid}}').bootstrapSwitch(); } else if ("{{type}}" == "array") { $("#credentials-list").append('<div class="list-group-item"><div class="row">\ <div class="col-md-3"><label title="{{title}}">{{name}}</label></div>\ <div class="col-md-8">\ - <select class="form-control" name="{{name}}" form="settingsForm">\ + <select class="form-control" name="{{uid}}" form="settingsForm">\ {{#array}}\ <option value="{{option}}" {{#active}}selected{{/active}}>{{option}}</option>\ {{/array}}\ |