You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/06/02 11:36:50 UTC
airavata-php-gateway git commit: Fixing AIRAVATA-1440
Repository: airavata-php-gateway
Updated Branches:
refs/heads/master ae1ffd07a -> 45768f362
Fixing AIRAVATA-1440
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/45768f36
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/45768f36
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/45768f36
Branch: refs/heads/master
Commit: 45768f362f309b8ea8a119063a7090ec9d3cb23c
Parents: ae1ffd0
Author: Supun Nakandala <sc...@apache.org>
Authored: Tue Jun 2 15:05:52 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Tue Jun 2 15:05:52 2015 +0530
----------------------------------------------------------------------
app/libraries/Utilities.php | 4 +--
app/views/experiment/browse.blade.php | 4 +--
app/views/experiment/search.blade.php | 3 +-
app/views/partials/experiment-info.blade.php | 11 +++++--
app/views/project/browse.blade.php | 8 +++--
app/views/project/search.blade.php | 8 +++--
app/views/project/summary.blade.php | 6 +++-
public/js/time-conversion.js | 37 +++++++++++++++++++++++
8 files changed, 68 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/libraries/Utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/Utilities.php b/app/libraries/Utilities.php
index f18bf31..cdceb25 100644
--- a/app/libraries/Utilities.php
+++ b/app/libraries/Utilities.php
@@ -1639,8 +1639,8 @@ public static function get_experiment_values( $experiment, $project, $forSearch
$experimentState = $experimentStatus->experimentState;
$experimentStatusString = ExperimentState::$__names[$experimentState];
$expVal["experimentStatusString"] = $experimentStatusString;
- $expVal["experimentTimeOfStateChange"] = date('Y-m-d H:i:s', $experimentStatus->timeOfStateChange/1000); // divide by 1000 since timeOfStateChange is in ms
- $expVal["experimentCreationTime"] = date('Y-m-d H:i:s', $experiment->creationTime/1000); // divide by 1000 since creationTime is in ms
+ $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange/1000; // divide by 1000 since timeOfStateChange is in ms
+ $expVal["experimentCreationTime"] = $experiment->creationTime/1000; // divide by 1000 since creationTime is in ms
}
$jobStatus = Airavata::getJobStatuses($experiment->experimentID);
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/experiment/browse.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/browse.blade.php b/app/views/experiment/browse.blade.php
index 52a607f..8e27b85 100755
--- a/app/views/experiment/browse.blade.php
+++ b/app/views/experiment/browse.blade.php
@@ -82,7 +82,7 @@ if (isset( $expContainer))
echo '<td>' . $description . '</td>';
//echo "<td>$computeResource->hostName</td>";
- echo '<td>' . date('Y-m-d H:i:s', $experiment['experiment']->creationTime/1000) . '</td>';
+ echo '<td class="time" unix-time="' . $experiment['experiment']->creationTime/1000 . '"></td>';
switch ($experiment['expValue']['experimentStatusString'])
@@ -128,7 +128,7 @@ if (isset( $expContainer))
@section('scripts')
@parent
-
+ {{ HTML::script('js/time-conversion.js')}}
<script type="text/javascript">
$(document).ready( function(){
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/experiment/search.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/search.blade.php b/app/views/experiment/search.blade.php
index 90a194c..b103bbd 100755
--- a/app/views/experiment/search.blade.php
+++ b/app/views/experiment/search.blade.php
@@ -161,7 +161,7 @@ if (isset( $expContainer))
echo '<td>' . $description . '</td>';
//echo "<td>$computeResource->hostName</td>";
- echo '<td>' . date('Y-m-d H:i:s', $experiment['experiment']->creationTime/1000) . '</td>';
+ echo '<td class="time" unix-time="' . $experiment['experiment']->creationTime/1000 . '"></td>';
switch ($experiment['expValue']['experimentStatusString'])
@@ -211,6 +211,7 @@ if (isset( $expContainer))
@section('scripts')
@parent
+ {{ HTML::script('js/time-conversion.js')}}
{{ HTML::script('js/moment.js')}}
{{ HTML::script('js/datetimepicker.js')}}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 90c7ae7..458a28f 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -71,11 +71,11 @@
<tr>
<td><strong>Creation time</strong></td>
- <td><?php echo $expVal["experimentCreationTime"]; ?></td>
+ <td class="time" unix-time="<?php echo $expVal["experimentCreationTime"]; ?>"></td>
</tr>
<tr>
<td><strong>Update time</strong></td>
- <td><?php echo $expVal["experimentTimeOfStateChange"]; ?></td>
+ <td class="time" unix-time="<?php echo $expVal["experimentTimeOfStateChange"]; ?>"></td>
</tr>
<tr>
<td><strong>Inputs</strong></td>
@@ -133,4 +133,9 @@
<!-- check of correct experiment Id ends here -->
@endif
-</div>
\ No newline at end of file
+</div>
+
+@section('scripts')
+@parent
+ {{ HTML::script('js/time-conversion.js')}}
+@stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/project/browse.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/browse.blade.php b/app/views/project/browse.blade.php
index 90e3ada..674e654 100755
--- a/app/views/project/browse.blade.php
+++ b/app/views/project/browse.blade.php
@@ -74,8 +74,8 @@
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
- <td>
- <?php echo date('Y-m-d H:i:s', $project->creationTime/1000); ?>
+ <td class="time" unix-time="
+ <?php echo $project->creationTime/1000 ?>">
</td>
<td>
<a href="{{URL::to('/')}}/project/summary?projId=<?php echo $project->projectID; ?>">
@@ -99,4 +99,8 @@
</div>
+@stop
+@section('scripts')
+@parent
+ {{ HTML::script('js/time-conversion.js')}}
@stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/project/search.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/search.blade.php b/app/views/project/search.blade.php
index f265b91..d4c7835 100755
--- a/app/views/project/search.blade.php
+++ b/app/views/project/search.blade.php
@@ -104,8 +104,8 @@
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
- <td>
- <?php echo date('Y-m-d H:i:s', $project->creationTime/1000); ?>
+ <td class="time" unix-time="
+ <?php echo $project->creationTime/1000 ?>">
</td>
<td>
<a href="{{URL::to('/')}}/project/summary?projId=<?php echo $project->projectID; ?>">
@@ -129,4 +129,8 @@
</div>
+@stop
+@section('scripts')
+@parent
+ {{ HTML::script('js/time-conversion.js')}}
@stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/app/views/project/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/summary.blade.php b/app/views/project/summary.blade.php
index 9cb1582..fc1c0b7 100755
--- a/app/views/project/summary.blade.php
+++ b/app/views/project/summary.blade.php
@@ -77,7 +77,7 @@
- echo '<td>' . $expValues["experimentTimeOfStateChange"] . '</td>';
+ echo '<td class="time" unix-time="' . $expValues["experimentTimeOfStateChange"] . '"></td>';
switch ($expValues["experimentStatusString"])
@@ -118,4 +118,8 @@
</div>
+@stop
+@section('scripts')
+@parent
+ {{ HTML::script('js/time-conversion.js')}}
@stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45768f36/public/js/time-conversion.js
----------------------------------------------------------------------
diff --git a/public/js/time-conversion.js b/public/js/time-conversion.js
new file mode 100644
index 0000000..29bf960
--- /dev/null
+++ b/public/js/time-conversion.js
@@ -0,0 +1,37 @@
+//This script files changes all the table <td> elements with time class to show browser bases local time.
+//<td> elements should have the unix time as an attribute e.g. <td class="time" unix-time="423423423524"></td>
+
+function convertTimestamp(timestamp) {
+ var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
+ yyyy = d.getFullYear(),
+ mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
+ dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
+ hh = d.getHours(),
+ h = hh,
+ min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
+ ampm = 'AM',
+ time;
+
+ if (hh > 12) {
+ h = hh - 12;
+ ampm = 'PM';
+ } else if (hh === 12) {
+ h = 12;
+ ampm = 'PM';
+ } else if (hh == 0) {
+ h = 12;
+ }
+
+ // ie: 2013-02-18, 8:35 AM
+ time = yyyy + '-' + mm + '-' + dd + ', ' + h + ':' + min + ' ' + ampm;
+
+ return time;
+}
+
+$(document).ready( function(){
+ var elements = document.getElementsByClassName("time"),
+ i = elements.length;
+ while (i--) {
+ elements[i].innerHTML = convertTimestamp(elements[i].getAttribute("unix-time"));
+ }
+});
\ No newline at end of file