set edit and view mode