1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +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){
$value = $this->crypto->encrypt($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));
} 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));
}
}

View File

@ -24,9 +24,11 @@ var app = angular.module('OcSms', ['OC']);
app.controller('SettingsController', ['$scope',
function ($scope) {
$scope.buttons = [{}];
$scope.buttons = [
{text: "Send"}
];
$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){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {

View File

@ -8,7 +8,7 @@ use \OCA\OcSms\Lib\CountryCodes;
?>
<div class="ng-scope" id="app" ng-app="OcSms">
<div id="app-mailbox-peers" ng-controller="ContactsController">
<div id="app-mailbox-peers">
<ul>
<li><div id="ocsms-empty-peers">There isn't any conversation</div></li>
</ul>
@ -23,7 +23,7 @@ use \OCA\OcSms\Lib\CountryCodes;
<option><?php p($code); ?></option>
<?php } ?>
</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>