diff --git a/assets/js/custom.js b/assets/js/custom.js
index 572d9a9..eb2b6f9 100644
--- a/assets/js/custom.js
+++ b/assets/js/custom.js
@@ -74,23 +74,10 @@ function playReceptionSound ()
jQuery(document).ready(function()
{
- jQuery('.datatable').DataTable({
- "pageLength": 25,
- "bLengthChange": false,
- "language": {
- "url": HTTP_PWD + "/assets/js/datatables/french.json",
- },
- "columnDefs": [{
- 'targets': 'checkcolumn',
- 'orderable': false,
- }],
- });
-
jQuery('.datatable').on('draw.dt', function (){
jQuery('body :checkbox').off('shiftcheckbox');
jQuery('body :checkbox').shiftcheckbox();
});
-
var verifReceivedInterval = setInterval(verifReceived, 10000);
diff --git a/controllers/publics/Command.php b/controllers/publics/Command.php
index c3cf06a..7536aa9 100644
--- a/controllers/publics/Command.php
+++ b/controllers/publics/Command.php
@@ -42,8 +42,17 @@ namespace controllers\publics;
*/
public function list()
{
- $commands = $this->internal_command->list_for_user($_SESSION['user']['id']);
- $this->render('command/list', ['commands' => $commands]);
+ $this->render('command/list');
+ }
+
+ /**
+ * Return commands as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_command->list_for_user($_SESSION['user']['id']);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/ConditionalGroup.php b/controllers/publics/ConditionalGroup.php
index aea5dc6..194b3a5 100644
--- a/controllers/publics/ConditionalGroup.php
+++ b/controllers/publics/ConditionalGroup.php
@@ -48,9 +48,19 @@ namespace controllers\publics;
{
$page = (int) $page;
- $groups = $this->internal_conditional_group->list_for_user($_SESSION['user']['id'], 25, $page);
+ $groups = $this->internal_conditional_group->list_for_user($_SESSION['user']['id']);
$this->render('conditional_group/list', ['groups' => $groups]);
}
+
+ /**
+ * Return conditionnals groups as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_conditional_group->list_for_user($_SESSION['user']['id']);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
+ }
/**
* Cette fonction va supprimer une liste de groups.
diff --git a/controllers/publics/Contact.php b/controllers/publics/Contact.php
index b20b04d..e931750 100644
--- a/controllers/publics/Contact.php
+++ b/controllers/publics/Contact.php
@@ -40,9 +40,22 @@ namespace controllers\publics;
*/
public function list()
{
- $contacts = $this->internal_contact->list_for_user($_SESSION['user']['id']);
+ return $this->render('contact/list');
+ }
+
+ /**
+ * Return contacts as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_contact->list_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
+ {
+ $entity['number_formatted'] = \controllers\internals\Tool::phone_link($entity['number']);
+ }
- return $this->render('contact/list', ['contacts' => $contacts]);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/Discussion.php b/controllers/publics/Discussion.php
index 784013e..81e540e 100644
--- a/controllers/publics/Discussion.php
+++ b/controllers/publics/Discussion.php
@@ -46,21 +46,24 @@ namespace controllers\publics;
*/
public function list()
{
- $discussions = $this->internal_received->get_discussions_for_user($_SESSION['user']['id']);
+ $this->render('discussion/list');
+ }
+
+ /**
+ * Return discussions as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_received->get_discussions_for_user($_SESSION['user']['id']);
- foreach ($discussions as $key => $discussion)
+ foreach ($entities as &$entity)
{
- if (!$contact = $this->internal_contact->get_by_number_and_user($_SESSION['user']['id'], $discussion['number']))
- {
- continue;
- }
-
- $discussions[$key]['contact'] = $contact['name'];
+ $entity['number_formatted'] = \controllers\internals\Tool::phone_link($entity['number']);
+ $entity['link'] = \descartes\Router::url('Discussion', 'show', ['number' => $entity['number']]);
}
- $this->render('discussion/list', [
- 'discussions' => $discussions,
- ]);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/Event.php b/controllers/publics/Event.php
index 17b616c..84445c6 100644
--- a/controllers/publics/Event.php
+++ b/controllers/publics/Event.php
@@ -40,8 +40,22 @@ namespace controllers\publics;
*/
public function list()
{
- $events = $this->internal_event->list_for_user($_SESSION['user']['id']);
- $this->render('event/list', ['events' => $events, 'nb_results' => \count($events)]);
+ $this->render('event/list');
+ }
+
+ /**
+ * Return events as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_event->list_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
+ {
+ $entity['icon'] = \controllers\internals\Tool::event_type_to_icon($entity['type']);
+ }
+
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
@@ -60,6 +74,13 @@ namespace controllers\publics;
return $this->redirect(\descartes\Router::url('Event', 'list'));
}
+
+ if (!\controllers\internals\Tool::is_admin())
+ {
+ \FlashMessage\FlashMessage::push('danger', 'Vous devez être administrateur pour supprimer un event !');
+
+ return $this->redirect(\descartes\Router::url('Event', 'list'));
+ }
$ids = $_GET['ids'] ?? [];
foreach ($ids as $id)
diff --git a/controllers/publics/Group.php b/controllers/publics/Group.php
index 61c2514..95dbf47 100644
--- a/controllers/publics/Group.php
+++ b/controllers/publics/Group.php
@@ -42,15 +42,18 @@ namespace controllers\publics;
*/
public function list()
{
- $groups = $this->internal_group->list_for_user($_SESSION['user']['id']);
-
- foreach ($groups as $key => $group)
- {
- $contacts = $this->internal_group->get_contacts($group['id']);
- $groups[$key]['nb_contacts'] = \count($contacts);
- }
-
- $this->render('group/list', ['groups' => $groups]);
+ $this->render('group/list');
+ }
+
+
+ /**
+ * Return groups as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_group->list_for_user($_SESSION['user']['id']);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/Phone.php b/controllers/publics/Phone.php
index 37655c3..b942062 100644
--- a/controllers/publics/Phone.php
+++ b/controllers/publics/Phone.php
@@ -72,6 +72,51 @@ class Phone extends \descartes\Controller
$this->render('phone/list', ['phones' => $phones]);
}
+ /**
+ * Return phones as json with additionnals datas about callbacks
+ */
+ public function list_json()
+ {
+ $id_user = $_SESSION['user']['id'];
+ $api_key = $_SESSION['user']['api_key'];
+ $phones = $this->internal_phone->list_for_user($id_user);
+
+ $adapters = [];
+ $adapters = $this->internal_adapter->list_adapters();
+ foreach ($adapters as $key => $adapter)
+ {
+ unset($adapters[$key]);
+ $adapters[$adapter['meta_classname']] = $adapter;
+ }
+
+ foreach ($phones as &$phone)
+ {
+ $adapter = $adapters[$phone['adapter']] ?? false;
+
+ if (!$adapter)
+ {
+ $phone['adapter'] = 'Inconnu';
+
+ continue;
+ }
+
+ $phone['adapter'] = $adapter['meta_name'];
+
+ if ($adapter['meta_support_reception'])
+ {
+ $phone['callback_reception'] = \descartes\Router::url('Callback', 'reception', ['adapter_uid' => $adapter['meta_uid'], 'id_phone' => $phone['id']], ['api_key' => $api_key]);
+ }
+
+ if ($adapter['meta_support_status_change'])
+ {
+ $phone['callback_status'] = \descartes\Router::url('Callback', 'update_sended_status', ['adapter_uid' => $adapter['meta_uid']], ['api_key' => $api_key]);
+ }
+ }
+
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $phones]);
+ }
+
/**
* Cette fonction va supprimer une liste de phones.
*
diff --git a/controllers/publics/Received.php b/controllers/publics/Received.php
index 9b946d5..28bd2b4 100644
--- a/controllers/publics/Received.php
+++ b/controllers/publics/Received.php
@@ -41,32 +41,22 @@ namespace controllers\publics;
*/
public function list()
{
- $receiveds = $this->internal_received->list_for_user($_SESSION['user']['id']);
-
- foreach ($receiveds as $key => $received)
+ $this->render('received/list', ['is_unread' => false]);
+ }
+
+ /**
+ * Return received as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_received->list_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
{
- if ('read' !== $received['status'])
- {
- $this->internal_received->mark_as_read_for_user($_SESSION['user']['id'], $received['id']);
- }
-
- if (null !== $received['id_phone'])
- {
- $phone = $this->internal_phone->get_for_user($_SESSION['user']['id'], $received['id_phone']);
- if ($phone)
- {
- $receiveds[$key]['phone_name'] = $phone['name'];
- }
- }
-
- $contact = $this->internal_contact->get_by_number_and_user($_SESSION['user']['id'], $received['origin']);
- if ($contact)
- {
- $receiveds[$key]['contact'] = $contact['name'];
- }
+ $entity['origin_formatted'] = \controllers\internals\Tool::phone_link($entity['origin']);
}
- $this->render('received/list', ['receiveds' => $receiveds, 'nb_results' => \count($receiveds)]);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
@@ -74,29 +64,56 @@ namespace controllers\publics;
*/
public function list_unread()
{
- $receiveds = $this->internal_received->list_unread_for_user($_SESSION['user']['id']);
-
- foreach ($receiveds as $key => $received)
+ $this->render('received/list', ['is_unread' => true]);
+ }
+
+ /**
+ * Return unred received as json
+ */
+ public function list_unread_json()
+ {
+ $entities = $this->internal_received->list_unread_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
{
- $this->internal_received->mark_as_read_for_user($_SESSION['user']['id'], $received['id']);
+ $entity['origin_formatted'] = \controllers\internals\Tool::phone_link($entity['origin']);
+ }
- if (null !== $received['id_phone'])
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
+ }
+
+ /**
+ * Mark messages as
+ *
+ * @param string $status : New status of the message, read or unread
+ * @param array int $_GET['ids'] : Ids of receiveds to delete
+ * @param mixed $csrf
+ *
+ * @return boolean;
+ */
+ public function mark_as ($status, $csrf)
+ {
+ if (!$this->verify_csrf($csrf))
+ {
+ \FlashMessage\FlashMessage::push('danger', 'Jeton CSRF invalid !');
+
+ return $this->redirect(\descartes\Router::url('Received', 'list'));
+ }
+
+ $ids = $_GET['ids'] ?? [];
+ foreach ($ids as $id)
+ {
+ if ($status === \models\Received::STATUS_UNREAD)
{
- $phone = $this->internal_phone->get_for_user($_SESSION['user']['id'], $received['id_phone']);
- if ($phone)
- {
- $receiveds[$key]['phone_name'] = $phone['name'];
- }
+ $this->internal_received->mark_as_unread_for_user($_SESSION['user']['id'], $id);
}
-
- $contact = $this->internal_contact->get_by_number_and_user($_SESSION['user']['id'], $received['origin']);
- if ($contact)
+ elseif ($status === \models\Received::STATUS_READ)
{
- $receiveds[$key]['contact'] = $contact['name'];
+ $this->internal_received->mark_as_read_for_user($_SESSION['user']['id'], $id);
}
}
- $this->render('received/list_unread', ['receiveds' => $receiveds, 'nb_results' => \count($receiveds)]);
+ return $this->redirect(\descartes\Router::url('Received', 'list'));
}
/**
diff --git a/controllers/publics/Scheduled.php b/controllers/publics/Scheduled.php
index b4ad289..8755cf6 100644
--- a/controllers/publics/Scheduled.php
+++ b/controllers/publics/Scheduled.php
@@ -47,8 +47,18 @@ namespace controllers\publics;
*/
public function list()
{
- $scheduleds = $this->internal_scheduled->list_for_user($_SESSION['user']['id']);
- $this->render('scheduled/list', ['scheduleds' => $scheduleds]);
+ $this->render('scheduled/list');
+ }
+
+ /**
+ * Return scheduleds as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_scheduled->list_for_user($_SESSION['user']['id']);
+
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/Sended.php b/controllers/publics/Sended.php
index 59cf871..58c5913 100644
--- a/controllers/publics/Sended.php
+++ b/controllers/publics/Sended.php
@@ -42,28 +42,24 @@ namespace controllers\publics;
*/
public function list()
{
- $sendeds = $this->internal_sended->list_for_user($_SESSION['user']['id']);
+ $this->render('sended/list');
+ }
- foreach ($sendeds as $key => $sended)
+ /**
+ * Return sendeds as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_sended->list_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
{
- if (null !== $sended['id_phone'])
- {
- $phone = $this->internal_phone->get_for_user($_SESSION['user']['id'], $sended['id_phone']);
- if ($phone)
- {
- $sendeds[$key]['phone_name'] = $phone['name'];
- }
- }
-
- $contact = $this->internal_contact->get_by_number_and_user($_SESSION['user']['id'], $sended['destination']);
- if ($contact)
- {
- $sendeds[$key]['contact'] = $contact['name'];
- }
+ $entity['destination_formatted'] = \controllers\internals\Tool::phone_link($entity['destination']);
}
- $this->render('sended/list', ['sendeds' => $sendeds, 'nb_results' => \count($sendeds)]);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
+
/**
* Cette fonction va supprimer une liste de sendeds.
diff --git a/controllers/publics/SmsStop.php b/controllers/publics/SmsStop.php
index aa45191..1dcb102 100644
--- a/controllers/publics/SmsStop.php
+++ b/controllers/publics/SmsStop.php
@@ -39,8 +39,22 @@ namespace controllers\publics;
*/
public function list()
{
- $smsstops = $this->internal_sms_stop->list_for_user($_SESSION['user']['id']);
- $this->render('smsstop/list', ['smsstops' => $smsstops, 'nb_results' => \count($smsstops)]);
+ $this->render('smsstop/list');
+ }
+
+ /**
+ * Return smsstops as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_sms_stop->list_for_user($_SESSION['user']['id']);
+ foreach ($entities as &$entity)
+ {
+ $entity['number_formatted'] = \controllers\internals\Tool::phone_link($entity['number']);
+ }
+
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/User.php b/controllers/publics/User.php
index 55353af..bd6132c 100644
--- a/controllers/publics/User.php
+++ b/controllers/publics/User.php
@@ -42,8 +42,17 @@ class User extends \descartes\Controller
*/
public function list()
{
- $users = $this->internal_user->list();
- $this->render('user/list', ['users' => $users]);
+ $this->render('user/list');
+ }
+
+ /**
+ * Return users as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_user->list();
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/controllers/publics/Webhook.php b/controllers/publics/Webhook.php
index 0ee9862..20ad309 100644
--- a/controllers/publics/Webhook.php
+++ b/controllers/publics/Webhook.php
@@ -36,8 +36,17 @@ namespace controllers\publics;
*/
public function list()
{
- $webhooks = $this->internal_webhook->list_for_user($_SESSION['user']['id']);
- $this->render('webhook/list', ['webhooks' => $webhooks]);
+ $this->render('webhook/list');
+ }
+
+ /**
+ * Return commands as json
+ */
+ public function list_json()
+ {
+ $entities = $this->internal_webhook->list_for_user($_SESSION['user']['id']);
+ header('Content-Type: application/json');
+ echo json_encode(['data' => $entities]);
}
/**
diff --git a/db/migrations/20200923155009_add_index_for_perfs.php b/db/migrations/20200923155009_add_index_for_perfs.php
new file mode 100644
index 0000000..9024e38
--- /dev/null
+++ b/db/migrations/20200923155009_add_index_for_perfs.php
@@ -0,0 +1,46 @@
+table('contact');
+ $table->addIndex('number');
+ $table->update();
+
+ $table = $this->table('sended');
+ $table->addIndex('destination');
+ $table->update();
+
+ $table = $this->table('received');
+ $table->addIndex('origin');
+ $table->update();
+ }
+}
diff --git a/models/Group.php b/models/Group.php
index fd12a16..eb47dae 100644
--- a/models/Group.php
+++ b/models/Group.php
@@ -13,6 +13,45 @@ namespace models;
class Group extends StandardModel
{
+ /**
+ * Return a list of groups for a user.
+ * Add a column nb_contacts
+ *
+ * @param int $id_user : user id
+ * @param ?int $limit : Number of entry to return or null
+ * @param ?int $offset : Number of entry to ignore or null
+ *
+ * @return array
+ */
+ public function list_for_user(int $id_user, $limit, $offset)
+ {
+ $query = '
+ SELECT g.*, COUNT(gc.id) as nb_contact
+ FROM `group` as g
+ LEFT JOIN group_contact as gc
+ ON g.id = gc.id_group
+ WHERE id_user = :id_user
+ GROUP BY g.id
+ ';
+
+ if ($limit !== null)
+ {
+ $limit = (int) $limit;
+
+ $query .= ' LIMIT ' . $limit;
+ if ($offset !== null)
+ {
+ $offset = (int) $offset;
+ $query .= ' OFFSET ' . $offset;
+ }
+ }
+
+ $params = [
+ 'id_user' => $id_user,
+ ];
+
+ return $this->_run_query($query, $params);
+ }
/**
* Return a group by his name for a user.
*
diff --git a/models/Received.php b/models/Received.php
index d085a64..aa76325 100644
--- a/models/Received.php
+++ b/models/Received.php
@@ -18,31 +18,93 @@ namespace models;
{
const STATUS_UNREAD = 'unread';
const STATUS_READ = 'read';
-
+
/**
- * Return a list of unread received for a user.
+ * Return a list of received messages for a user.
+ * Add a column contact_name and phone_name when available
*
- * @param int $id_user : User id
- * @param int $limit : Max results to return
- * @param int $offset : Number of results to ignore
+ * @param int $id_user : user id
+ * @param ?int $limit : Number of entry to return or null
+ * @param ?int $offset : Number of entry to ignore or null
+ *
+ * @return array
*/
- public function list_unread_for_user($id_user, $limit, $offset)
+ public function list_for_user(int $id_user, $limit, $offset)
{
- $limit = (int) $limit;
- $offset = (int) $offset;
+ $query = '
+ SELECT received.*, contact.name as contact_name, phone.name as phone_name
+ FROM received
+ LEFT JOIN contact
+ ON contact.number = received.origin
+ AND contact.id_user = received.id_user
+ LEFT JOIN phone
+ ON phone.id = received.id_phone
+ WHERE received.id_user = :id_user
+ ';
- $query = '
- SELECT * FROM received
- WHERE status = \'unread\'
- AND id_user = :id_user
- LIMIT ' . $limit . ' OFFSET ' . $offset;
+ if ($limit !== null)
+ {
+ $limit = (int) $limit;
+ $query .= ' LIMIT ' . $limit;
+ if ($offset !== null)
+ {
+ $offset = (int) $offset;
+ $query .= ' OFFSET ' . $offset;
+ }
+ }
+
$params = [
'id_user' => $id_user,
];
return $this->_run_query($query, $params);
}
+
+
+ /**
+ * Return a list of unread received messages for a user.
+ * Add a column contact_name and phone_name when available
+ *
+ * @param int $id_user : user id
+ * @param ?int $limit : Number of entry to return or null
+ * @param ?int $offset : Number of entry to ignore or null
+ *
+ * @return array
+ */
+ public function list_unread_for_user(int $id_user, $limit, $offset)
+ {
+ $query = '
+ SELECT received.*, contact.name as contact_name, phone.name as phone_name
+ FROM received
+ LEFT JOIN contact
+ ON contact.number = received.origin
+ AND contact.id_user = received.id_user
+ LEFT JOIN phone
+ ON phone.id = received.id_phone
+ WHERE received.id_user = :id_user
+ AND status = :status
+ ';
+
+ if ($limit !== null)
+ {
+ $limit = (int) $limit;
+
+ $query .= ' LIMIT ' . $limit;
+ if ($offset !== null)
+ {
+ $offset = (int) $offset;
+ $query .= ' OFFSET ' . $offset;
+ }
+ }
+
+ $params = [
+ 'id_user' => $id_user,
+ 'status' => self::STATUS_UNREAD,
+ ];
+
+ return $this->_run_query($query, $params);
+ }
/**
* Count number of unread received sms for user.
@@ -154,7 +216,7 @@ namespace models;
public function get_discussions_for_user(int $id_user)
{
$query = '
- SELECT at, number
+ SELECT discussions.at, discussions.number, contact.name as contact_name
FROM (
SELECT at, destination as number FROM sended
WHERE id_user = :id_user
@@ -163,6 +225,8 @@ namespace models;
WHERE id_user = :id_user
)
) as discussions
+ LEFT JOIN contact
+ ON discussions.number = contact.number AND id_user = :id_user
GROUP BY number
ORDER BY at DESC
';
diff --git a/models/Sended.php b/models/Sended.php
index 3837659..8d5e61d 100644
--- a/models/Sended.php
+++ b/models/Sended.php
@@ -19,6 +19,48 @@ namespace models;
const STATUS_UNKNOWN = 'unknown';
const STATUS_DELIVERED = 'delivered';
const STATUS_FAILED = 'failed';
+
+ /**
+ * Return a list of sended messages for a user.
+ * Add a column contact_name and phone_name when available
+ *
+ * @param int $id_user : user id
+ * @param ?int $limit : Number of entry to return or null
+ * @param ?int $offset : Number of entry to ignore or null
+ *
+ * @return array
+ */
+ public function list_for_user(int $id_user, $limit, $offset)
+ {
+ $query = '
+ SELECT sended.*, contact.name as contact_name, phone.name as phone_name
+ FROM sended
+ LEFT JOIN contact
+ ON contact.number = sended.destination
+ AND contact.id_user = sended.id_user
+ LEFT JOIN phone
+ ON phone.id = sended.id_phone
+ WHERE sended.id_user = :id_user
+ ';
+
+ if ($limit !== null)
+ {
+ $limit = (int) $limit;
+
+ $query .= ' LIMIT ' . $limit;
+ if ($offset !== null)
+ {
+ $offset = (int) $offset;
+ $query .= ' OFFSET ' . $offset;
+ }
+ }
+
+ $params = [
+ 'id_user' => $id_user,
+ ];
+
+ return $this->_run_query($query, $params);
+ }
/**
* Return x last sendeds message for a user, order by date.
diff --git a/routes.php b/routes.php
index deaf2b3..08e4fa4 100644
--- a/routes.php
+++ b/routes.php
@@ -24,10 +24,8 @@
],
'Command' => [
- 'list' => [
- '/command/',
- '/command/p/{page}/',
- ],
+ 'list' => '/command/',
+ 'list_json' => '/command/json/',
'add' => '/command/add/',
'create' => '/command/create/{csrf}/',
'delete' => '/command/delete/{csrf}/',
@@ -36,10 +34,8 @@
],
'Contact' => [
- 'list' => [
- '/contact/',
- '/contact/p/{page}/',
- ],
+ 'list' => '/contact/',
+ 'list_json' => '/contact/json/',
'add' => '/contact/add/',
'create' => '/contact/create/{csrf}/',
'delete' => '/contact/delete/{csrf}/',
@@ -55,6 +51,7 @@
'/discussion/',
'/discussion/p/{page}/',
],
+ 'list_json' => '/discussion/json/',
'show' => '/discussion/show/{number}/',
'send' => '/discussion/send/{csrf}/',
'get_messages' => '/discussion/getmessage/{number}/{transaction_id}/',
@@ -65,14 +62,13 @@
'/event/',
'/event/p/{page}/',
],
+ 'list_json' => '/event/json/',
'delete' => '/event/delete/{csrf}/',
],
'Group' => [
- 'list' => [
- '/group/',
- '/group/p/{page}/',
- ],
+ 'list' => '/group/',
+ 'list_json' => '/group/json/',
'add' => '/group/add/',
'create' => '/group/create/{csrf}/',
'delete' => '/group/delete/{csrf}/',
@@ -82,10 +78,8 @@
],
'ConditionalGroup' => [
- 'list' => [
- '/conditional_group/',
- '/conditional_group/p/{page}/',
- ],
+ 'list' => '/conditional_group/',
+ 'list_json' => '/conditional_group/json/',
'add' => '/conditional_group/add/',
'create' => '/conditional_group/create/{csrf}/',
'delete' => '/conditional_group/delete/{csrf}/',
@@ -96,14 +90,11 @@
],
'Received' => [
- 'list' => [
- '/received/',
- '/received/p/{page}/',
- ],
- 'list_unread' => [
- '/unread/',
- '/unread/p/{page}/',
- ],
+ 'list' => '/received/',
+ 'list_json' => '/received/json/',
+ 'list_unread' => '/unread/',
+ 'list_unread_json' => '/unread/json/',
+ 'mark_as' => '/mark/{status}/{csrf}/',
'delete' => '/received/delete/{csrf}/',
'popup' => '/received/popup/',
],
@@ -113,6 +104,7 @@
'/scheduled/',
'/scheduled/p/{page}/',
],
+ 'list_json' => '/scheduled/json/',
'add' => [
'/scheduled/add/',
'/scheduled/add/{prefilled}/',
@@ -128,6 +120,7 @@
'/sended/',
'/sended/p/{page}/',
],
+ 'list_json' => '/sended/json/',
'delete' => '/sended/delete/{csrf}/',
],
@@ -137,10 +130,8 @@
],
'SmsStop' => [
- 'list' => [
- '/smsstop/',
- '/smsstop/p/{page}/',
- ],
+ 'list' => '/smsstop/',
+ 'list_json' => '/smsstop/json/',
'delete' => '/smsstop/delete/{csrf}/',
],
@@ -149,10 +140,8 @@
],
'User' => [
- 'list' => [
- '/user/',
- '/user/p/{page}/',
- ],
+ 'list' => '/user/',
+ 'list_json' => '/user/json/',
'add' => '/user/add/',
'create' => '/user/create/{csrf}/',
'delete' => '/user/delete/{csrf}/',
@@ -160,20 +149,16 @@
],
'Phone' => [
- 'list' => [
- '/phone/',
- '/phone/p/{page}/',
- ],
+ 'list' => '/phone/',
+ 'list_json' => '/phone/json/',
'add' => '/phone/add/',
'create' => '/phone/create/{csrf}/',
'delete' => '/phone/delete/{csrf}/',
],
'Webhook' => [
- 'list' => [
- '/webhook/',
- '/webhook/p/{page}/',
- ],
+ 'list' => '/webhook/',
+ 'list_json' => '/webhook/json/',
'add' => '/webhook/add/',
'create' => '/webhook/create/{csrf}/',
'delete' => '/webhook/delete/{csrf}/',
diff --git a/templates/command/list.php b/templates/command/list.php
index 22da1ed..89a2ab1 100644
--- a/templates/command/list.php
+++ b/templates/command/list.php
@@ -35,43 +35,29 @@
@@ -81,5 +67,44 @@
+
render('incs/footer');
diff --git a/templates/conditional_group/list.php b/templates/conditional_group/list.php
index 198f079..28d92a8 100644
--- a/templates/conditional_group/list.php
+++ b/templates/conditional_group/list.php
@@ -81,20 +81,37 @@
render('incs/footer');
diff --git a/templates/contact/list.php b/templates/contact/list.php
index 45b5ae0..d6cadb1 100644
--- a/templates/contact/list.php
+++ b/templates/contact/list.php
@@ -37,42 +37,29 @@
@@ -124,18 +111,50 @@
render('incs/footer');
diff --git a/templates/discussion/list.php b/templates/discussion/list.php
index bca4210..8b27505 100644
--- a/templates/discussion/list.php
+++ b/templates/discussion/list.php
@@ -34,28 +34,24 @@
Liste des discussions
-
- Aucune discussion n'est en cours actuellement.
-
-
-
-
-
- Date du dernier message |
- Numéro |
-
-
-
-
-
- s($discussion['at']); ?> |
- s(isset($discussion['contact']) ? $discussion['contact'] . ' (' . \controllers\internals\Tool::phone_format($discussion['number']) . ')' : \controllers\internals\Tool::phone_format($discussion['number'])); ?> |
-
-
-
-
-
-
+
+
+
+
+ Date du dernier message |
+ Numéro |
+
+
+
+
+
+ s($discussion['at']); ?> |
+ s(isset($discussion['contact']) ? $discussion['contact'] . ' (' . \controllers\internals\Tool::phone_format($discussion['number']) . ')' : \controllers\internals\Tool::phone_format($discussion['number'])); ?> |
+
+
+
+
+
@@ -63,5 +59,44 @@
+
render('incs/footer');
diff --git a/templates/discussion/show.php b/templates/discussion/show.php
index ddb74c8..bb6a357 100644
--- a/templates/discussion/show.php
+++ b/templates/discussion/show.php
@@ -136,7 +136,10 @@
var messageInputContainer = jQuery('.message-input-container').outerHeight();
var footerHeight = jQuery('footer').outerHeight();
- var containerHeight = Math.floor(windowHeight - (containerPosition.top + footerHeight * 2 + messageInputContainer));
+ console.log(windowHeight);
+ console.log(containerPosition.top);
+
+ var containerHeight = Math.floor(windowHeight - (containerPosition.top + messageInputContainer) - 20); //-20 px for aesthetic
jQuery('.discussion-container').outerHeight(containerHeight);
}
diff --git a/templates/event/list.php b/templates/event/list.php
index 544a206..7f034c1 100644
--- a/templates/event/list.php
+++ b/templates/event/list.php
@@ -35,42 +35,29 @@
@@ -80,20 +67,46 @@
render('incs/footer');
diff --git a/templates/group/list.php b/templates/group/list.php
index a0035f3..c28ad3a 100644
--- a/templates/group/list.php
+++ b/templates/group/list.php
@@ -35,42 +35,36 @@
@@ -81,20 +75,37 @@
render('incs/footer');
diff --git a/templates/phone/list.php b/templates/phone/list.php
index 65111a7..19cffce 100644
--- a/templates/phone/list.php
+++ b/templates/phone/list.php
@@ -35,58 +35,28 @@
@@ -80,20 +68,37 @@
render('incs/footer');
diff --git a/templates/sended/list.php b/templates/sended/list.php
index d88b12d..726cb2b 100644
--- a/templates/sended/list.php
+++ b/templates/sended/list.php
@@ -35,62 +35,27 @@
@@ -100,21 +65,64 @@
render('incs/footer');
diff --git a/templates/smsstop/list.php b/templates/smsstop/list.php
index 77cf0f4..9e6ab7e 100644
--- a/templates/smsstop/list.php
+++ b/templates/smsstop/list.php
@@ -35,38 +35,28 @@
@@ -76,20 +66,38 @@
render('incs/footer');
diff --git a/templates/user/list.php b/templates/user/list.php
index 3171687..59775cd 100644
--- a/templates/user/list.php
+++ b/templates/user/list.php
@@ -41,19 +41,11 @@
Email |
Admin |
- Status |
+ Statut |
✓ |
-
-
- s($user['email']); ?> |
- s($user['admin']); ?> |
- s($user['status']); ?> |
- |
-
-
@@ -78,20 +70,38 @@
render('incs/footer');
diff --git a/templates/webhook/list.php b/templates/webhook/list.php
index 8efd0c3..0b306dc 100644
--- a/templates/webhook/list.php
+++ b/templates/webhook/list.php
@@ -33,41 +33,28 @@
@@ -77,5 +64,50 @@
+
render('incs/footer');