         @view = new ColabView(codekey[1],@getFilename())
         @view.show()
 
+        #stop collab button
         $('#stopCollab').on 'click', =>
           @stop()
+
         #@initStatistics
+
+        #read only button
+        $('#readonlycheckbox').on 'click', =>
+          console.log($('#readonlycheckbox')[0].checked)
+          @readonlyref.set($('#readonlycheckbox')[0].checked);
 
         #Lets add the comment stating where the collaboration is being done online
         #comment = @getColabComment(@getLanguage(),codekey[1])
         #editor.setText comment+editor.getText()
+        @readonlyref.on 'value',(snapshot) =>
+          $('#readonlycheckbox')[0].checked = snapshot.val()
+
         @chatref.on 'child_added', (snapshot) =>
           chattext = snapshot.val().text
           chatuser = snapshot.val().user

          $('#'+connectedusercolor.substr(1)).css('color',connectedusercolor);
          $('#'+connectedusercolor.substr(1)).text(connecteduser);






    @coderef = @ref.child('code');
    @userref = @ref.child('users');
    @chatref = @ref.child('chat');
    @readonlyref = @ref.child('readonly');

    @coderef.once 'value', (snapshot) =>
        options = {sv_: Firebase.ServerValue.TIMESTAMP}
