New sessions list
This commit is contained in:
		
							parent
							
								
									6cdc2e92da
								
							
						
					
					
						commit
						c3fae98bfe
					
				| @ -36,6 +36,15 @@ $this->create('office_session_list', 'ajax/session/list') | |||||||
| 	->action('\OCA\Office\Controller', 'listSessions') | 	->action('\OCA\Office\Controller', 'listSessions') | ||||||
| ; | ; | ||||||
| 
 | 
 | ||||||
|  | $this->create('office_session_listhtml', 'ajax/session/listHtml') | ||||||
|  | 	->get() | ||||||
|  | 	->action('\OCA\Office\Controller', 'listSessionsHtml') | ||||||
|  | ; | ||||||
|  | $this->create('office_session_listhtml', 'ajax/session/listHtml') | ||||||
|  | 	->post() | ||||||
|  | 	->action('\OCA\Office\Controller', 'listSessionsHtml') | ||||||
|  | ; | ||||||
|  | 
 | ||||||
| $this->create('office_session_join', 'ajax/session/join/{es_id}') | $this->create('office_session_join', 'ajax/session/join/{es_id}') | ||||||
| 	->get() | 	->get() | ||||||
| 	->action('\OCA\Office\Controller', 'joinSession') | 	->action('\OCA\Office\Controller', 'joinSession') | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								js/office.js
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								js/office.js
									
									
									
									
									
								
							| @ -18,6 +18,8 @@ var officeMain = { | |||||||
| 				}); | 				}); | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
|  | 		officeMain.updateSessions(); | ||||||
|  | 		setInterval(officeMain.updateSessions, 10000); | ||||||
| 	}, | 	}, | ||||||
| 	initSession: function(response) { | 	initSession: function(response) { | ||||||
| 		"use strict"; | 		"use strict"; | ||||||
| @ -29,10 +31,15 @@ var officeMain = { | |||||||
| 			$('.documentslist, #emptyfolder').fadeOut('slow').promise().done(function() { | 			$('.documentslist, #emptyfolder').fadeOut('slow').promise().done(function() { | ||||||
| 				// odf action toolbar
 | 				// odf action toolbar
 | ||||||
| 				var odfToolbarHtml = | 				var odfToolbarHtml = | ||||||
| 					'<div id="odf-toolbar">' + | 					'<div id="odf-toolbar">' | ||||||
| 					'<button id="odf_close">' + t('files_odfviewer', 'Close') + '</button>' + | 					+ '<button id="odf_close">' | ||||||
| 					'<span id="toolbar" class="claro"></span>' + | 					+ t('files_odfviewer', 'Close') | ||||||
| 					'</div>'; | 					+ '</button>' | ||||||
|  | 					+ '<button id="odf_invite">' | ||||||
|  | 					+ t('files_odfviewer', 'Invite') | ||||||
|  | 					+ '</button>' | ||||||
|  | 					+ '<span id="toolbar" class="claro"></span>' | ||||||
|  | 					+ '</div>'; | ||||||
| 				$('#controls').append(odfToolbarHtml); | 				$('#controls').append(odfToolbarHtml); | ||||||
| 			}); | 			}); | ||||||
| 
 | 
 | ||||||
| @ -41,7 +48,6 @@ var officeMain = { | |||||||
| 				var memberId, odfelement, odfcanvas, canvashtml = | 				var memberId, odfelement, odfcanvas, canvashtml = | ||||||
| 					'<div id = "mainContainer" class="claro" style="">'+ | 					'<div id = "mainContainer" class="claro" style="">'+ | ||||||
| 						'<div id = "editor">'+ | 						'<div id = "editor">'+ | ||||||
| 							//'<span id = "toolbar" class="claro"></span>'+
 |  | ||||||
| 							'<div id = "container">'+ | 							'<div id = "container">'+ | ||||||
| 								'<div id="canvas"></div>'+ | 								'<div id="canvas"></div>'+ | ||||||
| 							'</div>'+ | 							'</div>'+ | ||||||
| @ -98,27 +104,16 @@ var officeMain = { | |||||||
| 			officeMain.initSession | 			officeMain.initSession | ||||||
| 		); | 		); | ||||||
| 	}, | 	}, | ||||||
| 	showSessions : function(){ | 	updateSessions : function(){ | ||||||
| 		if ($('#allsessions').length){ | 		$('#editing-sessions').load(OC.Router.generate('office_session_listhtml'), {}, officeMain.onSessions); | ||||||
| 			$('#allsessions').remove(); |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 		$.post(OC.Router.generate('office_session_list'), {}, officeMain.onSessions); |  | ||||||
| 	}, | 	}, | ||||||
| 	onSessions : function(response){ | 			 | ||||||
| 		if (response && response.session_list){ | 	onSessions : function(){ | ||||||
| 			$(response.session_list).each( function(i, s){ officeMain.addSession(s); } ); | 		$('#editing-sessions a').click( | ||||||
| 		} | 				function(event){ | ||||||
| 	}, |  | ||||||
| 	addSession : function(s){ |  | ||||||
| 		if (!$('#allsessions').length){ |  | ||||||
| 			$(document.body).append('<div id="allsessions"></div>'); |  | ||||||
| 		} |  | ||||||
| 		$('<div><a href="">'+s+ '</a></div>').appendTo('#allsessions').click( |  | ||||||
| 			function(event){ |  | ||||||
| 					event.preventDefault(); | 					event.preventDefault(); | ||||||
| 					officeMain.joinSession(s);   | 					officeMain.joinSession($(this).attr('data-esid')); | ||||||
| 			} | 				} | ||||||
| 		); | 		); | ||||||
| 	}, | 	}, | ||||||
| 			 | 			 | ||||||
| @ -145,6 +140,7 @@ $(document).ready(function() { | |||||||
| 		officeMain.startSession($(this).attr('data-file')); | 		officeMain.startSession($(this).attr('data-file')); | ||||||
| 	}); | 	}); | ||||||
| 	$('#odf_close').live('click', officeMain.onClose); | 	$('#odf_close').live('click', officeMain.onClose); | ||||||
|  | 	$('#odf_invite').live('click', officeMain.onInvite); | ||||||
| 	$('#session-list').click(officeMain.showSessions); | 	$('#session-list').click(officeMain.showSessions); | ||||||
| 	OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup); | 	OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -1,12 +1,16 @@ | |||||||
| <div id="controls"><button id="session-list"><?php p($l->t('Sessions')) ?></button></div>
 | <div id="controls"></div> | ||||||
|  | <div id="office-content"> | ||||||
|  | 	<div id="editing-sessions"> | ||||||
|  | 	</div> | ||||||
| <?php if(empty($_['list'])) { ?>
 | <?php if(empty($_['list'])) { ?>
 | ||||||
| 	<div id="emptyfolder"><?php p('No documents are found. Please upload a document into your ownCloud');?></div>	
 | 	<div id="emptyfolder"><?php p('No documents are found. Please upload a document into your ownCloud');?></div>	
 | ||||||
| <?php } else { ?>
 | <?php } else { ?>
 | ||||||
|  | 	<div id="editor-content"> | ||||||
| 	<table class="documentslist" > | 	<table class="documentslist" > | ||||||
| 	<?php foreach($_['list'] as $entry) { ?>
 | 	<?php foreach($_['list'] as $entry) { ?>
 | ||||||
| 		<tr data-file="<?php \OCP\Util::encodePath(p($entry['path'])) ?>"> | 		<tr data-file="<?php \OCP\Util::encodePath(p($entry['path'])) ?>"> | ||||||
| 			<td width="1"> | 			<td width="1"> | ||||||
| 				<img align="left" src="<?php p(\OCP\Util::linkToAbsolute('office','ajax/thumbnail.php').'?filepath='.urlencode($entry['url'])) ?>" /> | 				<img align="left" src="<?php p(\OCP\Util::linkToAbsolute('office','ajax/thumbnail.php').'?filepath='.\OCP\Util::encodePath($entry['path'])) ?>" /> | ||||||
| 			</td> | 			</td> | ||||||
| 			<td width="1"> | 			<td width="1"> | ||||||
| 				<img align="left" src="<?php p( \OCP\Util::linkToAbsolute('office','img/office.png')) ?>" /> | 				<img align="left" src="<?php p( \OCP\Util::linkToAbsolute('office','img/office.png')) ?>" /> | ||||||
| @ -19,4 +23,6 @@ | |||||||
| 		</tr> | 		</tr> | ||||||
| 	<?php } ?>
 | 	<?php } ?>
 | ||||||
| 	</table> | 	</table> | ||||||
|  | 	</div> | ||||||
| <?php } ?>
 | <?php } ?>
 | ||||||
|  | </div> | ||||||
							
								
								
									
										6
									
								
								templates/part.sessions.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								templates/part.sessions.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | <?php foreach ($_['invites'] as $invite){ ?>
 | ||||||
|  | <div><a href="" data-esid="<?php p($invite['es_id']); ?>"><?php p($invite['es_id']); ?></a></div>
 | ||||||
|  | <?php } ?>
 | ||||||
|  | <?php foreach ($_['sessions'] as $session){ ?>
 | ||||||
|  | <div><a href="" data-esid="<?php p($session['es_id']); ?>"><?php p($session['es_id']); ?></a></div>
 | ||||||
|  | <?php } ?>
 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user