0

この下のページの戻るボタンをクリックすると、言及されたページに移動できないようです。確認フォームの再送信を示します。ブラウザの戻るボタンをクリックすると、必要なページに移動できるようになりました。

フォームの戻るボタンだけで戻りたい..

viewrequest.phtml :

<script>
$(document).ready(function() {
    $('.review').button({
                icons: {
                primary: "ui-icon-gear"
            }
    });
    $('#back_btn').button();
    $('#back_btn').click(function() {
        window.history.back()
        return false;
    });
    $('#approve_btn').click(function() {
        $('#adialog').dialog('open');
        return false;
    });
    $('#reject_btn').click(function() {
        $('#rdialog').dialog('open');
        return false;
    });
    $('#comment_btn').click(function() {
        $('#cdialog').dialog('open');
        return false;
    });
    $('#edit_btn').click(function() {
        location.href = '<?php print $this->baseUrl() ?>/request/index/editrequest/id/<?php print $this->request['request_id'] ?>';
        return false;
    });
    $('#cor_btn').click(function() {
        $('#action').val('token_generate');
        //return false;
    });
    $("#adialog").dialog({
            autoOpen: false,
            width: 400,
            modal: true,
            position: 'top',
            buttons: {
                'Yes': function() {
                    var comment = $('#comment_area').val();;
                    $('#comment').val(comment);
                    $('#action').val('approve');
                    $('#view_form').submit();
                 },
                'No': function() {
                        $(this).dialog('close');
                 }
            },
            close: function() {
                    $('#action').value = '';
            }
    });
    $("#rdialog").dialog({
            autoOpen: false,
            width: 350,
            modal: true,
            buttons: {
                'Ok': function() {
                    var comment = $('#comment_area_required').val();;
                    $('#comment').val(comment);
                    $('#action').val('reject');
                    if($('#comment_area_required').val().length>0) {
                        $('#view_form').submit();
                    }
                    else {
                        $(".validateTips").html('<span class="error">Comment cannot be empty</span>');
                    }
                 },
                'Cancel': function() {
                        $(this).dialog('close');
                 }

            },
            close: function() {
                    $('#action').value = '';
                    $(".validateTips").html('');
            }
    });
      $("#cdialog").dialog({
            autoOpen: false,
            width: 400,
            modal: true,
            position: 'top',
            buttons: {
                'Yes': function() {
                    var comment = $('#comment_area_new').val();;
                    $('#comment').val(comment);
                    $('#action').val('addcomment');
                    $('#view_form').submit();
                 },
                'No': function() {
                        $(this).dialog('close');
                 }
            },
            close: function() {
                    $('#action').value = '';
            }
    });

    $('#add_comment').click(function() {
        $('#comment-box').toggle();    
    });
    $('#imageview').hide();
    $('#imagediv').addClass('off');
    $('#image_link').click(function() {
            if ($('#imagediv').hasClass('off')) {
                $('#imagediv').removeClass('off').addClass('on');
                $('#imageview').show();
            } else {
                $('#imagediv').removeClass('on').addClass('off');
                $('#imageview').hide();
            }
            return false;
    });

});

function toggleDiv(divid,imgid)
{
      var image = $('#'+imgid).attr('src');
      var dis =  $('#'+divid).css('display');
      $('#'+divid).toggle(); 
      if(dis=='none')
      $('#'+imgid).attr('src','<?php print $this->baseUrl(); ?>/public/images/minus.gif');
      else  
      $('#'+imgid).attr('src','<?php print $this->baseUrl(); ?>/public/images/plus.gif');
}
</script>
<div class="blockheading">Request Details</div>
<div class="blockbody">
<form name='view_form' id='view_form' method='post'>
<?php if(!empty($this->request)): ?>
<table class="reqTable reqStatus" cellpadding="0" cellspacing="0" border="1" bordercolor="#cdcdcd">
    <tr>
        <td><label>ID</label><?php print $this->request['id']; ?></td>
        <td><label>Employee</label><?php print $this->request['request_users']; ?></td>
        <td><label>Request Type</label><?php print $this->request['type_name']; ?></td>
        <?php if($this->request['type']=='2'): ?>
            <td><label>Project Name</label><?php print $this->request['project_name']; ?></td>
        <?php endif; ?>
        <td><label>Reference Number</label><?php print $this->request['reference_no']; ?></td>
        <?php
            $rdate = ((strtotime($this->request['start_date']))==(strtotime($this->request['end_date'])))?
                        $this->FormatDate($this->request['start_date']):
                        $this->FormatDate($this->request['start_date']).' - '.$this->FormatDate($this->request['end_date']);
        ?>
        <td><label>Date</label><?php print $rdate; ?></td>
        <td><label>Hours</label><?php print $this->request['hours']; ?></td>
        <td><label>Status</label><?php print $this->request['request_status_name']; ?></td>        
    </tr>
</table>
<table class="reqTable reqBy" cellpadding="0" cellspacing="0" border="1" bordercolor="#cdcdcd">
    <tr>
        <td><label>Submitted By</label><?php print $this->request['creator']; ?></td>
        <td><label>Submitted On</label><?php print $this->FormatDateTime($this->request['created_on']); ?></td>
        <td rowspan="6" style="padding:0; width:60%; vertical-align:top">
        <table class="reqTable" style="width:100%; vertical-align:top; margin:0;border-collapse: collapse;" align="left" cellpadding="0" cellspacing="0">
            <tr>
                <td class="descrptn"><label>Description</label>
                    <?php print nl2br($this->request['description']); ?>
                </td>
            </tr>
        </table>
        </td>
    </tr>
    <tr>
        <td><label>Modified By</label><?php print $this->request['modifier']; ?></td>
        <td><label>Modified On</label><?php print $this->FormatDateTime($this->request['updated_on']); ?></td>
    </tr>
    <tr>
        <td><label>Reviewed By</label><?php print $this->request['approver_name']; ?></td>
        <td><label>Reviewed On</label><?php print $this->FormatDateTime($this->request['approved_on']); ?></td>
    </tr>
    <tr>
        <td colspan="2"><label>Attachment</label>
        <?php $image_url = $this->baseUrl().'/request/index/viewattachment/id/'.$this->request['attachment_id']; ?>
        <?php if($this->file_extn): ?>
            <a id='image_link' href='#'><img alt="Image" id='image'  src='<?php print $image_url ?> '  height="50" width="50" /></a>
            <a href='<?php print $image_url ?> '><?php print $this->request['name'] ?></a>
        <?php else: ?>
            <a target='_blank' href='<?php print $image_url ?> '><?php print $this->request['name'] ?></a>
        <?php endif; ?></td>
    </tr>
</table>
<?php if($this->file_extn): ?>
<span id="imageview" >
<div id="imagediv" style='text-align:center;padding:10px;'>
    <b><?php print $this->request['name'] ?></b><br>
    <img width='300' height='300' src='<?php print $this->baseUrl(); ?>/request/index/viewattachment/id/<?php print $this->request['attachment_id'] ?>' alt="">
</div>
</span>
<?php endif; ?>

<div style='text-align:left;padding-top:10px;width:100%'>
<?php if(($this->is_reviewer) && ($this->request['status']=='1') && ($this->show_action)): ?>
<button name='approve' class='review' id='approve_btn'>Approve</button>
<button name='reject' class='review' id='reject_btn'>Reject</button>
<?php endif; ?>
<?php if(($this->comment) && ($this->show_action)): ?>
<button name='addcomment' class='review' id='comment_btn'>Add Comment</button>
<?php endif; ?>
<?php if($this->is_edit): ?>
<button name='Edit' id='edit_btn' class='review'>Edit</button>
<?php endif; ?>
<?php if($this->show_cor): ?>
<button name='cor_token' id='cor_btn' class='review'>Generate COR Token</button>
<?php endif; ?>
<div style='float:right;'>
<button name='Back' id='back_btn' class='reviewi'>Back</button>
</div>
</div>
<input type='hidden' name='request_id[]' id='request_id' value='<?php print $this->request['id']; ?>'>
<?php else: ?>
<br>
<h2>&nbsp;No Details</h2>
<br>
<?php endif; ?>
</div>
<div id="adialog" title="Approve Request" style="display:none">
    <div>Do you want to approve request(s)?</div>
    <br/><a href='#' id='add_comment' style='color:#1798E9;'>Add comment</a>
    <span id='comment-box' style='display:none;'><br/>
        <textarea name='comment_area' id='comment_area' rows='4' cols='30'></textarea></span>
</div>
<div id="rdialog" title="Reject Request">
    <p class="validateTips"></p>
    <div>Do you want to reject Request(s)?</div>
     <br/><a href='#' id='add_comment' style='color:#1798E9;'>Add comment</a>
        <textarea name='comment_area' id='comment_area_required' rows='4' cols='30'></textarea>
</div>
<div id="cdialog" title="Add Comments" style="display:none">
        <textarea name='comment_area' id='comment_area_new' rows='4' cols='30'></textarea>
</div>
<input type='hidden' name='comment' id='comment'>
<input type='hidden' name='action' id='action'>
</form>
<div id='hours'>
<div class="blockheading">Related Time Entries</div>
<div class='blockbody'>
<?php if(!empty($this->timesheet)): ?>
<table width="100%" class="datatable">
<tr class="tblheading">
<td>Date</td>
<td>Employee</td>
<td>Task</td>
<td>Description</td>
<td align='right'>Hours</td>
<td>Last Modified</td>
<td>Status</td>
</tr>
<?php
$gtotal = (float)0.00;
?>
<?php foreach($this->timesheet as $row): ?>
<tr>
<td><?php print $this->FormatDate($row['timeslice_date']) ?></td>
<td><?php print $row['user_fullname']; ?></td>
<td><?php print $row['task_name']; ?></td>
<td><?php print nl2br($row['timeslice_log']); ?></td>
<td align='right'><?php print $row['timeslice_hours']; ?></td>
<td><?php print $this->FormatDateTime($row['timeslice_mdate']) ?></td>
<td><?php print $row['timesheet_status_name']; ?></td>
</tr>
<?php
$gtotal += $row['timeslice_hours']; 
?>
<?php endforeach ?>
<tr class='tblheading'>
<td colspan='5' align='right'>
<strong><?php print sprintf("%1.2f", $gtotal); ?></strong>
</td>
<td></td>
<td></td>
</tr>
</table>
<?php else: ?>
<p>No time entries related to this request</p>
<?php endif; ?>
</div>
</div>
<!--Change History-->
<?php if(isset($this->logs)): ?>
<div style='padding:10px;'><a href="javascript:toggleDiv('log','img_showhide');" ><img src="<?php print $this->baseUrl(); ?>/public/images/plus.gif" id="img_showhide" value="plus">&nbsp;&nbsp;Change History</a></div>
<div id='log' style='display:none;'>
<div class='blockbody'>
<?php if(!empty($this->logs)): ?>
<table width="100%" class="datatable">
<thead>
<tr class="tblheading">
<td>Date</td>
<td>Entity Field</td>
<td>Previous Value</td>
<td>Current Value</td>
</tr>
<thead>
<?php foreach($this->logs as $row): ?>
<tr>
<td><?php print $this->FormatDateTime($row['log_datetime']); ?></td>
<td><?php print $row['entity_field'] ?></td>
<td><?php print $row['previous_value'] ?></td>
<td><?php print $row['current_value'] ?></td>
<?php endforeach; ?>
</tr>
</table>
<?php else: ?>
<p>No changes for this request</p>
<?php endif; ?>
</div>
</div>
<?php endif; ?>

<div style='padding:10px;'><a href="javascript:toggleDiv('comments','img_showhide1');" ><img src="<?php print $this->baseUrl(); ?>/public/images/minus.gif" id="img_showhide1" value="plus">&nbsp;&nbsp;Comments</a></div>
<div id='comments' style='display:block;margin-left:10px;'>
<?php
foreach($this->history as $row) {
    echo $row['comment']."</br>";
    echo "<i>Posted by ".$row['request_approver']. " On ".$this->FormatDateTime($row['created_on']).'</i>';
    echo "</br>";
    echo "</br>";
}
?>
</div>

4

1 に答える 1