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' "
|
||||
else:
|
||||
anon = ""
|
||||
if topic == 'BLOG':
|
||||
query = "SELECT * FROM docs WHERE topic=:topic %s ORDER BY cree_le DESC LIMIT 10;" % anon
|
||||
if topic == 'home':
|
||||
query = "SELECT * FROM docs WHERE topic='blog' %s ORDER BY cree_le DESC LIMIT 10;" % anon
|
||||
else:
|
||||
query = "SELECT * FROM docs WHERE topic=:topic ORDER BY intitule;"
|
||||
results = request.dbsession.execute(query, {'topic': topic}).fetchall()
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<table id="folder_list" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Titre</th>
|
||||
<th>Tags</th>
|
||||
<th>Date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -24,7 +24,7 @@
|
||||
var dataSet = ${dt_data};
|
||||
|
||||
$(document).ready(function() {
|
||||
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
|
||||
$.fn.dataTable.moment('DD.MM.YY');
|
||||
$('#folder_list').DataTable({
|
||||
data: dataSet,
|
||||
pageLength: 50,
|
||||
@@ -32,8 +32,9 @@
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||
},
|
||||
order: [[ 0, "desc" ]],
|
||||
columnDefs: [
|
||||
{ "targets": 0,
|
||||
{ "targets": 1,
|
||||
"render": function (data, type, row, meta) {
|
||||
// ajouter un link vers le formulaire
|
||||
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<br />
|
||||
<br />
|
||||
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image" /><br />
|
||||
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image"
|
||||
class = "img-responsive" width = "100%" /><br />
|
||||
</div>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<h3>Derniers posts</h3>
|
||||
<table class="table">
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -35,8 +35,8 @@ def folder(request):
|
||||
for tag in tags:
|
||||
tags_list += tag.tag + ', '
|
||||
|
||||
cree_le = item.cree_le.strftime('%d/%m/%Y')
|
||||
d = (item.intitule, tags_list, cree_le, item.doc_id)
|
||||
modif_le = item.cree_le.strftime('%d.%m.%y')
|
||||
d = (modif_le, item.intitule, tags_list, item.doc_id)
|
||||
liste.append(d)
|
||||
|
||||
return {
|
||||
@@ -134,7 +134,8 @@ def doc_search(request):
|
||||
|
||||
return {
|
||||
'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')
|
||||
|
||||
@@ -72,7 +72,7 @@ def home(request):
|
||||
id_photo = member.photo_instagram
|
||||
|
||||
# lire toutes les docs
|
||||
items = get_docs_bytopic(request, 'blog', logged_in)
|
||||
items = get_docs_bytopic(request, 'home', logged_in)
|
||||
|
||||
return {
|
||||
'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)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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