mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Add foreign admin views
This commit is contained in:
		@@ -24,6 +24,8 @@ def connect():
 | 
				
			|||||||
    ' will be used for further information exchange generated by a background
 | 
					    ' will be used for further information exchange generated by a background
 | 
				
			||||||
    ' task associated with the sid.
 | 
					    ' task associated with the sid.
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
 | 
					    logger = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					    logger.warning('[connect] Session id is: {}.'.format(request.sid))
 | 
				
			||||||
    socketio.start_background_task(background_task,
 | 
					    socketio.start_background_task(background_task,
 | 
				
			||||||
                                   current_app._get_current_object(),
 | 
					                                   current_app._get_current_object(),
 | 
				
			||||||
                                   current_user.id,
 | 
					                                   current_user.id,
 | 
				
			||||||
@@ -43,6 +45,7 @@ def connect_admin(selected_user_id):
 | 
				
			|||||||
    '''
 | 
					    '''
 | 
				
			||||||
    logger = logging.getLogger(__name__)
 | 
					    logger = logging.getLogger(__name__)
 | 
				
			||||||
    logger.warning('Admin emitted "connect_admin".')
 | 
					    logger.warning('Admin emitted "connect_admin".')
 | 
				
			||||||
 | 
					    logger.warning('[connect_admin] Session id is: {}.'.format(request.sid))
 | 
				
			||||||
    logger.warning('Selected user id is: {}'.format(selected_user_id))
 | 
					    logger.warning('Selected user id is: {}'.format(selected_user_id))
 | 
				
			||||||
    socketio.start_background_task(background_task_foreign,
 | 
					    socketio.start_background_task(background_task_foreign,
 | 
				
			||||||
                                   current_app._get_current_object(),
 | 
					                                   current_app._get_current_object(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,16 +17,28 @@
 | 
				
			|||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
        <div class="card-action">
 | 
					        <div class="card-action">
 | 
				
			||||||
          <a href="{{url_for('admin.edit_profile_admin', user_id=selected_user.id)}}" class="waves-effect waves-light btn"><i class="material-icons left">edit</i>Edit user</a>
 | 
					          <a href="{{url_for('admin.edit_profile_admin', user_id=selected_user.id)}}" class="waves-effect waves-light btn"><i class="material-icons left">edit</i>Edit user</a>
 | 
				
			||||||
 | 
					        <a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete User</a>
 | 
				
			||||||
 | 
					        <!-- Modal Strucutre -->
 | 
				
			||||||
 | 
					        <div id="modal-confirm-delete" class="modal">
 | 
				
			||||||
 | 
					          <div class="modal-content">
 | 
				
			||||||
 | 
					            <h4>Confirm deletion</h4>
 | 
				
			||||||
 | 
					              <p>Do you really want to delete the current selected user ({{selected_user.username}})?
 | 
				
			||||||
 | 
					              All associated jobs and job files will be permanently deleted.</p>
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
 | 
					          <div class="modal-footer">
 | 
				
			||||||
 | 
					            <a href="{{url_for('admin.admin_delete_user', user_id=selected_user.id)}}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete User</a></a>
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<script type="text/javascript">
 | 
					<script>
 | 
				
			||||||
  var selected_user_id = {{selected_user.id|tojson|safe}}
 | 
					  var selected_user_id = {{selected_user.id|tojson|safe}}
 | 
				
			||||||
  socket.emit('connect_admin', selected_user_id);
 | 
					  socket.emit('connect_admin', selected_user_id);
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<div class="col s12 m6">
 | 
					<div class="col s12 m6">
 | 
				
			||||||
  <div id="job-list">
 | 
					  <div id="job-foreign-list">
 | 
				
			||||||
    <div class="card">
 | 
					    <div class="card">
 | 
				
			||||||
      <div class="card-content">
 | 
					      <div class="card-content">
 | 
				
			||||||
        <div class="row">
 | 
					        <div class="row">
 | 
				
			||||||
@@ -47,7 +59,7 @@
 | 
				
			|||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
  var jobList = new JobList("job-list", {
 | 
					  var jobList = new JobList("job-foreign-list", foreignJobsSubscribers, {
 | 
				
			||||||
    item: '<div><span class="title"></span><span class="description"></span></div>',
 | 
					    item: '<div><span class="title"></span><span class="description"></span></div>',
 | 
				
			||||||
    page: 4,
 | 
					    page: 4,
 | 
				
			||||||
    pagination: true,
 | 
					    pagination: true,
 | 
				
			||||||
@@ -56,25 +68,35 @@
 | 
				
			|||||||
  jobList.on("filterComplete", List.updatePagination);
 | 
					  jobList.on("filterComplete", List.updatePagination);
 | 
				
			||||||
  jobList.on("searchComplete", List.updatePagination);
 | 
					  jobList.on("searchComplete", List.updatePagination);
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<div class="col s12">
 | 
					<div class="col s12 m6">
 | 
				
			||||||
  <div class="card large">
 | 
					  <div id="corpus-foreign-list">
 | 
				
			||||||
    <div class="card-content">
 | 
					    <div class="card">
 | 
				
			||||||
      <span class="card-title">Administration actions</span>
 | 
					      <div class="card-content">
 | 
				
			||||||
      <!-- Confirm deletion of selected user with modal dialogue
 | 
					        <div class="row">
 | 
				
			||||||
      Modal Trigger-->
 | 
					          <div class="col s12">
 | 
				
			||||||
      <a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete User</a>
 | 
					            <div class="input-field">
 | 
				
			||||||
      <!-- Modal Strucutre -->
 | 
					              <i class="material-icons prefix">search</i>
 | 
				
			||||||
      <div id="modal-confirm-delete" class="modal">
 | 
					              <input id="search-job" class="search" type="text"></input>
 | 
				
			||||||
        <div class="modal-content">
 | 
					              <label for="search-job">Search corpus</label>
 | 
				
			||||||
          <h4>Confirm deletion</h4>
 | 
					            </div>
 | 
				
			||||||
            <p>Do you really want to delete the current selected user ({{selected_user.username}})?
 | 
					          </div>
 | 
				
			||||||
            All associated jobs and job files will be permanently deleted.</p>
 | 
					          <div class="col s12">
 | 
				
			||||||
        </div>
 | 
					            <ul class="pagination"></ul>
 | 
				
			||||||
        <div class="modal-footer">
 | 
					          </div>
 | 
				
			||||||
          <a href="{{url_for('admin.admin_delete_user', user_id=selected_user.id)}}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete User</a></a>
 | 
					 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					    <div class="collection list"></div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  var corpusList = new CorpusList("corpus-foreign-list", foreignCorpusSubscribers, {
 | 
				
			||||||
 | 
					    item: '<div><span class="title"></span><span class="description"></span></div>',
 | 
				
			||||||
 | 
					    page: 4,
 | 
				
			||||||
 | 
					    pagination: true,
 | 
				
			||||||
 | 
					    valueNames: ["description", "title", {data: ["id"]}]
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					  corpusList.on("filterComplete", List.updatePagination);
 | 
				
			||||||
 | 
					  corpusList.on("searchComplete", List.updatePagination);
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,7 +76,7 @@
 | 
				
			|||||||
        var subscriber;
 | 
					        var subscriber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreignCorpora = JSON.parse(msg);
 | 
					        foreignCorpora = JSON.parse(msg);
 | 
				
			||||||
        for (subscriber of foreignCorporaSubscribers) {subscriber._init();}
 | 
					        for (subscriber of foreignCorporaSubscribers) {subscriber._init(foreignCorpora);}
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -84,7 +84,7 @@
 | 
				
			|||||||
        var subscriber;
 | 
					        var subscriber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreignJobs = JSON.parse(msg);
 | 
					        foreignJobs = JSON.parse(msg);
 | 
				
			||||||
        for (subscriber of foreignJobsSubscribers) {subscriber._init();}
 | 
					        for (subscriber of foreignJobsSubscribers) {subscriber._init(foreignJobs);}
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@
 | 
				
			|||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
  var corpusList = new CorpusList("corpus-list", {
 | 
					  var corpusList = new CorpusList("corpus-list", corporaSubscribers ,{
 | 
				
			||||||
    item: '<div><span class="title"></span><span class="description"></span></div>',
 | 
					    item: '<div><span class="title"></span><span class="description"></span></div>',
 | 
				
			||||||
    page: 4,
 | 
					    page: 4,
 | 
				
			||||||
    pagination: true,
 | 
					    pagination: true,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user