Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 89c9884a
authored
Nov 30, 2021
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan menus dan upload
1 parent
7611904f
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
74 deletions
.gitignore
opensipkd/base/__init__.py
opensipkd/base/scripts/initializedb.py
opensipkd/base/static/css/custom.css
opensipkd/base/static/icon/default.png
opensipkd/base/views/base_views.py
opensipkd/base/views/posisi.py
opensipkd/base/views/templates/base3.1.pt
opensipkd/base/views/templates/home.pt
opensipkd/base/views/templates/upload.pt
opensipkd/base/views/upload.py
.gitignore
View file @
89c9884
...
@@ -105,6 +105,8 @@ ENV/
...
@@ -105,6 +105,8 @@ ENV/
opensipkd/base/static/img/*
opensipkd/base/static/img/*
opensipkd/base/static/icon/*
!opensipkd/base/static/icon/default.png
!opensipkd/base/static/img/pyramid.png
!opensipkd/base/static/img/pyramid.png
!opensipkd/base/static/img/opensipkd.png
!opensipkd/base/static/img/opensipkd.png
!opensipkd/base/static/img/opensipkd_bg.png
!opensipkd/base/static/img/opensipkd_bg.png
...
...
opensipkd/base/__init__.py
View file @
89c9884
...
@@ -248,7 +248,13 @@ def get_menus(request):
...
@@ -248,7 +248,13 @@ def get_menus(request):
result
=
{}
result
=
{}
for
menu
in
menus
:
for
menu
in
menus
:
if
menu
.
find
(
':'
)
>
-
1
:
if
menu
.
find
(
','
)
>
-
1
:
key
,
val
=
menu
.
strip
()
.
split
(
','
)
key
=
key
.
strip
()
.
strip
(
'/'
)
val
=
re
.
sub
(
'[//-]'
,
' '
,
val
)
elif
menu
.
find
(
':'
)
>
-
1
:
key
,
val
=
menu
.
strip
()
.
split
(
':'
)
key
,
val
=
menu
.
strip
()
.
split
(
':'
)
key
=
key
.
strip
()
.
strip
(
'/'
)
key
=
key
.
strip
()
.
strip
(
'/'
)
val
=
re
.
sub
(
'[//-]'
,
' '
,
val
)
val
=
re
.
sub
(
'[//-]'
,
' '
,
val
)
...
...
opensipkd/base/scripts/initializedb.py
View file @
89c9884
...
@@ -52,9 +52,7 @@ def get_file(filename):
...
@@ -52,9 +52,7 @@ def get_file(filename):
return
open
(
fullpath
)
return
open
(
fullpath
)
def
restore_csv
(
table
,
filename
,
get_file_func
=
get_file
,
db_session
=
None
):
def
restore_csv
(
table
,
filename
,
get_file_func
=
get_file
,
db_session
=
DBSession
):
if
not
db_session
:
db_session
=
DBSession
q
=
db_session
.
query
(
table
)
q
=
db_session
.
query
(
table
)
if
q
.
first
():
if
q
.
first
():
return
return
...
@@ -65,20 +63,36 @@ def restore_csv(table, filename, get_file_func=get_file, db_session=None):
...
@@ -65,20 +63,36 @@ def restore_csv(table, filename, get_file_func=get_file, db_session=None):
is_first
=
True
is_first
=
True
fmap
=
dict
()
fmap
=
dict
()
for
cf
in
reader
:
for
cf
in
reader
:
# print(cf)
# sys.exit()
if
is_first
:
if
is_first
:
is_first
=
False
for
fieldname
in
cf
.
keys
():
for
fieldname
in
cf
.
keys
():
if
not
fieldname
:
continue
try
:
t
=
fieldname
.
split
(
'/'
)
t
=
fieldname
.
split
(
'/'
)
except
Exception
as
e
:
print
(
fieldname
,
cf
.
keys
())
raise
e
fname_orig
=
t
[
0
]
fname_orig
=
t
[
0
]
schema
=
"public"
if
t
[
1
:]:
if
t
[
1
:]:
foreign_table
,
foreign_field
=
t
[
1
]
.
split
(
'.'
)
t_array
=
t
[
1
]
.
split
(
'.'
)
foreign_table
=
Table
(
foreign_table
,
Base
.
metadata
,
autoload
=
True
)
if
len
(
t_array
)
==
2
:
foreign_table
=
t_array
[
0
]
foreign_field
=
t_array
[
1
]
else
:
schema
=
t_array
[
0
]
foreign_table
=
t_array
[
1
]
foreign_field
=
t_array
[
2
]
# foreign_table, foreign_field = t[1].split('.')
foreign_table
=
Table
(
foreign_table
,
Base
.
metadata
,
autoload
=
True
,
schema
=
schema
)
foreign_field
=
getattr
(
foreign_table
.
c
,
foreign_field
)
foreign_field
=
getattr
(
foreign_table
.
c
,
foreign_field
)
foreigns
[
fieldname
]
=
(
foreign_table
,
foreign_field
)
foreigns
[
fieldname
]
=
(
foreign_table
,
foreign_field
)
fmap
[
fieldname
]
=
fname_orig
fmap
[
fieldname
]
=
fname_orig
is_first
=
False
row
=
table
()
row
=
table
()
for
fieldname
in
cf
:
for
fieldname
in
cf
:
...
@@ -122,7 +136,6 @@ def append_csv(table, filename, keys, get_file_func=get_file,
...
@@ -122,7 +136,6 @@ def append_csv(table, filename, keys, get_file_func=get_file,
foreigns
=
dict
()
foreigns
=
dict
()
is_first
=
True
is_first
=
True
fmap
=
dict
()
fmap
=
dict
()
print
(
f
,
reader
)
for
cf
in
reader
:
for
cf
in
reader
:
if
is_first
:
if
is_first
:
is_first
=
False
is_first
=
False
...
@@ -136,19 +149,19 @@ def append_csv(table, filename, keys, get_file_func=get_file,
...
@@ -136,19 +149,19 @@ def append_csv(table, filename, keys, get_file_func=get_file,
raise
e
raise
e
fname_orig
=
t
[
0
]
fname_orig
=
t
[
0
]
schema
=
"public"
schema
=
"public"
if
t
[
1
:]:
if
t
[
1
:]:
t_array
=
t
[
1
]
.
split
(
'.'
)
t_array
=
t
[
1
]
.
split
(
'.'
)
if
len
(
t_array
)
==
2
:
if
len
(
t_array
)
==
2
:
foreign_table
=
t_array
[
0
]
foreign_table
=
t_array
[
0
]
foreign_field
=
t_array
[
1
]
foreign_field
=
t_array
[
1
]
else
:
else
:
schema
=
t_array
[
0
]
schema
=
t_array
[
0
]
foreign_table
=
t_array
[
1
]
foreign_table
=
t_array
[
1
]
foreign_field
=
t_array
[
2
]
foreign_field
=
t_array
[
2
]
foreign_table
=
Table
(
foreign_table
,
Base
.
metadata
,
autoload
=
True
,
foreign_table
=
Table
(
foreign_table
,
Base
.
metadata
,
schema
=
schema
)
autoload
=
True
,
schema
=
schema
)
foreign_field
=
getattr
(
foreign_table
.
c
,
foreign_field
)
foreign_field
=
getattr
(
foreign_table
.
c
,
foreign_field
)
foreigns
[
fname
]
=
(
foreign_table
,
foreign_field
)
foreigns
[
fname
]
=
(
foreign_table
,
foreign_field
)
...
@@ -204,6 +217,7 @@ def append_csv(table, filename, keys, get_file_func=get_file,
...
@@ -204,6 +217,7 @@ def append_csv(table, filename, keys, get_file_func=get_file,
transaction
.
commit
()
# diperlukan commit per record khususnya untuk yang internal link
transaction
.
commit
()
# diperlukan commit per record khususnya untuk yang internal link
def
ask_password
(
name
):
def
ask_password
(
name
):
while
True
:
while
True
:
pass1
=
getpass
(
'Tulis password untuk {}: '
.
format
(
name
))
pass1
=
getpass
(
'Tulis password untuk {}: '
.
format
(
name
))
...
...
opensipkd/base/static/css/custom.css
View file @
89c9884
...
@@ -227,9 +227,6 @@ button {
...
@@ -227,9 +227,6 @@ button {
border-color
:
#f39c12
border-color
:
#f39c12
}
}
//
from
application
implementation
table
.dataTable
tr
.selected
td
{
table
.dataTable
tr
.selected
td
{
background-color
:
#9fafd1
background-color
:
#9fafd1
...
@@ -277,7 +274,7 @@ div.dataTables_length label {
...
@@ -277,7 +274,7 @@ div.dataTables_length label {
.ui-autocomplete-loading
{
.ui-autocomplete-loading
{
padding-right
:
10px
;
padding-right
:
10px
;
background
:
url(
../img/loading.gif)
right
10px
center
no-repeat
!important
;
background
:
url(
"../img/loading.gif")
right
10px
center
no-repeat
!important
;
}
}
.ui-autocomplete
{
.ui-autocomplete
{
max-height
:
200px
;
max-height
:
200px
;
...
...
opensipkd/base/static/icon/default.png
0 → 100644
View file @
89c9884
4.25 KB
opensipkd/base/views/base_views.py
View file @
89c9884
...
@@ -112,12 +112,13 @@ class BaseView(object):
...
@@ -112,12 +112,13 @@ class BaseView(object):
self
.
add_schema
=
""
self
.
add_schema
=
""
self
.
table
=
""
self
.
table
=
""
def
route_list
(
self
,
):
def
route_list
(
self
,
msg
=
None
,
error
=
""
):
return
HTTPFound
(
location
=
self
.
req
.
route_url
(
self
.
list_route
))
return
HTTPFound
(
location
=
self
.
req
.
route_url
(
self
.
list_route
))
@staticmethod
def
form_validator
(
form
,
value
):
def
form_validator
(
self
,
form
,
value
):
pass
pass
def
get_params
(
self
,
params
):
def
get_params
(
self
,
params
):
return
get_params
(
params
)
return
get_params
(
params
)
...
...
opensipkd/base/views/posisi.py
View file @
89c9884
...
@@ -77,6 +77,7 @@ class EditSchema(AddSchema):
...
@@ -77,6 +77,7 @@ class EditSchema(AddSchema):
missing
=
colander
.
drop
,
missing
=
colander
.
drop
,
widget
=
widget
.
HiddenWidget
())
widget
=
widget
.
HiddenWidget
())
class
ViewPartner
(
BaseView
):
class
ViewPartner
(
BaseView
):
def
__init__
(
self
,
request
):
def
__init__
(
self
,
request
):
super
(
ViewPartner
,
self
)
.
__init__
(
request
)
super
(
ViewPartner
,
self
)
.
__init__
(
request
)
...
@@ -170,7 +171,7 @@ class ViewPartner(BaseView):
...
@@ -170,7 +171,7 @@ class ViewPartner(BaseView):
{
'title'
:
"Jabatan"
,
'data'
:
"jabatan"
},
{
'title'
:
"Jabatan"
,
'data'
:
"jabatan"
},
{
'title'
:
"Jenis Jabatan"
,
'data'
:
"jenis"
},
{
'title'
:
"Jenis Jabatan"
,
'data'
:
"jenis"
},
{
'title'
:
"Mulai"
,
'data'
:
"mulai"
},
{
'title'
:
"Mulai"
,
'data'
:
"mulai"
},
{
'title'
:
"Selesai"
,
'data'
:
"selesai"
},]
{
'title'
:
"Selesai"
,
'data'
:
"selesai"
},
]
self
.
list_buttons
=
'btn_view, btn_add, btn_edit, btn_delete, '
\
self
.
list_buttons
=
'btn_view, btn_add, btn_edit, btn_delete, '
\
'btn_close'
'btn_close'
self
.
form_params
=
dict
(
scripts
=
""
)
self
.
form_params
=
dict
(
scripts
=
""
)
...
@@ -198,7 +199,6 @@ class ViewPartner(BaseView):
...
@@ -198,7 +199,6 @@ class ViewPartner(BaseView):
elif
not
value
[
'partner_id'
]:
elif
not
value
[
'partner_id'
]:
err_partner
()
err_partner
()
def
get_form
(
self
,
class_form
,
row
=
None
,
buttons
=
(
btn_save
,
btn_cancel
)):
def
get_form
(
self
,
class_form
,
row
=
None
,
buttons
=
(
btn_save
,
btn_cancel
)):
schema
=
class_form
(
validator
=
self
.
form_validator
)
schema
=
class_form
(
validator
=
self
.
form_validator
)
schema
=
schema
.
bind
(
request
=
self
.
req
)
schema
=
schema
.
bind
(
request
=
self
.
req
)
...
@@ -215,7 +215,6 @@ class ViewPartner(BaseView):
...
@@ -215,7 +215,6 @@ class ViewPartner(BaseView):
PartnerDBSession
.
flush
()
PartnerDBSession
.
flush
()
return
row
return
row
def
save_request
(
self
,
values
,
row
=
None
):
def
save_request
(
self
,
values
,
row
=
None
):
request
=
self
.
req
request
=
self
.
req
if
'id'
in
request
.
matchdict
:
if
'id'
in
request
.
matchdict
:
...
@@ -230,32 +229,27 @@ class ViewPartner(BaseView):
...
@@ -230,32 +229,27 @@ class ViewPartner(BaseView):
values
[
'selesai'
]
=
date_from_str
(
values
[
'selesai'
])
values
[
'selesai'
]
=
date_from_str
(
values
[
'selesai'
])
else
:
else
:
values
[
'selesai'
]
=
None
values
[
'selesai'
]
=
None
query_struktural
=
DBSession
.
query
(
Jabatan
.
jenis
)
.
\
query_struktural
=
DBSession
.
query
(
Jabatan
.
jenis
)
.
\
filter
(
Jabatan
.
id
==
values
[
'jabatan_id'
])
.
scalar
()
filter
(
Jabatan
.
id
==
values
[
'jabatan_id'
])
.
scalar
()
values
[
'struktural_id'
]
=
query_struktural
values
[
'struktural_id'
]
=
query_struktural
row
=
self
.
save
(
values
,
request
.
user
,
row
)
row
=
self
.
save
(
values
,
request
.
user
,
row
)
request
.
session
.
flash
(
'Posisi Partner sudah disimpan.'
)
request
.
session
.
flash
(
'Posisi Partner sudah disimpan.'
)
def
route_list
(
self
,
):
def
route_list
(
self
,
):
return
HTTPFound
(
location
=
self
.
req
.
route_url
(
self
.
list_route
))
return
HTTPFound
(
location
=
self
.
req
.
route_url
(
self
.
list_route
))
def
session_failed
(
self
,
session_name
):
def
session_failed
(
self
,
session_name
):
r
=
dict
(
form
=
self
.
request
.
session
[
session_name
])
r
=
dict
(
form
=
self
.
request
.
session
[
session_name
])
del
self
.
request
.
session
[
session_name
]
del
self
.
request
.
session
[
session_name
]
return
r
return
r
def
query_id
(
self
):
def
query_id
(
self
):
return
PartnerDBSession
.
query
(
PartnerDepartemen
)
.
filter_by
(
id
=
self
.
req
.
matchdict
[
'id'
])
return
PartnerDBSession
.
query
(
PartnerDepartemen
)
.
filter_by
(
id
=
self
.
req
.
matchdict
[
'id'
])
def
id_not_found
(
self
):
def
id_not_found
(
self
):
msg
=
'Posisi Partner ID
%
s Tidak Ditemukan.'
%
self
.
req
.
matchdict
[
'id'
]
msg
=
'Posisi Partner ID
%
s Tidak Ditemukan.'
%
self
.
req
.
matchdict
[
'id'
]
self
.
request
.
session
.
flash
(
msg
,
'error'
)
self
.
req
.
session
.
flash
(
msg
,
'error'
)
return
route_list
()
return
self
.
route_list
()
########
########
# List #
# List #
...
@@ -414,7 +408,6 @@ class ViewPartner(BaseView):
...
@@ -414,7 +408,6 @@ class ViewPartner(BaseView):
form
.
set_appstruct
(
self
.
get_values
(
row
,
values
))
form
.
set_appstruct
(
self
.
get_values
(
row
,
values
))
return
dict
(
form
=
form
.
render
(
readonly
=
True
),
scripts
=
self
.
form_scripts
)
return
dict
(
form
=
form
.
render
(
readonly
=
True
),
scripts
=
self
.
form_scripts
)
#########
#########
# Add #
# Add #
#########
#########
...
@@ -430,7 +423,7 @@ class ViewPartner(BaseView):
...
@@ -430,7 +423,7 @@ class ViewPartner(BaseView):
try
:
try
:
controls
=
form
.
validate
(
controls
)
controls
=
form
.
validate
(
controls
)
except
ValidationFailure
as
e
:
except
ValidationFailure
as
e
:
form
.
render
(
appstruct
=
e
.
cstruct
)
form
.
render
(
appstruct
=
e
.
cstruct
)
return
dict
(
form
=
form
.
render
(),
scripts
=
self
.
form_scripts
)
return
dict
(
form
=
form
.
render
(),
scripts
=
self
.
form_scripts
)
self
.
save_request
(
dict
(
controls
))
self
.
save_request
(
dict
(
controls
))
return
self
.
route_list
()
return
self
.
route_list
()
...
@@ -522,7 +515,7 @@ class ViewPartner(BaseView):
...
@@ -522,7 +515,7 @@ class ViewPartner(BaseView):
if
jb
:
if
jb
:
values
[
'struktural_nm'
]
=
jb
.
nama
values
[
'struktural_nm'
]
=
jb
.
nama
form
.
set_appstruct
(
self
.
get_values
(
row
,
values
))
form
.
set_appstruct
(
self
.
get_values
(
row
,
values
))
return
dict
(
row
=
row
,
form
=
form
.
render
(
readonly
=
True
),
scripts
=
self
.
form_scripts
)
return
dict
(
row
=
row
,
form
=
form
.
render
(
readonly
=
True
),
scripts
=
self
.
form_scripts
)
def
get_values
(
self
,
row
,
values
=
None
):
def
get_values
(
self
,
row
,
values
=
None
):
if
not
values
:
if
not
values
:
...
...
opensipkd/base/views/templates/base3.1.pt
View file @
89c9884
...
@@ -4,14 +4,10 @@
...
@@ -4,14 +4,10 @@
home request.route_url('home')[:-1];
home request.route_url('home')[:-1];
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
group_path ['group', 'group-add', 'group-edit', 'group-view', 'group-delete'];
group_path ['group', 'group-add', 'group-edit', 'group-view', 'group-delete'];
param_path ['parameter', 'parameter-add', 'parameter-edit', 'parameter-view',
param_path ['parameter', 'parameter-add', 'parameter-edit', 'parameter-view', 'parameter-delete'];
'parameter-delete'];
dep_path ['departemen', 'departemen-add', 'departemen-edit', 'departemen-view', 'departemen-delete'];
dep_path ['departemen', 'departemen-add', 'departemen-edit',
partner_path ['partner', 'partner-add', 'partner-edit', 'partner-view', 'partner-delete'];
'departemen-view', 'departemen-delete'];
part_dep_path ['partner-departemen', 'partner-departemen-add', 'partner-departemen-edit', 'partner-departemen-view',
partner_path ['partner', 'partner-add', 'partner-edit', 'partner-view',
'partner-delete'];
part_dep_path ['partner-departemen', 'partner-departemen-add',
'partner-departemen-edit', 'partner-departemen-view',
'partner-departemen-delete'];
'partner-departemen-delete'];
jabatan_path ['jabatan', 'jabatan-add', 'jabatan-edit', 'jabatan-view',
jabatan_path ['jabatan', 'jabatan-add', 'jabatan-edit', 'jabatan-view',
'jabatan-delete'];
'jabatan-delete'];
...
@@ -59,7 +55,7 @@
...
@@ -59,7 +55,7 @@
<metal:css
define-slot=
"css_files"
></metal:css>
<metal:css
define-slot=
"css_files"
></metal:css>
<style
metal:define-slot=
"style"
>
<style
metal:define-slot=
"style"
>
.twitter-typeahead
{
.twitter-typeahead
{
font-size
:
12px
!important
;
font-size
:
12px
!important
;
margin-bottom
:
0
;
margin-bottom
:
0
;
width
:
100%
;
width
:
100%
;
...
@@ -67,7 +63,7 @@
...
@@ -67,7 +63,7 @@
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
z-index
:
auto
;
z-index
:
auto
;
}
}
.twitter-typeahead
.tt-query
,
.twitter-typeahead
.tt-hint
{
.twitter-typeahead
.tt-query
,
.twitter-typeahead
.tt-hint
{
...
@@ -78,7 +74,7 @@
...
@@ -78,7 +74,7 @@
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
z-index
:
auto
;
z-index
:
auto
;
}
}
</style>
</style>
...
@@ -125,7 +121,8 @@
...
@@ -125,7 +121,8 @@
</div>
</div>
<!-- collapse menu button -->
<!-- collapse menu button -->
<div
id=
"hide-menu"
class=
"btn-header pull-right"
>
<div
id=
"hide-menu"
class=
"btn-header pull-right"
>
<span>
<a
href=
"javascript:void(0);"
data-action=
"toggleMenu"
title=
"Collapse Menu"
><i
class=
"fa fa-reorder"
></i></a>
</span>
<span>
<a
href=
"javascript:void(0);"
data-action=
"toggleMenu"
title=
"Collapse Menu"
><i
class=
"fa fa-reorder"
></i></a>
</span>
</div>
</div>
<!-- end collapse menu -->
<!-- end collapse menu -->
...
@@ -140,11 +137,13 @@
...
@@ -140,11 +137,13 @@
<ul
tal:condition=
"request.user"
class=
"header-dropdown-list hidden-xs"
>
<ul
tal:condition=
"request.user"
class=
"header-dropdown-list hidden-xs"
>
<li>
<li>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
><i
class=
"fa fa-lg fa-fw fa-user"
></i>
<span
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
><i
class=
"fa fa-lg fa-fw fa-user"
></i>
<span
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<i
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<i
class=
"fa fa-angle-down"
></i>
</a>
class=
"fa fa-angle-down"
></i>
</a>
<ul
class=
"dropdown-menu pull-right"
>
<ul
class=
"dropdown-menu pull-right"
>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('logout')}"
>
Logout
</a></li>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('logout')}"
>
Logout
</a></li>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah password
</a></li>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah password
</a>
</li>
<li
tal:condition=
"request.user.api_key"
><a
<li
tal:condition=
"request.user.api_key"
><a
style=
"text-transform:capitalize"
style=
"text-transform:capitalize"
href=
"${home}/recreate-api-key"
>
API Key
</a></li>
href=
"${home}/recreate-api-key"
>
API Key
</a></li>
...
...
opensipkd/base/views/templates/home.pt
View file @
89c9884
...
@@ -37,18 +37,6 @@
...
@@ -37,18 +37,6 @@
<div
id=
"content"
class=
"container"
>
<div
id=
"content"
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-10 col-sm-offset-1"
>
<div
class=
"col-sm-10 col-sm-offset-1"
>
<!--div class="col-sm-4 padding-thin">
<div class="box about">
<a href="#" data-toggle="modal"
data-target="#about-us"
style="color:#fff; text-decoration:none;">
<i class="fa fa-info-circle"></i>
<span class="about-text">Powered by</span>
<img id="" src="${home}static/img/opensipkd.png"
alt="">
</a>
</div>
</div-->
<div
class=
"col-sm-12 padding-thin"
>
<div
class=
"col-sm-12 padding-thin"
>
<div
class=
"box appname"
>
<div
class=
"box appname"
>
<div
class=
"col-sm-3 padding-medium"
align=
"center"
>
<div
class=
"col-sm-3 padding-medium"
align=
"center"
>
...
@@ -64,10 +52,17 @@
...
@@ -64,10 +52,17 @@
</div>
</div>
<div
class=
"col-sm-12 no-padding"
align=
"center"
>
<div
class=
"col-sm-12 no-padding"
align=
"center"
>
<div
tal:repeat=
"modul modules"
class=
"col-sm-3 col-xs-6 module padding-thin"
>
<div
tal:repeat=
"modul modules"
class=
"col-sm-3 col-xs-6 module padding-thin"
>
<a
href=
"${home}${modul}"
icon=
"${modul.replace('/','_')}"
class=
"box"
>
<a
tal:condition=
"modul.find('://')<0"
href=
"${home}${modul}"
icon=
"${modul.replace('/','_')}"
class=
"box"
>
<img
alt=
""
class=
"icon-modul"
src=
"${home}static/icon/${modul.replace('/','_')}.png"
>
<img
alt=
""
class=
"icon-modul"
src=
"${home}static/icon/${modul.replace('/','_')}.png"
>
<span>
${modules[modul]}
</span>
<span>
${modules[modul]}
</span>
</a>
</a>
<a
tal:condition=
"modul.find('://')>-1"
target=
"_blank"
href=
"${modul}"
class=
"box"
>
<img
alt=
""
class=
"icon-modul"
src=
"${home}static/icon/${modul.replace('://','').replace('https','').replace('http','')}.png"
>
<span>
${modules[modul]}
</span>
</a>
</div>
</div>
</div>
</div>
...
...
opensipkd/base/views/templates/upload.pt
View file @
89c9884
<html
metal:use-macro=
"load: main.pt"
>
<html
metal:use-macro=
"load: main.pt"
>
<!-- content -->
<!-- content -->
<div
metal:fill-slot=
"content"
>
<div
metal:fill-slot=
"content"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
@@ -16,10 +16,9 @@
...
@@ -16,10 +16,9 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end content -->
<!-- end content -->
</html>
</html>
\ No newline at end of file
\ No newline at end of file
opensipkd/base/views/upload.py
View file @
89c9884
...
@@ -51,11 +51,15 @@ class AddSchema(colander.Schema):
...
@@ -51,11 +51,15 @@ class AddSchema(colander.Schema):
FileData
(),
FileData
(),
widget
=
widget
.
FileUploadWidget
(
tmpstore
),
widget
=
widget
.
FileUploadWidget
(
tmpstore
),
title
=
'Unggah'
)
title
=
'Unggah'
)
typ
=
colander
.
SchemaNode
(
colander
.
String
(),
widget
=
widget
.
SelectWidget
(
values
=
((
'img'
,
"Image"
),
(
'icon'
,
"Icon"
))),
title
=
'Jenis'
)
def
get_form
(
schema_cls
):
def
get_form
(
schema_cls
):
schema
=
schema_cls
()
schema
=
schema_cls
()
return
Form
(
schema
,
buttons
=
(
'simpan'
,
'batal
kan
'
))
return
Form
(
schema
,
buttons
=
(
'simpan'
,
'batal'
))
@view_config
(
route_name
=
'upload-logo'
,
@view_config
(
route_name
=
'upload-logo'
,
...
@@ -65,7 +69,6 @@ def view_file(request):
...
@@ -65,7 +69,6 @@ def view_file(request):
form
=
get_form
(
AddSchema
)
form
=
get_form
(
AddSchema
)
if
request
.
POST
:
if
request
.
POST
:
if
'simpan'
in
request
.
POST
:
if
'simpan'
in
request
.
POST
:
settings
=
get_settings
()
input_file
=
request
.
POST
[
'upload'
]
.
file
input_file
=
request
.
POST
[
'upload'
]
.
file
filename
=
request
.
POST
[
'upload'
]
.
filename
.
lower
()
filename
=
request
.
POST
[
'upload'
]
.
filename
.
lower
()
ext
=
get_ext
(
filename
)
.
lower
()
ext
=
get_ext
(
filename
)
.
lower
()
...
@@ -81,8 +84,13 @@ def view_file(request):
...
@@ -81,8 +84,13 @@ def view_file(request):
elif
filename
.
startswith
(
'background'
):
elif
filename
.
startswith
(
'background'
):
fname
=
f
"background{ext}"
fname
=
f
"background{ext}"
else
:
else
:
fname
=
filename
fname
=
filename
fullpath
=
os
.
path
.
join
(
static_path
,
'img/'
+
fname
)
folder
=
os
.
path
.
join
(
static_path
,
request
.
POST
[
'typ'
])
if
not
os
.
path
.
exists
(
folder
):
os
.
makedirs
(
folder
)
fullpath
=
os
.
path
.
join
(
folder
,
fname
)
output_file
=
open
(
fullpath
,
'wb'
)
output_file
=
open
(
fullpath
,
'wb'
)
input_file
.
seek
(
0
)
input_file
.
seek
(
0
)
while
True
:
while
True
:
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment