I'm getting an interesting error after upgrading to 1.4.3. I created a patch
of my modifications, revertted, and then did an "Apply Patch.." Problem is,
2 of my .js files in the patch I had changed come up in red, and when double
clicking on them to 'merge' the patch off the repo, I get an error:
"The patch seems outdated! The file line
<three garbage characters>var stKmedia;
and the patch line
var stKmedia;
do not match!"
There are three garbage characters (upside down exclamation point and
question mark?) and "var stKmedia" is the first line in the file that had
changed. (That line itself had no changes, btw.)
Here is a snip of the (large) patch file that includes the diffs for the two
files that come up in red, DropView.js and Master.js. Note that there are
these "\ No newline at end of file" lines which look odd, one of them
doesn't show up immediately before the "Index" line like the others do. If I
take this line out, the <garbage characters> above go away so I get
something which is equally mysterious:
"The patch seems outdated! The file line
<three garbage characters>var stKmedia;
and the patch line
var stKmedia;
do not match!"
Any ideas?
+ var hoursAgo = Math.floor(ticksLeft / (1000*60*60));
+ ticksLeft %= (1000*60*60);
+ var minutesAgo = Math.floor(ticksLeft / (1000*60));
+
+ var st = "";
+ if (daysAgo > 0) st += daysAgo + " Day" + (daysAgo > 1 ? "s" : "");
+ if (hoursAgo > 0) st += (st.length > 0 ? ", " : "") + hoursAgo + "
Hour" + (hoursAgo > 1 ? "s" : "");
+ if (daysAgo == 0 && minutesAgo > 0) st += (st.length > 0 ? ", " : "") +
minutesAgo + " Minute" + (minutesAgo > 1 ? "s" : "");
+ if (st.length > 0)
+ st += " Ago";
+ else
+ st = "Less Than A Minute Ago";
+
+ return st;
}
\ No newline at end of file
Index: Web/Scripts/DropView.js
===================================================================
--- Web/Scripts/DropView.js (revision 51)
+++ Web/Scripts/DropView.js (working copy)
@@ -1,6 +1,5 @@
-var stKmedia;
-var idMq; var idSub;
-var fMayVote;
+var idMq; var idSub;
+var trnMqDisp;
var cUcmPerPage = 25;
var rgKmedia = ["Text", "Video", "Image", "Url"];
var rgStTxtSubCreate = [
@@ -33,9 +32,8 @@
mpIdSub_TrnSubDisp = new Array();
clearDrop();
Minddrop.Web.Services.ScsMq.TrnMqDispFetch(idMqLocal, true,
- function(trnMqDisp) {
- stKmedia = trnMqDisp.StKmedia;
- fMayVote = trnMqDisp.FMayVote;
+ function(trnMqDispLocal) {
+ trnMqDisp = trnMqDispLocal;
HideSubCreateForms();
$get('alSubCreate').style["display"] = trnMqDisp.FMayAddSub ?
"block" : "none";
$get('lblDropViewDetails').innerHTML = trnMqDisp.StDetails;
@@ -126,13 +124,13 @@
if (!trnSubDisp) return;
var fVoted = trnSubDisp.Kvote != Minddrop.Core.Model.Kvote.None;
- $ctlGet('divCmsVoteNotAllowed').set_visible(!fVoted && !fMayVote &&
fLoggedIn);
- $ctlGet('divCmsVoteNotLoggedIn').set_visible(!fVoted && !fMayVote &&
!fLoggedIn);
+ $ctlGet('divCmsVoteNotAllowed').set_visible(!fVoted &&
!trnMqDisp.FMayVote && fLoggedIn);
+ $ctlGet('divCmsVoteNotLoggedIn').set_visible(!fVoted &&
!trnMqDisp.FMayVote && !fLoggedIn);
// IE doesn't like background animation.
if (!fAnimate || Sys.Browser.agent == Sys.Browser.InternetExplorer) {
- $ctlGet('divCmsVoteButtons').set_visible(!fVoted && fMayVote);
+ $ctlGet('divCmsVoteButtons').set_visible(!fVoted &&
trnMqDisp.FMayVote);
}
// Hide it first if we must.
@@ -155,7 +153,7 @@
function HideSubCreateForms() {
Array.forEach(rgKmedia, function (stkm) {
- $get("divfCreate" + stkm).style["display"] = stkm == stKmedia ?
"block" : "none";
+ $get("divfCreate" + stkm).style["display"] = stkm ==
trnMqDisp.StKmedia ? "block" : "none";
});
}
@@ -196,19 +194,19 @@
var trn;
var createFunction;
- if (stKmedia == "Image") {
+ if (trnMqDisp.StKmedia == "Image") {
trn = new Minddrop.Transport.TrnSubImage();
populateTrn(trn, "", "CreateSubImage", ["Sturl", "StDetails"]);
createFunction = Minddrop.Web.Services.ScsSub.SubCreateImage;
- } else if (stKmedia == "Video") {
+ } else if (trnMqDisp.StKmedia == "Video") {
trn = new Minddrop.Transport.TrnSubVideo();
populateTrn(trn, "", "CreateSubVideo", ["Sturl", "StDetails"]);
createFunction = Minddrop.Web.Services.ScsSub.SubCreateVideo;
- } else if (stKmedia == "Text") {
+ } else if (trnMqDisp.StKmedia == "Text") {
trn = new Minddrop.Transport.TrnSubText();
populateTrn(trn, "", "CreateSubText", ["StDetails"]);
createFunction = Minddrop.Web.Services.ScsSub.SubCreateText;
- } else if (stKmedia == "Url") {
+ } else if (trnMqDisp.StKmedia == "Url") {
trn = new Minddrop.Transport.TrnSubUrl();
populateTrn(trn, "", "CreateSubUrl", ["Sturl", "StDetails"]);
createFunction = Minddrop.Web.Services.ScsSub.SubCreateUrl;
@@ -262,7 +260,7 @@
var sb = new Sys.StringBuilder();
var trnUcm = rgTrnUcmDisp[iTrnUcm];
- elNew.innerHTML = "<h1>" + trnUcm.StContent + "</h1><h2>- "
+ trnUcm.StUserCreator + " (X hours ago)</h2>";
+ elNew.innerHTML = "<h1>" + trnUcm.StContent + "</h1><h2>- "
+ trnUcm.StUserCreator + " (" + stTimeAgo(trnUcm.DtCreated) + ".)</h2>";
scrollLoader.get_ulTarget().insertBefore(elNew, $get(
scrollLoader.get_stElBottom()));
}
});
@@ -274,16 +272,21 @@
}
function htmlSubLi(trnSub) {
+ var stVoteStar = "<img class=\"voteStar\"
src=\"/images/voteStar.gif\"/>";
+ var stVoteWin = "<img class=\"voteWin\" src=\"/images/voteWin.gif\"/>";
+ var stWinner = trnSub.PtrePt > 0 && trnSub.PtrePl == 0 ?
" " + stVoteWin + " <b>Winner</b> " + stVoteWin +
" ": "";
+ var stDrippsWon = trnSub.PtrePt > 0 ? ", <b>" + trnSub.PtrePt + "</b>
Dripps" : "";
+
var stVoteInfo = "";
if (trnSub.Kvote == Minddrop.Core.Model.Kvote.For) {
- stVoteInfo = "<img class=\"voteStar\"
src=\"/images/voteStar.gif\"/> " + trnSub.VtCurrent + " votes for ";
- } else if (trnSub.Kvote != Minddrop.Core.Model.Kvote.None) {
- stVoteInfo = trnSub.VtCurrent + " votes for ";
+ stVoteInfo = stVoteStar + " <b>" + trnSub.VtCurrent + "</b> votes"
+ stDrippsWon + " for ";
+ } else if (trnSub.Kvote != Minddrop.Core.Model.Kvote.None ||
trnMqDisp.KmqStage == Minddrop.Core.Model.KmqStage.Closed) {
+ stVoteInfo = "<b>" + trnSub.VtCurrent + "</b> vote(s) for ";
} else {
stVoteInfo = "By ";
}
return "<h1>" + trnSub.StTitle + "</h1>" +
"<br><h2>" + stVoteInfo + "<a href=\"/Users/" +
trnSub.StUserCreator+"\">" +
trnSub.StUserCreator +
- "</a>. Created on " + trnSub.DtCreated.localeFormat("d") + " "
+ trnSub.DtCreated.localeFormat("t") + "</h2>";
-}
\ No newline at end of file
+ "</a>." + "<br/>Created " + stTimeAgo(trnSub.DtCreated) + "." +
stWinner + "</h2>";
+}
Index: Web/Scripts/Master.js
===================================================================
--- Web/Scripts/Master.js (revision 50)
+++ Web/Scripts/Master.js (working copy)
@@ -1,4 +1,5 @@
var aoLoginCurrent;
+var fAdmin = false;
var rgStTxtLogin = ['txtLoginUserName', 'txtLoginPassword'];
var rgStTxtNewUser = ['txtNewUserUserName', 'txtNewUserEmail',
'txtNewUserEmail2', 'txtNewUserPassword',
'txtNewUserPassword2'];
@@ -135,6 +136,7 @@
Minddrop.Web.Services.ScsUser.SyncLogin(
function(aoLogin) {
aoLoginCurrent = aoLogin;
+ fAdmin = aoLogin != null && aoLogin.FAdmin;
fLoggedIn = aoLogin != null;
if (aoLogin == null) {
Index: Web/Web.config
==============================================
Received on Thu Feb 8 10:23:00 2007