1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-08 00:16:24 +00:00

Country value is now sent and stored to database

add jquery call
fix database table name
This commit is contained in:
Loic Blot 2015-01-09 17:05:49 +00:00
parent 5624cd684b
commit 76decabe11
3 changed files with 9 additions and 6 deletions

View File

@ -37,10 +37,10 @@ class ConfigMapper extends Mapper {
public function set($backend, $key, $value){ public function set($backend, $key, $value){
$value = $this->crypto->encrypt($value); $value = $this->crypto->encrypt($value);
if($this->hasKey($key, $value)){ if($this->hasKey($key, $value)){
$sql = "UPDATE `*PREFIX*chat_config` SET `value` = ? WHERE `user` = ? AND `keyi` = ?"; $sql = "UPDATE `*PREFIX*ocsms_config` SET `value` = ? WHERE `user` = ? AND `keyi` = ?";
$this->execute($sql, array($value, $this->user, $backend, $key)); $this->execute($sql, array($value, $this->user, $backend, $key));
} else { } else {
$sql = "INSERT INTO `*PREFIX*chat_config` (`user`,`key`,`value`) VALUES (?,?,?);"; $sql = "INSERT INTO `*PREFIX*ocsms_config` (`user`,`key`,`value`) VALUES (?,?,?);";
$this->execute($sql, array($this->user, $key, $value)); $this->execute($sql, array($this->user, $key, $value));
} }
} }

View File

@ -24,9 +24,11 @@ var app = angular.module('OcSms', ['OC']);
app.controller('SettingsController', ['$scope', app.controller('SettingsController', ['$scope',
function ($scope) { function ($scope) {
$scope.buttons = [{}]; $scope.buttons = [
{text: "Send"}
];
$scope.sendCountry = function () { $scope.sendCountry = function () {
alert('sendCountry'); $.post(OC.generateUrl('/apps/ocsms/set/country'),{'country': $('select[name=intl_phone]').val()});
}; };
} }
]); ]);
@ -36,6 +38,7 @@ app.controller('ContactsController' ['$scope', function ($scope) {
]); ]);
$.urlParam = function(name){ $.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) { if (results == null) {

View File

@ -8,7 +8,7 @@ use \OCA\OcSms\Lib\CountryCodes;
?> ?>
<div class="ng-scope" id="app" ng-app="OcSms"> <div class="ng-scope" id="app" ng-app="OcSms">
<div id="app-mailbox-peers" ng-controller="ContactsController"> <div id="app-mailbox-peers">
<ul> <ul>
<li><div id="ocsms-empty-peers">There isn't any conversation</div></li> <li><div id="ocsms-empty-peers">There isn't any conversation</div></li>
</ul> </ul>
@ -23,7 +23,7 @@ use \OCA\OcSms\Lib\CountryCodes;
<option><?php p($code); ?></option> <option><?php p($code); ?></option>
<?php } ?> <?php } ?>
</select> </select>
<button class="new-button primary icon-checkmark-white" ng-repeat="button in buttons" ng-click="sendCountryCode();"></button> <button class="new-button primary icon-checkmark-white" ng-repeat="button in buttons" ng-click="sendCountry();"></button>
</div> <!-- app-settings-content --> </div> <!-- app-settings-content -->
</div> </div>