mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Misc.
This commit is contained in:
@@ -2,28 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% load amextras %}
|
||||
{% block css %}
|
||||
#searchbox {
|
||||
/*float: left;*/ /* Marche pas ici?! obligé de le faire en JS sous FF */
|
||||
margin-right: 10px;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#searchbox img {
|
||||
float: left;
|
||||
margin-top: 4px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#searchparams {
|
||||
background: white;
|
||||
padding: 5px;
|
||||
width: 90%;
|
||||
border-bottom: 5px solid #CCCCCC;
|
||||
border-left: 5px solid #CCCCCC;
|
||||
border-right: 5px solid #CCCCCC;
|
||||
}
|
||||
|
||||
thead tr {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
@@ -103,38 +81,7 @@ tr.table-tr-selected {
|
||||
}
|
||||
mysubmit(event, "delete");
|
||||
});
|
||||
|
||||
var myFx = new Fx.Slide($("searchparams"));
|
||||
myFx.hide();
|
||||
$("searchopts").addEvent("click", function(event) {
|
||||
myFx.cancel();
|
||||
myFx.toggle();
|
||||
});
|
||||
$$("input[name=scriteria]").addEvent("click", function(event) {
|
||||
myFx.cancel();
|
||||
myFx.toggle();
|
||||
});
|
||||
$("searchfield").addEvent("change", function(event) {
|
||||
var criteria = "";
|
||||
$$("input[name=scriteria]:checked").each(function(obj) {
|
||||
criteria = obj.value;
|
||||
});
|
||||
var url = "listing"
|
||||
+ "?pattern=" + $("searchfield").value
|
||||
+ "&criteria=" + criteria;
|
||||
current_anchor.parse_string(url, true).setparams(navparams);
|
||||
current_anchor.update();
|
||||
});
|
||||
$("searchfield").addEvent("click", function(event) {
|
||||
$("searchfield").select();
|
||||
});
|
||||
|
||||
$("searchfield").addEvent("blur", function(event) {
|
||||
if ($("searchfield").value == "") {
|
||||
$("searchfield").set("value", "{% trans "Search..." %}");
|
||||
}
|
||||
});
|
||||
$("searchbox").setStyle("float", "left");
|
||||
searchbox_init();
|
||||
$$("tr").addEvent("dblclick", viewmail);
|
||||
});
|
||||
|
||||
|
||||
@@ -100,9 +100,13 @@ class IMAPheader(object):
|
||||
return value
|
||||
ndate = datetime(*(tmp)[:7])
|
||||
now = datetime.now()
|
||||
if now - ndate > timedelta(7):
|
||||
return ndate.strftime("%d.%m.%Y %H:%M")
|
||||
return ndate.strftime("%a %H:%M")
|
||||
try:
|
||||
if now - ndate > timedelta(7):
|
||||
return ndate.strftime("%d.%m.%Y %H:%M")
|
||||
return ndate.strftime("%a %H:%M")
|
||||
except ValueError:
|
||||
return value
|
||||
|
||||
|
||||
@staticmethod
|
||||
def parse_subject(value, **kwargs):
|
||||
|
||||
@@ -221,6 +221,7 @@ tr.selected {
|
||||
}
|
||||
register_callback("folder", function(resp) {
|
||||
wm_updatelisting(resp);
|
||||
searchbox_init();
|
||||
if (navparams.has("order")) {
|
||||
src = navparams.get("order").charAt(0) == "-" ? "down_arrow.png" : "up_arrow.png";
|
||||
th = $$("th[id=" + navparams.get("order").substring(1) + "]");
|
||||
|
||||
@@ -94,7 +94,8 @@ def listing_menu(selection, folder, perms):
|
||||
"img" : "/static/pics/clear.png",
|
||||
"label" : _("Empty trash")}
|
||||
]
|
||||
|
||||
return render_to_string("main/menu.html",
|
||||
menu = render_to_string("main/menu.html",
|
||||
{"selection" : selection, "entries" : entries,
|
||||
"perms" : perms})
|
||||
searchbar = render_to_string("common/email_searchbar.html", {})
|
||||
return menu + searchbar
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
import re
|
||||
import os
|
||||
from email.header import decode_header
|
||||
import lxml
|
||||
import lxml.html
|
||||
@@ -159,7 +160,7 @@ class Email(object):
|
||||
if re.match("^http:", fname):
|
||||
path = fname
|
||||
else:
|
||||
path = "/%s" % os.path.join("static/tmp", fname)
|
||||
path = os.path.abspath("static/tmp" + fname)
|
||||
fp = open(path, "wb")
|
||||
fp.write(part.get_payload(decode=True))
|
||||
fp.close()
|
||||
|
||||
@@ -273,4 +273,37 @@ checkTableSelection = function(text) {
|
||||
return false;
|
||||
}
|
||||
return confirm(text);
|
||||
}
|
||||
|
||||
searchbox_init = function() {
|
||||
var myFx = new Fx.Slide($("searchparams"));
|
||||
myFx.hide();
|
||||
$("searchopts").addEvent("click", function(event) {
|
||||
myFx.cancel();
|
||||
myFx.toggle();
|
||||
});
|
||||
$$("input[name=scriteria]").addEvent("click", function(event) {
|
||||
myFx.cancel();
|
||||
myFx.toggle();
|
||||
});
|
||||
$("searchfield").addEvent("change", function(event) {
|
||||
var criteria = "";
|
||||
$$("input[name=scriteria]:checked").each(function(obj) {
|
||||
criteria = obj.value;
|
||||
});
|
||||
var params = "pattern=" + $("searchfield").value
|
||||
+ "&criteria=" + criteria;
|
||||
current_anchor.updateparams(params);
|
||||
current_anchor.update();
|
||||
});
|
||||
$("searchfield").addEvent("click", function(event) {
|
||||
$("searchfield").select();
|
||||
});
|
||||
|
||||
$("searchfield").addEvent("blur", function(event) {
|
||||
if ($("searchfield").value == "") {
|
||||
$("searchfield").set("value", "Search...");
|
||||
}
|
||||
});
|
||||
$("searchbox").setStyle("float", "right");
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#searchbox {
|
||||
/*float: left;*/ /* Marche pas ici?! obligé de le faire en JS sous FF */
|
||||
margin-right: 10px;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#searchbox img {
|
||||
float: left;
|
||||
margin-top: 4px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#searchparams {
|
||||
background: white;
|
||||
padding: 5px;
|
||||
width: 90%;
|
||||
border-bottom: 5px solid #CCCCCC;
|
||||
border-left: 5px solid #CCCCCC;
|
||||
border-right: 5px solid #CCCCCC;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "nlayout.html" %}
|
||||
{% load i18n %}
|
||||
{% block html_head %}
|
||||
<link rel="stylesheet" type="text/css" href="/static/stylesheets/searchbar.css" />
|
||||
<style type="text/css">
|
||||
#navbar {
|
||||
float: right;
|
||||
@@ -21,6 +22,7 @@
|
||||
}
|
||||
{% block css %}{% endblock %}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEvent("domready", function() {
|
||||
navparams = new Hash({
|
||||
@@ -55,16 +57,6 @@ window.addEvent("domready", function() {
|
||||
$("navbar").getChildren("a").addEvent("click", navbarcallback);
|
||||
}
|
||||
}
|
||||
|
||||
if ($("selectall")) {
|
||||
$("selectall").addEvent("click", function(event) {
|
||||
if ($("selectall").checked) {
|
||||
toggleSelection("selection", true);
|
||||
} else {
|
||||
toggleSelection("selection", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
{% block js %}{% endblock %}
|
||||
ajaxListener("{{ deflocation }}", {{ defcallback }});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user