Jordan Earls avatar Jordan Earls committed 3d61878

Add IP and user agent logging to comments
More styling

Comments (0)

Files changed (5)

CommentHandler.cs

 			}
 			post.Name=post.Name.Substring(0,Math.Min(post.Name.Length,32));
 			post.Text=post.Text.Substring(0,Math.Min(post.Text.Length,1024));
+			post.IPAddress=Request.UserHostAddress;
+			post.UserAgent=Request.UserAgent;
 			post.Text=CheckLines(post.Text);
 			BlogEntryData entry=BlogEntryData.Get(entryid);
 			if(entry==null)

Models/CommentData.cs

 		public ObjectId EntryID{get;set;}
 		public string Name{get;set;}
 		public string Text{get;set;}
+		public string IPAddress{get;set;}
+		public string UserAgent{get;set;}
 		[ParameterIgnore]
 		public DateTime Posted{get;set;}
 
 	color: #00D;
 	text-decoration: underline;
 }
-h1,h2,h3,h4,h5,h6{color:#661111;font-family: 'Nunito', arial, serif;font-weight:bold;}
+h1,h2,h3,h4,h5,h6{color:#333; font-family: 'Nunito', arial, serif;font-weight:bold;}
 
 .wrapper{
 	margin-right: auto;
 }
 
 .header #nav{
+	padding-top: 3px;
 	font-size: 75%;
 }
 
-.header  #logo{
+.header  #logo a{
 	
     font-family: "Helvetica", Arial, sans-serif;
     font-size: 230%;
     font-weight:bold;
 	color: #333;
     text-shadow: 1px 2px 1px rgba(0, 0, 0, 0.4);
+    padding-bottom: 0px;
+    margin-bottom: 0px;
 }
 
 
 .header a{
 	text-decoration: none;
 	color: #222;
-    padding:6px 6px;
+    padding:6px 12px 6px 0px;
 }
 
 .header a:hover{ /*needed?*/
    /* text-shadow: 1px 1px 1px rgba(55, 133, 189, 0.7);*/
     text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
 }
-
 .header #tagline a
 {
 	float: left;
 	margin-top: 1px;
 	padding-right: 4px;
 	line-height: 0px;
-	padding-top: 0px;
+	padding-top: 8px;
 	color: #111;
     text-decoration: none;	
 	font-family: Helvetica,Arial,sans-serif;
     font-size:50%;
     font-weight:normal;
+    padding-left: 2px;
 }
 
 
 
 .content{
 	margin-top: 15px;
-	padding-left: 15px;
-	padding-right: 10px;
+	padding-left: 0px;
+	padding-right: 0px;
 	padding-bottom: 20px;
 	min-height: 100px;
 }
 	color: #222;
 }
 .content .entry{
-	width: 860px;
+	/*width: 860px;*/
 	background-color: #fff;
 	border-bottom:1px solid #ccc;
 	
-
 	margin-top: 10px;
 	margin-bottom: 20px;
-	padding: 5px 20px 25px;
-	padding-bottom: 10px;
+	padding: 5px 0px 10px 0px;
 	min-height: 150px;
     overflow:hidden;
 }
     text-align:center;
     margin:0 auto;
 	text-decoration: none;
-	color:#eee;
+	color:#777;
     font-size:60%;
-    padding:8px 10px;
-    background:rgba(255,255,255,0.1);
-    -moz-box-shadow:0 0 1px rgba(255,255,255,0.33), inset 1px 1px 2px 0 rgba(0,0,0,0.25);
-    -webkit-box-shadow:0 0 1px rgba(255,255,255,0.33), inset 1px 1px 2px 0 rgba(0,0,0,0.25);
-    box-shadow:0 0 1px rgba(255,255,255,0.33), inset 1px 1px 2px 0 rgba(0,0,0,0.25);    
-    -moz-text-shadow:-1px -1px 1px rgba(0,0,0,0.4);
-    -webkit-text-shadow:-1px -1px 1px rgba(0,0,0,0.4);    
-    text-shadow:-1px -1px 1px rgba(0,0,0,0.4);
-    -moz-border-radius:7px;
-    -webkit-border-radius:7px;
+    padding:8px 0px;
     border-radius:7px;
     width:75%;
 }
 
-#copyright a{color:#eee;text-decoration:underline;}
+#copyright a{color:#777;text-decoration:underline;}
 
 .x12{
 	/*honey pot*/

templates/CommentListView.html

 	<head>
 		<title></title>
 	</head>
-	<body>
+	<body style="max-width: 700px">
 		{!foreach comment in Comments!}
 			<div>
 				</div>By {=HttpUtility.HtmlEncode(comment.Name)=}</div>
 				{="<pre>"+HttpUtility.HtmlEncode(comment.Text)+"</pre>"=}
 				<div>posted at {=HttpUtility.HtmlEncode(comment.Posted.ToString())=}
+				{!if FSCAuth.IsAuthenticated() !}
+				<div>IP: {=comment.IPAddress=}</div>
+				<div>Agent: {=HttpUtility.HtmlEncode(comment.UserAgent)=}</div>
+				{!endif!}
 				<div><a href="{=BlogHandler.GetUrl(comment.GetOwner())=}">Go to Comment</a></div>
 			</div>
 		{!endforeach!}

templates/ViewGenerator.cs

 	<head>
 		<title></title>
 	</head>
-	<body>
+	<body style=""max-width: 700px"">
 		");
 foreach(var comment in Comments){
 __Write(@"
 __OutputVariable(__v);
 }
 __Write(@"
+				");
+if(FSCAuth.IsAuthenticated() ){
+__Write(@"
+				<div>IP: ");
+{
+                object __v;
+                
+
+                    __v=comment.IPAddress;
+                
+__OutputVariable(__v);
+}
+__Write(@"</div>
+				<div>Agent: ");
+{
+                object __v;
+                
+
+                    __v=HttpUtility.HtmlEncode(comment.UserAgent);
+                
+__OutputVariable(__v);
+}
+__Write(@"</div>
+				");
+}
+__Write(@"
 				<div><a href=""");
 {
                 object __v;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.