causefx 8 tahun lalu
induk
melakukan
96e15177cc
5 mengubah file dengan 100 tambahan dan 31 penghapusan
  1. 9 2
      ajax.php
  2. 9 3
      chatjs.php
  3. TEMPAT SAMPAH
      images/settings/not-so-hidden.gif
  4. 61 21
      index.php
  5. 21 5
      settings.php

+ 9 - 2
ajax.php

@@ -180,10 +180,17 @@ switch ($_SERVER['REQUEST_METHOD']) {
                         $response['tab']['goto'] = 'updatedb.php';
                         break;
                     case 'deleteLog':
-                        sendNotification(unlink(FAIL_LOG));
+						$response['notify'] = sendNotification(unlink(FAIL_LOG));
+						$response['show_apply'] = true;
+						break;
+					case 'deleteChat':
+						$response['notify'] = sendNotification(unlink("chatpack.db"));
+						$response['show_apply'] = true;
+						$response['reload'] = true;
                         break;
                     case 'deleteOrgLog':
-                        sendNotification(unlink("org.log"));
+						$response['notify'] = sendNotification(unlink("org.log"));
+						$response['show_apply'] = true;
                         break;
                     case 'submit-tabs':
                         $response['notify'] = sendNotification(updateTabs($_POST) , false, false);

+ 9 - 3
chatjs.php

@@ -503,32 +503,36 @@ $(document).ready(function()
                         var onlineusers = JSON.parse(result);
                         var oldonlineusers = $("#onlineusers").html();
                         var newonlineusers = '';
+                        var onlinecount = 0;
                         
                         if( onlineusers.length <= 0 )  // no user typing
                         {
                             newonlineusers += "No Users Online";
+                            onlinecount = 0;
+
                         }
                         else
                         {   
                             if( onlineusers.length >= 1 )  // one user typing
                             {
                                 jQuery.each( onlineusers, function( i, val ) {
+                                    onlinecount++;
                                     var timecheck = val[1];
                                     var status = "";
                                     var color = "";
                                     if( timecheck < timenow - 1800 )
                                     {
-                                        status = '<span style="min-height: 14px;margin-top: 10px;" class="pull-right badge badge-danger animated pulse"> </span>';
+                                        status = '<span style="min-height: 14px;margin-top: 10px;" class="pull-right badge badge-danger"> </span>';
                                         color = "red";
                                     }else{
-                                        status = '<span style="min-height: 14px;margin-top: 10px;" class="pull-right badge badge-success animated flash"> </span>';                       
+                                        status = '<span style="min-height: 14px;margin-top: 10px;" class="pull-right badge badge-success"> </span>';                       
                                         color = "blue";                       
                                     }
                                     if( timecheck < timenow - 3600 )
                                     {
                                         newonlineusers += '';      
                                     }else{
-                                        newonlineusers += '<div class="member-info"><img style="height:40px" src="'+val[2]+'" alt="admin" class="img-circle"><span class="member-name">'+val[0]+'</span>'+status+'</div>'; 
+                                        newonlineusers += '<div class="member-info"><img style="height:40px" src="'+val[2]+'" alt="admin" class="img-circle"><span class="member-name" style="position: absolute;margin-top: 10px;">'+val[0]+'</span>'+status+'</div>'; 
                                         i++;
                                     }
                                     
@@ -556,10 +560,12 @@ $(document).ready(function()
                                 });
                             }
                         }
+                        if(onlinecount > 9 ){ onlinecount = "9-plus"; }
                         if(newonlineusers === ''){ newonlineusers = "No Users Online";}
                         if( newonlineusers != oldonlineusers )
                         {
                             $("#onlineusers").html(newonlineusers);
+                            $("#online-count").attr("class", "mdi mdi-numeric-"+onlinecount+"-box");
                         }
                     }
                 });

TEMPAT SAMPAH
images/settings/not-so-hidden.gif


+ 61 - 21
index.php

@@ -222,7 +222,7 @@ if(!isset($notifyExplode)) :
 
 endif;
 
-if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; $chatSize = "114px"; else : $slimBar = "56"; $userSize = "40"; $chatSize = "140px";endif;
+if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; $chatSize = "142px"; else : $slimBar = "56"; $userSize = "40"; $chatSize = "171px";endif;
 
 if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon = "settings2.png"; else: $iconRotate = "true"; $settingsIcon = "settings.png"; endif;
 
@@ -1197,7 +1197,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 		<?php } ?>
 		<!-- CHAT BOX -->
 		<?php if(CHAT == "true" && qualifyUser(CHATAUTH)){?>
-		<div class="email-content chat-box white-bg">
+		<div id="main-chat" class="email-content chat-box white-bg" style="z-index:1000000">
 			<div class="email-body">
 				<div class="email-inner small-box" style="padding: 0">
 
@@ -1209,33 +1209,46 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 								<?php if( $dbcreated ){ ?>
 									<div class="main-wrapper" style="position: initial; left:0;">
 										<div id="content">
-												<div id="chat-div" class="">
-													<div class="big-box chat gray-bg">
-														<div class="box" style="overflow: hidden; width: auto; height: calc(100vh - <?php echo $chatSize; ?>) !important;">
-															<div id="intro">
-																<center><img class="logo" alt="logo" src="images/organizr-logo-h.png" style="width: 100%;">
-																<br><br>start chatting...</center>
-															</div>
-															<ul id="messages" class="chat-double chat-container"></ul>
-															<ul class="chat-double chat-container" style="padding: 0px;"><li id="istyping"></li></ul>
-														</div>
-														<br/>
-														<input id="message" autofocus type="text" class="form-control gray-bg" placeholder="Enter your text" autocomplete="off"/>
-														<audio id="tabalert" preload="auto">
-															<source src="chat/audio/newmessage.mp3" type="audio/mpeg">
-														</audio>
 
+											<div class="btn-group btn-group-justified grayish-blue-bg">
+												<div class="btn-group" role="group">
+													<button id="chat-switch-chat" type="button" class="btn waves waves-effect waves-float grayish-blue-bg"><i class="fa fa-comments-o"></i> Chat</button>
+												</div>
+												<div class="btn-group" role="group">
+													<button id="chat-switch-online" type="button" class="btn waves  waves-effect waves-float grayish-blue-bg"><i id="online-count" class="fa fa-users"></i> Online Users</button>
+												</div>
+											</div>
+
+											<div id="chat-chat-div" class="">
+												<div class="big-box chat gray-bg">
+													<div class="box" style="overflow: hidden; width: auto; height: calc(100vh - <?php echo $chatSize; ?>) !important;">
+														<div id="intro">
+															<center><img class="logo" alt="logo" src="images/organizr-logo-h.png" style="width: 100%;">
+															<br><br>start chatting...</center>
+														</div>
+														<ul id="messages" class="chat-double chat-container"></ul>
+														<ul class="chat-double chat-container" style="padding: 0px;"><li id="istyping"></li></ul>
 													</div>
+													<br/>
+													<input id="message" autofocus onfocus="ensureVisible(this)" type="text" class="form-control gray-bg" placeholder="Enter your text" autocomplete="off"/>
+													<audio id="tabalert" preload="auto">
+														<source src="chat/audio/newmessage.mp3" type="audio/mpeg">
+													</audio>
+
 												</div>
-												<div id="chat-users-div" class="col-lg-12" style="display: none">
+											</div>
+											<div id="chat-users-div" class="col-lg-12 gray-bg" style="display: none;">
+												<div class="gray-bg"  style="overflow: hidden; width: auto; height: calc(100vh - 62px) !important;">
+													<br>
 													<div class="content-box">
 														<div class="content-title big-box i-block gray-bg">
 															<h4 class="zero-m">Online</h4>
 														</div>
 														<div class="clearfix"></div>
-														<div id="onlineusers" class="big-box"></div>
+														<div id="onlineusers" class="big-box" style="color:black;"></div>
 													</div>
 												</div>
+											</div>
 											
 							
         						<?php } ?>
@@ -1281,8 +1294,24 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 		<script src="<?=$baseURL;?>js/common.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
 		<script src="<?=$baseURL;?>js/mousetrap.min.js"></script>
 		<script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
-		<?php if(CHAT == "true" && qualifyUser(CHATAUTH)){?><script src="chatjs.php" defer="true"></script><?php }?>
+		<?php if(CHAT == "true" && qualifyUser(CHATAUTH)){?>
+		<script src="chatjs.php" defer="true"></script>
+		<script type="text/javascript">
+		var scrolling = function(e, c) {
+			e.scrollIntoView();
+			if (c < 5) setTimeout(scrolling, 300, e, c + 1);
+		};
+		var ensureVisible = function(e) {
+			setTimeout(scrolling, 300, e, 0);
+		};
+		var mainchatdiv = document.getElementById('main-chat');
+		mainchatdiv.addEventListener('touchmove', function(e) {
 
+			e.preventDefault();
+
+		}, false);  
+   		</script>
+		<?php }?>
 		<script>
 		//Tooltips
 		$('[data-toggle="tooltip"]').tooltip();
@@ -1304,7 +1333,8 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 
 			e.preventDefault();
 
-		}, false);    
+		}, false);  
+
 		function setHeight() {
 			windowHeight = $(window).innerHeight();
 			$("div").find(".iframe").css('height', windowHeight - <?=$slimBar;?> + "px");
@@ -1669,6 +1699,16 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 
 		});
 
+		$('#chat-switch-chat').on('click tap', function(){
+			$('#chat-chat-div').show();
+			$('#chat-users-div').hide();
+			$("#message").focus();
+		});
+		$('#chat-switch-online').on('click tap', function(){
+			$('#chat-users-div').show();
+			$('#chat-chat-div').hide();
+		});
+
 		$('#reload').on('contextmenu', function(e){
 
 			$("i[class^='mdi mdi-refresh']").attr("class", "mdi mdi-refresh fa-spin");

+ 21 - 5
settings.php

@@ -1716,9 +1716,8 @@ echo buildSettings(
 			array(
 				'title' => 'Chat Settings',
 				'id' => 'chat_settings',
-				'image' => 'images/settings/full-color/png/64px/chat.png',
+				'image' => 'images/settings/full-color/png/64px/chat.png',//onsubmit="ajax_request(\'POST\', \'deleteLog\'); return false;"
 				'fields' => array(
-					array(
 						array(
 							'type' => $userSelectType,
 							'labelTranslate' => 'CHAT_AUTH',
@@ -1726,13 +1725,20 @@ echo buildSettings(
 							'value' => CHATAUTH,
 							'options' => $userTypes,
 						),
-                        array(
+						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'ENABLE_CHAT',
 							'name' => 'chat',
 							'value' => CHAT,
 						),
-					),
+						array(
+							'type' => 'button',
+							'id' => 'deleteChat',
+							'labelTranslate' => 'DELETE_CHAT_DATABASE',
+							'icon' => 'trash',
+							'onclick' => 'ajax_request(\'POST\', \'deleteChat\');',
+							'class' => 'btn-warning',
+						),
 				),
 			),
             array(
@@ -2171,7 +2177,8 @@ echo buildSettings(
                                                 </div>
 
                                                 <div class="modal-footer">
-
+													
+													<button type="button" class="btn special" style="background: transparent !important;color: transparent !important;">Special</button>
                                                     <button type="button" class="btn btn-default waves" data-dismiss="modal"><?php echo $language->translate("CLOSE");?></button>
 
                                                 </div>
@@ -2736,6 +2743,15 @@ echo buildSettings(
 			$(".settingsMenu").click(function() {
                 $(".settingsMenu").removeClass("settingsMenuActive");
                 $(this).addClass("settingsMenuActive");
+			})
+			$(".special").click(function() {
+                swal({
+					title: "Hmmm What is This?",
+					text: '<p><img src="images/settings/not-so-hidden.gif"></p>',
+					html: true,
+					confirmButtonColor: "#63A8EB"
+				});
+                console.log('hmmmmm, what the hell is this section?');
             })
             //IP INFO
             $(".ipInfo").click(function(){