|
@@ -656,66 +656,6 @@ 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()));
|
|
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 viewMsg__OLD($msg) {
|
|
|
|
|
- $tblName = $msg['tblName'];
|
|
|
|
|
- $usrLogin = $msg['usrLogin'];
|
|
|
|
|
- $idTable = ProcesHelper::getZasobTableID($tblName);
|
|
|
|
|
- if (!$idTable) throw new Exception("Nie udało się odnaleźć nr tabeli '{$tblName}'");
|
|
|
|
|
- $idRow = $msg['idRow'];
|
|
|
|
|
- $usrAcl = User::getAcl();
|
|
|
|
|
- $tblAcl = $usrAcl->getTableAcl($idTable);
|
|
|
|
|
-
|
|
|
|
|
- $showRemoveBtn = true;
|
|
|
|
|
- if ('DELETED' == $msg['_raw']->A_STATUS) $showRemoveBtn = false;
|
|
|
|
|
- if ('OFF_HARD' == $msg['_raw']->A_STATUS && $usrLogin != $msg['_raw']->A_RECORD_CREATE_AUTHOR) $showRemoveBtn = false;
|
|
|
|
|
-
|
|
|
|
|
- $linkBase = "index.php?_route=UserMsgs";
|
|
|
|
|
- $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>
|
|
|
|
|
- » Wiadomość nr <?php echo $msg['_raw']->ID; ?>
|
|
|
|
|
- <br><small>wiadomość powiązana z rekordem <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>#EDIT/<?php echo $idRow; ?>"><?php echo $idRow; ?></a>
|
|
|
|
|
- z tabeli <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>"><?php echo $tblAcl->getLabel(); ?></a>
|
|
|
|
|
- </small>
|
|
|
|
|
- </h3>
|
|
|
|
|
-
|
|
|
|
|
- <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; ?>
|
|
|
|
|
- <span class="pull-right"><?php echo $msg['_raw']->A_RECORD_CREATE_DATE; ?></span></h3>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="panel-body">
|
|
|
|
|
- <?php echo htmlspecialchars($msg['message']); ?>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="panel-footer" style="overflow:hidden">
|
|
|
|
|
- <?php if (!empty($msg['_raw']->A_RECORD_UPDATE_DATE) && !empty($msg['_raw']->A_RECORD_UPDATE_AUTHOR)) : ?>
|
|
|
|
|
- <em style="margin-left:20px" class="text-muted">odczytana <?php echo $msg['_raw']->A_RECORD_UPDATE_DATE; ?> przez <?php echo $msg['_raw']->A_RECORD_UPDATE_AUTHOR; ?></em>
|
|
|
|
|
- <?php endif; ?>
|
|
|
|
|
- <?php if (!empty($msg['_raw']->A_RECORD_DELETE_DATE) && !empty($msg['_raw']->A_RECORD_DELETE_AUTHOR)) : ?>
|
|
|
|
|
- <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>
|
|
|
|
|
- <?php endif; ?>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-</div>
|
|
|
|
|
-<?php
|
|
|
|
|
- if (V::get('DBG_VIEW', '', $_GET)) $this->_testViewMsg($msg);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public function viewMsg($msg) {
|
|
public function viewMsg($msg) {
|
|
|
$usrLogin = User::getLogin();
|
|
$usrLogin = User::getLogin();
|
|
|
$idTable = 0;
|
|
$idTable = 0;
|
|
@@ -724,6 +664,7 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
$idTable = ProcesHelper::getZasobTableID($tblName);
|
|
$idTable = ProcesHelper::getZasobTableID($tblName);
|
|
|
if (!$idTable) throw new Exception("Nie udało się odnaleźć nr tabeli '{$tblName}'");
|
|
if (!$idTable) throw new Exception("Nie udało się odnaleźć nr tabeli '{$tblName}'");
|
|
|
$idRow = $msg['idRow'];
|
|
$idRow = $msg['idRow'];
|
|
|
|
|
+ if (!$idRow) throw new Exception("Brak numeru powiązanego rekordu!");
|
|
|
$usrAcl = User::getAcl();
|
|
$usrAcl = User::getAcl();
|
|
|
$tblAcl = $usrAcl->getTableAcl($idTable);
|
|
$tblAcl = $usrAcl->getTableAcl($idTable);
|
|
|
}
|
|
}
|
|
@@ -736,34 +677,45 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
<h3><i class="glyphicon glyphicon-envelope"></i> <a href="<?php echo $backLink; ?>">Wiadomości <?php echo $usrLogin; ?></a>
|
|
<h3><i class="glyphicon glyphicon-envelope"></i> <a href="<?php echo $backLink; ?>">Wiadomości <?php echo $usrLogin; ?></a>
|
|
|
» Wiadomość nr <?php echo $msg['_raw']->ID; ?>
|
|
» Wiadomość nr <?php echo $msg['_raw']->ID; ?>
|
|
|
<?php if ($idTable > 0) : ?>
|
|
<?php if ($idTable > 0) : ?>
|
|
|
- <br><small>wiadomość powiązana z rekordem <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>#EDIT/<?php echo $idRow; ?>"><?php echo $idRow; ?></a>
|
|
|
|
|
|
|
+<!-- <br><small>wiadomość powiązana z rekordem <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>#EDIT/<?php echo $idRow; ?>"><?php echo $idRow; ?></a>
|
|
|
z tabeli <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>"><?php echo $tblAcl->getLabel(); ?></a>
|
|
z tabeli <a href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>"><?php echo $tblAcl->getLabel(); ?></a>
|
|
|
</small>
|
|
</small>
|
|
|
|
|
+-->
|
|
|
|
|
+ <small style="display:block; text-align:right">
|
|
|
|
|
+ <a style="font-size:12px; line-height:15px; vertical-align:text-bottom;" title="Edytuj rekord" href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>#EDIT/<?php echo $idRow; ?>"><i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $idRow; ?></a>
|
|
|
|
|
+ <span style="font-size:12px; line-height:15px; vertical-align:text-bottom;">z tabeli</span>
|
|
|
|
|
+ <a style="font-size:12px; line-height:15px; vertical-align:text-bottom;" href="index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $idTable; ?>"><?php echo $tblAcl->getRawLabel(); ?></a>
|
|
|
|
|
+ </small>
|
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
</h3>
|
|
</h3>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+<?php $this->printWidgetViewMsg($msg); ?>
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function printWidgetViewMsg($msg) {
|
|
|
$messageList = array();
|
|
$messageList = array();
|
|
|
$uiTargetName = $msg['_raw']->uiTargetName;
|
|
$uiTargetName = $msg['_raw']->uiTargetName;
|
|
|
$uiTargetType = $msg['_raw']->uiTargetType;
|
|
$uiTargetType = $msg['_raw']->uiTargetType;
|
|
|
$replyLink = "index.php?_route=UserMsgs&_task=reply&uiTargetName={$uiTargetName}&uiTargetType={$uiTargetType}";
|
|
$replyLink = "index.php?_route=UserMsgs&_task=reply&uiTargetName={$uiTargetName}&uiTargetType={$uiTargetType}";
|
|
|
$markAsReadLink = "index.php?_route=UserMsgs&_task=markAsRead";
|
|
$markAsReadLink = "index.php?_route=UserMsgs&_task=markAsRead";
|
|
|
$message = $this->_convertMessageToJson($msg['_raw']);
|
|
$message = $this->_convertMessageToJson($msg['_raw']);
|
|
|
- if ($message->idThread > 0) {
|
|
|
|
|
|
|
+ {//if ($message->idThread > 0) {
|
|
|
$sqlLimit = 100;
|
|
$sqlLimit = 100;
|
|
|
$ds = DB::getDataSource();
|
|
$ds = DB::getDataSource();
|
|
|
|
|
+ $sqlIdThread = ($message->idThread > 0)? $message->idThread : $message->id;
|
|
|
$sql = "
|
|
$sql = "
|
|
|
select m.*
|
|
select m.*
|
|
|
from `CRM_UI_MSGS` m
|
|
from `CRM_UI_MSGS` m
|
|
|
- where (m.`idThread` = {$message->idThread} or m.`ID` = {$message->idThread})
|
|
|
|
|
- and m.`ID` < {$message->id}
|
|
|
|
|
|
|
+ where (m.`idThread` = {$sqlIdThread} or m.`ID` = {$sqlIdThread})
|
|
|
|
|
+ -- and m.`ID` < {$message->id}
|
|
|
order by m.`ID` asc
|
|
order by m.`ID` asc
|
|
|
limit {$sqlLimit}
|
|
limit {$sqlLimit}
|
|
|
";
|
|
";
|
|
|
$moreMsgs = $ds->getListByQuery($sql);
|
|
$moreMsgs = $ds->getListByQuery($sql);
|
|
|
foreach ($moreMsgs as $msg) $messageList[] = $this->_convertMessageToJson($msg);
|
|
foreach ($moreMsgs as $msg) $messageList[] = $this->_convertMessageToJson($msg);
|
|
|
}
|
|
}
|
|
|
- $messageList[] = $message;
|
|
|
|
|
|
|
+ //$messageList[] = $message;
|
|
|
?>
|
|
?>
|
|
|
<link rel="stylesheet" href="./stuff/widget-select.css">
|
|
<link rel="stylesheet" href="./stuff/widget-select.css">
|
|
|
<style type="text/css">
|
|
<style type="text/css">
|