unified feedback v1
This commit is contained in:
@@ -63,6 +63,7 @@ class Databap extends PhpObject
|
|||||||
const SUCCESS = '__SUCCESS__';
|
const SUCCESS = '__SUCCESS__';
|
||||||
const DISCONNECTED = '__DISCONNECTED__';
|
const DISCONNECTED = '__DISCONNECTED__';
|
||||||
const NOT_FOUND = '__NOT_FOUND__';
|
const NOT_FOUND = '__NOT_FOUND__';
|
||||||
|
const NOT_AUTH = '__NOT_AUTHORIZED__';
|
||||||
const FAIL_INSERT = '__FAIL_INSERT__';
|
const FAIL_INSERT = '__FAIL_INSERT__';
|
||||||
const FAIL_UPDATE = '__FAIL_UPDATE__';
|
const FAIL_UPDATE = '__FAIL_UPDATE__';
|
||||||
const FAIL_DELETE = '__FAIL_DELETE__';
|
const FAIL_DELETE = '__FAIL_DELETE__';
|
||||||
@@ -380,7 +381,12 @@ class Databap extends PhpObject
|
|||||||
'version_date'=>self::VERSION_DATE,
|
'version_date'=>self::VERSION_DATE,
|
||||||
'default_page'=>$sPage,
|
'default_page'=>$sPage,
|
||||||
'default_id'=>$oItemId,
|
'default_id'=>$oItemId,
|
||||||
'errors'=>array('disconnected'=>self::DISCONNECTED, 'not_found'=>self::NOT_FOUND, 'insert'=>self::FAIL_INSERT, 'update'=>self::FAIL_UPDATE, 'delete'=>self::FAIL_DELETE),
|
'errors'=>array('disconnected'=>self::DISCONNECTED,
|
||||||
|
'not_authorized'=>self::NOT_AUTH,
|
||||||
|
'not_found'=>self::NOT_FOUND,
|
||||||
|
'insert'=>self::FAIL_INSERT,
|
||||||
|
'update'=>self::FAIL_UPDATE,
|
||||||
|
'delete'=>self::FAIL_DELETE),
|
||||||
'success'=>self::SUCCESS,
|
'success'=>self::SUCCESS,
|
||||||
'error'=>self::ERROR,
|
'error'=>self::ERROR,
|
||||||
'keep_alive'=>self::KEEP_ALIVE,
|
'keep_alive'=>self::KEEP_ALIVE,
|
||||||
@@ -1416,14 +1422,16 @@ class Databap extends PhpObject
|
|||||||
$iCompChan = array_search($sChanSafeName, array_map(array('self', 'getChanSafeName'), $asCompanies));
|
$iCompChan = array_search($sChanSafeName, array_map(array('self', 'getChanSafeName'), $asCompanies));
|
||||||
$asPm = $this->isPmChan($sChanSafeName);
|
$asPm = $this->isPmChan($sChanSafeName);
|
||||||
|
|
||||||
return $sChanSafeName!='' && //Empty channel name
|
return $sChanSafeName!='' && //Empty channel name
|
||||||
($iCompChan===false || $asUserInfo['company']==self::getCompanyFormat($asCompanies[$iCompChan])) && //Test Company Channel
|
($iCompChan===false || $asUserInfo['company']==self::getCompanyFormat($asCompanies[$iCompChan])) && //Test Company Channel
|
||||||
(!$asPm['is_pm'] || $iUserId==$asPm['from'] || $iUserId==$asPm['to']); //Test PM
|
(!$asPm['is_pm'] || $iUserId==$asPm['from'] || $iUserId==$asPm['to']); //Test PM
|
||||||
}
|
}
|
||||||
|
|
||||||
public function joinChan($sChanName, $bFirstConn=false, $asAttendees=array())
|
public function joinChan($sChanName, $bFirstConn=false, $asAttendees=array())
|
||||||
{
|
{
|
||||||
$asResult = array('success'=>self::ERROR);
|
$bSuccess = false;
|
||||||
|
$sDesc = '';
|
||||||
|
$asVars = array();
|
||||||
$sSafeChanName = self::getChanSafeName($sChanName);
|
$sSafeChanName = self::getChanSafeName($sChanName);
|
||||||
|
|
||||||
//Authorization to join channel
|
//Authorization to join channel
|
||||||
@@ -1457,21 +1465,21 @@ class Databap extends PhpObject
|
|||||||
//Is user already connected to this chan
|
//Is user already connected to this chan
|
||||||
$bConnectedUser = $this->isUserConnected($iChanId);
|
$bConnectedUser = $this->isUserConnected($iChanId);
|
||||||
$iConnId = $this->oMySql->insertUpdateRow(self::CONN_TABLE, array($sUserIdCol=>$this->getUserId(), $sChanIdCol=>$iChanId), array($sUserIdCol, $sChanIdCol), false);
|
$iConnId = $this->oMySql->insertUpdateRow(self::CONN_TABLE, array($sUserIdCol=>$this->getUserId(), $sChanIdCol=>$iChanId), array($sUserIdCol, $sChanIdCol), false);
|
||||||
if($iConnId>0) $asResult['success'] = self::SUCCESS;
|
if($iConnId>0) $bSuccess = true;
|
||||||
|
|
||||||
if($asResult['success']==self::SUCCESS)
|
if($bSuccess)
|
||||||
{
|
{
|
||||||
//Return connected channels
|
//Return connected channels
|
||||||
$asResult['channels'] = $this->getChannels($this->getUserId());
|
$asVars['channels'] = $this->getChannels($this->getUserId());
|
||||||
|
|
||||||
//Add tab title (customized)
|
//Add tab title (customized)
|
||||||
//FIXME delete this shit and insert the channel type into channels DB table
|
//FIXME delete this shit and insert the channel type into channels DB table
|
||||||
foreach($asResult['channels'] as $iConnectedChanId=>$sConnectedChanName)
|
foreach($asVars['channels'] as $iConnectedChanId=>$sConnectedChanName)
|
||||||
{
|
{
|
||||||
$asPm = $this->isPmChan($sConnectedChanName);
|
$asPm = $this->isPmChan($sConnectedChanName);
|
||||||
$asResult['channel_tab_names'][$iConnectedChanId] = $asPm['is_pm']?$this->getChatNickNames($asPm['from']==$this->getUserId()?$asPm['to']:$asPm['from']):$sConnectedChanName;
|
$asVars['channel_tab_names'][$iConnectedChanId] = $asPm['is_pm']?$this->getChatNickNames($asPm['from']==$this->getUserId()?$asPm['to']:$asPm['from']):$sConnectedChanName;
|
||||||
}
|
}
|
||||||
$asResult['current_chan_id'] = $iChanId;
|
$asVars['current_chan_id'] = $iChanId;
|
||||||
|
|
||||||
//Communicate on user's connection
|
//Communicate on user's connection
|
||||||
if(!$bConnectedUser)
|
if(!$bConnectedUser)
|
||||||
@@ -1502,9 +1510,11 @@ class Databap extends PhpObject
|
|||||||
//Update chan leds
|
//Update chan leds
|
||||||
$this->pingChans();
|
$this->pingChans();
|
||||||
}
|
}
|
||||||
|
else $sDesc = self::FAIL_UPDATE;
|
||||||
}
|
}
|
||||||
|
else $sDesc = 'Nom de chan non autorisé (nom de personne / nom de société interdit)';
|
||||||
|
|
||||||
return self::jsonExport($asResult);
|
return self::getJsonPostResult($bSuccess, $sDesc, $asVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isUserConnected($iChanId=0, $iUserId=0)
|
private function isUserConnected($iChanId=0, $iUserId=0)
|
||||||
|
|||||||
35
jquery/databap.js
vendored
35
jquery/databap.js
vendored
@@ -339,7 +339,7 @@ function Databap()
|
|||||||
{
|
{
|
||||||
//Add page Header
|
//Add page Header
|
||||||
self.$title
|
self.$title
|
||||||
.find('.h1_wrap').attr('id', self.vars.current_page+'_title')
|
.find('.side_margins').attr('id', self.vars.current_page+'_title')
|
||||||
.find('#title_text').text(self.vars.page_titles[self.vars.current_page]);
|
.find('#title_text').text(self.vars.page_titles[self.vars.current_page]);
|
||||||
self.$title.fadeTo(self.consts.transTime, 1);
|
self.$title.fadeTo(self.consts.transTime, 1);
|
||||||
self.vars.pageIcon = 'fa-c-'+self.vars.current_page;
|
self.vars.pageIcon = 'fa-c-'+self.vars.current_page;
|
||||||
@@ -360,11 +360,11 @@ function Databap()
|
|||||||
|
|
||||||
this.pageIcon = function(pageIcon, comment)
|
this.pageIcon = function(pageIcon, comment)
|
||||||
{
|
{
|
||||||
var $Header = $('#'+self.vars.current_page+'_title');
|
self.$title
|
||||||
$Header.find('i')
|
.find('h1').attr('title', comment || '')
|
||||||
.attr('class', 'fa fa-fw fa-20')
|
.find('#page_icon')
|
||||||
.addClass(pageIcon);
|
.attr('class', 'fa fa-fw fa-20')
|
||||||
$Header.find('h1').attr('title', comment || '');
|
.addClass(pageIcon);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addBufferIcon = function()
|
this.addBufferIcon = function()
|
||||||
@@ -432,7 +432,8 @@ function Databap()
|
|||||||
this.saveForm = function(action, $form, fOnSuccess, bProcessIcon, dataType)
|
this.saveForm = function(action, $form, fOnSuccess, bProcessIcon, dataType)
|
||||||
{
|
{
|
||||||
var sFormVars = $form.serialize();
|
var sFormVars = $form.serialize();
|
||||||
if(typeof bProcessIcon != 'undefined') self.addBufferIcon();
|
bProcessIcon = bProcessIcon || false;
|
||||||
|
if(bProcessIcon) self.addBufferIcon();
|
||||||
if(!dataType) dataType = 'text';
|
if(!dataType) dataType = 'text';
|
||||||
|
|
||||||
self.vars.loading = true;
|
self.vars.loading = true;
|
||||||
@@ -446,7 +447,7 @@ function Databap()
|
|||||||
{
|
{
|
||||||
self.vars.loading = false;
|
self.vars.loading = false;
|
||||||
self.vars.disconnected = false;
|
self.vars.disconnected = false;
|
||||||
if(typeof bProcessIcon != 'undefined') self.resetIcon();
|
if(bProcessIcon) self.resetIcon();
|
||||||
fOnSuccess(result);
|
fOnSuccess(result);
|
||||||
},
|
},
|
||||||
error: function(jqXHR, textStatus, errorThrown)
|
error: function(jqXHR, textStatus, errorThrown)
|
||||||
@@ -465,7 +466,8 @@ function Databap()
|
|||||||
{
|
{
|
||||||
if(!vars) vars = {};
|
if(!vars) vars = {};
|
||||||
if(!type) type = 'html';
|
if(!type) type = 'html';
|
||||||
if(typeof bProcessIcon != 'undefined') self.addBufferIcon();
|
bProcessIcon = bProcessIcon || false;
|
||||||
|
if(bProcessIcon) self.addBufferIcon();
|
||||||
|
|
||||||
vars['a'] = action;
|
vars['a'] = action;
|
||||||
self.vars.loading = true;
|
self.vars.loading = true;
|
||||||
@@ -482,7 +484,7 @@ function Databap()
|
|||||||
{
|
{
|
||||||
self.vars.loading = false;
|
self.vars.loading = false;
|
||||||
self.vars.disconnected = false;
|
self.vars.disconnected = false;
|
||||||
if(typeof bProcessIcon != 'undefined') self.resetIcon();
|
if(bProcessIcon) self.resetIcon();
|
||||||
fOnSuccess(result);
|
fOnSuccess(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -493,7 +495,7 @@ function Databap()
|
|||||||
self.vars.loading = false;
|
self.vars.loading = false;
|
||||||
self.vars.disconnected = true;
|
self.vars.disconnected = true;
|
||||||
debug('Error databap.js 361');
|
debug('Error databap.js 361');
|
||||||
if(typeof bProcessIcon != 'undefined') self.resetIcon();
|
if(bProcessIcon) self.resetIcon();
|
||||||
if(!fOnError)
|
if(!fOnError)
|
||||||
{
|
{
|
||||||
self.showError(textStatus);
|
self.showError(textStatus);
|
||||||
@@ -846,6 +848,17 @@ function Databap()
|
|||||||
$msg.hide().insertBefore(elem).slideDown('fast', function(){databap.updateScrollBar('bottom');}).delay(5000).slideUp('fast', function(){$(this).remove();databap.updateScrollBar();});
|
$msg.hide().insertBefore(elem).slideDown('fast', function(){databap.updateScrollBar('bottom');}).delay(5000).slideUp('fast', function(){$(this).remove();databap.updateScrollBar();});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.feedback = function(sClass, sMsg)
|
||||||
|
{
|
||||||
|
$('<span>', {'class':'feedback '+sClass})
|
||||||
|
.append($('<i>', {'class':'fa fa-inline'}))
|
||||||
|
.append(self.addPunctuation(sMsg))
|
||||||
|
.appendTo('#title_feedback')
|
||||||
|
.slideDown('fast')
|
||||||
|
.delay(5000)
|
||||||
|
.slideUp('fast', function(){$(this).remove();});
|
||||||
|
};
|
||||||
|
|
||||||
this.setTitle = function(extra)
|
this.setTitle = function(extra)
|
||||||
{
|
{
|
||||||
if(!extra)
|
if(!extra)
|
||||||
|
|||||||
@@ -319,25 +319,33 @@ function joinChan(sChanName, bFirstConn, asAttendees, bSwitchOnJoin)
|
|||||||
databap.getInfo
|
databap.getInfo
|
||||||
(
|
(
|
||||||
'join_chan',
|
'join_chan',
|
||||||
function(result)
|
function(data)
|
||||||
{
|
{
|
||||||
//Add to channels list
|
debug(data);
|
||||||
var sConnectedChanKeyName = '';
|
if(data.result == databap.consts.error)
|
||||||
$.each
|
{
|
||||||
(
|
databap.feedback('error', data.desc);
|
||||||
result.channels,
|
}
|
||||||
function(iChanId, sReturnedChanName)
|
else
|
||||||
{
|
{
|
||||||
//Add tab if not already there
|
//Add to channels list
|
||||||
if(!getChanName(iChanId)) addChanTab(iChanId, sReturnedChanName, result.channel_tab_names[iChanId], !bSwitchOnJoin);
|
var sConnectedChanKeyName = '';
|
||||||
}
|
$.each
|
||||||
);
|
(
|
||||||
|
data.channels,
|
||||||
|
function(iChanId, sReturnedChanName)
|
||||||
|
{
|
||||||
|
//Add tab if not already there
|
||||||
|
if(!getChanName(iChanId)) addChanTab(iChanId, sReturnedChanName, data.channel_tab_names[iChanId], !bSwitchOnJoin);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
//Full reload of messages
|
//Full reload of messages
|
||||||
refresh_chat(true);
|
refresh_chat(true);
|
||||||
|
|
||||||
//Switch to the right chan
|
//Switch to the right chan
|
||||||
switchChan(bSwitchOnJoin?result.current_chan_id:null);
|
switchChan(bSwitchOnJoin?data.current_chan_id:null);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{chan:sChanName, first_conn:(bFirstConn?1:0), attendees:asAttendees},
|
{chan:sChanName, first_conn:(bFirstConn?1:0), attendees:asAttendees},
|
||||||
'json',
|
'json',
|
||||||
@@ -638,7 +646,6 @@ function refresh_chat(bReset)
|
|||||||
{
|
{
|
||||||
var prevLastMsgId = self.tmp('last_message_id');;
|
var prevLastMsgId = self.tmp('last_message_id');;
|
||||||
updateUsersList = false;
|
updateUsersList = false;
|
||||||
databap.resetIcon();
|
|
||||||
if(prevLastMsgId < result.last_message_id || bReset)
|
if(prevLastMsgId < result.last_message_id || bReset)
|
||||||
{
|
{
|
||||||
//Update last read message id
|
//Update last read message id
|
||||||
|
|||||||
@@ -62,10 +62,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="main_container" class="round">
|
<div id="main_container" class="round">
|
||||||
<div id="page_title">
|
<div id="page_title">
|
||||||
<div class="h1_wrap side_margins">
|
<div class="side_margins">
|
||||||
<h1 class="round">
|
<h1 class="round">
|
||||||
<i class="fa fa-fw fa-20 fa-c-loading fa-spin"></i>
|
<i id="page_icon" class="fa fa-fw fa-20 fa-c-loading fa-spin"></i>
|
||||||
<span id="title_text">Chargement...</span>
|
<span id="title_text">Chargement...</span>
|
||||||
|
<span id="title_feedback"></span>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -301,19 +301,6 @@ a[href^="table"].internal_link span.item {
|
|||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h1_wrap h1 {
|
|
||||||
margin:0 -12px 12px;
|
|
||||||
padding:12px 10px;
|
|
||||||
width:100%;
|
|
||||||
border:2px solid #04357B;
|
|
||||||
background-color:#D9E5F2;
|
|
||||||
font-family:Arial;
|
|
||||||
font-size:32px;
|
|
||||||
line-height:32px;
|
|
||||||
font-style:italic;
|
|
||||||
font-weight:600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.author_box {
|
.author_box {
|
||||||
padding:5px 10px;
|
padding:5px 10px;
|
||||||
border:1px solid #04357B;
|
border:1px solid #04357B;
|
||||||
@@ -1250,6 +1237,40 @@ vertical-align 0% -5% -10% -15% -20% -25% -30%
|
|||||||
margin-bottom:10px;
|
margin-bottom:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#page_title h1 {
|
||||||
|
margin:0 -12px 12px;
|
||||||
|
padding:12px 10px;
|
||||||
|
width:100%;
|
||||||
|
border:2px solid #04357B;
|
||||||
|
font-family:Arial;
|
||||||
|
font-size:32px;
|
||||||
|
line-height:32px;
|
||||||
|
font-style:italic;
|
||||||
|
font-weight:600;
|
||||||
|
|
||||||
|
background: #D9E5F2;
|
||||||
|
background: -moz-linear-gradient(45deg, #D9E5F2 25%, #ffffff 75%);
|
||||||
|
background: -webkit-gradient(linear, left bottom, right top, color-stop(25%,#D9E5F2), color-stop(75%,#ffffff));
|
||||||
|
background: -webkit-linear-gradient(45deg, #D9E5F2 25%,#ffffff 75%);
|
||||||
|
background: -o-linear-gradient(45deg, #D9E5F2 25%,#ffffff 75%);
|
||||||
|
background: -ms-linear-gradient(45deg, #D9E5F2 25%,#ffffff 75%);
|
||||||
|
background: linear-gradient(45deg, #D9E5F2 25%,#ffffff 75%);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D9E5F2', endColorstr='#ffffff',GradientType=1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#page_title h1 #title_feedback {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#title_feedback .feedback {
|
||||||
|
margin:0;
|
||||||
|
padding: 0 5px;
|
||||||
|
border:none;
|
||||||
|
position:absolute;
|
||||||
|
right:10px;
|
||||||
|
top:14px;
|
||||||
|
}
|
||||||
|
|
||||||
#main {
|
#main {
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
|
|||||||
Reference in New Issue
Block a user