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
})
-def file_html(request, path):
- return direct_to_template(request, 'explorer/file_html.html', extra_context={
- 'object': html.transform(repo.get_file(path).data(), is_file=False),
- 'hash': path,
- 'image_folders_form': forms.ImageFoldersForm(),
+# ===============
+# = Panel views =
+# ===============
+def xmleditor_panel(request, path):
+ form = forms.BookForm()
+ text = repo.get_file(path).data()
+
+ return direct_to_template(request, 'explorer/panels/xmleditor.html', extra_context={
+ 'text': text,
+ })
+
+
+def gallery_panel(request, path):
+ return direct_to_template(request, 'explorer/panels/gallery.html', extra_context={
+ 'form': forms.ImageFoldersForm(),
})
-
+
+
+def htmleditor_panel(request, path):
+ return direct_to_template(request, 'explorer/panels/htmleditor.html', extra_context={
+ 'html': html.transform(repo.get_file(path).data(), is_file=False),
+ })
+
+
def folder_images(request, folder):
return direct_to_template(request, 'explorer/folder_images.html', extra_context={
'images': models.get_images_from_folder(folder),
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 {
overflow-y: scroll;
}
-#whatever {
- float: left;
+/* ========== */
+/* = Panels = */
+/* ========== */
+.panel-wrap {
+ overflow: hidden;
}
-#images-wrap {
-/* width: 0px;*/
- height: 480px;
- overflow-y: scroll;
- overflow-x: hidden;
- background-color: #fff;
+#left-panel-wrap {
float: left;
+ width: 8px;
}
-#sidebar {
- float: left;
- width: 8px;
+
+/* Toolbars with select box to change panel contents*/
+.panel-toolbar {
+ height: 20px;
+ padding: 0 0 2px 0;
+ border-top: 1px solid #AAA;
+ border-bottom: 1px solid #AAA;
+ font-size: 12px;
+ line-height: 20px;
+ background-color: #DDD;
+ white-space: nowrap;
overflow: hidden;
}
-#toggle-sidebar {
+.panel-toolbar label {
+ display: block;
+ float: left;
+ margin: 0 10px 0 2px;
+}
+
+/* Slider between panels */
+#slider {
border-left: 1px solid #999;
border-right: 1px solid #999;
background-color: #DDD;
float: left;
}
-#toggle-sidebar:hover {
+#slider:hover {
background-color: #999;
cursor: col-resize;
}
-#status-bar {
- border-top: 1px solid #999;
- background-color: #EEE;
- padding: 2px 10px;
-}
-
-.errorlist {
- color: red;
- margin: 0 20px 0 0;
- padding: 0;
- float: left;
-}
-
-.errorlist:before {
- content: '';
- clear: both;
+/* ================= */
+/* = Gallery panel = */
+/* ================= */
+.images-wrap, .htmleditor {
+ overflow-x: hidden;
+ overflow-y: scroll;
}
-p {
- margin: 0;
-}
-.image-box {
- border-top: 1px solid #DDD;
-}
+/* ==================== */
+/* = XML Editor panel = */
+/* ==================== */
#toolbar {
height: 48px;
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;
+ }
+
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'^html/(?P<path>[^/]+)/$', 'explorer.views.file_html', name='file_html'),
url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'),
+ # Editor panels
+ url(r'^editor/(?P<path>[^/]+)/panels/xmleditor/$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
+ url(r'^editor/(?P<path>[^/]+)/panels/gallery/$', 'explorer.views.gallery_panel', name='gallery_panel'),
+ url(r'^editor/(?P<path>[^/]+)/panels/htmleditor/$', 'explorer.views.htmleditor_panel', name='htmleditor_panel'),
+
# 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'}),
)