- display the submit time correctly in admin panels

- display the submitter correctly in admin panels
This commit is contained in:
Jonathan Ernst
2005-02-20 01:55:53 +00:00
committed by WineHQ
parent b103c6651d
commit 25f3f01412
7 changed files with 52 additions and 39 deletions

View File

@@ -61,15 +61,14 @@ if (!$_REQUEST['id'])
while($ob = mysql_fetch_object($hResult)) while($ob = mysql_fetch_object($hResult))
{ {
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n"; echo "<tr class=\"$bgcolor\">\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n"; echo "<td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
if($ob->userId) $oUser = new User($ob->submitterId);
{ echo "<td>";
$oUser = new User($ob->userId); echo $oUser->sEmail ? "<a href=\"mailto:".$oUser->sEmail."\">":"";
echo " <td>".$oUser->sRealname." (".$oUser->sEmail.")</td>\n"; echo $oUser->sRealname;
} echo $oUser->sEmail ? "</a>":"";
else echo "</td>\n";
echo " <td>Anonymous</td>\n";
echo "<td>".lookup_app_name($ob->appId)."</td>\n"; echo "<td>".lookup_app_name($ob->appId)."</td>\n";
echo "<td>".lookup_version_name($ob->versionId)."</td>\n"; echo "<td>".lookup_version_name($ob->versionId)."</td>\n";
echo "<td>".$ob->type."</td>\n"; echo "<td>".$ob->type."</td>\n";

View File

@@ -287,8 +287,12 @@ else
} }
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=\"$bgcolor\">\n"; echo "<tr class=\"$bgcolor\">\n";
echo " <td>".date("Y-n-t h:i:sa", $oApp->sSubmitTime)." &nbsp;</td>\n"; echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
echo " <td><a href=\"mailto:".$oSubmitter->sEmail."\">".$oSubmitter->sRealname."</a></td>\n"; echo " <td>\n";
echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oUser->sEmail."\">":"";
echo $oSubmitter->sRealname;
echo $oSubmitter->sEmail ? "</a>":"";
echo " </td>\n";
echo " <td>".$sVendor."</td>\n"; echo " <td>".$sVendor."</td>\n";
echo " <td>".$oApp->sName."</td>\n"; echo " <td>".$oApp->sName."</td>\n";
echo " <td align=\"center\">[<a href=\"adminAppQueue.php?sub=view&appId=".$oApp->iAppId."\">process</a>]</td>\n"; echo " <td align=\"center\">[<a href=\"adminAppQueue.php?sub=view&appId=".$oApp->iAppId."\">process</a>]</td>\n";
@@ -343,8 +347,12 @@ else
$sVendor = $oVendor->sName; $sVendor = $oVendor->sName;
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=\"$bgcolor\">\n"; echo "<tr class=\"$bgcolor\">\n";
echo " <td>".date("Y-n-t h:i:sa", $oVersion->sSubmitTime)." &nbsp;</td>\n"; echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
echo " <td><a href=\"mailto:".$oSubmitter->sEmail."\">".$oSubmitter->sRealname."</a></td>\n"; echo " <td>\n";
echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oUser->sEmail."\">":"";
echo $oSubmitter->sRealname;
echo $oSubmitter->sEmail ? "</a>":"";
echo " </td>\n";
echo " <td>".$sVendor."</td>\n"; echo " <td>".$sVendor."</td>\n";
echo " <td>".$oApp->sName."</td>\n"; echo " <td>".$oApp->sName."</td>\n";
echo " <td>".$oVersion->sName."</td>\n"; echo " <td>".$oVersion->sName."</td>\n";

View File

@@ -249,7 +249,7 @@ if ($_REQUEST['sub'])
$query = "SELECT queueId, appId, versionId,". $query = "SELECT queueId, appId, versionId,".
"userId, maintainReason,". "userId, maintainReason,".
"superMaintainer,". "superMaintainer,".
"UNIX_TIMESTAMP(submitTime) as submitTime ". "submitTime as submitTime ".
"from appMaintainerQueue;"; "from appMaintainerQueue;";
$result = query_appdb($query); $result = query_appdb($query);
@@ -290,7 +290,7 @@ if ($_REQUEST['sub'])
$oVersion = new Version($ob->versionId); $oVersion = new Version($ob->versionId);
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n"; echo " <td>".print_date(mysqldatetime_to_unixtimestamp($ob->submitTime))." &nbsp;</td>\n";
echo " <td>".$oApp->sName."</td>\n"; echo " <td>".$oApp->sName."</td>\n";
if($ob->superMaintainer) if($ob->superMaintainer)

View File

@@ -68,9 +68,8 @@ if ($_REQUEST['sub'])
$oUser = new User($ob->userId); $oUser = new User($ob->userId);
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n"; echo " <td>".print_date(mysqldatetime_to_unixtimestamp($ob->submitTime))." &nbsp;</td>\n";
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n"; echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
if($ob->superMaintainer) if($ob->superMaintainer)
{ {
echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".lookup_app_name($ob->appId)."</a></td>\n"; echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".lookup_app_name($ob->appId)."</a></td>\n";

View File

@@ -80,6 +80,7 @@ class Application {
$this->iVendorId = $oRow->vendorId; $this->iVendorId = $oRow->vendorId;
$this->iCatId = $oRow->catId; $this->iCatId = $oRow->catId;
$this->iSubmitterId = $oRow->submitterId; $this->iSubmitterId = $oRow->submitterId;
$this->sSubmitTime = $oRow->submitTime;
$this->sDate = $oRow->submitTime; $this->sDate = $oRow->submitTime;
$this->sName = $oRow->appName; $this->sName = $oRow->appName;
$this->sKeywords = $oRow->keywords; $this->sKeywords = $oRow->keywords;

View File

@@ -1,7 +1,4 @@
<?php <?php
require(BASE."include/"."parsedate.php");
class TableVE { class TableVE {
var $mode; var $mode;
@@ -176,15 +173,6 @@ class TableVE {
echo html_frame_end(); echo html_frame_end();
} }
function timestamp_to_unix($stamp)
{
$result = query_appdb("select unix_timestamp($stamp)");
if(!$result)
return 0;
$r = mysql_fetch_row($result);
return $r[0];
}
function make_option_list($varname, $cvalue, $table, $idField, $nameField, $where = "") function make_option_list($varname, $cvalue, $table, $idField, $nameField, $where = "")
{ {
@@ -261,12 +249,12 @@ class TableVE {
echo "<textarea cols=$len rows=10 name='$varname'>".stripslashes($value)."</textarea>\n"; echo "<textarea cols=$len rows=10 name='$varname'>".stripslashes($value)."</textarea>\n";
break; break;
case "timestamp": case "timestamp":
$time = $this->timestamp_to_unix($value); $time = mysqltimestamp_to_unixtimestamp($value);
echo makedate($time); echo print_date($time);
break; break;
case "datetime": case "datetime":
$time = parsedate($value); $time = mysqldatetime_to_unixtimestamp($value);
echo makedate($time); echo print_date($time);
break; break;
default: default:
echo "$value &nbsp;\n"; echo "$value &nbsp;\n";
@@ -315,12 +303,12 @@ class TableVE {
echo "$value &nbsp;\n"; echo "$value &nbsp;\n";
break; break;
case "timestamp": case "timestamp":
$time = $this->timestamp_to_unix($value); $time = mysqltimestamp_to_unixtimestamp($value);
echo makedate($time); echo print_date($time);
break; break;
case "datetime": case "datetime":
$time = parsedate($value); $time = mysqldatetime_to_unixtimestamp($value);
echo makedate($time); echo print_date($time);
break; break;
default: default:
echo "$value &nbsp;\n"; echo "$value &nbsp;\n";

View File

@@ -34,11 +34,29 @@ function values($arr)
/* /*
* format date * format date
*/ */
function makedate($time) function print_date($sTimestamp)
{ {
return date("F d, Y H:i:s", $time); return date("F d Y H:i:s", $sTimestamp);
} }
function mysqltimestamp_to_unixtimestamp($sTimestamp)
{
$d = substr($sTimestamp,6,2); // day
$m = substr($sTimestamp,4,2); // month
$y = substr($sTimestamp,0,4); // year
$hours = substr($sTimestamp,8,2); // year
$minutes = substr($sTimestamp,10,2); // year
$seconds = substr($sTimestamp,12,2); // year
return mktime($hours,$minutes,$seconds,$m, $d, $y);
}
function mysqldatetime_to_unixtimestamp($sDatetime)
{
sscanf($sDatetime, "%4s-%2s-%2s %2s:%2s:%2s",
&$y, &$m, &$d,
&$hours, &$minutes, &$seconds);
return mktime($hours,$minutes,$seconds,$m, $d, $y);
}
function get_remote() function get_remote()
{ {