Commit a162349c by aa.gusti

perbaikan readme

1 parent 65dc5a1e
Basis Aplikasi openSIPKD
# Basis Aplikasi openSIPKD
========================
Ini adalah basis dari seluruh aplikasi openSIPKD.
......@@ -90,14 +90,12 @@ Jalankan::
$ ~/env/bin/pserve --reload test.ini
Penggunaan Proxy
================
# Penggunaan Proxy
Apache::
-------
## Apache::
Tambahkan line berikut ini didalam ``<VirtualHost>``::
```
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://server:port/
......@@ -105,9 +103,9 @@ Tambahkan line berikut ini didalam ``<VirtualHost>``::
<Proxy *>
allow from all
</Proxy>
```
Contoh::
```
<VirtualHost ip:80>
SuexecUserGroup "#uid" "#gid"
ServerName antrian.opensipkd.com
......@@ -121,14 +119,39 @@ Contoh::
allow from all
</Proxy>
</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
# as directory, then fall back to displaying a 404.
proxy_set_header Host $host;
......@@ -139,6 +162,7 @@ Nginx::
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://127.0.0.1:6543/;
#try_files $uri $uri/ =404;
}
```
......@@ -30,8 +30,9 @@ def provinsi_widget(node, kw):
class AddSchema(colander.Schema):
kode = colander.SchemaNode(colander.String(),
validator=colander.Length(max=32), oid="kode")
kode = colander.SchemaNode(colander.Float(),
oid="kode",
validator=colander.Length(max=32), )
kategori = colander.SchemaNode(colander.String(),
widget=widget.SelectWidget(values=kategori_provinsi),
validator=colander.Length(max=32), oid="kode")
......@@ -46,7 +47,10 @@ class EditSchema(AddSchema):
class ListSchema(colander.Schema):
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())
......
......@@ -2,13 +2,15 @@
# Standard Library
import json
import re
import logging
import colander
from chameleon.utils import Markup
from deform import compat
from deform import field
from . import widget
log = logging.getLogger(__name__)
class DeTable(field.Field):
"""
Field representing an entire form.
......@@ -90,7 +92,6 @@ class DeTable(field.Field):
"""
css_class = "deform" # bw compat only; pass a widget to override
def __init__(
self,
schema,
......@@ -141,23 +142,51 @@ class DeTable(field.Field):
table_widget = getattr(schema, "widget", None)
if table_widget is None:
table_widget = widget.TableWidget()
self.widget = table_widget
columns = []
cols2=[]
for f in schema:
d = {'data': f.name}
data = []
if hasattr(f, 'width'):
d["width"] = f.width
if hasattr(f, 'text_align'):
d["text-align"] = f.align
data.append(f'width: "{f.width}"')
if hasattr(f, 'aligned'):
d["className"] = f.aligned
data.append(f'className: "{f.aligned}"')
if hasattr(f, 'searchable'):
d["searchable"] = f.searchable
data.append(f'searchable: {f.searchable}')
if hasattr(f, 'visible'):
d["visible"] = f.visible
data.append(f'visible: "{f.visible}"')
if hasattr(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)
cols2.append(data)
self.columns = json.dumps(columns)
# self.columns = columns
self.columns = json.dumps(cols2)
self.url = action
self.url_suffix = action_suffix
......
......@@ -42,7 +42,7 @@
function (oid) {
var m${tableid}ID;
var o${tableid};
var o${tableid}Uri = "${url}"
var o${tableid}Uri = "${url}";
var o${tableid}Url = o${tableid}Uri + "${url_suffix}";
var tb_array = [
'<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!