Skip to content

Commit f7e1e80

Browse files
committed
Merge pull request #8 from kasioumis/master-WebNews
WebNews: New module to display and manage news Conflicts: modules/webstyle/lib/webinterface_layout.py
2 parents d45ea25 + 40f2794 commit f7e1e80

16 files changed

+1204
-0
lines changed

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,10 @@ AC_CONFIG_FILES([config.nice \
875875
modules/webmessage/doc/hacking/Makefile \
876876
modules/webmessage/lib/Makefile \
877877
modules/webmessage/web/Makefile \
878+
modules/webnews/Makefile \
879+
modules/webnews/doc/Makefile \
880+
modules/webnews/lib/Makefile \
881+
modules/webnews/web/Makefile \
878882
modules/websearch/Makefile \
879883
modules/websearch/bin/Makefile \
880884
modules/websearch/bin/webcoll \

modules/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ SUBDIRS = bibauthorid \
5252
webjournal \
5353
weblinkback \
5454
webmessage \
55+
webnews \
5556
websearch \
5657
websession \
5758
webstat \
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# -*- coding: utf-8 -*-
2+
##
3+
## This file is part of Invenio.
4+
## Copyright (C) 2012 CERN.
5+
##
6+
## Invenio is free software; you can redistribute it and/or
7+
## modify it under the terms of the GNU General Public License as
8+
## published by the Free Software Foundation; either version 2 of the
9+
## License, or (at your option) any later version.
10+
##
11+
## Invenio is distributed in the hope that it will be useful, but
12+
## WITHOUT ANY WARRANTY; without even the implied warranty of
13+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
## General Public License for more details.
15+
##
16+
## You should have received a copy of the GNU General Public License
17+
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
18+
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19+
20+
from invenio.dbquery import run_sql
21+
22+
depends_on = ['invenio_release_1_1_0']
23+
24+
def info():
25+
return "New database tables for the WebNews module"
26+
27+
def do_upgrade():
28+
query_story = \
29+
"""DROP TABLE IF EXISTS `nwsSTORY`;
30+
CREATE TABLE `nwsSTORY` (
31+
`id` int(11) NOT NULL AUTO_INCREMENT,
32+
`title` varchar(256) NOT NULL,
33+
`body` text NOT NULL,
34+
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
35+
PRIMARY KEY (`id`)
36+
);"""
37+
run_sql(query_story)
38+
39+
query_tag = \
40+
"""DROP TABLE IF EXISTS `nwsTAG`;
41+
CREATE TABLE `nwsTAG` (
42+
`id` int(11) NOT NULL AUTO_INCREMENT,
43+
`tag` varchar(64) NOT NULL,
44+
PRIMARY KEY (`id`)
45+
);"""
46+
run_sql(query_tag)
47+
48+
query_tooltip = \
49+
"""DROP TABLE IF EXISTS `nwsTOOLTIP`;
50+
CREATE TABLE `nwsTOOLTIP` (
51+
`id` int(11) NOT NULL AUTO_INCREMENT,
52+
`id_story` int(11) NOT NULL,
53+
`body` varchar(512) NOT NULL,
54+
`target_element` varchar(256) NOT NULL DEFAULT '',
55+
`target_page` varchar(256) NOT NULL DEFAULT '',
56+
PRIMARY KEY (`id`),
57+
KEY `id_story` (`id_story`),
58+
CONSTRAINT `nwsTOOLTIP_ibfk_1` FOREIGN KEY (`id_story`) REFERENCES `nwsSTORY` (`id`)
59+
);"""
60+
run_sql(query_tooltip)
61+
62+
query_story_tag = \
63+
"""DROP TABLE IF EXISTS `nwsSTORY_nwsTAG`;
64+
CREATE TABLE `nwsSTORY_nwsTAG` (
65+
`id_story` int(11) NOT NULL,
66+
`id_tag` int(11) NOT NULL,
67+
PRIMARY KEY (`id_story`,`id_tag`),
68+
KEY `id_story` (`id_story`),
69+
KEY `id_tag` (`id_tag`),
70+
CONSTRAINT `nwsSTORY_nwsTAG_ibfk_1` FOREIGN KEY (`id_story`) REFERENCES `nwsSTORY` (`id`),
71+
CONSTRAINT `nwsSTORY_nwsTAG_ibfk_2` FOREIGN KEY (`id_tag`) REFERENCES `nwsTAG` (`id`)
72+
);"""
73+
run_sql(query_story_tag)
74+
75+
def estimate():
76+
return 1
77+
78+
def pre_upgrade():
79+
pass
80+
81+
def post_upgrade():
82+
pass

modules/webnews/Makefile.am

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## This file is part of Invenio.
2+
## Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 CERN.
3+
##
4+
## Invenio is free software; you can redistribute it and/or
5+
## modify it under the terms of the GNU General Public License as
6+
## published by the Free Software Foundation; either version 2 of the
7+
## License, or (at your option) any later version.
8+
##
9+
## Invenio is distributed in the hope that it will be useful, but
10+
## WITHOUT ANY WARRANTY; without even the implied warranty of
11+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
## General Public License for more details.
13+
##
14+
## You should have received a copy of the GNU General Public License
15+
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
16+
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17+
18+
SUBDIRS = lib web doc
19+
20+
CLEANFILES = *~

modules/webnews/doc/Makefile.am

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## This file is part of Invenio.
2+
## Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 CERN.
3+
##
4+
## Invenio is free software; you can redistribute it and/or
5+
## modify it under the terms of the GNU General Public License as
6+
## published by the Free Software Foundation; either version 2 of the
7+
## License, or (at your option) any later version.
8+
##
9+
## Invenio is distributed in the hope that it will be useful, but
10+
## WITHOUT ANY WARRANTY; without even the implied warranty of
11+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
## General Public License for more details.
13+
##
14+
## You should have received a copy of the GNU General Public License
15+
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
16+
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17+
18+
CLEANFILES = *~

modules/webnews/lib/Makefile.am

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## This file is part of Invenio.
2+
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
3+
##
4+
## Invenio is free software; you can redistribute it and/or
5+
## modify it under the terms of the GNU General Public License as
6+
## published by the Free Software Foundation; either version 2 of the
7+
## License, or (at your option) any later version.
8+
##
9+
## Invenio is distributed in the hope that it will be useful, but
10+
## WITHOUT ANY WARRANTY; without even the implied warranty of
11+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
## General Public License for more details.
13+
##
14+
## You should have received a copy of the GNU General Public License
15+
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
16+
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17+
18+
pylibdir = $(libdir)/python/invenio
19+
webdir = $(localstatedir)/www/img
20+
jsdir = $(localstatedir)/www/js
21+
22+
pylib_DATA = webnews.py \
23+
webnews_config.py \
24+
webnews_webinterface.py \
25+
webnews_dblayer.py \
26+
webnews_utils.py
27+
28+
js_DATA = webnews.js
29+
30+
web_DATA = webnews.css
31+
32+
EXTRA_DIST = $(pylib_DATA) \
33+
$(js_DATA) \
34+
$(web_DATA)
35+
36+
CLEANFILES = *~ *.tmp *.pyc

modules/webnews/lib/webnews.css

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/***************************************************************************
2+
* Assume that we want the arrow's size (i.e. side; height in case it's on *
3+
* the left or right side; width otherwise) to be 16px. Then the border *
4+
* width for the arrow and its border will be half that dimension, 8px. In *
5+
* order for the arrow to be right on the tooltip, the arrow border's left *
6+
* positioning has to be as much as it's size, therefore -16px. The arrow's *
7+
* left positioning has to be a couple of pixels to the right in order for *
8+
* the border effect to be visible, therefore -14px. At the same time, in *
9+
* order for the arrow's point to not overlap with the targeted item, the *
10+
* tooltip's left margin has to be half the arrow's size (=the arrow's *
11+
* border width), 8px. The tooltip's padding has to at least as much as the *
12+
* arrow's left positioning overhead, (-(-16px-(-14px))) 2px in this case. *
13+
* The arrow's and the arrow border's top positioning can be as much as we *
14+
* want, and it must be the same for both. *
15+
* *
16+
* Desired arrow's size ([height|width]): 16px *
17+
* Arrow's border-width: 8px (half the arrow's size) *
18+
* Tooltip's [left|right] margin: 8px (half the arrow's size) *
19+
* Arrow's [left|right] positioning: -16px & -14px (arrow border and arrow) *
20+
* Arrow's [top|bottom] positioning: 8px *
21+
* *
22+
***************************************************************************/
23+
24+
/* Arrow implementation using traditional elements */
25+
.ttn {
26+
/* Display */
27+
position: absolute;
28+
display: none;
29+
z-index: 9997;
30+
31+
/* Dimensions */
32+
max-width: 250px;
33+
min-width: 150px;
34+
35+
/* Contents */
36+
background: #FFFFCC;
37+
margin-left: 8px;
38+
padding: 5px; /* padding has to be at least 2 */
39+
font-size: small;
40+
41+
/* Border */
42+
border: 1px solid #FFCC00;
43+
-moz-border-radius: 5px;
44+
-webkit-border-radius: 5px;
45+
-o-border-radius: 5px;
46+
border-radius: 5px;
47+
48+
/* Shadow */
49+
-moz-box-shadow: 1px 1px 3px gray;
50+
-webkit-box-shadow: 1px 1px 3px gray;
51+
-o-box-shadow: 1px 1px 3px gray;
52+
box-shadow: 1px 1px 3px gray;
53+
}
54+
55+
.ttn_arrow {
56+
/* Display */
57+
position: absolute;
58+
left: -14px;
59+
top: 8px;
60+
z-index: 9999;
61+
62+
/* Dimensions */
63+
height: 0;
64+
width: 0;
65+
66+
/* Border */
67+
border-color: transparent #FFFFCC transparent transparent;
68+
border-color: rgba(255,255,255,0) #FFFFCC rgba(255,255,255,0) rgba(255,255,255,0);
69+
border-style: solid;
70+
border-width: 8px;
71+
}
72+
73+
.ttn_arrow_border {
74+
/* Display */
75+
position: absolute;
76+
left: -16px;
77+
top: 8px;
78+
z-index: 9998;
79+
80+
/* Dimensions */
81+
height: 0;
82+
width: 0;
83+
84+
/* Border */
85+
border-color: transparent #FFCC00 transparent transparent;
86+
border-color: rgba(255,255,255,0) #FFCC00 rgba(255,255,255,0) rgba(255,255,255,0);
87+
border-style: solid;
88+
border-width: 8px;
89+
}
90+
91+
/* Arrow implementation using the :before and :after pseudo elements */
92+
.ttn_alt_arrow_box {
93+
/* Display */
94+
position: absolute;
95+
display: none;
96+
z-index: 9997;
97+
98+
/* Dimensions */
99+
max-width: 250px;
100+
min-width: 150px;
101+
102+
/* Contents */
103+
background: #FFFFCC;
104+
margin-left: 6px;
105+
padding: 3px;
106+
107+
/* Border */
108+
border: 1px solid #FFCC00;
109+
-moz-border-radius: 5px;
110+
-webkit-border-radius: 5px;
111+
-o-border-radius: 5px;
112+
border-radius: 5px;
113+
114+
/* Shadow */
115+
-moz-box-shadow: 1px 1px 3px gray;
116+
-webkit-box-shadow: 1px 1px 3px gray;
117+
-o-box-shadow: 1px 1px 3px gray;
118+
box-shadow: 1px 1px 3px gray;
119+
}
120+
121+
.ttn_alt_arrow_box:after, .ttn_alt_arrow_box:before {
122+
right: 100%;
123+
border: 1px solid transparent;
124+
content: " ";
125+
height: 0;
126+
width: 0;
127+
position: absolute;
128+
pointer-events: none;
129+
}
130+
131+
.ttn_alt_arrow_box:after {
132+
border-color: transparent;
133+
border-right-color: #FFFFCC;
134+
border-width: 6px;
135+
top: 13px;
136+
}
137+
138+
.ttn_alt_arrow_box:before {
139+
border-color: transparent;
140+
border-right-color: #FFCC00;
141+
border-width: 8px;
142+
top: 11px;
143+
}
144+
145+
/* Style for the tooltip's contents */
146+
.ttn_text {
147+
/* Contents */
148+
vertical-align: top;
149+
text-align: left;
150+
}
151+
152+
.ttn_actions {
153+
/* Contents */
154+
vertical-align: bottom;
155+
text-align: right;
156+
}
157+
158+
.ttn_actions_read_more {
159+
}
160+
161+
.ttn_actions_dismiss {
162+
}

0 commit comments

Comments
 (0)