Commit b885fab2 authored by PkSM3's avatar PkSM3

[UPDATE] dynatable-paginator

parent c1a02b29
......@@ -80,7 +80,8 @@ urlpatterns = patterns('',
url(r'^tests/pubmedquery$', pubmedscrapper.getGlobalStats),
url(r'^tests/project/(\d+)/pubmedquery/go$', pubmedscrapper.doTheQuery),
url(r'^tests/project/(\d+)/ISTEXquery/go$', pubmedscrapper.testISTEX),
url(r'^tests/paginator/project/(\d+)/corpus/(\d+)/$', views.newpaginatorJSON)
url(r'^tests/paginator/corpus/(\d+)/$', views.newpaginatorJSON),
url(r'^tests/project/(\d+)/corpus/(\d+)/$', views.corpus_trial)
)
......
......@@ -308,13 +308,67 @@ def corpus(request, project_id, corpus_id):
return HttpResponse(html)
def newpaginatorJSON(request , project_id , corpus_id):
def corpus_trial(request, project_id, corpus_id):
if not request.user.is_authenticated():
return redirect('/login/?next=%s' % request.path)
try:
offset = int(project_id)
offset = int(corpus_id)
except ValueError:
raise Http404()
t = get_template('corpus_trial.html')
user = request.user
date = datetime.datetime.now()
project = cache.Node[int(project_id)]
corpus = cache.Node[int(corpus_id)]
type_doc_id = cache.NodeType['Document'].id
number = session.query(func.count(Node.id)).filter(Node.parent_id==corpus_id, Node.type_id==type_doc_id).all()[0][0]
try:
chart = dict()
chart['first'] = parse(corpus.children.first().metadata['publication_date']).strftime("%Y, %m, %d")
# TODO write with sqlalchemy
#chart['first'] = parse(session.query(Node.metadata['publication_date']).filter(Node.parent_id==corpus.id, Node.type_id==type_doc_id).first()).strftime("%Y, %m, %d")
chart['last'] = parse(corpus.children.last().metadata['publication_date']).strftime("%Y, %m, %d")
print(chart)
except Exception as error:
print(error)
try:
processing = corpus.metadata['Processing']
except Exception as error:
print(error)
processing = 0
print('processing', processing)
html = t.render(Context({\
'user': user,\
'date': date,\
'project': project,\
'corpus' : corpus,\
'processing' : processing,\
# 'documents': documents,\
'number' : number,\
'dates' : chart,\
}))
return HttpResponse(html)
def newpaginatorJSON(request , corpus_id):
results = ["hola" , "mundo"]
# t = get_template('tests/newpag/thetable.html')
project = session.query(Node).filter(Node.id==project_id).first()
# project = session.query(Node).filter(Node.id==project_id).first()
corpus = session.query(Node).filter(Node.id==corpus_id).first()
type_document_id = cache.NodeType['Document'].id
documents = session.query(Node).filter(Node.parent_id==corpus_id , Node.type_id == type_document_id ).all()
......@@ -344,17 +398,6 @@ def newpaginatorJSON(request , project_id , corpus_id):
"totalRecordCount":len(results)
}
return JsonHttpResponse(finaldict)
# html = t.render(Context({\
# # 'user': user,\
# # 'date': date,\
# 'project': project_id,\
# 'corpus' : corpus_id,\
# # 'documents': results,\
# # 'number' : len(filtered_docs),\
# # 'dates' : chart,\
# }))
# return HttpResponse(html)
# Im using this actually
......
Cython==0.20.2
Django==1.6.11
Jinja2==2.7.3
MarkupSafe==0.23
Pillow==2.5.3
Pygments==1.6
RandomWords==0.1.12
SQLAlchemy==0.9.8
South==1.0
aldjemy==0.3.10
amqp==1.4.6
anyjson==0.3.3
bibtexparser==0.6.0
billiard==3.3.0.18
celery==3.1.15
certifi==14.05.14
cffi==0.8.6
chardet==2.3.0
cryptography==0.6
decorator==3.4.0
django-autoslug==1.7.2
django-autoslug-field==0.2.3
django-celery==3.1.16
django-cte-trees==0.9.2
django-extensions==1.4.0
django-grappelli==2.5.3
django-hstore==1.3.1
django-maintenance==0.1
django-mptt==0.6.1
django-nested-inlines==0.1
django-pgfields==1.4.4
django-pgjson==0.2.2
django-pgjsonb==0.0.10
django-treebeard==2.0
djangorestframework==3.0.0
gensim==0.10.3
graphviz==0.4
ipython==2.2.0
kombu==3.0.23
lxml==3.4.1
matplotlib==1.4.0
networkx==1.9
nltk==3.0a4
nose==1.3.4
numpy==1.8.2
pandas==0.14.1
pexpect-u==2.5.1
psycopg2==2.5.4
pycountry==1.8
pycparser==2.10
pydot2==1.0.33
pyparsing==2.0.2
python-dateutil==2.2
python-igraph==0.7
pytz==2014.7
pyzmq==14.3.1
readline==6.2.4.1
redis==2.10.3
scikit-learn==0.15.1
scipy==0.14.0
simplerandom==0.12.1
six==1.7.3
sympy==0.7.5
tornado==4.0.1
uWSGI==2.0.7
ujson==1.33
from django.db import transaction
from lxml import etree
from .FileParser import FileParser
from ..NgramsExtractors import *
class PubmedFileParser(FileParser):
def _parse(self, file):
# open the file as XML
xml_parser = etree.XMLParser(resolve_entities=False, recover=True)
xml = etree.parse(file, parser=xml_parser)
xml_articles = xml.findall('PubmedArticle')
# parse all the articles, one by one
for xml_article in xml_articles:
# extract data from the document
metadata = {}
metadata_path = {
"journal" : 'MedlineCitation/Article/Journal/Title',
"title" : 'MedlineCitation/Article/ArticleTitle',
"language_iso3" : 'MedlineCitation/Article/Language',
"doi" : 'PubmedData/ArticleIdList/ArticleId[@type=doi]',
"abstract" : 'MedlineCitation/Article/Abstract/AbstractText',
"publication_year" : 'MedlineCitation/DateCreated/Year',
"publication_month" : 'MedlineCitation/DateCreated/Month',
"publication_day" : 'MedlineCitation/DateCreated/Day',
"authors" : 'MedlineCitation/Article/AuthorList',
}
for key, path in metadata_path.items():
try:
xml_node = xml_article.find(path)
if key == 'authors':
metadata[key] = ', '.join([
xml_author.find('ForeName').text + ' ' + xml_author.find('LastName').text
for xml_author in xml_node
])
else:
metadata[key] = xml_node.text
except:
pass
yield metadata
\ No newline at end of file
/*
* jQuery Dynatable plugin 0.3.1
*
* Copyright (c) 2014 Steve Schwartz (JangoSteve)
*
* Dual licensed under the AGPL and Proprietary licenses:
* http://www.dynatable.com/license/
*
* Date: Tue Jan 02 2014
*/
th {
background: #006a72;
}
th a {
color: #fff;
}
th a:hover {
color: #fff;
text-decoration: underline;
}
.dynatable-search {
float: right;
margin-bottom: 10px;
}
.dynatable-pagination-links {
float: right;
}
.dynatable-record-count {
display: block;
padding: 5px 0;
}
.dynatable-pagination-links span,
.dynatable-pagination-links li {
display: inline-block;
}
.dynatable-page-link,
.dynatable-page-break {
display: block;
padding: 5px 7px;
}
.dynatable-page-link {
cursor: pointer;
}
.dynatable-active-page,
.dynatable-disabled-page {
cursor: text;
}
.dynatable-active-page:hover,
.dynatable-disabled-page:hover {
text-decoration: none;
}
.dynatable-active-page {
background: #006a72;
border-radius: 5px;
color: #fff;
}
.dynatable-active-page:hover {
color: #fff;
}
.dynatable-disabled-page,
.dynatable-disabled-page:hover {
background: none;
color: #999;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -54,6 +54,7 @@ function getCookie(name) {
return cookieValue;
}
//Delete all the duplicates using the Django-Garg API.
function deleteDuplicates(url) {
console.log("hello world")
console.log(url)
......
<!DOCTYPE html>
<html ng-app="myApp">
{% load staticfiles %}
<head>
<link data-require="bootstrap-css@3.1.1" data-semver="3.1.1" rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="{% static "js/libs/css2/dirPagination.css" %}" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-8">
<div ng-controller="MyController" class="my-controller">
<h1>Tasty Paginated Menu</h1>
<small>this is in "MyController"</small>
<div class="row">
<div class="col-xs-4">
<h3>Meals Page: {{ currentPage }}</h3>
</div>
<div class="col-xs-4">
<label for="search">Search:</label>
<input ng-model="q" id="search" class="form-control" placeholder="Filter text">
</div>
<div class="col-xs-4">
<label for="search">items per page:</label>
<input type="number" min="1" max="100" class="form-control" ng-model="pageSize">
</div>
</div>
<br>
<div class="panel panel-default">
<div class="panel-body">
<ul>
<li dir-paginate="meal in meals | filter:q | itemsPerPage: pageSize" current-page="currentPage">{{ meal }}</li>
</ul>
</div>
</div>
</div>
<div ng-controller="OtherController" class="other-controller">
<small>this is in "OtherController"</small>
<div class="text-center">
<dir-pagination-controls boundary-links="true" on-page-change="pageChangeHandler(newPageNumber)">
<ul class="pagination" ng-if="1 < pages.length">
<li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }">
<a href="" ng-click="setCurrent(1)">&laquo;</a>
</li>
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }" class="ng-scope">
<a href="" ng-click="setCurrent(pagination.current - 1)" class="ng-binding"></a>
</li>
<li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == '...' }">
<a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a>
</li>
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }" class="ng-scope">
<a href="" ng-click="setCurrent(pagination.current + 1)" class="ng-binding"></a>
</li>
<li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == pagination.last }">
<a href="" ng-click="setCurrent(pagination.last)">&raquo;</a>
</li>
</ul>
</dir-pagination-controls>
</div>
</div>
</div>
</div>
</div>
<script data-require="angular.js@1.3.0" data-semver="1.3.0" src="http://code.angularjs.org/1.3.0/angular.js"></script>
<script data-require="jquery@*" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script data-require="bootstrap@3.1.1" data-semver="3.1.1" src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="{% static "js/libs/dirPagination.js"%}"></script>
<script>
// Code goes here
var myApp = angular.module('myApp', ['angularUtils.directives.dirPagination']);
function MyController($scope) {
$scope.currentPage = 1;
$scope.pageSize = 10;
$scope.meals = ["a","b","c","d"];
// var dishes = [
// 'noodles',
// 'sausage',
// 'beans on toast',
// 'cheeseburger',
// 'battered mars bar',
// 'crisp butty',
// 'yorkshire pudding',
// 'wiener schnitzel',
// 'sauerkraut mit ei',
// 'salad',
// 'onion soup',
// 'bak choi',
// 'avacado maki'
// ];
// var sides = [
// 'with chips',
// 'a la king',
// 'drizzled with cheese sauce',
// 'with a side salad',
// 'on toast',
// 'with ketchup',
// 'on a bed of cabbage',
// 'wrapped in streaky bacon',
// 'on a stick with cheese',
// 'in pitta bread'
// ];
// for (var i = 1; i <= 100; i++) {
// var dish = dishes[Math.floor(Math.random() * dishes.length)];
// var side = sides[Math.floor(Math.random() * sides.length)];
// $scope.meals.push('meal ' + i + ': ' + dish + ' ' + side);
// }
$scope.pageChangeHandler = function(num) {
console.log('meals page changed to ' + num);
};
}
function OtherController($scope) {
$scope.pageChangeHandler = function(num) {
console.log('going to page ' + num);
};
}
myApp.controller('MyController', MyController);
myApp.controller('OtherController', OtherController);
</script>
</body>
</html>
#!/bin/bash
function FA2gephi {
for f in gexfs/*.gexf
do
if [[ "$f" != *_.gexf* ]]
then
java -jar tinaviz-2.0-SNAPSHOT.jar "$f" 10 &
break;
fi
done
}
function testing {
for f in gexfs/*.gexf
do
if [[ "$f" != *_.gexf* ]]
then
variable=`cat $f | grep "<description>Carla__Taramasco"`
if [[ "$variable" != "" ]]
then
echo $f
fi
fi
done
}
# Usage:
# ./zearcher.sh "extension" "the query"
function test2 {
extension=$1
query=$2
# echo "lala $extension , $query"
iter=`find . -name "*.$extension" -print`
counter=0
for f in $iter
do
filename=`echo $f | sed s/"\.\/"//g`
variable=`cat $filename | grep "$query"`
if [[ "$variable" != "" ]]
then
echo $filename
counter=$((counter + 1));
fi
done
if [ $counter -eq 0 ]
then
echo "Nothing found. Die."
fi
}
test2 $1 $2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment