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
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
541 additions
and
524 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
body
{
body
{
font-family
:
"Open Sans"
,
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-family
:
"Open Sans"
,
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
--font-weight
:
300
;
--font-weight
:
300
;
--color
:
#ffffff
;
--color
:
#ffffff
;
--background
:
#bc2131
;
--background
:
#bc2131
;
font-size
:
12px
!important
;
font-size
:
12px
!important
;
padding-top
:
40px
;
padding-top
:
40px
;
}
}
h1
,
h1
,
h2
,
h2
,
h3
,
h3
,
...
@@ -21,107 +21,116 @@ legend {
...
@@ -21,107 +21,116 @@ legend {
}
}
.bar
{
.bar
{
height
:
18px
;
height
:
18px
;
background
:
green
;
background
:
green
;
}
}
.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
;
padding
:
3px
6px
!important
;
padding
:
3px
6px
!important
;
height
:
26px
;
height
:
26px
;
}
}
.btn
{
.btn
{
font-size
:
12px
;
font-size
:
12px
;
padding
:
3px
6px
;
padding
:
3px
6px
;
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
,
padding
:
0.1em
;
.picker__select--year
{
/*height: 3em;*/
padding
:
0.1em
;
/*height: 3em;*/
}
}
.container
{
.container
{
--max-width
:
1024px
;
--max-width
:
1024px
;
}
}
.container
.info
{
.container
.info
{
font-size
:
18px
;
font-size
:
18px
;
padding
:
14px
;
padding
:
14px
;
color
:
#fff
;
color
:
#fff
;
}
}
.container
.btn-menu
{
.container
.btn-menu
{
text-align
:
left
;
text-align
:
left
;
font-size
:
16px
;
font-size
:
16px
;
padding
:
14px
24px
;
padding
:
14px
24px
;
border-radius
:
6px
;
border-radius
:
6px
;
border
:
0px
none
;
border
:
0px
none
;
width
:
100%
;
width
:
100%
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
.container
.btn-login
{
.container
.btn-login
{
font-size
:
18px
;
font-size
:
18px
;
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
{
display
:
block
;
display
:
block
;
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
;
}
}
/*
/*
...
@@ -169,7 +178,7 @@ div.tab-content {
...
@@ -169,7 +178,7 @@ div.tab-content {
}
}
*/
*/
.form-horizontal
.form-group
{
.form-horizontal
.form-group
{
margin-bottom
:
4px
!important
;
margin-bottom
:
4px
!important
;
}
}
.picker
{
.picker
{
...
@@ -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
;
}
\ No newline at end of file
\ No newline at end of file
}
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,302 +41,316 @@
...
@@ -41,302 +41,316 @@
<!-- 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..."
/>
<!-- #HEADER -->
<header
id=
"header"
>
<div
id=
"logo-group"
>
<!-- PLACE YOUR LOGO HERE -->
<h3
id=
"logo"
>
<a
href=
"${home}/"
><img
src=
"${home}/static/img/logo.png"
alt=
"LOGO"
></a>
</h3>
<!-- END LOGO PLACEHOLDER -->
</div>
</div>
<!-- #PROJECTS: projects dropdown -->
<!-- #HEADER -->
<div
class=
"project-context hidden-xs"
>
<header
id=
"header"
>
<span
class=
"title-page"
>
${request.title}
</span>
<div
id=
"logo-group"
>
</div>
<!-- PLACE YOUR LOGO HERE -->
<!-- end projects dropdown -->
<h3
id=
"logo"
>
<a
href=
"${home}/"
><img
src=
"${home}/static/img/logo.png"
alt=
"LOGO"
></a>
<!-- #TOGGLE LAYOUT BUTTONS -->
</h3>
<!-- pulled right: nav area -->
<!-- END LOGO PLACEHOLDER -->
<div
class=
"pull-right"
>
<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
tal:condition=
"request.user"
class=
"project-selector dropdown-toggle"
data-toggle=
"dropdown"
>
Pilih Module
<i
class=
"fa fa-angle-down"
></i></span>
<ul
tal:condition=
"request.user"
class=
"dropdown-menu"
>
<li
tal:repeat=
"menu request.menus"
>
<a
href=
"${home}/${menu}"
>
${request.menus[menu]}
</a>
</li>
</ul>
</div>
</div>
<!-- collapse menu button -->
<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>
</div>
<!-- end collapse menu -->
<!-- fullscreen button -->
<!-- #PROJECTS: projects dropdown -->
<div
id=
"fullscreen"
class=
"btn-header transparent pull-right"
>
<div
class=
"project-context hidden-xs"
>
<span>
<a
href=
"javascript:void(0);"
data-action=
"launchFullscreen"
title=
"Full Screen"
>
<span
class=
"title-page"
>
${request.title}
</span>
<i
class=
"fa fa-arrows-alt"
></i></a>
</span>
</div>
</div>
<!-- end
fullscreen butto
n -->
<!-- end
projects dropdow
n -->
<!--
User info
-->
<!--
#TOGGLE LAYOUT BUTTONS
-->
<
ul
tal:condition=
"request.user"
class=
"header-dropdown-list hidden-xs"
>
<
!-- pulled right: nav area --
>
<li
>
<div
class=
"pull-right"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
><i
class=
"fa fa-lg fa-fw fa-user"
></i>
<span
<div
tal:condition=
"request.user"
class=
"project-context hidden-xs"
>
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<span
class=
"label"
><i
class=
"fa fa-sm fa-fw fa-institution"
></i>
${request.company}
</span>
<i
class=
"fa fa-angle-down"
></i>
</a>
<span
tal:condition=
"request.user"
class=
"project-selector dropdown-toggle"
data-toggle=
"dropdown"
>
Pilih
<ul
class=
"dropdown-menu pull-right"
>
Module
<i
class=
"fa fa-angle-down"
></i></span
>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('profile')}"
>
Profile
</a></li
>
<ul
tal:condition=
"request.user"
class=
"dropdown-menu"
>
<li
tal:
condition=
"not request.user.external
"
>
<li
tal:
repeat=
"menu request.menus
"
>
<a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah password
</a>
<a
href=
"${home}/${menu}"
>
${request.menus[menu]}
</a>
</li>
</li>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('logout')}"
>
Logout
</a></li>
<li
tal:condition=
"request.user.api_key"
><a
style=
"text-transform:capitalize"
href=
"${home}/recreate-api-key"
>
API Key
</a></li>
<li
tal:condition=
"'core' in request.modules and change_unit(request)"
>
<a
style=
"text-transform:capitalize"
href=
"${home}/departemen/chg"
>
Ubah
Organisasi
</a></li>
</ul>
</ul>
</li>
</div>
</ul>
<!-- collapse menu button -->
<!-- end user info -->
<div
id=
"hide-menu"
class=
"btn-header pull-right"
>
</div>
<span>
<a
href=
"javascript:void(0);"
data-action=
"toggleMenu"
title=
"Collapse Menu"
><i
<!-- end pulled right: nav area -->
class=
"fa fa-reorder"
></i></a>
</span>
</header>
</div>
<!-- END HEADER -->
<!-- end collapse menu -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside
id=
"left-panel"
style=
"padding-bottom:67px"
>
<!-- NAVIGATION : This navigation is also responsive-->
<nav
style=
""
>
<!-- Modul Menu -->
<ul
metal:define-slot=
"navs"
></ul>
<!-- Admin Menu -->
<ul
tal:condition=
"has_permission(request, user_path)"
style=
"margin-top: 0; padding-top: 0;"
>
<li>
<a
href=
"#"
><i
class=
"fa fa-lg fa-fw fa-shield"
></i><span
class=
"menu-item-parent"
>
Admin
</span></a>
<ul>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_path and 'active'"
>
<a
href=
"${home}/user"
>
User
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_area_path and 'active'"
>
<a
href=
"${home}/user/area"
>
User Area
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_dep_path and 'active'"
>
<a
href=
"${home}/user/departemen"
>
User Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_ext_path and 'active'"
>
<a
href=
"${home}/user/ext"
>
External User
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in group_path and 'active'"
>
<a
href=
"${home}/group"
>
Group
</a>
</li>
<li
tal:condition=
"has_permission(request, 'upload-logo')"
tal:attributes=
"class route_name in ['upload-logo'] and 'active'"
>
<a
href=
"${home}/upload/logo"
>
Upload Logo
</a></li>
<li
tal:condition=
"has_permission(request, 'parameter')"
tal:attributes=
"class route_name in param_path and 'active'"
>
<a
href=
"${home}/parameter"
>
Parameter
</a></li>
<li
tal:condition=
"has_permission(request, 'company')"
tal:attributes=
"class route_name in company_path and 'active'"
>
<a
href=
"${home}/company"
>
Pemerintah
</a></li>
<li
tal:condition=
"has_permission(request, 'eselon')"
tal:attributes=
"class route_name in eselon_path and 'active'"
>
<a
href=
"${home}/eselon"
>
Eselon
</a></li>
<li
tal:condition=
"has_permission(request, 'jabatan')"
tal:attributes=
"class route_name in jabatan_path and 'active'"
>
<a
href=
"${home}/jabatan"
>
Jabatan
</a></li>
<li
tal:condition=
"has_permission(request, 'departemen')"
tal:attributes=
"class route_name in dep_path and 'active'"
>
<a
href=
"${home}/departemen"
>
Departemen
</a></li>
<li
tal:condition=
"has_permission(request, 'partner')"
tal:attributes=
"class route_name in partner_path and 'active'"
>
<a
href=
"${home}/partner"
>
Partner
</a></li>
<li
tal:condition=
"has_permission(request, 'partner-departemen')"
tal:attributes=
"class route_name in part_dep_path and 'active'"
>
<a
href=
"${home}/partner/departemen"
>
Partner Departemen
</a></li>
<li
tal:condition=
"has_permission(request, 'provinsi')"
tal:attributes=
"class route_name in provinsi_path and 'active'"
>
<a
href=
"${home}/provinsi"
>
Provinsi
</a></li>
<li
tal:condition=
"has_permission(request, 'dati2')"
tal:attributes=
"class route_name in dati2_path and 'active'"
>
<a
href=
"${home}/dati2"
>
Kabupaten/Kota
</a></li>
<li
tal:condition=
"has_permission(request, 'kecamatan')"
tal:attributes=
"class route_name in kecamatan_path and 'active'"
>
<a
href=
"${home}/kecamatan"
>
Kecamatan
</a></li>
<li
tal:condition=
"has_permission(request, 'desa')"
tal:attributes=
"class route_name in desa_path and 'active'"
>
<a
href=
"${home}/desa"
>
Desa/Kelurahan
</a></li>
<li
tal:condition=
"has_permission(request, 'log')"
tal:attributes=
"class route_name in ['log'] and 'active'"
>
<a
href=
"${home}/log"
>
Log
</a></li>
</ul>
<!-- fullscreen button -->
</li>
<div
id=
"fullscreen"
class=
"btn-header transparent pull-right"
>
</ul>
<span>
<a
href=
"javascript:void(0);"
data-action=
"launchFullscreen"
title=
"Full Screen"
>
</nav>
<i
class=
"fa fa-arrows-alt"
></i></a>
</span>
<span
class=
"minifyme"
data-action=
"minifyMenu"
>
</div>
<i
class=
"fa fa-arrow-circle-left hit"
></i>
<!-- end fullscreen button -->
</span>
<span
class=
"footer-side"
>
©
OpenSIPKD.com
<!-- User info -->
<script>
document
.
write
(
new
Date
().
getFullYear
());
</script>
<ul
tal:condition=
"request.user"
class=
"header-dropdown-list hidden-xs"
>
</span>
<li>
</aside>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
><i
class=
"fa fa-lg fa-fw fa-user"
></i>
<!-- END NAVIGATION -->
<span
style=
"text-transform:capitalize"
>
${request.user and request.user.nice_username() or ""}
</span>
<i
class=
"fa fa-angle-down"
></i>
</a>
<!-- JS -->
<ul
class=
"dropdown-menu pull-right"
>
<script
src=
"${home}/static/v3/js/jquery-2.1.1.min.js"
></script>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('profile')}"
>
Profile
</a></li>
<script>
<li
tal:condition=
"not request.user.external"
>
if
(
!
window
.
jQuery
)
{
<a
style=
"text-transform:capitalize"
href=
"${request.route_url('password')}"
>
Ubah
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>'
);
password
</a>
}
</li>
</script>
<li><a
style=
"text-transform:capitalize"
href=
"${request.route_url('logout')}"
>
Logout
</a></li>
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<li
tal:condition=
"request.user.api_key"
><a
style=
"text-transform:capitalize"
<script>
href=
"${home}/recreate-api-key"
>
API Key
</a></li>
// if (!window.jQuery.ui) {
<li
tal:condition=
"'core' in request.modules and change_unit(request)"
>
<!--
?
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>'
);
-->
<a
style=
"text-transform:capitalize"
href=
"${home}/departemen/chg"
>
Ubah
// }
Organisasi
</a>
</script>
</li>
</ul>
<!-- IMPORTANT: APP CONFIG -->
</li>
<script
src=
"${home}/static/v3/js/app.config.js"
></script>
</ul>
<!-- end user info -->
<!-- BOOTSTRAP JS -->
</div>
<script
src=
"${home}/static/v3/js/bootstrap/bootstrap.min.js"
></script>
<!-- end pulled right: nav area -->
</header>
<!-- FastClick: For mobile devices -->
<!-- END HEADER -->
<script
src=
"${home}/static/v3/js/plugin/fastclick/fastclick.min.js"
></script>
<!--[if IE 8]>
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside
id=
"left-panel"
style=
"padding-bottom:67px"
>
<!-- NAVIGATION : This navigation is also responsive-->
<nav
style=
""
>
<!-- Modul Menu -->
<ul
metal:define-slot=
"navs"
></ul>
<!-- Admin Menu -->
<ul
tal:condition=
"has_permission(request, user_path)"
style=
"margin-top: 0; padding-top: 0;"
>
<li>
<a
href=
"#"
><i
class=
"fa fa-lg fa-fw fa-shield"
></i><span
class=
"menu-item-parent"
>
Admin
</span></a>
<ul>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_path and 'active'"
>
<a
href=
"${home}/user"
>
User
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_area_path and 'active'"
>
<a
href=
"${home}/user/area"
>
User Area
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_dep_path and 'active'"
>
<a
href=
"${home}/user/departemen"
>
User Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in user_ext_path and 'active'"
>
<a
href=
"${home}/user/ext"
>
External User
</a>
</li>
<li
tal:condition=
"has_permission(request, ['user-view', 'user-edit'])"
tal:attributes=
"class route_name in group_path and 'active'"
>
<a
href=
"${home}/group"
>
Group
</a>
</li>
<li
tal:condition=
"has_permission(request, 'upload-logo')"
tal:attributes=
"class route_name in ['upload-logo'] and 'active'"
>
<a
href=
"${home}/upload/logo"
>
Upload Logo
</a>
</li>
<li
tal:condition=
"has_permission(request, 'parameter')"
tal:attributes=
"class route_name in param_path and 'active'"
>
<a
href=
"${home}/parameter"
>
Parameter
</a>
</li>
<li
tal:condition=
"has_permission(request, 'company')"
tal:attributes=
"class route_name in company_path and 'active'"
>
<a
href=
"${home}/company"
>
Pemerintah
</a>
</li>
<li
tal:condition=
"has_permission(request, 'eselon')"
tal:attributes=
"class route_name in eselon_path and 'active'"
>
<a
href=
"${home}/eselon"
>
Eselon
</a>
</li>
<li
tal:condition=
"has_permission(request, 'jabatan')"
tal:attributes=
"class route_name in jabatan_path and 'active'"
>
<a
href=
"${home}/jabatan"
>
Jabatan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'departemen')"
tal:attributes=
"class route_name in dep_path and 'active'"
>
<a
href=
"${home}/departemen"
>
Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, 'partner')"
tal:attributes=
"class route_name in partner_path and 'active'"
>
<a
href=
"${home}/partner"
>
Partner
</a>
</li>
<li
tal:condition=
"has_permission(request, 'partner-departemen')"
tal:attributes=
"class route_name in part_dep_path and 'active'"
>
<a
href=
"${home}/partner/departemen"
>
Partner Departemen
</a>
</li>
<li
tal:condition=
"has_permission(request, 'provinsi')"
tal:attributes=
"class route_name in provinsi_path and 'active'"
>
<a
href=
"${home}/provinsi"
>
Provinsi
</a>
</li>
<li
tal:condition=
"has_permission(request, 'dati2')"
tal:attributes=
"class route_name in dati2_path and 'active'"
>
<a
href=
"${home}/dati2"
>
Kabupaten/Kota
</a>
</li>
<li
tal:condition=
"has_permission(request, 'kecamatan')"
tal:attributes=
"class route_name in kecamatan_path and 'active'"
>
<a
href=
"${home}/kecamatan"
>
Kecamatan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'desa')"
tal:attributes=
"class route_name in desa_path and 'active'"
>
<a
href=
"${home}/desa"
>
Desa/Kelurahan
</a>
</li>
<li
tal:condition=
"has_permission(request, 'log')"
tal:attributes=
"class route_name in ['log'] and 'active'"
>
<a
href=
"${home}/log"
>
Log
</a>
</li>
</ul>
</li>
</ul>
</nav>
<span
class=
"minifyme"
data-action=
"minifyMenu"
>
<i
class=
"fa fa-arrow-circle-left hit"
></i>
</span>
<span
class=
"footer-side"
>
©
OpenSIPKD.com
<script>
document
.
write
(
new
Date
().
getFullYear
());
</script>
</span>
</aside>
<!-- END NAVIGATION -->
<!-- JS -->
<script
src=
"${home}/static/v3/js/jquery-2.1.1.min.js"
></script>
<script>
if
(
!
window
.
jQuery
)
{
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>'
);
}
</script>
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<script>
// if (!window.jQuery.ui) {
<!--
?
document
.
write
(
'<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>'
);
-->
// }
</script>
<!-- IMPORTANT: APP CONFIG -->
<script
src=
"${home}/static/v3/js/app.config.js"
></script>
<!-- BOOTSTRAP JS -->
<script
src=
"${home}/static/v3/js/bootstrap/bootstrap.min.js"
></script>
<!-- FastClick: For mobile devices -->
<script
src=
"${home}/static/v3/js/plugin/fastclick/fastclick.min.js"
></script>
<!--[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"
>
<!-- Error session flash -->
<!-- Error session flash -->
<div
tal:condition=
"request.session.peek_flash()"
>
<div
tal:condition=
"request.session.peek_flash()"
>
<div
class=
"alert alert-success"
tal:repeat=
"message request.session.pop_flash()"
><i
<div
class=
"alert alert-success"
tal:repeat=
"message request.session.pop_flash()"
><i
class=
"fa fa-fw fa-lg fa-check-circle"
></i>
${message}
class=
"fa fa-fw fa-lg fa-check-circle"
></i>
${message}
</div>
</div>
</div>
</div
>
<div
tal:condition=
"request.session.peek_flash('error')"
>
<div
tal:condition=
"request.session.peek_flash('error')"
>
<div
class=
"alert alert-danger"
tal:repeat=
"message request.session.pop_flash('error')"
><i
<div
class=
"alert alert-danger"
tal:repeat=
"message request.session.pop_flash('error')"
><i
class=
"fa fa-fw fa-lg fa-times-circle"
></i>
${message}
class=
"fa fa-fw fa-lg fa-times-circle"
></i>
${message}
</div>
</div>
</div>
</div>
<!-- Error session flash -->
<!-- Error session flash -->
<!-- <div id="errors" name="errors"> -->
<!-- <div id="errors" name="errors"> -->
<div
class=
"alert alert-danger"
id=
"errors"
name=
"errors"
style=
"display:none;"
>
errors
</div>
<div
class=
"alert alert-danger"
id=
"errors"
name=
"errors"
style=
"display:none;"
>
errors
</div>
<div
class=
"alert alert-success"
id=
"success"
name=
"success"
style=
"display:none;"
>
success
</div>
<div
class=
"alert alert-success"
id=
"success"
name=
"success"
style=
"display:none;"
>
success
</div>
<!-- <div id="errors" name="errors"> -->
<!-- <div id="errors" name="errors"> -->
<!-- Global Alert -->
<!-- Global Alert -->
<div
tal:condition=
"request.session.peek_flash()"
>
<div
tal:condition=
"request.session.peek_flash()"
>
<div
class=
"alert alert-success"
tal:repeat=
"message request.session.pop_flash()"
>
${message}
</div>
<div
class=
"alert alert-success"
tal:repeat=
"message request.session.pop_flash()"
>
${message}
</div>
</div>
</div>
<div
tal:condition=
"request.session.peek_flash('error')"
>
<div
tal:condition=
"request.session.peek_flash('error')"
>
<div
class=
"alert alert-danger"
tal:repeat=
"message request.session.pop_flash('error')"
>
${message}
</div>
<div
class=
"alert alert-danger"
tal:repeat=
"message request.session.pop_flash('error')"
>
${message}
</div>
</div>
</div>
<!-- End Global Alert -->
<!-- End Global Alert -->
<!-- SLOT KONTEN -->
<!-- SLOT KONTEN -->
<div
metal:define-slot=
"content"
></div>
<div
metal:define-slot=
"content"
></div>
<!-- END SLOT KONTEN -->
<!-- END SLOT KONTEN -->
</div>
<!-- END MAIN CONTENT -->
</div>
</div>
<!-- END MAIN CONTENT -->
<!-- END MAIN PANEL -->
</div>
<!-- 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,9 +204,9 @@ class ViewLogin(BaseView):
...
@@ -205,9 +204,9 @@ 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
if
pckgs
:
if
pckgs
:
...
@@ -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__
))
...
@@ -558,4 +557,4 @@ def view_reset_password(request):
...
@@ -558,4 +557,4 @@ def view_reset_password(request):
route_name
=
'reset-password-sent'
,
route_name
=
'reset-password-sent'
,
renderer
=
'templates/reset-password-sent.pt'
)
renderer
=
'templates/reset-password-sent.pt'
)
def
view_reset_password_sent
(
request
):
def
view_reset_password_sent
(
request
):
return
dict
(
title
=
_
(
'Reset password'
))
\ No newline at end of file
\ No newline at end of file
return
dict
(
title
=
_
(
'Reset password'
))
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,18 +443,27 @@ class DeTable(field.Field):
...
@@ -441,18 +443,27 @@ class DeTable(field.Field):
html
+=
'</select>'
html
+=
'</select>'
elif
isinstance
(
f
.
typ
,
colander
.
Date
):
elif
isinstance
(
f
.
typ
,
colander
.
Date
):
html
+=
f
'<div class="form-group" {txt}>'
search_method
=
getattr
(
f
,
"search_method"
,
None
)
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
if
search_method
==
"date"
:
html
+=
f
'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
# html += f'<div class="tooltip">'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
html
+=
f
'data-index={field_index} placeholder="{f.title} Awal"'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter"'
html
+=
f
'name="{col_id}" id="{col_id}-min"/>'
html
+=
f
'{txt}/>'
html
+=
f
'<div class="input-group-addon">-</div>'
# html += f'<span class="tooltiptext">{f.title}</span>'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
# html += f'</div>'
html
+=
f
'data-index={field_index} placeholder="{f.title} Akhir" '
else
:
html
+=
f
'name="{col_id}" id="{col_id}-max" /></span>'
html
+=
f
'<div class="form-group" {txt}>'
html
+=
f
'</div>'
html
+=
f
'<label class="form-label" style="font-size:12px">{f.title}</label>'
html
+=
f
'</div>'
html
+=
f
'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html
+=
f
'data-index={field_index} placeholder="{f.title} Awal"'
html
+=
f
'name="{col_id}" id="{col_id}-min"/>'
html
+=
f
'<div class="input-group-addon">-</div>'
html
+=
f
'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html
+=
f
'data-index={field_index} placeholder="{f.title} Akhir" '
html
+=
f
'name="{col_id}" id="{col_id}-max" /></span>'
html
+=
f
'</div>'
html
+=
f
'</div>'
"""
"""
awal
awal
html += f'<div class="form-group" {txt}>'
html += f'<div class="form-group" {txt}>'
...
...
opensipkd/detable/templates/detable.pt
View file @
d65b84e
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<div class="row" tal:condition="filter_columns">
<div class="row" tal:condition="filter_columns">
<div id="${tableid}-form-filter-container" class="col-md-3">
<div id="${tableid}-form-filter-container" class="col-md-3">
<div id="${tableid}-form-filter" class="collapse">
<div id="${tableid}-form-filter" class="collapse">
${structure:filter_form}
${structure:filter_form}
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -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 {
...
@@ -69,18 +69,18 @@
...
@@ -69,18 +69,18 @@
</div>
</div>
<table id="${tableid}" class="table table-bordered table-hover table-condensed dataTable no-footer">
<table id="${tableid}" class="table table-bordered table-hover table-condensed dataTable no-footer">
<thead>
<thead>
<tr>
<tr>
<tr>
<tr>
<tal:block tal:repeat="child field">
<tal:block tal:repeat="child field">
<tal:block tal:condition="python:not hasattr(child, 'visible') or getattr(child, 'visible')==True">
<tal:block tal:condition="python:not hasattr(child, 'visible') or getattr(child, 'visible')==True">
<th
<th
tal:condition="python:hasattr(child, 'action') and not getattr(child.condition)==False and False or True">
tal:condition="python:hasattr(child, 'action') and not getattr(child.condition)==False and False or True">
${child.title}
</th>
${child.title} </th>
</tal:block>
</tal:block>
</tal:block>
</tal:block>
</tr>
</tr>
</thead>
</thead>
<tbody></tbody>
<tbody></tbody>
...
@@ -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,28 +143,24 @@
...
@@ -147,28 +143,24 @@
};
};
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>';
}
}
for (let co in ${tableid}Columns) {
for (let co in ${tableid}Columns) {
if (${tableid}Columns[co].wg_checkbox === true) {
if (${tableid}Columns[co].wg_checkbox === true) {
${tableid}Columns[co].render = function (value) {
${tableid}Columns[co].render = function (value) {
if (typeof value === "string" && value.length > 0) {
if (typeof value === "string" && value.length > 0) {
return render_checkbox(value)
return render_checkbox(value)
}
}
...
@@ -177,134 +169,128 @@
...
@@ -177,134 +169,128 @@
}
}
return render_checkbox(false);
return render_checkbox(false);
}
}
//}
//}
//else if (${tableid}Columns[co].wg_select === true) {
//else if (${tableid}Columns[co].wg_select === true) {
// ${tableid}Columns[co].render = function (value) {
// ${tableid}Columns[co].render = function (value) {
// if (value != null)
// if (value != null)
// 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";
if (data != null) {
if (data != null) {
result = '<a href="' + url + data + '" target="_blank">Link</a> ';
result = '<a href="' + url + data + '" target="_blank">Link</a> ';
}
}
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" : "";
m${tableid}CheckList.push(id);
m${tableid}CheckList.push(id);
}
}
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: [
[10, 25, 50, 100],
[10, 25, 50, 100],
[10, 25, 50, 100]
[10, 25, 50, 100]
],
],
pageLength: 25,
pageLength: 25,
columns: ${tableid}Columns,
columns: ${tableid}Columns,
language: ${tableid}Language,
language: ${tableid}Language,
initComplete: function () {
initComplete: function () {
$('.dataTables_filter input').unbind()
$('.dataTables_filter input').unbind()
.bind('keyup', function (e) {
.bind('keyup', function (e) {
var code = e.keyCode || e.which;
var code = e.keyCode || e.which;
if (code === 13) {
if (code === 13) {
o${tableid}.search(this.value).draw();
o${tableid}.search(this.value).draw();
}
}
});
});
}
}
}
});
);
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);
});
});
$('#${tableid} tbody').on('click', 'tr', function () {
$('#${tableid} tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
$(this).removeClass('selected');
m${tableid}ID = null;
m${tableid}ID = null;
} else {
} else {
let aData = o${tableid}.row(this).data();
let aData = o${tableid}.row(this).data();
o${tableid}.$('tr.selected').removeClass('selected');
o${tableid}.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
$(this).addClass('selected');
m${tableid}ID = aData.id;
m${tableid}ID = aData.id;
o${tableid}.$('tr.row_selected').removeClass('row_selected');
o${tableid}.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
$(this).addClass('row_selected');
}
}
});
});
<tal:block tal:condition="filter_columns">
<tal:block tal:condition="filter_columns">
$(".${tableid}-control-filter").on('keyup', function (e) {
$(".${tableid}-control-filter").on('keyup', function (e) {
var code = e.keyCode || e.which;
var code = e.keyCode || e.which;
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,74 +302,69 @@
...
@@ -316,74 +302,69 @@
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('-');
var min_val = undefined;
if (splitted[splitted.length - 1] !== "min" && splitted[splitted.length - 1] !== "max"){
var max_val = undefined;
o${tableid}.column($(this).data('index')).search(value)
if (splitted[splitted.length - 1] === "min") {
min_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
max_val = $("#" + col_id + '-max').val()
} else {
max_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
min_val = $("#" + col_id + '-min').val()
}
}
if (min_val === undefined && max_val !== undefined)
else{
min_val = max_val;
var min_val = undefined;
if (max_val === undefined && min_val !== undefined)
var max_val = undefined;
max_val = min_val;
if (splitted[splitted.length - 1] === "min") {
if (max_val !== undefined && min_val !== undefined && min_val !== "" && max_val !== "" && min_val !== null && max_val !== null)
min_val = this.value;
o${tableid}
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
max_val = $("#" + col_id + '-max').val()
}
else {
max_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
min_val = $("#" + col_id + '-min').val();
}
if (min_val === undefined && max_val !== undefined) min_val = max_val;
if (max_val === undefined && min_val !== undefined) max_val = min_val;
if (max_val !== undefined && min_val !== undefined && min_val !== null && max_val !== null)
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}
.column($(this).data('index'))
.column($(this).data('index'))
.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();
}
}
});
});
$(".${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");
...
@@ -396,21 +377,20 @@
...
@@ -396,21 +377,20 @@
col_id = col_id.join("-");
col_id = col_id.join("-");
value = localStorage.getItem(col_id);
value = localStorage.getItem(col_id);
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