src/cm/media/js/client/c_db.js
changeset 114 49647a504de8
parent 0 40c8f766c9b8
child 144 e7e1bc64f613
--- a/src/cm/media/js/client/c_db.js	Thu Jan 21 09:16:56 2010 +0100
+++ b/src/cm/media/js/client/c_db.js	Thu Jan 21 21:11:32 2010 +0100
@@ -23,6 +23,10 @@
 	init : function() {
 		// at first server side ordered comment by asc ids, replies by creation date :
 		this.allComments = CY.JSON.parse(sv_comments) ;
+		if (sv_read_only) {
+			this.initToReadOnly() ;
+		}
+		
 	    this._computeAllCommentsByDbId() ;
 	    
 	    this._reorder() ;
@@ -252,6 +256,16 @@
 		return isChild ;
 	},	
 	
+	initToReadOnly : function(commentDbId, parentDbId) {
+		for (var i = 0, ilen = this.allComments.length ; i < ilen ; i++) {
+			var comment = this.allComments[i] ;
+			for (var prop in comment) {
+				if (0 == prop.indexOf("can_") && typeof comment[prop] === 'boolean')
+					comment[prop] = false ;
+			}
+		}
+	},	
+	
 //////////////////////////////
 //	BROWSING FUNCTIONS
 //////////////////////////////