-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified: Default template Modified: Less file
- Loading branch information
Showing
19 changed files
with
2,760 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,7 @@ | |
/** | ||
* Template for Backend | ||
* | ||
* Copyright (C) 2015 Arie Nugraha ([email protected]) | ||
* Create by Eddy Subratha ([email protected]) | ||
* Copyright (C) 2015 Arie Nugraha ([email protected]), Eddy Subratha ([email protected]) | ||
* | ||
* Slims 8 (Akasia) | ||
* | ||
|
@@ -121,73 +120,6 @@ | |
</footer> | ||
</main> | ||
|
||
<?php | ||
// Chat | ||
// ============================================= | ||
if($sysconf['chat_system']['enabled'] && $sysconf['chat_system']['librarian']) : ?> | ||
<aside class="s-chat s-maximize"> | ||
<a href="#" id="pchat-hide" class="s-chat-header"><?php echo __('Chat With Members'); ?></a> | ||
<div class="s-chat-content"> | ||
<div id="log"></div> | ||
<label for="message">Message</label> | ||
<input type="text" id="message" name="message" /> | ||
</div> | ||
<footer><?php echo __('Please type and hit Enter button to send your messages'); ?></footer> | ||
</aside> | ||
|
||
<script> | ||
var Server; | ||
function log( text ) { | ||
$log = $('#log'); | ||
//Add text to log | ||
$log.append(($log.html()?'<br>':'') + text); | ||
//Autoscroll | ||
$log[0].scrollTop = $log[0].scrollHeight - $log[0].clientHeight; | ||
} | ||
|
||
function send( text ) { | ||
Server.send( 'message', text ); | ||
} | ||
|
||
$(document).ready(function() { | ||
log('Connecting...'); | ||
Server = new FancyWebSocket('ws://<?php echo $sysconf['chat_system']['server'] ?>:<?php echo $sysconf['chat_system']['server_port'] ?>'); | ||
$('#message').keypress(function(e) { | ||
if ( e.keyCode == 13 && this.value ) { | ||
log( 'You: ' + this.value ); | ||
send( '<?php echo $_SESSION["realname"]?>|'+this.value); | ||
$(this).val(''); | ||
} | ||
}); | ||
|
||
//Let the user know we're connected | ||
Server.bind('open', function() { | ||
log( "Connected." ); | ||
}); | ||
|
||
//OH NOES! Disconnection occurred. | ||
Server.bind('close', function( data ) { | ||
log( "Disconnected." ); | ||
}); | ||
|
||
//Log any messages sent from server | ||
Server.bind('message', function( payload ) { | ||
log( payload ); | ||
}); | ||
|
||
Server.connect(); | ||
}); | ||
|
||
// Show or hide chat | ||
// ============================================ | ||
$('.s-chat').toggleClass('s-minimize s-maximize'); | ||
$('#pchat-hide').on('click', function(){ | ||
$('.s-chat').toggleClass('s-minimize s-maximize '); | ||
}); | ||
|
||
</script> | ||
<?php endif; ?> | ||
|
||
<!-- fake submit iframe for search form, DONT REMOVE THIS! --> | ||
<iframe name="blindSubmit" style="visibility: hidden; width: 0; height: 0;"></iframe> | ||
<!-- fake submit iframe --> | ||
|
@@ -260,6 +192,6 @@ function send( text ) { | |
); | ||
}); | ||
</script> | ||
<?php if (isset($chat)) { echo $chat; } ?> | ||
<?php include "chat.php" ?> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
// Chat | ||
// ============================================= | ||
if($sysconf['chat_system']['enabled'] && $sysconf['chat_system']['librarian']) : ?> | ||
<aside class="s-chat s-maximize"> | ||
<a href="#" id="hide-pchat" class="s-chat-header"><?php echo __('Chat With Members'); ?></a> | ||
<div class="s-chat-content"> | ||
<div id="log"></div> | ||
<label for="message">Message</label> | ||
<input type="text" id="message" name="message" /> | ||
</div> | ||
<footer> | ||
<p> | ||
<?php echo __('Please type and hit Enter button to send your messages'); ?><br> | ||
[M] <?php echo __('Members') ?> - [L] <?php echo __('Librarian') ?> | ||
</p> | ||
</footer> | ||
</aside> | ||
|
||
<script> | ||
var Server; | ||
function log( text ) { | ||
$log = $('#log'); | ||
//Add text to log | ||
$log.append(($log.html()?'<br>':'') + text); | ||
//Autoscroll | ||
$log[0].scrollTop = $log[0].scrollHeight - $log[0].clientHeight; | ||
} | ||
|
||
function send( text ) { | ||
Server.send( 'message', text ); | ||
} | ||
|
||
$(document).ready(function() { | ||
log('Connecting...'); | ||
Server = new FancyWebSocket('ws://<?php echo $sysconf['chat_system']['server'] ?>:<?php echo $sysconf['chat_system']['server_port'] ?>?u=<?php echo $_SESSION["realname"] ?>'); | ||
$('#message').keypress(function(e) { | ||
if ( e.keyCode == 13 && this.value ) { | ||
log( 'You: ' + this.value ); | ||
send( '[L] <?php echo $_SESSION["realname"]?>|'+this.value); | ||
$.ajax({ | ||
type: 'POST', | ||
url: '../index.php?p=chat', | ||
data: {msg: '<?php echo date("Y.m.d H:i:s") ?> [L] <?php echo $_SESSION["realname"] ?> - ' + this.value} | ||
}); | ||
$(this).val(''); | ||
} | ||
}); | ||
|
||
//Let the user know we're connected | ||
Server.bind('open', function() { | ||
log( "Connected." ); | ||
}); | ||
|
||
//OH NOES! Disconnection occurred. | ||
Server.bind('close', function( data ) { | ||
log( "Disconnected." ); | ||
}); | ||
|
||
//Log any messages sent from server | ||
Server.bind('message', function( payload ) { | ||
log( payload ); | ||
}); | ||
|
||
Server.connect(); | ||
}); | ||
|
||
// Show or hide chat | ||
// ============================================ | ||
$('.s-chat').toggleClass('s-minimize s-maximize'); | ||
$('#hide-pchat').on('click', function(){ | ||
$('.s-chat').toggleClass('s-minimize s-maximize '); | ||
}); | ||
|
||
</script> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.