Skip to content

Commit

Permalink
Merge pull request #114 from go-faustino/double-slash-url
Browse files Browse the repository at this point in the history
Remove double slash URLs
  • Loading branch information
go-faustino authored Dec 13, 2017
2 parents 55469c2 + b6fd6ac commit 70f1ca7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This is a fork of Sentrifugo v3.2 with the following changes:
- Billing report in Analytics
- Erase week button made available for rejected and enabled days
- Allow special characters and ensure correct encoding on all pages and emails
- Remove double slashes from time management URLs to avoid problems with servers that rewrite them out

Docker
======
Expand Down
2 changes: 1 addition & 1 deletion application/modules/timemanagement/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function _initRoute()
'controller' => 'index',
'action' => 'week',
'calWeek' => '',
'flag' => '',
'flag' => 'none',
'day' => '',
));
$router->addRoute('weekview', $route);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public function weekAction()
$data = $storage->read();

$selYrMon = $this->_getParam('selYrMon');
$week = ($this->_getParam('week') != '')?$this->_getParam('week'):1;
$week = ($this->_getParam('week') != '')?$this->_getParam('week'):1;
$calWeek = $this->_getParam('calWeek');
$timeFlag = $this->_getParam('flag');
$selDay = $this->_getParam('day');
Expand All @@ -606,7 +606,7 @@ public function weekAction()
$selYrMon = ($selYrMon != '')?$selYrMon:$now->format('Y-m');
$yrMon = explode('-', $selYrMon);

if($timeFlag == 'time' && $selYrMon == $now->format('Y-m') && $calWeek == '') {
if($timeFlag == 'time' && $selYrMon == $now->format('Y-m') && ($calWeek == '' || $calWeek == '0')) {

$calWeek = strftime('%U',strtotime($selYrMon.'-'.$now->format('d')));
$startCalWeek = strftime('%U',strtotime($selYrMon.'-01'));
Expand All @@ -628,8 +628,8 @@ public function weekAction()
$startCalWeek = strftime('%U',strtotime($selYrMon.'-01'));
$week = ($calWeek- $startCalWeek) +1;
} else {
if($calWeek == '')
$calWeek = strftime('%U',strtotime($selYrMon.'-01'));
if($calWeek == '' || $calWeek == '0')
$calWeek = strftime('%U',strtotime($selYrMon.'-01'));
}
// }
$myTsModel = new Timemanagement_Model_MyTimesheet();
Expand Down Expand Up @@ -1117,7 +1117,7 @@ public function weekAction()
$this->view->messages = $this->_helper->flashMessenger->getMessages();
/*oncall request code ends*/

if($timeFlag != '') {
if($timeFlag != '' && $timeFlag != 'none') {
$this->_helper->viewRenderer('entertime');
}

Expand Down
16 changes: 11 additions & 5 deletions public/media/timemanagement/js/timemanagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function viewTimeEntry(year_month) {
//console.log(" year_month "+year_month);
// var url = base_url + module_name + "/index/week?flag=time&selYrMon="+year_month;
// window.location.href = url;
window.location.href = base_url+"/timeentry/"+year_month+"///time";
window.location.href = base_url+"/timeentry/"+year_month+"/1/0/time";
}
function viewEnterTime(week,calWeek) {
var selYrMon = $("#calSelYrMonth").val();
Expand All @@ -52,14 +52,20 @@ function monthlyView(){
function getWeekData(flag,weekNo,calWeek,day) {
if(day == undefined )
day = '';

if(flag == undefined )
flag = 'none';

if(flag == '' )
flag = 'none';

var selYrMon = $("#calSelYrMonth").val();
var url = base_url + module_name + "/index/week";
//window.location.href = url+'?selYrMon='+selYrMon+'&week='+weekNo+'&calWeek='+calWeek+'&flag='+flag+'&day='+day;
if(flag != 'time')
window.location.href = base_url+'/weekview/'+selYrMon+'/'+weekNo+'/'+calWeek+'/'+flag+'/'+day;
if(flag != 'time')
window.location.href = base_url+'/weekview/'+selYrMon+'/'+weekNo+'/'+calWeek+'/'+flag+'/'+day;
else
window.location.href = base_url+'/timeentry/'+selYrMon+'/'+weekNo+'/'+calWeek+'/'+flag+'/'+day;
window.location.href = base_url+'/timeentry/'+selYrMon+'/'+weekNo+'/'+calWeek+'/'+flag+'/'+day;
}
function editWeekData(flag,day) {

Expand Down Expand Up @@ -198,7 +204,7 @@ function submitWeekTimesheet(week, calWeek, submitText) {
$("#error_message").html('<div id="messageData" class="ml-alert-1-' + flag + '"><div style="display:block;"><span class="style-1-icon ' + flag + '"></span>' + response.message + '</div></div>');
setTimeout(function() {
$('#error_message').fadeIn('slow').fadeOut(function() {
location.href = base_url +"/weekview/"+selYrMon+"/"+week+"/"+calWeek+"//";
location.href = base_url +"/weekview/"+selYrMon+"/"+week+"/"+calWeek+"/none/";
});
}, 3000);
//location.href = base_url + module_name + "/index/week?week="+week+"&calWeek="+calWeek+"&selYrMon="+selYrMon;
Expand Down

0 comments on commit 70f1ca7

Please sign in to comment.