Make remote server variable
This commit is contained in:
@@ -88,7 +88,8 @@ class CATC extends Main
|
||||
'context' => $this->asContext,
|
||||
'cookie' => Auth::USER_COOKIE_PASS,
|
||||
'workshops' => (new Course($this->oDb))->getWorkshops(),
|
||||
'courses' => (new Course($this->oDb))->getCourses()
|
||||
'courses' => (new Course($this->oDb))->getCourses(),
|
||||
'server' => Settings::SERVER_URL
|
||||
),
|
||||
'vars' => $this->getVars()
|
||||
),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<a tabindex="0" class="body btn btn-outline-primary ml-2 my-0" role="button" data-toggle="popover"><i class="fa-body"></i></a>
|
||||
<button class="sync btn btn-outline-primary ml-2 my-0" type="button" data-toggle="tooltip" title="Sync local server with lutran.ch"><i class="fa-sync"></i></button>
|
||||
<button class="sync btn btn-outline-primary ml-2 my-0" type="button" data-toggle="tooltip"><i class="fa-sync"></i></button>
|
||||
<button class="home btn btn-outline-primary ml-2 my-0" type="button"><i class="fa-home"></i></button>
|
||||
<button class="logoff btn btn-outline-primary ml-2 my-0" type="button" data-toggle="modal" data-target="#log-off"><i class="fa-logoff"></i></button>
|
||||
</form>
|
||||
|
||||
@@ -193,15 +193,22 @@ function CATC(asGlobals)
|
||||
});
|
||||
|
||||
//Sync
|
||||
self.elem.$Menu.find('.sync').click(function(){
|
||||
Tools.ajax(
|
||||
'server_push',
|
||||
()=>{self.feedback('success', 'Successful Sync');},
|
||||
{},
|
||||
(sDesc)=>{self.feedback('error', sDesc);},
|
||||
$(this).find('i')
|
||||
);
|
||||
});
|
||||
var $Sync = self.elem.$Menu.find('.sync');
|
||||
if(self.consts.server!='') {
|
||||
$Sync
|
||||
.attr('title', 'Sync local server with '+getHostname(self.consts.server))
|
||||
.tooltip()
|
||||
.click(function(){
|
||||
Tools.ajax(
|
||||
'server_push',
|
||||
()=>{self.feedback('success', 'Successful Sync');},
|
||||
{},
|
||||
(sDesc)=>{self.feedback('error', sDesc);},
|
||||
$(this).find('i')
|
||||
);
|
||||
});
|
||||
}
|
||||
else $Sync.hide();
|
||||
|
||||
//Home
|
||||
self.elem.$Menu.find('.home').click(function(){self.setHash(self.consts.default_page);});
|
||||
|
||||
@@ -285,6 +285,22 @@ function getLoginToken(sPass)
|
||||
return md5(sPass+window.location.origin+window.location.pathname);
|
||||
}
|
||||
|
||||
function getHostname(url) {
|
||||
var hostname;
|
||||
|
||||
//find & remove protocol (http, ftp, etc.) and get hostname
|
||||
if(url.indexOf("//") > -1) hostname = url.split('/')[2];
|
||||
else hostname = url.split('/')[0];
|
||||
|
||||
//find & remove port number
|
||||
hostname = hostname.split(':')[0];
|
||||
|
||||
//find & remove "?"
|
||||
hostname = hostname.split('?')[0];
|
||||
|
||||
return hostname;
|
||||
}
|
||||
|
||||
var defaultDiacriticsRemovalap = [
|
||||
{'base':'A', 'letters':'\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'},
|
||||
{'base':'AA','letters':'\uA732'},
|
||||
|
||||
Reference in New Issue
Block a user