Commit a162349c by aa.gusti

perbaikan readme

1 parent 65dc5a1e
Basis Aplikasi openSIPKD # Basis Aplikasi openSIPKD
======================== ========================
Ini adalah basis dari seluruh aplikasi openSIPKD. Ini adalah basis dari seluruh aplikasi openSIPKD.
...@@ -90,14 +90,12 @@ Jalankan:: ...@@ -90,14 +90,12 @@ Jalankan::
$ ~/env/bin/pserve --reload test.ini $ ~/env/bin/pserve --reload test.ini
Penggunaan Proxy # Penggunaan Proxy
================
Apache:: ## Apache::
-------
Tambahkan line berikut ini didalam ``<VirtualHost>``:: Tambahkan line berikut ini didalam ``<VirtualHost>``::
```
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass / http://server:port/ ProxyPass / http://server:port/
...@@ -105,9 +103,9 @@ Tambahkan line berikut ini didalam ``<VirtualHost>``:: ...@@ -105,9 +103,9 @@ Tambahkan line berikut ini didalam ``<VirtualHost>``::
<Proxy *> <Proxy *>
allow from all allow from all
</Proxy> </Proxy>
```
Contoh:: Contoh::
```
<VirtualHost ip:80> <VirtualHost ip:80>
SuexecUserGroup "#uid" "#gid" SuexecUserGroup "#uid" "#gid"
ServerName antrian.opensipkd.com ServerName antrian.opensipkd.com
...@@ -121,14 +119,39 @@ Contoh:: ...@@ -121,14 +119,39 @@ Contoh::
allow from all allow from all
</Proxy> </Proxy>
</VirtualHost> </VirtualHost>
```
# Virtual Directory
## Setting Ini File
### Ubah `[app:ain]` jadi `[app:opensipkd]`
```
;[app:main]
[app:opensipkd_base]
trusted_proxy_headers = "forwarded x-forwarded-for x-forwarded-host x-forwarded-proto x-forwarded-port"
url_prefix='/virtualdir' ; nama cirtual direktory
```
Nginx:: Tambahkan blok berikut ini dibawah ini file
-----
location /demo{ ```
return 302 /demo/; [filter:proxy-prefix]
use = egg:PasteDeploy#prefix
prefix = /virtualdir ; nama virtual directory
[pipeline:main]
pipeline =
proxy-prefix
opensipkd_base
```
## Nginx::
```
location /virtualdir{
return 302 /virtualdir/;
} }
location /demo/ { location /virtualdir/ {
# First attempt to serve request as file, then # First attempt to serve request as file, then
# as directory, then fall back to displaying a 404. # as directory, then fall back to displaying a 404.
proxy_set_header Host $host; proxy_set_header Host $host;
...@@ -139,6 +162,7 @@ Nginx:: ...@@ -139,6 +162,7 @@ Nginx::
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://127.0.0.1:6543/; proxy_pass http://127.0.0.1:6543/;
#try_files $uri $uri/ =404;
} }
```
...@@ -30,8 +30,9 @@ def provinsi_widget(node, kw): ...@@ -30,8 +30,9 @@ def provinsi_widget(node, kw):
class AddSchema(colander.Schema): class AddSchema(colander.Schema):
kode = colander.SchemaNode(colander.String(), kode = colander.SchemaNode(colander.Float(),
validator=colander.Length(max=32), oid="kode") oid="kode",
validator=colander.Length(max=32), )
kategori = colander.SchemaNode(colander.String(), kategori = colander.SchemaNode(colander.String(),
widget=widget.SelectWidget(values=kategori_provinsi), widget=widget.SelectWidget(values=kategori_provinsi),
validator=colander.Length(max=32), oid="kode") validator=colander.Length(max=32), oid="kode")
...@@ -46,7 +47,10 @@ class EditSchema(AddSchema): ...@@ -46,7 +47,10 @@ class EditSchema(AddSchema):
class ListSchema(colander.Schema): class ListSchema(colander.Schema):
id = colander.SchemaNode(colander.Integer(), searchable=False, orderable=False, visible=False) id = colander.SchemaNode(colander.Integer(), searchable=False, orderable=False, visible=False)
kode = colander.SchemaNode(colander.String(), width='100pt') kode = colander.SchemaNode(colander.String(), width='100pt',
thousand={"separator": ',', "decimal": '.',
"point": 0}
)
nama = colander.SchemaNode(colander.String()) nama = colander.SchemaNode(colander.String())
......
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
# Standard Library # Standard Library
import json import json
import re import re
import logging
import colander
from chameleon.utils import Markup from chameleon.utils import Markup
from deform import compat from deform import compat
from deform import field from deform import field
from . import widget from . import widget
log = logging.getLogger(__name__)
class DeTable(field.Field): class DeTable(field.Field):
""" """
Field representing an entire form. Field representing an entire form.
...@@ -90,7 +92,6 @@ class DeTable(field.Field): ...@@ -90,7 +92,6 @@ class DeTable(field.Field):
""" """
css_class = "deform" # bw compat only; pass a widget to override css_class = "deform" # bw compat only; pass a widget to override
def __init__( def __init__(
self, self,
schema, schema,
...@@ -141,23 +142,51 @@ class DeTable(field.Field): ...@@ -141,23 +142,51 @@ class DeTable(field.Field):
table_widget = getattr(schema, "widget", None) table_widget = getattr(schema, "widget", None)
if table_widget is None: if table_widget is None:
table_widget = widget.TableWidget() table_widget = widget.TableWidget()
self.widget = table_widget self.widget = table_widget
columns = [] columns = []
cols2=[]
for f in schema: for f in schema:
d = {'data': f.name} d = {'data': f.name}
data = []
if hasattr(f, 'width'): if hasattr(f, 'width'):
d["width"] = f.width d["width"] = f.width
if hasattr(f, 'text_align'): data.append(f'width: "{f.width}"')
d["text-align"] = f.align
if hasattr(f, 'aligned'):
d["className"] = f.aligned
data.append(f'className: "{f.aligned}"')
if hasattr(f, 'searchable'): if hasattr(f, 'searchable'):
d["searchable"] = f.searchable d["searchable"] = f.searchable
data.append(f'searchable: {f.searchable}')
if hasattr(f, 'visible'): if hasattr(f, 'visible'):
d["visible"] = f.visible d["visible"] = f.visible
data.append(f'visible: "{f.visible}"')
if hasattr(f, 'orderable'): if hasattr(f, 'orderable'):
d["orderable"] = f.orderable d["orderable"] = f.orderable
data.append(f'orderable: {f.orderable}')
thousand = hasattr(f, 'thousand') and f.thousand or None
separator = thousand and "separator" in thousand and thousand["separator"] or ','
decimal = thousand and "decimal" in thousand and thousand["decimal"] or '.'
point = thousand and "point" in thousand and thousand["point"] or 2
currency = thousand and "currency" in thousand and thousand["currency"] or ""
if thousand or type(f.typ)==colander.Float():
d["renderer"]=f"$.fn.dataTable.render.number( '{separator}', '{decimal}', {point}, '{currency}' )"
if 'className' not in d:
d["className"] = "text-right"
data.append(f'renderer: $.fn.dataTable.render.number( "{separator}", "{decimal}", {point}, "{currency}" )')
columns.append(d) columns.append(d)
cols2.append(data)
self.columns = json.dumps(columns) self.columns = json.dumps(columns)
# self.columns = columns
self.columns = json.dumps(cols2)
self.url = action self.url = action
self.url_suffix = action_suffix self.url_suffix = action_suffix
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
function (oid) { function (oid) {
var m${tableid}ID; var m${tableid}ID;
var o${tableid}; var o${tableid};
var o${tableid}Uri = "${url}" var o${tableid}Uri = "${url}";
var o${tableid}Url = o${tableid}Uri + "${url_suffix}"; var o${tableid}Url = o${tableid}Uri + "${url_suffix}";
var tb_array = [ var tb_array = [
'<div class="btn-group pull-left">', '<div class="btn-group pull-left">',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!