mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Load the country settings at app load
This commit is contained in:
parent
3774653643
commit
77a9e9cccf
@ -25,4 +25,5 @@ $application->registerRoutes($this, array('routes' => array(
|
||||
array('name' => 'sms#check_new_messages', 'url' => '/get/new_messages', 'verb' => 'GET'),
|
||||
array('name' => 'sms#get_api_version', 'url' => '/get/apiversion', 'verb' => 'GET'),
|
||||
array('name' => 'sms#set_country', 'url'=> '/set/country', 'verb' => 'POST'),
|
||||
array('name' => 'sms#get_country', 'url'=> '/get/country', 'verb' => 'GET'),
|
||||
)));
|
||||
|
@ -314,4 +314,15 @@ class SmsController extends Controller {
|
||||
$this->configMapper->set("country", $country);
|
||||
return new JSONResponse(array("status" => true, "msg" => "OK"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
function getCountry() {
|
||||
$country = $this->configMapper->getKey("country");
|
||||
if ($country === false) {
|
||||
return new JSONResponse(array("status" => false));
|
||||
}
|
||||
return new JSONResponse(array("status" => true, "country" => $country));
|
||||
}
|
||||
}
|
||||
|
@ -368,6 +368,15 @@ function desktopNotify(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
function fetchInitialSettings() {
|
||||
$.getJSON(OC.generateUrl('/apps/ocsms/get/country'), function(jsondata, status) {
|
||||
if (jsondata['status'] == true) {
|
||||
$('#sel_intl_phone').val(jsondata["country"]);
|
||||
}
|
||||
else {
|
||||
}
|
||||
});
|
||||
}
|
||||
(function ($, OC) {
|
||||
$(document).ready(function () {
|
||||
// Register real title
|
||||
@ -393,6 +402,7 @@ function desktopNotify(msg) {
|
||||
}
|
||||
|
||||
});
|
||||
fetchInitialSettings();
|
||||
initDesktopNotifies();
|
||||
setInterval(refreshConversation, 10000);
|
||||
setInterval(checkNewMessages, 10000);
|
||||
|
@ -20,7 +20,7 @@ use \OCA\OcSms\Lib\CountryCodes;
|
||||
<button name="app settings" class="settings-button" data-apps-slide-toggle="#app-settings-content"></button>
|
||||
</div>
|
||||
<div id="app-settings-content">
|
||||
<select name="intl_phone">
|
||||
<select name="intl_phone" id="sel_intl_phone">
|
||||
<?php foreach (CountryCodes::$codes as $code => $cval) { ?>
|
||||
<option><?php p($code); ?></option>
|
||||
<?php } ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user