Ver código fonte

UserMsgs - view, reply test

Piotr Labudda 10 anos atrás
pai
commit
d5a31f257e

+ 82 - 22
SE/se-lib/Route/UserMsgs.php

@@ -579,7 +579,7 @@ function tblMsgsLoadMoreRows(n) {
 		try {
 			$msg = $this->_getMsg($idMsg, $usrLogin);
 			$this->_markAsRead($msg);
-			$this->tableRowMsg($msg);
+			$this->viewMsg($msg);
 		} catch (Exception $e) {
 			SE_Layout::alert('danger', $e->getMessage() . ' #' . $e->getLine());
 		}
@@ -598,7 +598,7 @@ function tblMsgsLoadMoreRows(n) {
 
 		try {
 			$msg = $this->_getMsg($idMsg, $usrLogin);
-			$this->tableRowMsg($msg);
+			$this->viewMsg($msg);
 		} catch (Exception $e) {
 			SE_Layout::alert('danger', $e->getMessage() . ' #' . $e->getLine());
 		}
@@ -646,7 +646,7 @@ function tblMsgsLoadMoreRows(n) {
 		if (!$res || $db->has_errors()) throw new Exception("Wystąpiły błędy podczas próby zapisu wiadomości: " . implode("\n<br>", $db->get_errors()));
 	}
 
-	public function tableRowMsg($msg) {
+	public function viewMsg($msg) {
 		$tblName = $msg['tblName'];
 		$usrLogin = $msg['usrLogin'];
 		$idTable = ProcesHelper::getZasobTableID($tblName);
@@ -663,7 +663,16 @@ function tblMsgsLoadMoreRows(n) {
 		$linkBase .= "&usrLogin={$usrLogin}";
 		$rmMsgLink = "{$linkBase}&_task=removeMsg&id={$msg['_raw']->ID}";
 		$backLink = "{$linkBase}";
-		?>
+
+		$msgMetaInfo = "do ";
+		if ('everyone' == $msg['_raw']->userTargetType) {
+			$msgMetaInfo .= 'wszystkich';
+		} else if ('user' == $msg['_raw']->userTargetType) {
+			$msgMetaInfo .= $msg['_raw']->userTargetName;
+		} else if ('group' == $msg['_raw']->userTargetType) {
+			$msgMetaInfo .= "grupy {$msg['_raw']->userTargetName}";
+		}
+?>
 <div class="container">
 	<h3><i class="glyphicon glyphicon-envelope"></i> <a href="<?php echo $backLink; ?>">Wiadomości <?php echo $usrLogin; ?></a>
 		&raquo; Wiadomość nr <?php echo $msg['_raw']->ID; ?>
@@ -671,22 +680,7 @@ function tblMsgsLoadMoreRows(n) {
 			z tabeli <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>"><?php echo $tblAcl->getLabel(); ?></a>
 		</small>
 	</h3>
-<!--
-<ul class="media-list">
-  <li class="media">
-    <div class="media-left">
-      <a href="#">
-        <img class="media-object" src="..." alt="...">
-      </a>
-    </div>
-    <div class="media-body">
-      <h4 class="media-heading">Media heading</h4>
-      ...
-			<ul class="media-list">...</ul>
-    </div>
-  </li>
-</ul>
--->
+
 	<div class="panel panel-<?php echo $msg['type']; ?>">
 		<div class="panel-heading">
 			<h3 class="panel-title">Wiadomość wysłana przez <?php echo $msg['_raw']->A_RECORD_CREATE_AUTHOR; ?>
@@ -703,13 +697,79 @@ function tblMsgsLoadMoreRows(n) {
 				<em style="margin-left:20px" class="text-muted">usunięta <?php echo $msg['_raw']->A_RECORD_DELETE_DATE; ?> przez <?php echo $msg['_raw']->A_RECORD_DELETE_AUTHOR; ?></em>
 			<?php endif; ?>
 			<?php if ($showRemoveBtn) : ?>
-				<a href="<?php echo $rmMsgLink; ?>" class="btn btn-xs btn-default pull-right" title="usuń wiadomość" onclick="return confirm('Czy jesteś pewien że chcesz usunąć wiadomość?');"><i class="glyphicon glyphicon-remove"></i> Usuń</a>
+				<a href="<?php echo $rmMsgLink; ?>" class="btn btn-xs btn-default pull-right" title="usuń wiadomość" onclick="return confirm('Czy jesteś pewien że chcesz usunąć wiadomość?');"><i class="glyphicon glyphicon-remove"></i> Usuń</a>
 			<?php endif; ?>
 		</div>
 	</div>
 </div>
 <?php
-		// TODO: odpisz
+		if (V::get('DBG_VIEW', '', $_GET)) $this->_testViewMsg();
+	}
+
+	public function _testViewMsg($msg) {
+		?>
+<link rel="stylesheet" href="./stuff/widget-select.css">
+<style type="text/css">
+.user_avatar {
+	display:block;
+	float:left;
+	width:40px;
+	height:40px;
+	margin:0;
+	padding:0;
+	border:1px solid #ddd;
+	line-height: 38px;
+	font-size:16px;
+	text-align:center;
+	vertical-align:middle;
+	color:#aaa;
+}
+</style>
+<div class="container">
+	<div id="widget-msg-tree" class="col-md-10"></div>
+</div>
+<script>
+function frmTestSubmit(frm) {
+	console.log('frmTestSubmit frm: ', frm);
+	//console.log('frmTestSubmit "' + frm.fldNameMulti.value + '"');
+	return false;
+}
+</script>
+<script src="stuff/vendors.js"></script>
+<script src="stuff/bundle.se_route_user_msgs.js"></script>
+<script>
+	jQuery("#widget-msg-tree").MsgTree({
+		usrLogin: '<?php echo User::getLogin(); ?>',
+		fetchOptionsForGroup: function(input, callback) {
+			var options = [];
+			for (var i = 1; i <= 100; i++) {
+				options.push({value: 'group' + i, label: 'Group [' + i + ']'});
+			}
+			callback(null, {
+				options: options,
+				// CAREFUL! Only set this to true when there are no more options,
+				// or more specific queries will not be sent to the server.
+				//complete: true
+			});
+		},
+		fetchOptionsForUser: function(input, callback) {
+			var options = [];
+			for (var i = 1; i <= 100; i++) {
+				options.push({value: 'user' + i, label: 'User [' + i + ']'});
+			}
+			callback(null, {
+				options: options,
+				// CAREFUL! Only set this to true when there are no more options,
+				// or more specific queries will not be sent to the server.
+				//complete: true
+			});
+		}
+	});
+//	jQuery("#widget-msg-tree").on('change', function(e, data) {
+//		console.log('#widget-msg-tree/MsgTree::onChange: data:', data);
+//	});
+</script>
+<?php
 	}
 
 	public function removeMsgAction() {

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
SE/stuff/bundle.se_route_user_msgs.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
SE/stuff/vendors.js


+ 317 - 0
SE/stuff/widget-select.css

@@ -0,0 +1,317 @@
+.Select {
+  position: relative;
+}
+.Select,
+.Select div,
+.Select input,
+.Select span {
+  -webkit-box-sizing: border-box;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+}
+.Select.is-disabled > .Select-control {
+  background-color: #f6f6f6;
+}
+.Select.is-disabled .Select-arrow-zone {
+  cursor: default;
+  pointer-events: none;
+}
+.Select-control {
+  background-color: #fff;
+  border-color: #d9d9d9 #ccc #b3b3b3;
+  border-radius: 4px;
+  border: 1px solid #ccc;
+  color: #333;
+  cursor: default;
+  display: table;
+  height: 34px;
+  outline: none;
+  overflow: hidden;
+  position: relative;
+  width: 100%;
+}
+.Select-control:hover {
+  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
+}
+.is-searchable.is-open > .Select-control {
+  cursor: text;
+}
+.is-open > .Select-control {
+  border-bottom-right-radius: 0;
+  border-bottom-left-radius: 0;
+  background: #fff;
+  border-color: #b3b3b3 #ccc #d9d9d9;
+}
+.is-open > .Select-control > .Select-arrow {
+  border-color: transparent transparent #999;
+  border-width: 0 5px 5px;
+}
+.is-searchable.is-focused:not(.is-open) > .Select-control {
+  cursor: text;
+}
+.is-focused:not(.is-open) > .Select-control {
+  border-color: #66afe9 #66afe9 #66afe9;
+  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 5px -1px rgba(0, 126, 255, 0.5);
+}
+.Select-placeholder {
+  bottom: 0;
+  color: #aaa;
+  left: 0;
+  line-height: 32px;
+  padding-left: 10px;
+  padding-right: 10px;
+  position: absolute;
+  right: 0;
+  top: 0;
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.has-value > .Select-control > .Select-placeholder {
+  color: #333;
+}
+.Select-value {
+  color: #aaa;
+  left: 0;
+  padding: 8px 52px 8px 10px;
+  position: absolute;
+  right: -15px;
+  top: 0;
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.has-value > .Select-control > .Select-value {
+  color: #333;
+}
+.Select-input {
+  height: 32px;
+  padding-left: 10px;
+  padding-right: 10px;
+  vertical-align: middle;
+}
+.Select-input > input {
+  background: none transparent;
+  border: 0 none;
+  box-shadow: none;
+  cursor: default;
+  display: inline-block;
+  font-family: inherit;
+  font-size: inherit;
+  height: 32px;
+  margin: 0;
+  outline: none;
+  padding: 0;
+  -webkit-appearance: none;
+}
+.is-focused .Select-input > input {
+  cursor: text;
+}
+.Select-control:not(.is-searchable) > .Select-input {
+  outline: none;
+}
+.Select-loading-zone {
+  cursor: pointer;
+  display: table-cell;
+  position: relative;
+  text-align: center;
+  vertical-align: middle;
+  width: 16px;
+}
+.Select-loading {
+  -webkit-animation: Select-animation-spin 400ms infinite linear;
+  -o-animation: Select-animation-spin 400ms infinite linear;
+  animation: Select-animation-spin 400ms infinite linear;
+  width: 16px;
+  height: 16px;
+  box-sizing: border-box;
+  border-radius: 50%;
+  border: 2px solid #ccc;
+  border-right-color: #333;
+  display: inline-block;
+  position: relative;
+  vertical-align: middle;
+}
+.Select-clear-zone {
+  -webkit-animation: Select-animation-fadeIn 200ms;
+  -o-animation: Select-animation-fadeIn 200ms;
+  animation: Select-animation-fadeIn 200ms;
+  color: #999;
+  cursor: pointer;
+  display: table-cell;
+  position: relative;
+  text-align: center;
+  vertical-align: middle;
+  width: 17px;
+}
+.Select-clear-zone:hover {
+  color: #D0021B;
+}
+.Select-clear {
+  display: inline-block;
+  font-size: 18px;
+  line-height: 1;
+}
+.Select--multi .Select-clear-zone {
+  width: 17px;
+}
+.Select-arrow-zone {
+  cursor: pointer;
+  display: table-cell;
+  position: relative;
+  text-align: center;
+  vertical-align: middle;
+  width: 25px;
+  padding-right: 5px;
+}
+.Select-arrow {
+  border-color: #999 transparent transparent;
+  border-style: solid;
+  border-width: 5px 5px 2.5px;
+  display: inline-block;
+  height: 0;
+  width: 0;
+}
+.is-open .Select-arrow,
+.Select-arrow-zone:hover > .Select-arrow {
+  border-top-color: #666;
+}
+@-webkit-keyframes Select-animation-fadeIn {
+  from {
+    opacity: 0;
+  }
+  to {
+    opacity: 1;
+  }
+}
+@keyframes Select-animation-fadeIn {
+  from {
+    opacity: 0;
+  }
+  to {
+    opacity: 1;
+  }
+}
+.Select-menu-outer {
+  border-bottom-right-radius: 4px;
+  border-bottom-left-radius: 4px;
+  background-color: #fff;
+  border: 1px solid #ccc;
+  border-top-color: #e6e6e6;
+  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
+  box-sizing: border-box;
+  margin-top: -1px;
+  max-height: 200px;
+  position: absolute;
+  top: 100%;
+  width: 100%;
+  z-index: 1000;
+  -webkit-overflow-scrolling: touch;
+}
+.Select-menu {
+  max-height: 198px;
+  overflow-y: auto;
+}
+.Select-option {
+  box-sizing: border-box;
+  color: #666666;
+  cursor: pointer;
+  display: block;
+  padding: 8px 10px;
+}
+.Select-option:last-child {
+  border-bottom-right-radius: 4px;
+  border-bottom-left-radius: 4px;
+}
+.Select-option.is-focused {
+  background-color: rgba(0, 126, 255, 0.08);
+  color: #333;
+}
+.Select-option.is-disabled {
+  color: #cccccc;
+  cursor: not-allowed;
+}
+.Select-noresults,
+.Select-search-prompt,
+.Select-searching {
+  box-sizing: border-box;
+  color: #999999;
+  cursor: default;
+  display: block;
+  padding: 8px 10px;
+}
+.Select--multi .Select-input {
+  vertical-align: middle;
+  margin-left: 10px;
+  padding: 0;
+}
+.Select--multi.has-value .Select-input {
+  margin-left: 5px;
+}
+.Select-item {
+  background-color: rgba(0, 126, 255, 0.08);
+  border-radius: 2px;
+  border: 1px solid rgba(0, 126, 255, 0.24);
+  color: #66afe9;
+  display: inline-block;
+  font-size: 0.9em;
+  margin-left: 5px;
+  margin-top: 5px;
+  vertical-align: top;
+}
+.Select-item-icon,
+.Select-item-label {
+  display: inline-block;
+  vertical-align: middle;
+}
+.Select-item-label {
+  border-bottom-right-radius: 2px;
+  border-top-right-radius: 2px;
+  cursor: default;
+  padding: 2px 5px;
+}
+.Select-item-label .Select-item-label__a {
+  color: #66afe9;
+  cursor: pointer;
+}
+.Select-item-icon {
+  cursor: pointer;
+  border-bottom-left-radius: 2px;
+  border-top-left-radius: 2px;
+  border-right: 1px solid rgba(0, 126, 255, 0.24);
+  padding: 1px 5px 3px;
+}
+.Select-item-icon:hover,
+.Select-item-icon:focus {
+  background-color: rgba(0, 113, 230, 0.08);
+  color: #0071e6;
+}
+.Select-item-icon:active {
+  background-color: rgba(0, 126, 255, 0.24);
+}
+.Select--multi.is-disabled .Select-item {
+  background-color: #f2f2f2;
+  border: 1px solid #d9d9d9;
+  color: #888;
+}
+.Select--multi.is-disabled .Select-item-icon {
+  cursor: not-allowed;
+  border-right: 1px solid #d9d9d9;
+}
+.Select--multi.is-disabled .Select-item-icon:hover,
+.Select--multi.is-disabled .Select-item-icon:focus,
+.Select--multi.is-disabled .Select-item-icon:active {
+  background-color: #f2f2f2;
+}
+@keyframes Select-animation-spin {
+  to {
+    transform: rotate(1turn);
+  }
+}
+@-webkit-keyframes Select-animation-spin {
+  to {
+    -webkit-transform: rotate(1turn);
+  }
+}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff