forked from inveniosoftware/invenio
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebNews: New module to display and manage news
* The WebNews module that will be responsible for presenting the site's news to the users and keeping a history of them. * This first release includes the tooltip functionality and the database structure. (addresses inveniosoftware#1288)
- Loading branch information
Showing
16 changed files
with
1,201 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
modules/miscutil/lib/upgrades/invenio_2013_02_15_webnews_new_db_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# -*- coding: utf-8 -*- | ||
## | ||
## This file is part of Invenio. | ||
## Copyright (C) 2012 CERN. | ||
## | ||
## Invenio is free software; you can redistribute it and/or | ||
## modify it under the terms of the GNU General Public License as | ||
## published by the Free Software Foundation; either version 2 of the | ||
## License, or (at your option) any later version. | ||
## | ||
## Invenio is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
## General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with Invenio; if not, write to the Free Software Foundation, Inc., | ||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
|
||
from invenio.dbquery import run_sql | ||
|
||
depends_on = ['invenio_release_1_1_0'] | ||
|
||
def info(): | ||
return "New database tables for the WebNews module" | ||
|
||
def do_upgrade(): | ||
query_story = \ | ||
"""DROP TABLE IF EXISTS `nwsSTORY`; | ||
CREATE TABLE `nwsSTORY` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`title` varchar(256) NOT NULL, | ||
`body` text NOT NULL, | ||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (`id`) | ||
);""" | ||
run_sql(query_story) | ||
|
||
query_tag = \ | ||
"""DROP TABLE IF EXISTS `nwsTAG`; | ||
CREATE TABLE `nwsTAG` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`tag` varchar(64) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
);""" | ||
run_sql(query_tag) | ||
|
||
query_tooltip = \ | ||
"""DROP TABLE IF EXISTS `nwsTOOLTIP`; | ||
CREATE TABLE `nwsTOOLTIP` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`id_story` int(11) NOT NULL, | ||
`body` varchar(512) NOT NULL, | ||
`target_element` varchar(256) NOT NULL DEFAULT '', | ||
`target_page` varchar(256) NOT NULL DEFAULT '', | ||
PRIMARY KEY (`id`), | ||
KEY `id_story` (`id_story`), | ||
CONSTRAINT `nwsTOOLTIP_ibfk_1` FOREIGN KEY (`id_story`) REFERENCES `nwsSTORY` (`id`) | ||
);""" | ||
run_sql(query_tooltip) | ||
|
||
query_story_tag = \ | ||
"""DROP TABLE IF EXISTS `nwsSTORY_nwsTAG`; | ||
CREATE TABLE `nwsSTORY_nwsTAG` ( | ||
`id_story` int(11) NOT NULL, | ||
`id_tag` int(11) NOT NULL, | ||
PRIMARY KEY (`id_story`,`id_tag`), | ||
KEY `id_story` (`id_story`), | ||
KEY `id_tag` (`id_tag`), | ||
CONSTRAINT `nwsSTORY_nwsTAG_ibfk_1` FOREIGN KEY (`id_story`) REFERENCES `nwsSTORY` (`id`), | ||
CONSTRAINT `nwsSTORY_nwsTAG_ibfk_2` FOREIGN KEY (`id_tag`) REFERENCES `nwsTAG` (`id`) | ||
);""" | ||
run_sql(query_story_tag) | ||
|
||
def estimate(): | ||
return 1 | ||
|
||
def pre_upgrade(): | ||
pass | ||
|
||
def post_upgrade(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## This file is part of Invenio. | ||
## Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 CERN. | ||
## | ||
## Invenio is free software; you can redistribute it and/or | ||
## modify it under the terms of the GNU General Public License as | ||
## published by the Free Software Foundation; either version 2 of the | ||
## License, or (at your option) any later version. | ||
## | ||
## Invenio is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
## General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with Invenio; if not, write to the Free Software Foundation, Inc., | ||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
|
||
SUBDIRS = lib web doc | ||
|
||
CLEANFILES = *~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## This file is part of Invenio. | ||
## Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 CERN. | ||
## | ||
## Invenio is free software; you can redistribute it and/or | ||
## modify it under the terms of the GNU General Public License as | ||
## published by the Free Software Foundation; either version 2 of the | ||
## License, or (at your option) any later version. | ||
## | ||
## Invenio is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
## General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with Invenio; if not, write to the Free Software Foundation, Inc., | ||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
|
||
CLEANFILES = *~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## This file is part of Invenio. | ||
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN. | ||
## | ||
## Invenio is free software; you can redistribute it and/or | ||
## modify it under the terms of the GNU General Public License as | ||
## published by the Free Software Foundation; either version 2 of the | ||
## License, or (at your option) any later version. | ||
## | ||
## Invenio is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
## General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with Invenio; if not, write to the Free Software Foundation, Inc., | ||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
|
||
pylibdir = $(libdir)/python/invenio | ||
webdir = $(localstatedir)/www/img | ||
jsdir = $(localstatedir)/www/js | ||
|
||
pylib_DATA = webnews.py \ | ||
webnews_config.py \ | ||
webnews_webinterface.py \ | ||
webnews_dblayer.py \ | ||
webnews_utils.py | ||
|
||
js_DATA = webnews.js | ||
|
||
web_DATA = webnews.css | ||
|
||
EXTRA_DIST = $(pylib_DATA) \ | ||
$(js_DATA) \ | ||
$(web_DATA) | ||
|
||
CLEANFILES = *~ *.tmp *.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/*************************************************************************** | ||
* Assume that we want the arrow's size (i.e. side; height in case it's on * | ||
* the left or right side; width otherwise) to be 16px. Then the border * | ||
* width for the arrow and its border will be half that dimension, 8px. In * | ||
* order for the arrow to be right on the tooltip, the arrow border's left * | ||
* positioning has to be as much as it's size, therefore -16px. The arrow's * | ||
* left positioning has to be a couple of pixels to the right in order for * | ||
* the border effect to be visible, therefore -14px. At the same time, in * | ||
* order for the arrow's point to not overlap with the targeted item, the * | ||
* tooltip's left margin has to be half the arrow's size (=the arrow's * | ||
* border width), 8px. The tooltip's padding has to at least as much as the * | ||
* arrow's left positioning overhead, (-(-16px-(-14px))) 2px in this case. * | ||
* The arrow's and the arrow border's top positioning can be as much as we * | ||
* want, and it must be the same for both. * | ||
* * | ||
* Desired arrow's size ([height|width]): 16px * | ||
* Arrow's border-width: 8px (half the arrow's size) * | ||
* Tooltip's [left|right] margin: 8px (half the arrow's size) * | ||
* Arrow's [left|right] positioning: -16px & -14px (arrow border and arrow) * | ||
* Arrow's [top|bottom] positioning: 8px * | ||
* * | ||
***************************************************************************/ | ||
|
||
/* Arrow implementation using traditional elements */ | ||
.ttn { | ||
/* Display */ | ||
position: absolute; | ||
display: none; | ||
z-index: 9997; | ||
|
||
/* Dimensions */ | ||
max-width: 250px; | ||
min-width: 150px; | ||
|
||
/* Contents */ | ||
background: #FFFFCC; | ||
margin-left: 8px; | ||
padding: 5px; /* padding has to be at least 2 */ | ||
font-size: small; | ||
|
||
/* Border */ | ||
border: 1px solid #FFCC00; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-o-border-radius: 5px; | ||
border-radius: 5px; | ||
|
||
/* Shadow */ | ||
-moz-box-shadow: 1px 1px 3px gray; | ||
-webkit-box-shadow: 1px 1px 3px gray; | ||
-o-box-shadow: 1px 1px 3px gray; | ||
box-shadow: 1px 1px 3px gray; | ||
} | ||
|
||
.ttn_arrow { | ||
/* Display */ | ||
position: absolute; | ||
left: -14px; | ||
top: 8px; | ||
z-index: 9999; | ||
|
||
/* Dimensions */ | ||
height: 0; | ||
width: 0; | ||
|
||
/* Border */ | ||
border-color: transparent #FFFFCC transparent transparent; | ||
border-color: rgba(255,255,255,0) #FFFFCC rgba(255,255,255,0) rgba(255,255,255,0); | ||
border-style: solid; | ||
border-width: 8px; | ||
} | ||
|
||
.ttn_arrow_border { | ||
/* Display */ | ||
position: absolute; | ||
left: -16px; | ||
top: 8px; | ||
z-index: 9998; | ||
|
||
/* Dimensions */ | ||
height: 0; | ||
width: 0; | ||
|
||
/* Border */ | ||
border-color: transparent #FFCC00 transparent transparent; | ||
border-color: rgba(255,255,255,0) #FFCC00 rgba(255,255,255,0) rgba(255,255,255,0); | ||
border-style: solid; | ||
border-width: 8px; | ||
} | ||
|
||
/* Arrow implementation using the :before and :after pseudo elements */ | ||
.ttn_alt_arrow_box { | ||
/* Display */ | ||
position: absolute; | ||
display: none; | ||
z-index: 9997; | ||
|
||
/* Dimensions */ | ||
max-width: 250px; | ||
min-width: 150px; | ||
|
||
/* Contents */ | ||
background: #FFFFCC; | ||
margin-left: 6px; | ||
padding: 3px; | ||
|
||
/* Border */ | ||
border: 1px solid #FFCC00; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-o-border-radius: 5px; | ||
border-radius: 5px; | ||
|
||
/* Shadow */ | ||
-moz-box-shadow: 1px 1px 3px gray; | ||
-webkit-box-shadow: 1px 1px 3px gray; | ||
-o-box-shadow: 1px 1px 3px gray; | ||
box-shadow: 1px 1px 3px gray; | ||
} | ||
|
||
.ttn_alt_arrow_box:after, .ttn_alt_arrow_box:before { | ||
right: 100%; | ||
border: 1px solid transparent; | ||
content: " "; | ||
height: 0; | ||
width: 0; | ||
position: absolute; | ||
pointer-events: none; | ||
} | ||
|
||
.ttn_alt_arrow_box:after { | ||
border-color: transparent; | ||
border-right-color: #FFFFCC; | ||
border-width: 6px; | ||
top: 13px; | ||
} | ||
|
||
.ttn_alt_arrow_box:before { | ||
border-color: transparent; | ||
border-right-color: #FFCC00; | ||
border-width: 8px; | ||
top: 11px; | ||
} | ||
|
||
/* Style for the tooltip's contents */ | ||
.ttn_text { | ||
/* Contents */ | ||
vertical-align: top; | ||
text-align: left; | ||
} | ||
|
||
.ttn_actions { | ||
/* Contents */ | ||
vertical-align: bottom; | ||
text-align: right; | ||
} | ||
|
||
.ttn_actions_read_more { | ||
} | ||
|
||
.ttn_actions_dismiss { | ||
} |
Oops, something went wrong.