amélioration de la page Accueil
This commit is contained in:
@@ -32,8 +32,8 @@ def get_docs_bytopic(request, topic, logged_in):
|
|||||||
anon = "AND statut = 'public' "
|
anon = "AND statut = 'public' "
|
||||||
else:
|
else:
|
||||||
anon = ""
|
anon = ""
|
||||||
if topic == 'BLOG':
|
if topic == 'home':
|
||||||
query = "SELECT * FROM docs WHERE topic=:topic %s ORDER BY cree_le DESC LIMIT 10;" % anon
|
query = "SELECT * FROM docs WHERE topic='blog' %s ORDER BY cree_le DESC LIMIT 10;" % anon
|
||||||
else:
|
else:
|
||||||
query = "SELECT * FROM docs WHERE topic=:topic ORDER BY intitule;"
|
query = "SELECT * FROM docs WHERE topic=:topic ORDER BY intitule;"
|
||||||
results = request.dbsession.execute(query, {'topic': topic}).fetchall()
|
results = request.dbsession.execute(query, {'topic': topic}).fetchall()
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
<table id="folder_list" class="table">
|
<table id="folder_list" class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
<th>Titre</th>
|
<th>Titre</th>
|
||||||
<th>Tags</th>
|
<th>Tags</th>
|
||||||
<th>Date</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
var dataSet = ${dt_data};
|
var dataSet = ${dt_data};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
|
$.fn.dataTable.moment('DD.MM.YY');
|
||||||
$('#folder_list').DataTable({
|
$('#folder_list').DataTable({
|
||||||
data: dataSet,
|
data: dataSet,
|
||||||
pageLength: 50,
|
pageLength: 50,
|
||||||
@@ -32,8 +32,9 @@
|
|||||||
language: {
|
language: {
|
||||||
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||||
},
|
},
|
||||||
|
order: [[ 0, "desc" ]],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{ "targets": 0,
|
{ "targets": 1,
|
||||||
"render": function (data, type, row, meta) {
|
"render": function (data, type, row, meta) {
|
||||||
// ajouter un link vers le formulaire
|
// ajouter un link vers le formulaire
|
||||||
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';
|
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';
|
||||||
|
|||||||
@@ -4,15 +4,15 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image"
|
||||||
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image" /><br />
|
class = "img-responsive" width = "100%" /><br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<h3>Derniers posts</h3>
|
<h3>Derniers posts</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr tal:repeat="ligne items">
|
<tr tal:repeat="ligne items">
|
||||||
<td>${ligne.cree_le.strftime("%d %b")}</td>
|
<td>${ligne.modif_le.strftime("%d %b %y")}</td>
|
||||||
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
|
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ def folder(request):
|
|||||||
for tag in tags:
|
for tag in tags:
|
||||||
tags_list += tag.tag + ', '
|
tags_list += tag.tag + ', '
|
||||||
|
|
||||||
cree_le = item.cree_le.strftime('%d/%m/%Y')
|
modif_le = item.cree_le.strftime('%d.%m.%y')
|
||||||
d = (item.intitule, tags_list, cree_le, item.doc_id)
|
d = (modif_le, item.intitule, tags_list, item.doc_id)
|
||||||
liste.append(d)
|
liste.append(d)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -134,7 +134,8 @@ def doc_search(request):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Rechercher",
|
'page_title': "Rechercher",
|
||||||
'dt_data': json.dumps(liste),
|
'dt_data': json.dumps(liste),
|
||||||
|
'critere': critere,
|
||||||
}
|
}
|
||||||
|
|
||||||
@view_config(route_name='doc_view', renderer='../templates/contents/doc_view.pt')
|
@view_config(route_name='doc_view', renderer='../templates/contents/doc_view.pt')
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ def home(request):
|
|||||||
id_photo = member.photo_instagram
|
id_photo = member.photo_instagram
|
||||||
|
|
||||||
# lire toutes les docs
|
# lire toutes les docs
|
||||||
items = get_docs_bytopic(request, 'blog', logged_in)
|
items = get_docs_bytopic(request, 'home', logged_in)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Méditer, c’est ouvrir la cage",
|
'page_title': "Méditer, c’est ouvrir la cage",
|
||||||
|
|||||||
50
gmail_caotek_purge.py
Normal file
50
gmail_caotek_purge.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf8 -*-
|
||||||
|
#
|
||||||
|
# Compter les emails BEFORE DATE
|
||||||
|
#
|
||||||
|
|
||||||
|
from pprint import pprint
|
||||||
|
import datetime
|
||||||
|
import imaplib
|
||||||
|
|
||||||
|
# connecter au serveur IMAP
|
||||||
|
conn = imaplib.IMAP4_SSL('imap.gmail.com')
|
||||||
|
conn.login('phuoc@caotek.fr', 'pcao.8211')
|
||||||
|
# lister les dossiers
|
||||||
|
typ, data = conn.list()
|
||||||
|
print('Liste des dossiers :')
|
||||||
|
pprint(data)
|
||||||
|
|
||||||
|
# delete mails before 14 years
|
||||||
|
before_date = (datetime.date.today() - datetime.timedelta(365.25 * 13)).strftime("%d-%b-%Y")
|
||||||
|
print("Delete emails before " + before_date)
|
||||||
|
|
||||||
|
# select ALL
|
||||||
|
conn.select('INBOX')
|
||||||
|
|
||||||
|
rv, data = conn.search(None, '(BEFORE {0})'.format(before_date))
|
||||||
|
nb_mails = str(len(data[0]))
|
||||||
|
print(nb_mails + " emails founded")
|
||||||
|
|
||||||
|
resp = input ("Enter 'c' to continue, or 'a' to abort : ")
|
||||||
|
if resp=="c":
|
||||||
|
print("Moving " + nb_mails + " emails to Trash")
|
||||||
|
messages = data[0].split(b' ')
|
||||||
|
for mail in messages:
|
||||||
|
# move to trash
|
||||||
|
conn.store(mail, '+X-GM-LABELS', '\\Trash')
|
||||||
|
|
||||||
|
#This block empties trash, remove if you want to keep, Gmail auto purges trash after 30 days.
|
||||||
|
print("Emptying Trash & Expunge...")
|
||||||
|
conn.select('[Gmail]/Corbeille')
|
||||||
|
conn.store("1:*", '+FLAGS', '\\Deleted')
|
||||||
|
# delete all the selected messages
|
||||||
|
conn.expunge()
|
||||||
|
print("Script completed")
|
||||||
|
else:
|
||||||
|
print("Script aborted")
|
||||||
|
|
||||||
|
# deconnexion du serveur
|
||||||
|
conn.close()
|
||||||
|
conn.logout()
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ print('Liste des dossiers :')
|
|||||||
pprint(data)
|
pprint(data)
|
||||||
|
|
||||||
# delete mails before 14 years
|
# delete mails before 14 years
|
||||||
before_date = (datetime.date.today() - datetime.timedelta(5110)).strftime("%d-%b-%Y")
|
before_date = (datetime.date.today() - datetime.timedelta(365.25 * 13)).strftime("%d-%b-%Y")
|
||||||
print("Delete emails before " + before_date)
|
print("Delete emails before " + before_date)
|
||||||
|
|
||||||
# select ALL
|
# select ALL
|
||||||
34
gmail_nb.py
34
gmail_nb.py
@@ -1,34 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# Compter les emails BEFORE DATE
|
|
||||||
#
|
|
||||||
|
|
||||||
from pprint import pprint
|
|
||||||
import datetime
|
|
||||||
import imaplib
|
|
||||||
|
|
||||||
# connecter au serveur IMAP
|
|
||||||
conn = imaplib.IMAP4_SSL('imap.gmail.com')
|
|
||||||
conn.login('ctphuoc@gmail.com', 'ztwciswzhxxogcfv')
|
|
||||||
|
|
||||||
# lister les dossiers
|
|
||||||
typ, data = conn.list()
|
|
||||||
print('Liste des dossiers :')
|
|
||||||
pprint(data)
|
|
||||||
|
|
||||||
# delete mails before 15 years
|
|
||||||
before_date = (datetime.date.today() - datetime.timedelta(10)).strftime("%d-%b-%Y")
|
|
||||||
print("Supprimer emails avant " + before_date)
|
|
||||||
|
|
||||||
# select ALL
|
|
||||||
conn.select('[Gmail]/Corbeille')
|
|
||||||
|
|
||||||
rv, data = conn.search(None, '(BEFORE {0})'.format(before_date))
|
|
||||||
nb_mails = str(len(data[0]))
|
|
||||||
print("Nombre de emails : " + nb_mails)
|
|
||||||
|
|
||||||
|
|
||||||
# deconnexion du serveur
|
|
||||||
conn.close()
|
|
||||||
conn.logout()
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user