from django.utils import simplejson as json
from django.views.generic.simple import direct_to_template
+
from django.conf import settings
from django.http import HttpResponseRedirect
+from django.contrib.auth.decorators import login_required
from explorer import forms, models
# 'django.template.loaders.eggs.load_template_source',
)
+TEMPLATE_CONTEXT_PROCESSORS = (
+ "django.core.context_processors.auth",
+ "django.core.context_processors.debug",
+ "django.core.context_processors.i18n",
+ "django.core.context_processors.media",
+ "django.core.context_processors.request",
+)
+
+
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
overflow: hidden;
}
-#breadcrumbs {
- padding: 2px 10px;
+#header {
+ position: relative;
+ padding: 2px 0.5em;
background-color: #CDCDCD;
- border-bottom: 1px solid #858585;
+ border-bottom: 1px solid black;
+ clear: both;
+}
+
+#header #breadcrumbs {
+
+}
+
+#header #login_info {
+ position: absolute;
+ right: 1em;
}
ul {
color: #FFF;
cursor: default;
}
+
+
+div.isection {
+ margin: 1em auto;
+ border: 1px solid black;
+ padding: 0.5em 2em;
+ background: #9f9ffa;
+
+ width: 60%;
+}
+
+div.isection p {
+ margin: 0.5em 1em;
+}
+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://platforma.wolnelektury.pl/">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>{% block title %}Platforma Redakcyjna{% endblock %}</title>
+ <title>{% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%}</title>
<link rel="stylesheet" href="/static/css/master.css" type="text/css" />
<script src="/static/js/jquery.js" type="text/javascript" charset="utf-8"></script>
{% block extrahead %}
{% endblock %}
</head>
<body id="{% block bodyid %}base{% endblock %}">
- <div id="breadcrumbs">{% block breadcrumbs %}Platforma Redakcyjna{% endblock breadcrumbs %}</div>
+ <div id="header">
+ <span id="breadcrumbs">{% block breadcrumbs %}Platforma Redakcyjna{% endblock breadcrumbs %}</span>
+ <span id="login_info">{% include "registration/head_login.html" %}</span>
+ </div>
{% block maincontent %}
{% endblock %}
--- /dev/null
+{% if user.is_authenticated %}
+<span class="user_name">{{ user.get_full_name }}</span> |
+<a href='{% url django.contrib.auth.views.logout %}?next_page={{request.get_full_path}}'>Wyloguj</a>
+{% else %}
+<a href='{% url django.contrib.auth.views.login %}?next_page={{request.get_full_path}}'>Logowanie</a>
+{% endif %}
--- /dev/null
+{% extends "base.html" %}
+
+{% block subtitle %} - Logowanie {% endblock subtitle %}
+
+{% block maincontent %}
+
+<div class="isection">
+<form method="POST" action="{% url django.contrib.auth.views.login %}">
+{{ form.as_p }}
+<p><input type="submit" value="Login" /></p>
+<input type="hidden" name="next_page" value="{{ next_page }}" />
+</form>
+</div>
+
+{% endblock maincontent %}
urlpatterns = patterns('',
- # Example:
+ # Explorer:
url(r'^$', 'explorer.views.file_list', name='file_list'),
url(r'^file/(?P<path>[^/]+)/$', 'explorer.views.file_xml', name='file_xml'),
url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
# Admin panel
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/(.*)', admin.site.root),
+
+ # Authorization
+ url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next_page'}),
+ url(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}), # {'redirect_field_name': 'next_page'}),
)
end
def refresh
+ @match_status = []
+
regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern])
Repository.all.each do |repo|
+ repo_status = []
repo.entries.each do |entry|
match = entry.path.match(regexp)
if match
Publication.find_or_create_by_name(:name => match[1],
:source_file => entry.path, :repository_id => repo.id)
- end
+ repo_status += [{:path => entry.path, :match => match[1], :matched => true}]
+ else
+ repo_status += [{:path => entry.path, :match =>nil, :matched => false}]
+ end
end
+ @match_status += [{:repo => repo, :status => repo_status}]
end
+
+ respond_to do |format|
+ format.html
+ format.xml { render :xml => @match_status}
+ format.json { render :json => @match_status }
+ end
end
def issues
<h2>Publikacje</h2>
+<p><a href="/publications/refresh">Odśwież listę publikacji</a></p>
<ol>
<% @publications.each do |pub| %>
<li><a href="/publications/issues/<%= pub.name %>"><%= pub.name %></a></li>
--- /dev/null
+<% @match_status.each do |repo_status| %>
+<h2>Repozytorium: <%= repo_status[:repo].url %></h2>
+<table>
+<tr><th>Ścieżka zasobu</th><th>Rozpoznano</th><th>ID zasobu</th></tr>
+
+<% repo_status[:status].each do |status| %>
+<tr>
+<td><%= status[:path] %></td>
+<td><%= (status[:matched] && 'Tak') || 'Nie' %></td>
+<td><%= status[:match] || '' %></td>
+</tr>
+<% end %>
+</table>
+<% end %>
-<% @tracker = Tracker.find(@settings['tracker']) %>
+<% @tracker = Tracker.find(@settings[:tracker] || 1) %>
<fieldset>
<p>
<p>
<label for="settings[pattern]">Filtr publikacji: </label>
- <%= text_field_tag 'settings[pattern]', @settings['pattern'] %>
+ <%= text_field_tag 'settings[pattern]', @settings[:pattern] || '' %>
</p>
</fieldset>