Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d65b84ee
authored
Feb 21, 2025
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan datatable dan css
1 parent
a3d64342
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
252 additions
and
235 deletions
opensipkd/base/static/css/osipkd.css
opensipkd/base/views/base_views.py
opensipkd/base/views/departemen.py
opensipkd/base/views/templates/base3.1.pt
opensipkd/base/views/user_login.py
opensipkd/base/views/widgets/autocomplete_input_ms.pt
opensipkd/detable/detable.py
opensipkd/detable/templates/detable.pt
opensipkd/base/static/css/osipkd.css
View file @
d65b84e
...
@@ -27,18 +27,28 @@ legend {
...
@@ -27,18 +27,28 @@ legend {
.twitter-typeahead
.tt-query
,
.twitter-typeahead
.tt-query
,
.twitter-typeahead
.tt-hint
{
.twitter-typeahead
.tt-hint
{
margin-bottom
:
0
;
margin-bottom
:
0
;
width
:
100%
;
width
:
100%
;
height
:
26px
;
height
:
26px
;
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
}
}
.twitter-typeahead
.tt-hint
{
.twitter-typeahead
.tt-hint
{
color
:
#a1a1a1
;
color
:
#a1a1a1
;
z-index
:
1
;
z-index
:
1
;
padding
:
3px
6px
;
padding
:
3px
6px
;
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
}
.select2-container
.select2-selection--single
.select2-selection__rendered
{
/* display: block; */
/* padding-left: 8px; */
/* padding-right: 20px; */
overflow
:
hidden
;
/* text-overflow: ellipsis; */
/* white-space: nowrap; */
padding
:
3px
6px
;
}
}
.form-control
{
.form-control
{
font-size
:
12px
;
font-size
:
12px
;
...
@@ -51,14 +61,14 @@ border: 1px solid transparent;
...
@@ -51,14 +61,14 @@ border: 1px solid transparent;
height
:
26px
;
height
:
26px
;
}
}
.input-group-addon
{
.input-group-addon
{
padding
:
3px
6px
;
padding
:
3px
6px
;
height
:
26px
;
height
:
26px
;
font-size
:
12px
;
font-size
:
12px
;
}
}
.picker__select--month
,
.picker__select--year
{
.picker__select--month
,
.picker__select--year
{
padding
:
0.1em
;
padding
:
0.1em
;
/*height: 3em;*/
/*height: 3em;*/
}
}
...
@@ -88,19 +98,19 @@ border: 1px solid transparent;
...
@@ -88,19 +98,19 @@ border: 1px solid transparent;
padding
:
10px
20px
;
padding
:
10px
20px
;
border-radius
:
6px
;
border-radius
:
6px
;
border
:
0px
none
;
border
:
0px
none
;
background
:
#BC
2131
;
background
:
#bc
2131
;
background-image
:
linear-gradient
(
to
bottom
,
#C6414E
0px
,
#BC
2131
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#c6414e
0px
,
#bc
2131
100%
);
background-repeat
:
repeat-x
;
background-repeat
:
repeat-x
;
margin-top
:
20px
;
margin-top
:
20px
;
}
}
.container
.btn-logout
{
.container
.btn-logout
{
margin-top
:
12px
;
margin-top
:
12px
;
}
}
.container
.btn-login
:hover
{
.container
.btn-login
:hover
{
background
:
#BC
2131
;
background
:
#bc
2131
;
}
}
.container
.btn-login
.label
{
.container
.btn-login
.label
{
...
@@ -108,20 +118,19 @@ border: 1px solid transparent;
...
@@ -108,20 +118,19 @@ border: 1px solid transparent;
font-size
:
8px
;
font-size
:
8px
;
}
}
/* dataTables Customize */
/* dataTables Customize */
table
.dataTable
thead
{
table
.dataTable
thead
{
background-color
:
#EAEAEA
;
background-color
:
#eaeaea
;
}
}
table
.dataTable
tr
.even.selected
td
{
table
.dataTable
tr
.even.selected
td
{
background-color
:
#B0BED
9
;
background-color
:
#b0bed
9
;
}
}
table
.dataTable
tr
.odd.selected
td
{
table
.dataTable
tr
.odd.selected
td
{
background-color
:
#9FAFD
1
;
background-color
:
#9fafd
1
;
}
}
table
.dataTable
tr
.selected
td
{
table
.dataTable
tr
.selected
td
{
background-color
:
#9FAFD
1
;
background-color
:
#9fafd
1
;
}
}
/*
/*
...
@@ -189,6 +198,6 @@ div.tab-content {
...
@@ -189,6 +198,6 @@ div.tab-content {
font-size
:
10px
!important
;
font-size
:
10px
!important
;
}
}
.paginate_button
.current
{
.paginate_button
.current
{
font-size
:
10px
!important
;
font-size
:
10px
!important
;
}
}
opensipkd/base/views/base_views.py
View file @
d65b84e
...
@@ -720,6 +720,8 @@ class BaseView(object):
...
@@ -720,6 +720,8 @@ class BaseView(object):
for
k
in
cstruct
:
for
k
in
cstruct
:
val
=
cstruct
.
get
(
k
)
val
=
cstruct
.
get
(
k
)
if
type
(
val
)
is
dict
:
if
type
(
val
)
is
dict
:
if
k
not
in
value
:
value
[
k
]
=
{}
value
[
k
]
=
self
.
update_value
(
value
[
k
],
val
)
value
[
k
]
=
self
.
update_value
(
value
[
k
],
val
)
elif
val
:
elif
val
:
value
[
k
]
=
cstruct
.
get
(
k
)
value
[
k
]
=
cstruct
.
get
(
k
)
...
@@ -747,14 +749,7 @@ class BaseView(object):
...
@@ -747,14 +749,7 @@ class BaseView(object):
e
.
cstruct
[
f
.
name
])
e
.
cstruct
[
f
.
name
])
if
f
.
name
==
"captcha"
:
if
f
.
name
==
"captcha"
:
e
.
cstruct
[
f
.
name
]
=
self
.
get_captcha_url
()
e
.
cstruct
[
f
.
name
]
=
self
.
get_captcha_url
()
# if e.cstruct[f.name]:
# cstruct = {}
value
=
self
.
update_value
(
value
,
e
.
cstruct
)
value
=
self
.
update_value
(
value
,
e
.
cstruct
)
# for k in cstruct:
# if not e.cstruct.get(k):
# e.cstruct[k] = value[k]
# value.update(e.cstruct)
# value.update(cstruct)
form
.
set_appstruct
(
value
)
form
.
set_appstruct
(
value
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
...
@@ -771,13 +766,6 @@ class BaseView(object):
...
@@ -771,13 +766,6 @@ class BaseView(object):
form
.
set_appstruct
(
values
)
form
.
set_appstruct
(
values
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
def
view_act
(
self
,
**
kwargs
):
if
self
.
req
.
matchdict
[
'act'
]
==
'grid'
:
if
self
.
req
.
params
.
get
(
"paren"
):
return
self
.
get_list
(
**
kwargs
)
return
self
.
get_list
(
**
kwargs
)
return
super
()
.
view_act
(
**
kwargs
)
def
save
(
self
,
values
,
user
,
row
=
None
):
def
save
(
self
,
values
,
user
,
row
=
None
):
log
.
info
(
"Save"
)
log
.
info
(
"Save"
)
log
.
debug
(
values
)
log
.
debug
(
values
)
...
@@ -890,7 +878,7 @@ class BaseView(object):
...
@@ -890,7 +878,7 @@ class BaseView(object):
form
=
self
.
get_form
(
self
.
edit_schema
,
**
kwargs
)
form
=
self
.
get_form
(
self
.
edit_schema
,
**
kwargs
)
table
=
self
.
get_item_table
(
row
)
table
=
self
.
get_item_table
(
row
)
resources
=
form
.
get_widget_resources
(
)
values
=
self
.
get_values
(
row
)
if
request
.
POST
:
if
request
.
POST
:
if
'save'
in
request
.
POST
:
if
'save'
in
request
.
POST
:
controls
=
request
.
POST
.
items
()
controls
=
request
.
POST
.
items
()
...
@@ -899,7 +887,14 @@ class BaseView(object):
...
@@ -899,7 +887,14 @@ class BaseView(object):
controls
=
form
.
validate
(
controls
)
controls
=
form
.
validate
(
controls
)
except
ValidationFailure
as
e
:
except
ValidationFailure
as
e
:
log
.
error
(
f
"Edit Error: {str(e.error.msg)}"
)
log
.
error
(
f
"Edit Error: {str(e.error.msg)}"
)
form
.
set_appstruct
(
e
.
cstruct
)
for
f
in
e
.
field
.
children
:
if
isinstance
(
f
.
typ
,
colander
.
Date
):
e
.
cstruct
[
f
.
name
]
=
date_from_str
(
e
.
cstruct
[
f
.
name
])
if
f
.
name
==
"captcha"
:
e
.
cstruct
[
f
.
name
]
=
self
.
get_captcha_url
()
values
=
self
.
update_value
(
values
,
e
.
cstruct
)
form
.
set_appstruct
(
values
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
c
=
dict
(
controls
)
c
=
dict
(
controls
)
...
@@ -908,7 +903,6 @@ class BaseView(object):
...
@@ -908,7 +903,6 @@ class BaseView(object):
return
self
.
next_edit
(
form
,
row
=
row
)
return
self
.
next_edit
(
form
,
row
=
row
)
values
=
self
.
get_values
(
row
)
form
.
set_appstruct
(
values
)
form
.
set_appstruct
(
values
)
form
=
self
.
before_edit
(
form
)
form
=
self
.
before_edit
(
form
)
...
...
opensipkd/base/views/departemen.py
View file @
d65b84e
...
@@ -78,7 +78,10 @@ class AddSchema(colander.Schema):
...
@@ -78,7 +78,10 @@ class AddSchema(colander.Schema):
missing
=
colander
.
drop
,
missing
=
colander
.
drop
,
oid
=
"company_id"
)
oid
=
"company_id"
)
status
=
colander
.
SchemaNode
(
colander
.
Boolean
(),
oid
=
"status"
)
status
=
colander
.
SchemaNode
(
colander
.
Integer
(),
widget
=
widget
.
CheckboxWidget
(
true_val
=
'1'
,
false_val
=
'0'
),
oid
=
"status"
)
def
after_bind
(
self
,
schema
,
kwargs
):
def
after_bind
(
self
,
schema
,
kwargs
):
request
=
kwargs
[
"request"
]
request
=
kwargs
[
"request"
]
...
...
opensipkd/base/views/templates/base3.1.pt
View file @
d65b84e
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en-us"
<html
lang=
"en-us"
tal:define=
"
tal:define=
"
home request._host;
home request._host;
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
user_area_path ['user-area', 'user-area-add', 'user-area-edit', 'user-area-view', 'user-area-delete'];
user_area_path ['user-area', 'user-area-add', 'user-area-edit', 'user-area-view', 'user-area-delete'];
...
@@ -22,6 +21,7 @@
...
@@ -22,6 +21,7 @@
js js|[];
js js|[];
route_name route_name|request.matched_route.name;
route_name route_name|request.matched_route.name;
"
>
"
>
<head>
<head>
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
...
@@ -41,42 +41,41 @@
...
@@ -41,42 +41,41 @@
<!-- Basic Styles -->
<!-- Basic Styles -->
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/bootstrap.min.css"
>
<!--? <link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/font-awesome.min.css">-->
<!--? <link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/font-awesome.min.css">-->
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/fonts/fontawesome-free-6.1.2-web/css/all.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/fonts/fontawesome-free-6.1.2-web/css/all.min.css"
>
<!-- SmartAdmin Styles : Caution! DO NOT change the order -->
<!-- SmartAdmin Styles : Caution! DO NOT change the order -->
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/smartadmin-production-plugins.min.css"
>
href=
"${home}/static/v3/css/smartadmin-production-plugins.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/smartadmin-production.min.css"
>
href=
"${home}/static/v3/css/smartadmin-production.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/smartadmin-skins.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/smartadmin-skins.min.css"
>
<!-- We recommend you use "your_style.css" to override SmartAdmin
<!-- We recommend you use "your_style.css" to override SmartAdmin
specific styles this will also ensure you retrain your customization with each SmartAdmin update. -->
specific styles this will also ensure you retrain your customization with each SmartAdmin update. -->
<!-- LOOP FORM CSS INCLUDED-->
<!-- LOOP FORM CSS INCLUDED-->
<tal:loop
tal:repeat=
"css_resource css"
>
<tal:loop
tal:repeat=
"css_resource css"
>
<link
rel=
"stylesheet"
href=
"${home}${request.static_path(css_resource)}"
<link
rel=
"stylesheet"
href=
"${home}${request.static_path(css_resource)}"
type=
"text/css"
type=
"text/css"
tal:condition=
"css_resource[:4]!='http'"
>
tal:condition=
"css_resource[:4]!='http'"
>
<link
rel=
"stylesheet"
href=
"${css_resource}"
<link
rel=
"stylesheet"
href=
"${css_resource}"
type=
"text/css"
tal:condition=
"css_resource[:4]=='http'"
>
type=
"text/css"
tal:condition=
"css_resource[:4]=='http'"
>
</tal:loop>
</tal:loop>
<!--? <link href="${home}/static/v3/js/plugin/bootstrap-datepicker/css/bootstrap-datepicker.min.css"-->
<!--? <link href="${home}/static/v3/js/plugin/bootstrap-datepicker/css/bootstrap-datepicker.min.css"-->
<!--? rel="stylesheet">-->
<!--? rel="stylesheet">-->
<link
href=
"${home}/deform_static/css/form.css"
rel=
"stylesheet"
>
<link
href=
"${home}/deform_static/css/form.css"
rel=
"stylesheet"
>
<!--? <link href="${home}/static/v3/css/select2.min.css" rel="stylesheet" type="text/css">-->
<!--? <link href="${home}/static/v3/css/select2.min.css" rel="stylesheet" type="text/css">-->
<metal:css
define-slot=
"css_files"
></metal:css>
<metal:css
define-slot=
"css_files"
></metal:css>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/osipkd.css"
>
</head>
</head>
<body
class=
"fixed-header"
>
<body
class=
"fixed-header"
>
<div
id=
"loading"
style=
"display:none;"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"${home}/static/v3/css/osipkd.css"
>
<img
id=
"loading-image"
src=
"${home}/static/img/ajax-loader.gif"
alt=
"Loading..."
/>
<div
id=
"loading"
style=
"display:none;"
>
</div>
<img
id=
"loading-image"
src=
"${home}/static/img/ajax-loader.gif"
alt=
"Loading..."
/>
</div>
<!-- #HEADER -->
<!-- #HEADER -->
<header
id=
"header"
>
<header
id=
"header"
>
<div
id=
"logo-group"
>
<div
id=
"logo-group"
>
<!-- PLACE YOUR LOGO HERE -->
<!-- PLACE YOUR LOGO HERE -->
<h3
id=
"logo"
>
<h3
id=
"logo"
>
...
@@ -96,8 +95,8 @@
...
@@ -96,8 +95,8 @@
<div
class=
"pull-right"
>
<div
class=
"pull-right"
>
<div
tal:condition=
"request.user"
class=
"project-context hidden-xs"
>
<div
tal:condition=
"request.user"
class=
"project-context hidden-xs"
>
<span
class=
"label"
><i
class=
"fa fa-sm fa-fw fa-institution"
></i>
${request.company}
</span>
<span
class=
"label"
><i
class=
"fa fa-sm fa-fw fa-institution"
></i>
${request.company}
</span>
<span
tal:condition=
"request.user"
class=
"project-selector dropdown-toggle"
data-toggle=
"dropdown"
>
Pilih Module
<i
<span
tal:condition=
"request.user"
class=
"project-selector dropdown-toggle"
data-toggle=
"dropdown"
>
Pilih
class=
"fa fa-angle-down"
></i></span>
Module
<i
class=
"fa fa-angle-down"
></i></span>
<ul
tal:condition=
"request.user"
class=
"dropdown-menu"
>
<ul
tal:condition=
"request.user"
class=
"dropdown-menu"
>
<li
tal:repeat=
"menu request.menus"
>
<li
tal:repeat=
"menu request.menus"
>
<a
href=
"${home}/${menu}"
>
${request.menus[menu]}
</a>
<a
href=
"${home}/${menu}"
>
${request.menus[menu]}
</a>
...
@@ -121,35 +120,36 @@
...
@@ -121,35 +120,36 @@
<!-- User info -->
<!-- User info -->
<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>
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<span
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<i
class=
"fa fa-angle-down"
></i>
</a>
<i
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('profile')}"
>
Profile
</a></li>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('profile')}"
>
Profile
</a></li>
<li
tal:condition=
"not request.user.external"
>
<li
tal:condition=
"not request.user.external"
>
<a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah password
</a>
<a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah
password
</a>
</li>
</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('logout')}"
>
Logout
</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>
<li
tal:condition=
"'core' in request.modules and change_unit(request)"
>
<li
tal:condition=
"'core' in request.modules and change_unit(request)"
>
<a
style=
"text-transform:capitalize"
<a
style=
"text-transform:capitalize"
href=
"${home}/departemen/chg"
>
Ubah
href=
"${home}/departemen/chg"
>
Ubah
Organisasi
</a>
Organisasi
</a>
</li>
</li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
<!-- end user info -->
<!-- end user info -->
</div>
</div>
<!-- end pulled right: nav area -->
<!-- end pulled right: nav area -->
</header>
</header>
<!-- END HEADER -->
<!-- END HEADER -->
<!-- Left panel : Navigation area -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside
id=
"left-panel"
style=
"padding-bottom:67px"
>
<aside
id=
"left-panel"
style=
"padding-bottom:67px"
>
<!-- NAVIGATION : This navigation is also responsive-->
<!-- NAVIGATION : This navigation is also responsive-->
<nav
style=
""
>
<nav
style=
""
>
<!-- Modul Menu -->
<!-- Modul Menu -->
...
@@ -181,44 +181,57 @@
...
@@ -181,44 +181,57 @@
</li>
</li>
<li
tal:condition=
"has_permission(request, 'upload-logo')"
<li
tal:condition=
"has_permission(request, 'upload-logo')"
tal:attributes=
"class route_name in ['upload-logo'] and 'active'"
>
tal:attributes=
"class route_name in ['upload-logo'] and 'active'"
>
<a
href=
"${home}/upload/logo"
>
Upload Logo
</a></li>
<a
href=
"${home}/upload/logo"
>
Upload Logo
</a>
</li>
<li
tal:condition=
"has_permission(request, 'parameter')"
<li
tal:condition=
"has_permission(request, 'parameter')"
tal:attributes=
"class route_name in param_path and 'active'"
>
tal:attributes=
"class route_name in param_path and 'active'"
>
<a
href=
"${home}/parameter"
>
Parameter
</a></li>
<a
href=
"${home}/parameter"
>
Parameter
</a>
</li>
<li
tal:condition=
"has_permission(request, 'company')"
<li
tal:condition=
"has_permission(request, 'company')"
tal:attributes=
"class route_name in company_path and 'active'"
>
tal:attributes=
"class route_name in company_path and 'active'"
>
<a
href=
"${home}/company"
>
Pemerintah
</a></li>
<a
href=
"${home}/company"
>
Pemerintah
</a>
</li>
<li
tal:condition=
"has_permission(request, 'eselon')"
<li
tal:condition=
"has_permission(request, 'eselon')"
tal:attributes=
"class route_name in eselon_path and 'active'"
>
tal:attributes=
"class route_name in eselon_path and 'active'"
>
<a
href=
"${home}/eselon"
>
Eselon
</a></li>
<a
href=
"${home}/eselon"
>
Eselon
</a>
</li>
<li
tal:condition=
"has_permission(request, 'jabatan')"
<li
tal:condition=
"has_permission(request, 'jabatan')"
tal:attributes=
"class route_name in jabatan_path and 'active'"
>
tal:attributes=
"class route_name in jabatan_path and 'active'"
>
<a
href=
"${home}/jabatan"
>
Jabatan
</a></li>
<a
href=
"${home}/jabatan"
>
Jabatan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'departemen')"
<li
tal:condition=
"has_permission(request, 'departemen')"
tal:attributes=
"class route_name in dep_path and 'active'"
>
tal:attributes=
"class route_name in dep_path and 'active'"
>
<a
href=
"${home}/departemen"
>
Departemen
</a></li>
<a
href=
"${home}/departemen"
>
Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, 'partner')"
<li
tal:condition=
"has_permission(request, 'partner')"
tal:attributes=
"class route_name in partner_path and 'active'"
>
tal:attributes=
"class route_name in partner_path and 'active'"
>
<a
href=
"${home}/partner"
>
Partner
</a></li>
<a
href=
"${home}/partner"
>
Partner
</a>
</li>
<li
tal:condition=
"has_permission(request, 'partner-departemen')"
<li
tal:condition=
"has_permission(request, 'partner-departemen')"
tal:attributes=
"class route_name in part_dep_path and 'active'"
>
tal:attributes=
"class route_name in part_dep_path and 'active'"
>
<a
href=
"${home}/partner/departemen"
>
Partner Departemen
</a></li>
<a
href=
"${home}/partner/departemen"
>
Partner Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, 'provinsi')"
<li
tal:condition=
"has_permission(request, 'provinsi')"
tal:attributes=
"class route_name in provinsi_path and 'active'"
>
tal:attributes=
"class route_name in provinsi_path and 'active'"
>
<a
href=
"${home}/provinsi"
>
Provinsi
</a></li>
<a
href=
"${home}/provinsi"
>
Provinsi
</a>
</li>
<li
tal:condition=
"has_permission(request, 'dati2')"
<li
tal:condition=
"has_permission(request, 'dati2')"
tal:attributes=
"class route_name in dati2_path and 'active'"
>
tal:attributes=
"class route_name in dati2_path and 'active'"
>
<a
href=
"${home}/dati2"
>
Kabupaten/Kota
</a></li>
<a
href=
"${home}/dati2"
>
Kabupaten/Kota
</a>
</li>
<li
tal:condition=
"has_permission(request, 'kecamatan')"
<li
tal:condition=
"has_permission(request, 'kecamatan')"
tal:attributes=
"class route_name in kecamatan_path and 'active'"
>
tal:attributes=
"class route_name in kecamatan_path and 'active'"
>
<a
href=
"${home}/kecamatan"
>
Kecamatan
</a></li>
<a
href=
"${home}/kecamatan"
>
Kecamatan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'desa')"
<li
tal:condition=
"has_permission(request, 'desa')"
tal:attributes=
"class route_name in desa_path and 'active'"
>
tal:attributes=
"class route_name in desa_path and 'active'"
>
<a
href=
"${home}/desa"
>
Desa/Kelurahan
</a></li>
<a
href=
"${home}/desa"
>
Desa/Kelurahan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'log')"
<li
tal:condition=
"has_permission(request, 'log')"
tal:attributes=
"class route_name in ['log'] and 'active'"
>
tal:attributes=
"class route_name in ['log'] and 'active'"
>
<a
href=
"${home}/log"
>
Log
</a></li>
<a
href=
"${home}/log"
>
Log
</a>
</li>
</ul>
</ul>
</li>
</li>
...
@@ -230,72 +243,72 @@
...
@@ -230,72 +243,72 @@
<span
class=
"footer-side"
>
©
OpenSIPKD.com
<span
class=
"footer-side"
>
©
OpenSIPKD.com
<script>
document
.
write
(
new
Date
().
getFullYear
());
</script>
<script>
document
.
write
(
new
Date
().
getFullYear
());
</script>
</span>
</span>
</aside>
</aside>
<!-- END NAVIGATION -->
<!-- END NAVIGATION -->
<!-- JS -->
<!-- JS -->
<script
src=
"${home}/static/v3/js/jquery-2.1.1.min.js"
></script>
<script
src=
"${home}/static/v3/js/jquery-2.1.1.min.js"
></script>
<script>
<script>
if
(
!
window
.
jQuery
)
{
if
(
!
window
.
jQuery
)
{
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>'
);
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>'
);
}
}
</script>
</script>
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<script>
<script>
// if (!window.jQuery.ui) {
// if (!window.jQuery.ui) {
<!--
?
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>'
);
-->
<!--
?
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>'
);
-->
// }
// }
</script>
</script>
<!-- IMPORTANT: APP CONFIG -->
<!-- IMPORTANT: APP CONFIG -->
<script
src=
"${home}/static/v3/js/app.config.js"
></script>
<script
src=
"${home}/static/v3/js/app.config.js"
></script>
<!-- BOOTSTRAP JS -->
<!-- BOOTSTRAP JS -->
<script
src=
"${home}/static/v3/js/bootstrap/bootstrap.min.js"
></script>
<script
src=
"${home}/static/v3/js/bootstrap/bootstrap.min.js"
></script>
<!-- FastClick: For mobile devices -->
<!-- FastClick: For mobile devices -->
<script
src=
"${home}/static/v3/js/plugin/fastclick/fastclick.min.js"
></script>
<script
src=
"${home}/static/v3/js/plugin/fastclick/fastclick.min.js"
></script>
<!--[if IE 8]>
<!--[if IE 8]>
<h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
<h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
<![endif]-->
<![endif]-->
<!-- MAIN APP JS FILE -->
<!-- MAIN APP JS FILE -->
<script
src=
"${home}/static/v3/js/app.min.js"
></script>
<script
src=
"${home}/static/v3/js/app.min.js"
></script>
<!-- PAGE RELATED PLUGIN(S) -->
<!-- PAGE RELATED PLUGIN(S) -->
<!--?<script src="${home}/static/v3/js/plugin/datatables/jquery.dataTables.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/jquery.dataTables.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.colVis.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.colVis.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.tableTools.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.tableTools.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.bootstrap.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.bootstrap.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatable-responsive/datatables.responsive.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatable-responsive/datatables.responsive.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/deform.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/deform.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/typeahead.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/typeahead.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/jquery.maskMoney-3.1.1.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/jquery.maskMoney-3.1.1.min.js"></script>-->
<!--?<script src="${home}/deform_static/tinymce/tinymce.min.js"></script>-->
<!--?<script src="${home}/deform_static/tinymce/tinymce.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/tools.js"></script>-->
<!--?<script src="${home}/static/v3/js/tools.js"></script>-->
<!--?<script src="${home}/static/v3/js/notification/SmartNotification.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/notification/SmartNotification.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/masked-input/jquery.maskedinput.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/masked-input/jquery.maskedinput.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/select2.full.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/select2.full.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/file_upload.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/file_upload.js"></script>-->
<script
src=
"${home}/static/v3/js/osipkd.js"
></script>
<script
src=
"${home}/static/v3/js/osipkd.js"
></script>
<!-- LOOP ON JS RESOURCE -->
<!-- LOOP ON JS RESOURCE -->
<tal:loop
tal:repeat=
"js_resource js"
>
<tal:loop
tal:repeat=
"js_resource js"
>
<script
src=
"${home}${request.static_path(js_resource)}"
tal:condition=
"js_resource[:4]!='http'"
></script>
<script
src=
"${home}${request.static_path(js_resource)}"
tal:condition=
"js_resource[:4]!='http'"
></script>
<script
src=
"${js_resource}"
tal:condition=
"js_resource[:4]=='http'"
></script>
<script
src=
"${js_resource}"
tal:condition=
"js_resource[:4]=='http'"
></script>
</tal:loop>
</tal:loop>
<metal:js
define-slot=
"js_files"
></metal:js>
<metal:js
define-slot=
"js_files"
></metal:js>
<!-- End isi Script-->
<!-- End isi Script-->
<!-- MAIN PANEL -->
<!-- MAIN PANEL -->
<div
id=
"main"
role=
"main"
>
<div
id=
"main"
role=
"main"
>
<!-- MAIN CONTENT -->
<!-- MAIN CONTENT -->
<div
id=
"content"
>
<div
id=
"content"
>
...
@@ -333,10 +346,11 @@
...
@@ -333,10 +346,11 @@
</div>
</div>
<!-- END MAIN CONTENT -->
<!-- END MAIN CONTENT -->
</div>
</div>
<!-- END MAIN PANEL -->
<!-- END MAIN PANEL -->
<!-- Define Script-->
<!-- Define Script-->
<script
metal:define-slot=
"scripts"
></script>
<script
metal:define-slot=
"scripts"
></script>
</body>
</body>
</html>
</html>
\ No newline at end of file
\ No newline at end of file
opensipkd/base/views/user_login.py
View file @
d65b84e
...
@@ -57,9 +57,6 @@ class Login(CSRFSchema):
...
@@ -57,9 +57,6 @@ class Login(CSRFSchema):
password
=
colander
.
SchemaNode
(
password
=
colander
.
SchemaNode
(
colander
.
String
(),
widget
=
widget
.
PasswordWidget
())
colander
.
String
(),
widget
=
widget
.
PasswordWidget
())
# def after_bind(self, schema, kwargs):
# def after_bind(self, schema, kwargs):
# request = kwargs["request"]
# request = kwargs["request"]
# csrf_token = new_csrf_token(request)
# csrf_token = new_csrf_token(request)
...
@@ -98,6 +95,8 @@ class LoginUser(object):
...
@@ -98,6 +95,8 @@ class LoginUser(object):
self
.
message
=
"Login Gagal"
self
.
message
=
"Login Gagal"
set_user_log
(
self
.
message
,
self
.
request
,
log
,
values
[
"username"
])
set_user_log
(
self
.
message
,
self
.
request
,
log
,
values
[
"username"
])
return
return
for
g
in
self
.
user
.
groups
:
log
.
debug
(
f
"Group: {g.id} as {g.group_name}"
)
# generate security_code dan simpan dalam session
# generate security_code dan simpan dalam session
regenerate_security_code
(
self
.
user
,
0.03
)
# berlaku selama 1.8 menit
regenerate_security_code
(
self
.
user
,
0.03
)
# berlaku selama 1.8 menit
...
@@ -115,8 +114,7 @@ class Oauth2UserExc(Exception):
...
@@ -115,8 +114,7 @@ class Oauth2UserExc(Exception):
def
oauth2_login
(
request
,
params
=
None
):
def
oauth2_login
(
request
,
params
=
None
):
provider_name
=
params
and
params
[
"provider_name"
]
\
provider_name
=
params
and
params
[
"provider_name"
]
or
request
.
params
[
"provider_name"
]
or
request
.
params
[
"provider_name"
]
if
provider_name
==
"google"
:
if
provider_name
==
"google"
:
from
.base_google
import
googlesignin
from
.base_google
import
googlesignin
try
:
try
:
...
@@ -129,8 +127,8 @@ def oauth2_login(request, params=None):
...
@@ -129,8 +127,8 @@ def oauth2_login(request, params=None):
id_info
=
None
id_info
=
None
iss
=
id_info
and
re
.
sub
(
r'https?://'
,
''
,
id_info
[
'iss'
])
or
None
iss
=
id_info
and
re
.
sub
(
r'https?://'
,
''
,
id_info
[
'iss'
])
or
None
user
=
id_info
and
ExternalIdentityService
.
\
user
=
id_info
and
ExternalIdentityService
.
user_by_external_id_and_provider
(
user_by_external_id_and_provider
(
id_info
[
'sub'
],
iss
)
id_info
[
'sub'
],
iss
)
log
.
debug
(
"Users :
%
s"
,
user
)
log
.
debug
(
"Users :
%
s"
,
user
)
log
.
debug
(
"IdInfo :
%
s"
,
id_info
)
log
.
debug
(
"IdInfo :
%
s"
,
id_info
)
if
id_info
and
not
user
:
if
id_info
and
not
user
:
...
@@ -143,7 +141,8 @@ def oauth2_login(request, params=None):
...
@@ -143,7 +141,8 @@ def oauth2_login(request, params=None):
log
.
debug
(
"User :
%
s"
,
user
)
log
.
debug
(
"User :
%
s"
,
user
)
log
.
debug
(
"Partner :
%
s"
,
partner
)
log
.
debug
(
"Partner :
%
s"
,
partner
)
if
user
or
partner
:
if
user
or
partner
:
raise
Oauth2UserExc
(
"Email sudah terdaftar silahkan login standard"
)
raise
Oauth2UserExc
(
"Email sudah terdaftar silahkan login standard"
)
user
=
User
()
user
=
User
()
user
.
from_dict
(
values
)
user
.
from_dict
(
values
)
...
@@ -205,8 +204,8 @@ class ViewLogin(BaseView):
...
@@ -205,8 +204,8 @@ class ViewLogin(BaseView):
# start cek external module
# start cek external module
pckgs
=
get_params
(
'external-uim'
)
pckgs
=
get_params
(
'external-uim'
)
if
user
:
if
user
:
external_user
=
DBSession
.
query
(
ExternalIdentity
)
\
external_user
=
DBSession
.
query
(
ExternalIdentity
)
.
\
.
filter_by
(
local_user_id
=
user
.
id
,
filter_by
(
local_user_id
=
user
.
id
,
external_user_name
=
identity
)
.
first
()
external_user_name
=
identity
)
.
first
()
pckgs
=
external_user
and
pckgs
or
None
pckgs
=
external_user
and
pckgs
or
None
...
@@ -224,7 +223,8 @@ class ViewLogin(BaseView):
...
@@ -224,7 +223,8 @@ class ViewLogin(BaseView):
login
=
LoginUser
(
self
.
req
)
login
=
LoginUser
(
self
.
req
)
if
not
login
.
login
(
values
,
user
):
if
not
login
.
login
(
values
,
user
):
request
.
session
.
flash
(
login
.
message
,
"error"
)
request
.
session
.
flash
(
login
.
message
,
"error"
)
next_url
=
get_urls
(
f
"{request.route_url('login')}?next={next_url}"
)
next_url
=
get_urls
(
f
"{request.route_url('login')}?next={next_url}"
)
return
HTTPFound
(
location
=
next_url
)
return
HTTPFound
(
location
=
next_url
)
return
redirect_login
(
request
,
user
)
return
redirect_login
(
request
,
user
)
...
@@ -237,8 +237,7 @@ class ViewLogin(BaseView):
...
@@ -237,8 +237,7 @@ class ViewLogin(BaseView):
del
request
.
session
[
'login failed'
]
del
request
.
session
[
'login failed'
]
return
r
return
r
elif
"provider_name"
in
request
.
params
and
\
elif
"provider_name"
in
request
.
params
and
request
.
params
[
"provider_name"
]:
request
.
params
[
"provider_name"
]:
try
:
try
:
user
=
oauth2_login
(
request
)
user
=
oauth2_login
(
request
)
except
Oauth2ParseExc
as
e
:
except
Oauth2ParseExc
as
e
:
...
@@ -279,6 +278,9 @@ class ViewLogin(BaseView):
...
@@ -279,6 +278,9 @@ class ViewLogin(BaseView):
def
redirect_login
(
request
,
user
):
def
redirect_login
(
request
,
user
):
set_user_log
(
"Login Sukses"
,
request
,
log
,
user
.
user_name
)
set_user_log
(
"Login Sukses"
,
request
,
log
,
user
.
user_name
)
for
g
in
user
.
groups
:
log
.
debug
(
f
"Group: {g.id} as {g.group_name}"
)
headers
=
get_login_headers
(
request
,
user
)
headers
=
get_login_headers
(
request
,
user
)
request
.
session
.
flash
(
"Sukses Login"
)
request
.
session
.
flash
(
"Sukses Login"
)
next_url
=
request
.
params
.
get
(
'next'
)
next_url
=
request
.
params
.
get
(
'next'
)
...
@@ -379,8 +381,7 @@ def view_change_password(request):
...
@@ -379,8 +381,7 @@ def view_change_password(request):
code
=
request
.
matchdict
[
'code'
]
code
=
request
.
matchdict
[
'code'
]
q
=
DBSession
.
query
(
User
)
.
filter_by
(
security_code
=
code
)
q
=
DBSession
.
query
(
User
)
.
filter_by
(
security_code
=
code
)
user
=
q
.
first
()
user
=
q
.
first
()
if
not
user
or
\
if
not
user
or
create_now
()
-
user
.
security_code_date
>
one_hour
:
create_now
()
-
user
.
security_code_date
>
one_hour
:
request
.
session
.
flash
(
'Security code expired'
,
'error'
)
request
.
session
.
flash
(
'Security code expired'
,
'error'
)
return
HTTPFound
(
location
=
get_urls
(
request
.
route_url
(
'login'
)))
return
HTTPFound
(
location
=
get_urls
(
request
.
route_url
(
'login'
)))
...
@@ -436,7 +437,7 @@ class ResetPassword(colander.Schema):
...
@@ -436,7 +437,7 @@ class ResetPassword(colander.Schema):
colander
.
String
(),
title
=
_
(
'Email'
),
colander
.
String
(),
title
=
_
(
'Email'
),
description
=
_
(
description
=
_
(
'email-reset-password'
,
'email-reset-password'
,
default
=
'Enter your email address and we will send you '
\
default
=
'Enter your email address and we will send you '
'a link to reset your password.'
)
'a link to reset your password.'
)
)
)
...
@@ -459,8 +460,7 @@ def send_email_security_code(
...
@@ -459,8 +460,7 @@ def send_email_security_code(
**
kwargs
):
**
kwargs
):
settings
=
get_settings
()
settings
=
get_settings
()
password
=
kwargs
.
get
(
"password"
,
""
)
password
=
kwargs
.
get
(
"password"
,
""
)
if
'mail.sender_name'
not
in
settings
\
if
'mail.sender_name'
not
in
settings
or
'mail.username'
not
in
settings
:
or
'mail.username'
not
in
settings
:
return
return
url
=
'{}/password/{}?password={}'
.
format
(
url
=
'{}/password/{}?password={}'
.
format
(
...
@@ -499,8 +499,7 @@ def sending_mail(request, user, subject, body):
...
@@ -499,8 +499,7 @@ def sending_mail(request, user, subject, body):
def
send_email_pending
(
def
send_email_pending
(
request
,
user
,
subject
,
body_msg_id
,
body_default_file
):
request
,
user
,
subject
,
body_msg_id
,
body_default_file
):
settings
=
get_settings
()
settings
=
get_settings
()
if
'mail.sender_name'
not
in
settings
\
if
'mail.sender_name'
not
in
settings
or
'mail.username'
not
in
settings
:
or
'mail.username'
not
in
settings
:
return
return
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
...
...
opensipkd/base/views/widgets/autocomplete_input_ms.pt
View file @
d65b84e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
oid oid|field.oid;
oid oid|field.oid;
style style|field.widget.style;
style style|field.widget.style;
autofocus autofocus|field.autofocus;
autofocus autofocus|field.autofocus;
url url|field.widget.url;
slave slave|field.widget.slave;
slave slave|field.widget.slave;
url url|field.widget.url;
" tal:omit-tag="">
" tal:omit-tag="">
${field.start_mapping()}
${field.start_mapping()}
<input type="hidden" name="auto_id" id="${oid}-auto_id" value="${auto_id}" />
<input type="hidden" name="auto_id" id="${oid}-auto_id" value="${auto_id}" />
...
@@ -28,15 +28,22 @@
...
@@ -28,15 +28,22 @@
var not_check = ["id", "value"];
var not_check = ["id", "value"];
$.each(datum, function (key, val) {
$.each(datum, function (key, val) {
if (!not_check.includes(key)) {
if (!not_check.includes(key)) {
var ele = $('#' + key);
var eleName = $('#' + key).prop('nodeName');
if (ele !== undefined) {
var eleName = ele.prop('nodeName').toLowerCase();
if (eleName !== undefined) {
eleName = eleName.toLowerCase();
if (eleName === "select")
if (eleName === "select")
$("#" + key).val(val).trigger("change");
$("#" + key).val(val).trigger("change");
else if (eleName === "input")
else if (eleName === "input")
$("#" + key).val(val);
$("#" + key).val(val);
else
else
$("#" + key).text(val);
$("#" + key).text(val);
} else {
//Check apakah jika radio button
eleName = $("input[name ='" + key + "']").prop('type');
if (eleName == "radio") {
$("input[name ='" + key + "'][value='" + val + "']").prop('checked', true);
}
}
}
}
}
});
});
...
...
opensipkd/detable/detable.py
View file @
d65b84e
...
@@ -265,6 +265,8 @@ class DeTable(field.Field):
...
@@ -265,6 +265,8 @@ class DeTable(field.Field):
d
[
"action"
]
=
f
.
action
d
[
"action"
]
=
f
.
action
else
:
else
:
d
[
"action"
]
=
True
d
[
"action"
]
=
True
if
hasattr
(
f
,
"search_method"
):
d
[
"search_method"
]
=
f
.
search_method
if
isinstance
(
f
.
widget
,
deform_widget
.
HiddenWidget
):
if
isinstance
(
f
.
widget
,
deform_widget
.
HiddenWidget
):
d
[
"visible"
]
=
False
d
[
"visible"
]
=
False
...
@@ -441,6 +443,15 @@ class DeTable(field.Field):
...
@@ -441,6 +443,15 @@ class DeTable(field.Field):
html
+=
'</select>'
html
+=
'</select>'
elif
isinstance
(
f
.
typ
,
colander
.
Date
):
elif
isinstance
(
f
.
typ
,
colander
.
Date
):
search_method
=
getattr
(
f
,
"search_method"
,
None
)
if
search_method
==
"date"
:
# html += f'<div class="tooltip">'
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter"'
html
+=
f
'{txt}/>'
# html += f'<span class="tooltiptext">{f.title}</span>'
# html += f'</div>'
else
:
html
+=
f
'<div class="form-group" {txt}>'
html
+=
f
'<div class="form-group" {txt}>'
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
html
+=
f
'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
html
+=
f
'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
...
...
opensipkd/detable/templates/detable.pt
View file @
d65b84e
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
<script>
<script>
$(document).ready(function () {
$(document).ready(function () {
$(document).on("click",
'.${tableid}checkAll',
function () {
$(document).on("click",
'.${tableid}checkAll',
function () {
if (this.checked) {
if (this.checked) {
$(".${tableid}_check").prop("checked", true);
$(".${tableid}_check").prop("checked", true);
} else {
} else {
...
@@ -105,20 +105,16 @@
...
@@ -105,20 +105,16 @@
var o${tableid}Url = o${tableid}Uri + "${url_suffix}";
var o${tableid}Url = o${tableid}Uri + "${url_suffix}";
var m${tableid}ID;
var m${tableid}ID;
var m${tableid}CheckList = [];
var m${tableid}CheckList = [];
var check_field = ${
check_field
};
var check_field = ${
check_field
};
deform.addCallback('${tableid}', function (oid) {
deform.addCallback('${tableid}', function (oid) {
// $(document).ready(function () {
function displayEmptyID() {
function displayEmptyID() {
$("#emptyID").show();
$("#emptyID").show();
$('#emptyID').animate({
opacity: 0.8
}, 2000);
$('#emptyID').animate({
opacity: 0.8
}, 2000);
setTimeout(function () {
setTimeout(function () {
$("#emptyID").fadeTo(500, 0).slideUp(500, function () {
$("#emptyID").fadeTo(500, 0).slideUp(500, function () {
$("#emptyID").hide();
$("#emptyID").hide();
});
});
}
}, 4000);
, 4000);
}
}
let tb_array = [
let tb_array = [
...
@@ -147,22 +143,18 @@
...
@@ -147,22 +143,18 @@
};
};
let ${tableid}Columns = ${
structure: columns
};
let ${tableid}Columns = ${
structure: columns
};
function render_checkbox(value) {
function render_checkbox(value) {
if (value === true)
{
if (value === true)
return '<i class="fas fa-check-square" aria-hidden="true">';
return '<i class="fas fa-check-square" aria-hidden="true">';
}
if (value === false)
if (value === false) {
return '<i class="fas fa-minus-square" aria-hidden="true">';
return '<i class="fas fa-minus-square" aria-hidden="true">';
//'Archived';
}
return value;
return value;
}
}
function render_checklist(value) {
function render_checklist(value) {
return '<input type="checkbox" class="${tableid}_check" checked="' + { value } + '"></input>';
return '<input type="checkbox" class="${tableid}_check" checked="' + {value} + '"></input>';
}
}
...
@@ -184,7 +176,7 @@
...
@@ -184,7 +176,7 @@
// return ${tableid}Columns[co].wg_select_val[value];
// return ${tableid}Columns[co].wg_select_val[value];
// return "";
// return "";
// }
// }
}
else if (${tableid}Columns[co].hasOwnProperty("url")) {
}else if (${tableid}Columns[co].hasOwnProperty("url")) {
let url = ${tableid}Columns[co].url;
let url = ${tableid}Columns[co].url;
${tableid}Columns[co].render = function (data) {
${tableid}Columns[co].render = function (data) {
let result = "No Data";
let result = "No Data";
...
@@ -193,12 +185,11 @@
...
@@ -193,12 +185,11 @@
}
}
return result;
return result;
}
}
}
else if (${tableid}Columns[co].data === "id") {
}else if (${tableid}Columns[co].data === "id") {
${tableid}Columns[co].render = function (id, typ, data, setting) {
${tableid}Columns[co].render = function (id, typ, data, setting) {
if (${tableid}Columns[co].action === false) return ""
if (${tableid}Columns[co].action === false) return ""
let result = "";
let result = "";
if (${
allow_check
}) {
if (${
allow_check
}) {
var checked = "";
var checked = "";
if (check_field !== "") {
if (check_field !== "") {
checked = data[check_field] !== null ? "checked" : "";
checked = data[check_field] !== null ? "checked" : "";
...
@@ -208,53 +199,49 @@
...
@@ -208,53 +199,49 @@
var mtableId = "${tableid}";
var mtableId = "${tableid}";
result = '<input type="checkbox" class="' + mtableId + '_check" value="' + id + '" ' + checked + ' name="' + mtableId + '_check"/> ';
result = '<input type="checkbox" class="' + mtableId + '_check" value="' + id + '" ' + checked + ' name="' + mtableId + '_check"/> ';
}
}
if (${
allow_view
})
if (${
allow_view
})
result += '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true" title="View"></i></a> ';
result += '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true" title="View"></i></a> ';
if (${
allow_edit
})
if (${
allow_edit
})
result += '<a href="${url}/' + id + '/edit"><i class="fas fa-edit" aria-hidden="true" title="Edit"></i></a> '
result += '<a href="${url}/' + id + '/edit"><i class="fas fa-edit" aria-hidden="true" title="Edit"></i></a> '
if (${
allow_delete
})
if (${
allow_delete
})
result += '<a href="${url}/' + id + '/delete"><i class="fas fa-trash" aria-hidden="true" title="Delete"></i></a>';
result += '<a href="${url}/' + id + '/delete"><i class="fas fa-trash" aria-hidden="true" title="Delete"></i></a>';
if (${
allow_post
})
if (${
allow_post
})
result += '<a href="${url}/' + id + '/post"><i class="fas fa-signs-post" aria-hidden="true" title="Post"></i></a>';
result += '<a href="${url}/' + id + '/post"><i class="fas fa-signs-post" aria-hidden="true" title="Post"></i></a>';
if (${
allow_unpost
})
if (${
allow_unpost
})
result += '<a href="${url}/' + id + '/unpost"><i class="fas fa-delete-left" aria-hidden="true" title="Unpost"></i></a>';
result += '<a href="${url}/' + id + '/unpost"><i class="fas fa-delete-left" aria-hidden="true" title="Unpost"></i></a>';
return result;
return result;
}
}
//columns[1].order = "order_asc";
}
}
}
}
let ${tableid}Params = {}
let ${tableid}Params = {};
var param_ajax = "";
var param_ajax = "";
var param_data = [];
var param_data = [];
if (!${server_side}) {
if (!${ server_side }) param_data = ${ data };
param_data = ${data};
else param_ajax = o${tableid}Url;
} else {
param_ajax = o${tableid}Url;
}
o${tableid} = $('#${tableid}').DataTable({
o${tableid} = $('#${tableid}').DataTable({
scrollX: ${field.scroll_x
},
scrollX: ${ field.scroll_x
},
//scrollY: ${field.scroll_y},
//scrollY: ${field.scroll_y},
//dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
//dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
dom: '<"row"<"col-md-8"<"toolbar">>><"row"<"col-md-8"Bl><"col-md-4"fr>>t<"row dt-footer"<"col-md-8" i><"col-md-4"p>>',
dom: '<"row"<"col-md-8"<"toolbar">>><"row"<"col-md-8"Bl><"col-md-4"fr>>t<"row dt-footer"<"col-md-8" i><"col-md-4"p>>',
processing: true,
processing: true,
serverSide: ${server_side
},
serverSide: ${ server_side
},
data: param_data,
data: param_data,
ajax: param_ajax,
ajax: param_ajax,
stateSave: ${state_save
},
stateSave: ${ state_save
},
scrollCollapse: true,
scrollCollapse: true,
sort: ${sorts
},
sort: ${ sorts
},
info: true,
info: true,
filter: ${filters
},
filter: ${ filters
},
autoWidth: false,
autoWidth: false,
paginate: ${paginates
},
paginate: ${ paginates
},
paginationType: "full_numbers",
paginationType: "full_numbers",
order: [],
order: [],
lengthMenu: [
lengthMenu: [
...
@@ -273,14 +260,13 @@
...
@@ -273,14 +260,13 @@
}
}
});
});
}
}
}
});
);
let tb = tb_array.join(' ');
let tb = tb_array.join(' ');
$("div.toolbar").html(tb);
$("div.toolbar").html(tb);
$("div.toolbar").attr('style', 'display:block; float: left; margin-bottom:6px; line-height:16px;');
$("div.toolbar").attr('style', 'display:block; float: left; margin-bottom:6px; line-height:16px;');
$("div.dt-footer").attr('style','margin-left: -7px;');
$("div.dt-footer").attr('style', 'margin-left: -7px;');
$(".dataTables_scrollBody").attr('style','margin-top: -10px;');
$(".dataTables_scrollBody").attr('style', 'margin-top: -10px;');
$('#${tableid} tbody').on('click', ':checkbox', function () {
$('#${tableid} tbody').on('click', ':checkbox', function () {
if (this.checked) m${tableid}CheckList.push($(this).val());
if (this.checked) m${tableid}CheckList.push($(this).val());
else m${tableid}CheckList.splice(m${tableid}CheckList.indexOf($(this).val()), 1);
else m${tableid}CheckList.splice(m${tableid}CheckList.indexOf($(this).val()), 1);
...
@@ -304,7 +290,7 @@
...
@@ -304,7 +290,7 @@
if (code === 13) filter_table();
if (code === 13) filter_table();
});
});
$("#${tableid}_length").append('<label> ${structure:edit_buttons}</label>')
$("#${tableid}_length").append('<label> ${structure:edit_buttons}</label>')
;
function filter_table() {
function filter_table() {
$(".${tableid}-control-filter").each(function (e) {
$(".${tableid}-control-filter").each(function (e) {
...
@@ -316,17 +302,19 @@
...
@@ -316,17 +302,19 @@
col_id = col_id.join("-");
col_id = col_id.join("-");
value = this.value;
value = this.value;
if (this.checked) {
if (this.checked) {
console.log(col_id, $(this).attr('id'), value, this.checked);
//
console.log(col_id, $(this).attr('id'), value, this.checked);
localStorage.setItem(col_id, value);
localStorage.setItem(col_id, value);
o${tableid}
o${tableid}.column($(this).data('index')).search(this.value)
.column($(this).data('index'))
.search(this.value)
}
}
}
}
else if ($(this).attr("type") === 'date') {
else if ($(this).attr("type") === 'date') {
value = this.value;
value = this.value;
localStorage.setItem(col_id, value);
localStorage.setItem(col_id, value);
var splitted = col_id.split('-');
var splitted = col_id.split('-');
if (splitted[splitted.length - 1] !== "min" && splitted[splitted.length - 1] !== "max"){
o${tableid}.column($(this).data('index')).search(value)
}
else{
var min_val = undefined;
var min_val = undefined;
var max_val = undefined;
var max_val = undefined;
if (splitted[splitted.length - 1] === "min") {
if (splitted[splitted.length - 1] === "min") {
...
@@ -334,27 +322,26 @@
...
@@ -334,27 +322,26 @@
splitted.length = splitted.length - 1;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
col_id = splitted.join("-");
max_val = $("#" + col_id + '-max').val()
max_val = $("#" + col_id + '-max').val()
} else {
}
else {
max_val = this.value;
max_val = this.value;
splitted.length = splitted.length - 1;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
col_id = splitted.join("-");
min_val = $("#" + col_id + '-min').val()
min_val = $("#" + col_id + '-min').val();
}
}
if (min_val === undefined && max_val !== undefined)
if (min_val === undefined && max_val !== undefined) min_val = max_val;
min_val = max_val;
if (max_val === undefined && min_val !== undefined) max_val = min_val;
if (max_val === undefined && min_val !== undefined)
if (max_val !== undefined && min_val !== undefined && min_val !== null && max_val !== null)
max_val = min_val;
if (max_val !== undefined && min_val !== undefined && min_val !== "" && max_val !== "" && min_val !== null && max_val !== null)
o${tableid}
o${tableid}
.column($(this).data('index'))
.column($(this).data('index'))
.search(min_val + '-yadcf_delim-' + max_val, true)
.search(min_val + '-yadcf_delim-' + max_val, true);
//&& min_val !== "" && max_val !== ""
}
}
}
else {
else {
col_id = this.id;
col_id = this.id;
value = this.value;
value = this.value;
if (value === undefined || value === null) {
if (value === undefined || value === null) value = "";
value = "";
}
console.log(col_id, $(this).attr('id'), value, $(this).data('index'));
console.log(col_id, $(this).attr('id'), value, $(this).data('index'));
localStorage.setItem(col_id, value);
localStorage.setItem(col_id, value);
o${tableid}
o${tableid}
...
@@ -362,12 +349,11 @@
...
@@ -362,12 +349,11 @@
.search(value);
.search(value);
}
}
});
});
//o${tableid}.ajax.url(o${tableid}Url).load();
o${tableid}.draw();
o${tableid}.draw();
}
}
$(".${tableid}-control-filter").on('click', function (e) {
$(".${tableid}-control-filter").on('click', function (e) {
console.log("Write Data Click");
//
console.log("Write Data Click");
var typ = $(this).attr("type");
var typ = $(this).attr("type");
if (typ === 'radio') {
if (typ === 'radio') {
filter_table();
filter_table();
...
@@ -375,15 +361,10 @@
...
@@ -375,15 +361,10 @@
});
});
$(".${tableid}-control-filter").on('change', function (e) {
$(".${tableid}-control-filter").on('change', function (e) {
var typ = $(this).prop("nodeName").toLowerCase();
var typ = $(this).prop("nodeName").toLowerCase();
if (typ === "select") {
if (typ === "select") filter_table();
filter_table()
}
var typ = $(this).attr("type").toLowerCase();
var typ = $(this).attr("type").toLowerCase();
if (typ === "date") {
if (typ === "date") filter_table();
filter_table();
}
});
});
console.log("Read Data");
console.log("Read Data");
...
@@ -398,19 +379,18 @@
...
@@ -398,19 +379,18 @@
if (value !== undefined && value != null)
if (value !== undefined && value != null)
if ($(this).val() === value) $(this).attr("checked", true);
if ($(this).val() === value) $(this).attr("checked", true);
else $(this).attr("checked", false);
else $(this).attr("checked", false);
} else {
}
else {
value = localStorage.getItem(col_id);
value = localStorage.getItem(col_id);
if (value !== undefined && value !== null)
if (value !== undefined && value !== null)
$(this).val(value);
$(this).val(value);
}
}
//console.log(col_id, $(this).attr('id'), value);
});
});
filter_table();
filter_table();
</tal:block>
</tal:block>
${structure:
btnscripts}
${structure:
btnscripts}
${structure:
filter_scripts}
${structure:
filter_scripts}
});
});
</script>
</script>
</div>
</div>
\ No newline at end of file
\ No newline at end of file
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