mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support time tracker with self host install
This commit is contained in:
parent
266cb851f6
commit
2d5cc10469
@ -89,6 +89,11 @@ class Utils
|
|||||||
return env('NINJA_DEV') == 'true';
|
return env('NINJA_DEV') == 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isTimeTracker()
|
||||||
|
{
|
||||||
|
return array_get($_SERVER, 'HTTP_USER_AGENT') == TIME_TRACKER_USER_AGENT;
|
||||||
|
}
|
||||||
|
|
||||||
public static function requireHTTPS()
|
public static function requireHTTPS()
|
||||||
{
|
{
|
||||||
if (Request::root() === 'http://ninja.dev' || Request::root() === 'http://ninja.dev:8000') {
|
if (Request::root() === 'http://ninja.dev' || Request::root() === 'http://ninja.dev:8000') {
|
||||||
|
@ -2519,6 +2519,9 @@ $LANG = array(
|
|||||||
'add_product' => 'Add Product',
|
'add_product' => 'Add Product',
|
||||||
'email_will_be_sent_on' => 'Note: the email will be sent on :date.',
|
'email_will_be_sent_on' => 'Note: the email will be sent on :date.',
|
||||||
'invoice_product' => 'Invoice Product',
|
'invoice_product' => 'Invoice Product',
|
||||||
|
'self_host_login' => 'Self-Host Login',
|
||||||
|
'set_self_hoat_url' => 'Self-Host URL',
|
||||||
|
'local_storage_required' => 'Error: local storage is not available.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -83,7 +83,11 @@
|
|||||||
{!! link_to('/recover_password', trans('texts.recover_password')) !!}
|
{!! link_to('/recover_password', trans('texts.recover_password')) !!}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5 col-sm-12">
|
<div class="col-md-5 col-sm-12">
|
||||||
{!! link_to(NINJA_WEB_URL.'/knowledgebase/', trans('texts.knowledge_base'), ['target' => '_blank']) !!}
|
@if (Utils::isTimeTracker())
|
||||||
|
{!! link_to('#', trans('texts.self_host_login'), ['onclick' => 'setSelfHostUrl()']) !!}
|
||||||
|
@else
|
||||||
|
{!! link_to(NINJA_WEB_URL.'/knowledgebase/', trans('texts.knowledge_base'), ['target' => '_blank']) !!}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@ -111,8 +115,13 @@
|
|||||||
$('#email').focus();
|
$('#email').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (array_get($_SERVER, 'HTTP_USER_AGENT') == TIME_TRACKER_USER_AGENT)
|
@if (Utils::isTimeTracker())
|
||||||
if (isStorageSupported()) {
|
if (isStorageSupported()) {
|
||||||
|
var selfHostUrl = localStorage.getItem('last:time_tracker:url');
|
||||||
|
if (selfHostUrl) {
|
||||||
|
location.href = selfHostUrl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
$('#email').change(function() {
|
$('#email').change(function() {
|
||||||
localStorage.setItem('last:time_tracker:email', $('#email').val());
|
localStorage.setItem('last:time_tracker:email', $('#email').val());
|
||||||
})
|
})
|
||||||
@ -124,6 +133,29 @@
|
|||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@if (Utils::isTimeTracker())
|
||||||
|
function setSelfHostUrl() {
|
||||||
|
if (! isStorageSupported()) {
|
||||||
|
swal("{{ trans('texts.local_storage_required') }}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
swal({
|
||||||
|
title: "{{ trans('texts.set_self_hoat_url') }}",
|
||||||
|
input: 'text',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Save',
|
||||||
|
}).then(function (value) {
|
||||||
|
if (!value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value = value.replace(/\/+$/, '') + '/time_tracker';
|
||||||
|
localStorage.setItem('last:time_tracker:url', value);
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@endif
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user