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 316405d6
authored
Dec 01, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Widget GMAP
1 parent
91fb10a3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
22 deletions
opensipkd/base/views/base_views.py
opensipkd/base/views/partner.py
opensipkd/base/views/templates/base3.1.pt
opensipkd/base/views/templates/include_table.pt
opensipkd/base/views/user.py
opensipkd/base/views/widget_os.py
opensipkd/base/views/widgets/gmap.pt
requirements.txt
opensipkd/base/views/base_views.py
View file @
316405d
...
...
@@ -253,9 +253,13 @@ class BaseView(object):
return
self
.
route_list
(
"Nilai Data tidak ditemukan"
,
"error"
)
form
.
set_appstruct
(
values
)
table
=
self
.
get_item_table
(
row
)
resources
=
form
.
get_widget_resources
()
return
dict
(
form
=
form
.
render
(
readonly
=
True
),
table
=
table
and
table
.
render
()
or
None
,
scripts
=
self
.
form_scripts
)
scripts
=
self
.
form_scripts
,
css
=
resources
[
"css"
],
js
=
resources
[
"js"
]
)
def
view_upload
(
self
,
exts
=
(
'.png'
,
'.ico'
)):
bindings
=
self
.
get_bindings
()
...
...
opensipkd/base/views/partner.py
View file @
316405d
...
...
@@ -222,10 +222,11 @@ class ViewPartner(BaseView):
err_kode
()
elif
found
:
err_kode
()
value
[
'is_vendor'
]
=
'is_vendor'
in
value
and
value
[
'is_vendor'
]
and
1
or
0
value
[
'is_customer'
]
=
'is_customer'
in
value
and
value
[
'is_customer'
]
and
1
or
0
value
[
'is_vendor'
]
=
'is_vendor'
in
value
and
\
value
[
'is_vendor'
]
and
1
or
0
value
[
'is_customer'
]
=
'is_customer'
in
value
and
\
value
[
'is_customer'
]
and
1
or
0
value
[
"status"
]
=
'status'
in
value
and
value
[
'status'
]
and
1
or
0
def
get_bindings
(
self
,
row
=
None
):
...
...
opensipkd/base/views/templates/base3.1.pt
View file @
316405d
...
...
@@ -52,7 +52,7 @@
<!-- We recommend you use "your_style.css" to override SmartAdmin
specific styles this will also ensure you retrain your customization with each SmartAdmin update. -->
<!--
OTHER CSS
-->
<!--
LOOP FORM CSS INCLUDED
-->
<tal:loop
tal:repeat=
"css_resource css"
>
<link
rel=
"stylesheet"
href=
"${home}${request.static_path(css_resource)}"
type=
"text/css"
>
...
...
@@ -271,6 +271,7 @@
<!--?<script src="${home}/static/v3/js/select2.full.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/file_upload.js"></script>-->
<script
src=
"${home}/static/v3/js/osipkd.js"
></script>
<!-- LOOP ON JS RESOURCE -->
<tal:loop
tal:repeat=
"js_resource js"
>
<script
src=
"${home}${request.static_path(js_resource)}"
></script>
</tal:loop>
...
...
opensipkd/base/views/templates/include_table.pt
0 → 100644
View file @
316405d
<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.tableTools.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>
opensipkd/base/views/user.py
View file @
316405d
...
...
@@ -4,7 +4,8 @@ import re
import
colander
from
deform
import
(
widget
,
)
from
opensipkd.tools
import
create_now
,
SaveFile
from
opensipkd.tools.report
import
open_rml_row
,
csv_response
,
open_rml_pdf
,
pdf_response
,
file_response
from
opensipkd.tools.report
import
open_rml_row
,
csv_response
,
open_rml_pdf
,
\
pdf_response
,
file_response
from
pyramid.i18n
import
TranslationStringFactory
from
pyramid.view
import
view_config
from
sqlalchemy
import
(
func
,
)
...
...
@@ -95,7 +96,8 @@ class Views(BaseView):
path
=
os
.
path
.
join
(
base_path
,
'reports'
)
rml_row
=
open_rml_row
(
path
+
'/user.row.rml'
)
rows
=
[
rml_row
.
format
(
user_name
=
r
.
user_name
,
email
=
r
.
email
,
registered_date
=
r
.
registered_date
)
for
r
in
query
.
all
()]
registered_date
=
r
.
registered_date
)
for
r
in
query
.
all
()]
pdf
,
filename
=
open_rml_pdf
(
path
+
'/user.rml'
,
rows
=
rows
,
company
=
self
.
req
.
company
,
departement
=
self
.
req
.
departement
,
...
...
@@ -118,7 +120,8 @@ class Views(BaseView):
values
[
"email"
]
=
values
[
'email'
]
.
lower
()
values
[
"user_name"
]
=
re
.
sub
(
' '
,
''
,
values
[
'user_name'
])
# .lower()
values
[
"security_code_date"
]
=
create_now
()
company_id
=
request
.
user
and
request
.
user
.
company_id
or
"company_id"
in
values
and
values
[
"company_id"
]
or
None
company_id
=
request
.
user
and
request
.
user
.
company_id
or
"company_id"
in
values
and
\
values
[
"company_id"
]
or
None
values
[
"company_id"
]
=
company_id
if
'is_api_key'
in
values
:
values
[
"api_key"
]
=
generate_api_key
()
...
...
@@ -261,7 +264,7 @@ class EmailValidator(colander.Email, Validator):
email
=
value
.
lower
()
q
=
DBSession
.
query
(
User
)
.
filter_by
(
email
=
email
)
found
=
q
.
first
()
if
found
and
(
not
self
.
user
or
self
.
user
.
email
!=
found
.
email
):
if
found
and
(
not
self
.
user
or
self
.
user
.
email
!=
found
.
email
):
email_found
()
...
...
@@ -380,5 +383,7 @@ def user_group_set(user):
def
query_register
():
return
DBSession
.
query
(
User
.
user_name
,
User
.
email
,
func
.
to_char
(
User
.
registered_date
,
"DD-MM-YYYY"
)
.
label
(
"registered_date"
))
.
order_by
(
func
.
to_char
(
User
.
registered_date
,
"DD-MM-YYYY"
)
.
label
(
"registered_date"
))
.
order_by
(
User
.
user_name
)
opensipkd/base/views/widget_os.py
View file @
316405d
import
json
from
colander
import
SchemaNode
,
null
,
Mapping
,
Invalid
,
text_
,
string_types
from
deform.widget
import
Widget
,
_StrippedString
,
Select2Widget
...
...
@@ -160,7 +162,8 @@ class BlokKavNoWidget(Widget):
result
=
"|"
.
join
([
blok_kav_no
,
rt
,
rw
])
if
not
blok_kav_no
or
not
rt
or
not
rw
:
raise
Invalid
(
field
.
schema
,
"Blok Kav No RT/RW tidak lengkap"
,
result
)
raise
Invalid
(
field
.
schema
,
"Blok Kav No RT/RW tidak lengkap"
,
result
)
return
result
...
...
@@ -183,6 +186,7 @@ class Select2MsWidget(Select2Widget):
template
=
"select2_ms.pt"
class
QtyWidget
(
Widget
):
template
=
"opensipkd.base:/views/widgets/qty.pt"
readonly_template
=
"opensipkd.base:/views/widgets/readonly/qty.pt"
...
...
@@ -228,6 +232,7 @@ class QtyWidget(Widget):
return
result
class
CaptchaWidget
(
Widget
):
"""
Renders an ``<input type="text"/>`` widget.
...
...
@@ -275,6 +280,7 @@ class CaptchaWidget(Widget):
return
null
return
pstruct
class
ImageWidget
(
Widget
):
"""
Renders an ``<img src="src"/>`` widget.
...
...
@@ -300,8 +306,72 @@ class ImageWidget(Widget):
strip
=
True
requirements
=
()
height
=
"30px"
def
__init__
(
self
,
**
kw
):
super
()
.
__init__
(
**
kw
)
def
serialize
(
self
,
field
,
cstruct
,
**
kw
):
if
cstruct
in
(
null
,
None
):
cstruct
=
""
readonly
=
kw
.
get
(
"readonly"
,
self
.
readonly
)
template
=
readonly
and
self
.
readonly_template
or
self
.
template
values
=
self
.
get_template_values
(
field
,
cstruct
,
kw
)
return
field
.
renderer
(
template
,
**
values
)
def
deserialize
(
self
,
field
,
pstruct
):
if
pstruct
is
null
:
return
null
elif
not
isinstance
(
pstruct
,
string_types
):
raise
Invalid
(
field
.
schema
,
"Pstruct is not a string"
)
if
self
.
strip
:
pstruct
=
pstruct
.
strip
()
if
not
pstruct
:
return
null
return
pstruct
class
MapWidget
(
Widget
):
"""
Renders an ``<div id="map"/>`` widget.
**Attributes/Arguments**
template
The template name used to render the widget. Default:
``textinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
strip
If true, during deserialization, strip the value of leading
and trailing whitespace (default ``True``).
"""
template
=
"opensipkd.base:views/widgets/gmap.pt"
readonly_template
=
"opensipkd.base:views/widgets/gmap.pt"
map_center
=
[
0
,
0
]
map_zoom
=
12
gmap_key
=
None
gmap_control
=
[
'Point'
,
'Polygon'
,
'LineString'
]
gmap_height
=
"400px"
gmap_width
=
"100
%
"
strip
=
True
html_info
=
{}
gmap_data_style
=
{
"editable"
:
"true"
,
"draggable"
:
"true"
,
"clickable"
:
"true"
,
"removable"
:
"true"
,
}
gmap_edit_url
=
""
requirements
=
()
def
__init__
(
self
,
**
kw
):
super
()
.
__init__
(
**
kw
)
self
.
gmap_data_style
=
json
.
dumps
(
self
.
gmap_data_style
)
def
serialize
(
self
,
field
,
cstruct
,
**
kw
):
if
cstruct
in
(
null
,
None
):
...
...
opensipkd/base/views/widgets/gmap.pt
0 → 100644
View file @
316405d
This diff is collapsed.
Click to expand it.
requirements.txt
View file @
316405d
...
...
@@ -8,14 +8,14 @@ Pillow>=9.1.1
lxml>=4.9.0
beautifulsoup4>=4.11.1
soupsieve>=2.3.2.post1
pip~=
18
.1
wheel~=0.3
7.0
pip~=
22.3
.1
wheel~=0.3
8.4
rsa>=4.8
pyasn1~=0.4.8
Chameleon>=3.10.1
six~=1.16.0
Mako>=1.2.0
Babel~=2.1
0.2
Babel~=2.1
1.0
Beaker~=1.11.0
Pygments>=2.12.0
MarkupSafe>=2.1.1
...
...
@@ -27,7 +27,7 @@ peppercorn~=0.6
iso8601>=1.0.2
google~=3.0.0
cachetools>=5.2.0
certifi~=2022.
5.18.1
certifi~=2022.
9.24
urllib3~=1.26.6
requests>=2.28.0
google-api-python-client>=2.51.0
...
...
@@ -38,21 +38,21 @@ venusian~=3.0.0
plaster~=1.0
hupper~=1.10.3
waitress>=2.1.2
greenlet~=
1.1
.1
greenlet~=
2.0
.1
pyparsing>=3.0.9
httplib2>=0.20.4
icecream~=2.1.1
executing~=
0.8
.0
executing~=
1.2
.0
paginate~=0.5.6
idna~=3.2
asttokens~=2.
0.5
asttokens~=2.
1.0
setuptools>=57.4.0
uritemplate>=4.1.1
reportlab~=3.6.1
PyJWT>=2.4.0
py~=1.11.0
attrs~=2
1.4
.0
pytest~=7.
1.1
attrs~=2
2.1
.0
pytest~=7.
2.0
pluggy~=1.0.0
iniconfig~=1.1.1
cffi>=1.15.0
...
...
@@ -65,6 +65,9 @@ pyramid_rpc
zipp~=3.8.0
papyrus~=2.4
geojson~=2.5.0
GeoAlchemy2~=0.12.1
pybind11~=2.9.2
qrcode~=7.3.1
exceptiongroup~=1.0.4
Shapely~=1.8.5.post1
GeoAlchemy~=0.7.2
tandur~=0.0.1b0
\ 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