- logo planeum
- status in news
- email in options
This commit is contained in:
2014-07-02 19:38:33 +02:00
parent e42c463826
commit 1f42d2286f
7 changed files with 51 additions and 21 deletions

BIN
images/logo_planeum_24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/logo_planeum_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -108,6 +108,7 @@ class Databap extends PhpObject
const OPT_IMAGE_CHAT = 6;
const OPT_STATUS = 7;
const OPT_CONSOLE = 8;
const OPT_EMAIL = 9;
//Options Values Id Constants
const OPT_CONSOLE_YES = 1;
@@ -195,7 +196,7 @@ class Databap extends PhpObject
$asOptions = array();
$asOptions['tables'] = array
(
self::USER_TABLE => array('first_name', 'last_name', 'email', MySqlManager::getId(self::COMP_TABLE), 'pass', 'auth_cookie', 'active', 'clearance'),
self::USER_TABLE => array('first_name', 'last_name', MySqlManager::getId(self::COMP_TABLE), 'pass', 'auth_cookie', 'active', 'clearance'),
self::COMP_TABLE => array(MySqlManager::getText(self::COMP_TABLE), 'logo'),
self::CODE_TABLE => array(MySqlManager::getText(self::CODE_TABLE), 'description', MySqlManager::getId(self::USER_TABLE), 'refer_id'),
self::URL_TABLE => array(MySqlManager::getId(self::CODE_TABLE), 'phrase'),
@@ -307,6 +308,7 @@ class Databap extends PhpObject
$iChatImageOptId = $this->oMySql->insertRow(self::OPTNAME_TABLE, array($sOptionNameIdCol=>self::OPT_IMAGE_CHAT, $sOptionNameCol=>'image du chat', 'type'=>self::OPT_TEXT, 'language'=>self::LANG_FR));
$iStatusOptId = $this->oMySql->insertRow(self::OPTNAME_TABLE, array($sOptionNameIdCol=>self::OPT_STATUS, $sOptionNameCol=>'mission en cours', 'type'=>self::OPT_TEXT, 'language'=>self::LANG_FR));
$iConsoleOptId = $this->oMySql->insertRow(self::OPTNAME_TABLE, array($sOptionNameIdCol=>self::OPT_CONSOLE, $sOptionNameCol=>'afficher la console du chat', 'type'=>self::OPT_SELECT, 'language'=>self::LANG_FR));
$iEmailOptId = $this->oMySql->insertRow(self::OPTNAME_TABLE, array($sOptionNameIdCol=>self::OPT_EMAIL, $sOptionNameCol=>'Email', 'type'=>self::OPT_TEXT, 'language'=>self::LANG_FR));
//Console Option
$asConsoleValues = array(self::OPT_CONSOLE_YES=>self::OPT_VAL_YES, self::OPT_CONSOLE_NO=>self::OPT_VAL_NO);
@@ -367,7 +369,8 @@ class Databap extends PhpObject
'all_chan_text'=>self::ALL_CHAN_TEXT,
'pm_separator'=>self::PM_SEP,
'reboot_delay'=>self::REBOOT_DELAY,
'versionHtml'=>$this->getItemBlock());
'versionHtml'=>$this->getItemBlock(),
'opt_console_no'=>self::OPT_CONSOLE_NO);
$oPage->setTag('constants', $this->jsonConvert($asConstants));
//Variables
@@ -375,6 +378,7 @@ class Databap extends PhpObject
$asVars['user_id'] = $this->getUserId();
$asVars['hash_to_page'] = $this->getPagesFromHash();
$asVars['page_to_hash'] = array_flip($asVars['hash_to_page']);
$asVars['opt_console'] = $this->getUserOptionValue(self::OPT_CONSOLE);
$oPage->setTag('variables', $this->jsonConvert($asVars));
return $oPage->getMask();
@@ -582,7 +586,6 @@ class Databap extends PhpObject
$asInfo = array('first_name'=>$sFirstName,
'last_name'=>$sLastName,
'email'=>$sEmail,
'active'=>self::MEMBER_ACTIVE,
MySqlManager::getId(self::COMP_TABLE)=>$iCompanyId,
'pass'=>$this->oAuth->HashPassword(self::getLoginToken($sCompany)),
@@ -603,7 +606,8 @@ class Databap extends PhpObject
//$this->oMySql->insertRow($sOptionTable, array($sUserIdCol=>$iUserId, $sOptNameIdCol=>self::OPT_TOKEN, $sOptionTextCol=>$this->generateExternalAccessLink('rss', $iUserId)));
//$this->oMySql->insertRow($sOptionTable, array($sUserIdCol=>$iUserId, $sOptNameIdCol=>self::OPT_IMAGE_CHAT, $sOptionTextCol=>'images/sap_gold_332.jpg'));
$this->oMySql->insertRow($sOptionTable, array($sUserIdCol=>$iUserId, $sOptNameIdCol=>self::OPT_CONSOLE, $sOptionValIdCol=>self::OPT_CONSOLE_NO));
$this->oMySql->insertRow($sOptionTable, array($sUserIdCol=>$iUserId, $sOptNameIdCol=>self::OPT_EMAIL, $sOptionTextCol=>$sEmail));
return $iUserId;
}
@@ -1052,10 +1056,12 @@ class Databap extends PhpObject
else
{
$asRow = $this->oMySql->selectRow(self::USER_TABLE, $iUserId);
$sEmail = $this->getUserOptionValue(self::OPT_EMAIL, $iUserId);
$asCompany = $this->oMySql->selectRow(self::COMP_TABLE, $asRow[MySqlManager::getId(self::COMP_TABLE)]);
$asUserInfo = array( 'name'=>self::getNameFormat($asRow['first_name'], $asRow['last_name']),
'nickname'=>self::getNickNameFormat($this->getChatNickNames($iUserId)),
'email'=>$asRow['email'],
'email'=>$sEmail,
'company'=>self::getCompanyFormat($asCompany[MySqlManager::getText(self::COMP_TABLE)]),
'status'=>$this->getDescriptionFormat($this->getUserOptionValue(self::OPT_STATUS, $iUserId)),
'logo'=>$asCompany['logo'],
@@ -1230,7 +1236,9 @@ class Databap extends PhpObject
//User Info
$asProfile['user'] = $this->getUserInfo($iUserId);
unset($asProfile['user']['email']);
unset($asProfile['user']['clearance']);
//History Info
$asTables = $this->getItemTables();
foreach($asTables as $sType=>$sTableName)
@@ -1747,12 +1755,12 @@ class Databap extends PhpObject
//Sort out messages for Json Export
$iPrefixLen = mb_strlen(self::JSON_PREFIX);
$iConsoleDisplay = $this->getUserOptionValue(self::OPT_CONSOLE);
//$iConsoleDisplay = $this->getUserOptionValue(self::OPT_CONSOLE);
$asMessages = array('messages'=>array(), 'last_message_id'=>0);
foreach($asSqlMessages as $iMessageId=>$asMessageInfo)
{
//Connection message filter
if($iConsoleDisplay==self::OPT_CONSOLE_NO && $asMessageInfo['type']==self::MESSAGE_CONN) continue;
//if($iConsoleDisplay==self::OPT_CONSOLE_NO && $asMessageInfo['type']==self::MESSAGE_CONN) continue;
//General message info
$iChanId = $asMessageInfo[MySqlManager::getId(self::CHAN_TABLE)];
@@ -1827,6 +1835,7 @@ class Databap extends PhpObject
{
$sMsgIdCol = MySqlManager::getId(self::MSG_TABLE);
//News
$asInfo['select'] = array($sMsgIdCol, 'nickname', MySqlManager::getText(self::MSG_TABLE), 'led');
$asInfo['from'] = self::MSG_TABLE;
$asInfo['constraint'] = array('type'=>self::MESSAGE_NEWS);
@@ -1834,8 +1843,19 @@ class Databap extends PhpObject
$asInfo['limit'] = 3;
$asNews = $this->oMySql->selectRows($asInfo);
//Status
$asInfo['constraint'] = array('type'=>self::MESSAGE_STATUS);
$asStatus = $this->oMySql->selectRows($asInfo);
//Sorting
//FIXME find a way to do it in SQL
$asNews = array_merge($asNews, $asStatus);
foreach($asNews as $iKey=>$asNewsInfo) $asNewsSort[$iKey] = strtotime($asNewsInfo['led']);
arsort($asNewsSort);
foreach($asNewsSort as $iKey=>$iTimestamp) $asNews2[] = $asNews[$iKey];
$asFormatNews = array();
foreach($asNews as $asNew)
foreach($asNews2 as $asNew)
{
$iMsgId = '-'.$asNew[$sMsgIdCol];
$asFormatNews[$iMsgId]['time_desc'] = ToolBox::getDateTimeDesc($asNew['led']);
@@ -2255,9 +2275,9 @@ class Databap extends PhpObject
$sPass = '';
if($iUserId>0)
{
$asUser = $this->oMySql->selectRow(self::USER_TABLE, $iUserId, array('first_name', 'last_name', 'email', MySqlManager::getId(self::COMP_TABLE)));
$asUser = $this->oMySql->selectRow(self::USER_TABLE, $iUserId, array('first_name', 'last_name', MySqlManager::getId(self::COMP_TABLE)));
$sCompanyName = $this->oMySql->selectvalue(self::COMP_TABLE, MySqlManager::getText(self::COMP_TABLE), $asUser[MySqlManager::getId(self::COMP_TABLE)]);
$sPass = $asUser['first_name'].$asUser['last_name'].$asUser['email'].$sCompanyName;
$sPass = $asUser['first_name'].$asUser['last_name'].$sCompanyName;
}
else $this->addError('generating token : invalid user id "'.$iUserId.'"');
return $sPass;

View File

@@ -187,7 +187,7 @@ if($bUserOk && $sAction!=Databap::EXT_ACCESS)
{
case 'add_user':
$asInfo = explode('-', strtolower($oUser));
$sResult = 'User added. Id='.$oDatabap->addUser($asInfo[0], $asInfo[1], $asInfo[2]);
$sResult = 'User added. Id='.$oDatabap->addUser($asInfo[0], $asInfo[1], $asInfo[2], array_key_exists(3, $asInfo)?$asInfo[3]:'');
break;
case 'build_index':
$oDatabap->buildCompleteIndex();

View File

@@ -77,10 +77,11 @@ databap.pageInit = function()
databap.consts.chanUnreadPrefix = 'unread_chan_';
//Page variables
databap.tmp('sending_msg', 'boolean');
databap.tmp('refresh', 'boolean');
self.tmp('sending_msg', 'boolean');
self.tmp('refresh', 'boolean');
self.vars2('unread_msg', 'object');
databap.tmp('news_period', 10*60*1000);
self.tmp('news_period', 10*60*1000);
self.tmp('get_news', false);
//Main elements
$MsgInput = databap.getMainElem('#message');
@@ -541,7 +542,7 @@ function add_message(e)
//Finding last word
var last_word = (chat_message.lastIndexOf(" ")==-1)?chat_message:chat_message.substr(chat_message.lastIndexOf(" ") + 1);
debug(last_word);
//debug(last_word);
if(last_word.substr(0, 1)=='@') last_word = last_word.substr(1);
var last_word_len = last_word.length;
@@ -653,6 +654,10 @@ function refresh_chat(bReset)
}
);
//News
if(databap.tmp('get_news') === true && !bReset) getNews();
databap.tmp('get_news', false);
//Nicknames changes
if(updateUsersList === true || prevLastMsgId == 0)
{
@@ -694,7 +699,7 @@ function addMessage(message_info, bReset)
msg_body = sMsgPrefix+'<span class="text">'+message_info.message+'</span>';
break;
case 'NW':
if(!bReset) getNews();
databap.tmp('get_news', true);
msg_body = '<span class="text action">'+message_info.nickname+' a une news : <span class="news"><i class="fa fa-30 fa-c-news"></i> '+message_info.message+' <i class="fa fa-30 fa-c-news"></i></span></span>';
break;
case 'A':
@@ -728,7 +733,7 @@ function addMessage(message_info, bReset)
break;
case 'C':
updateUsersList = true;
msg_body = '<span class="text action">'+message_info.nickname+' '+message_info.message+'</span>';
msg_body = (self.vars2('opt_console')==self.consts.opt_console_no)?'':'<span class="text action">'+message_info.nickname+' '+message_info.message+'</span>';
break;
case 'I':
var msg = '<a href="'+message_info.message[3]+'" target="_blank"><img src="'+message_info.message[0]+'" width="'+message_info.message[1]+'" height="'+message_info.message[2]+'" class="proxy"></a>';
@@ -755,6 +760,7 @@ function addMessage(message_info, bReset)
break;
case 'S':
updateUsersList = true;
databap.tmp('get_news', true);
msg_body = '<span class="text action">'+message_info.nickname+' '+message_info.message+'</span>';
break;
case 'DA':

View File

@@ -31,7 +31,7 @@ databap.pageInit = function()
//user history
$UserHistory = databap.getMainElem('#user_history');
if(typeof profile.history != 'undefined')
if(profile.history!= null && typeof profile.history != 'undefined')
{
$.each
(

8
todo
View File

@@ -7,13 +7,14 @@ Internal:
- Independant Option Class
Bug fix:
- [1.0.0] Fix les "xxx se déconnecte" intempestives
- [1.0.0] Tab dans chat
- [1.0.1] Check le document type plutot que l'extension pour les /img
- [1.0.1] Resize .gif
- [1.0.1] Tab dans chat
- [1.0.1] Request anti repost : POST REDIRECT GET : http://en.wikipedia.org/wiki/Post/Redirect/Get
- Fix les "xxx se déconnecte" intempestives
Améliorations
- liste complète : ajouter des tabs pour sélectionner soit code, soit article, soit table...
- [1.1.0] Chat : compatibilité mobile (utiliser la fonctionnalité ff)
- [1.1.0] search : add tagname, like code:blabla to search blabla in codes only
- delete phrases table / généraliser ?
@@ -38,5 +39,8 @@ Testing
MEP 1.0.0
---------
- Ajouter l'option 9 (email) : insert into option_names (option_name, type, language) values ('email', 'T', 'FR');
- copier les emails de users à options
- supprimer colonne email de users
- Remplacer le External Access Token dans sap_website_parser.sh
- Faire un nouvel export de base