Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
web-imgw
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cf403e62
authored
Nov 16, 2018
by
Web Instant Messaging Gateway
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Penambahan base_url pada INI file
1 parent
bf1c61fe
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
48 deletions
development.ini
production.ini
web_imgw/views/agent.py
web_imgw/views/login.py
web_imgw/views/message.py
web_imgw/views/templates/agent/delete.pt
web_imgw/views/templates/change-password-done.pt
web_imgw/views/templates/home.pt
web_imgw/views/templates/layout.pt
development.ini
View file @
cf403e6
...
...
@@ -24,6 +24,8 @@ mail.username = user@example.com
mail.password
=
FIXME
mail.sender_name
=
Example Name
base_url
=
http://localhost:6543
# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1
...
...
production.ini
View file @
cf403e6
...
...
@@ -22,6 +22,8 @@ mail.username = user@example.com
mail.password
=
FIXME
mail.sender_name
=
Example Name
base_url
=
http://localhost:6543
###
# wsgi server configuration
###
...
...
web_imgw/views/agent.py
View file @
cf403e6
...
...
@@ -25,7 +25,7 @@ from ..models.imgw import (
from
..tools.msisdn
import
get_msisdn
_
=
TranslationStringFactory
(
'
agent
'
)
_
=
TranslationStringFactory
(
'
user
'
)
########
...
...
@@ -218,6 +218,7 @@ def view_delete(request):
form
=
Form
(
colander
.
Schema
(),
buttons
=
buttons
)
resp
=
dict
(
title
=
_
(
'Delete agent'
))
if
not
request
.
POST
:
resp
[
'agent'
]
=
agent
resp
[
'form'
]
=
form
.
render
()
return
resp
if
'delete'
not
in
request
.
POST
:
...
...
web_imgw/views/login.py
View file @
cf403e6
...
...
@@ -204,8 +204,8 @@ def send_email_security_code(
request
,
user
,
time_remain
,
subject
,
body_msg_id
,
body_default_file
):
settings
=
get_settings
()
up
=
urlparse
(
request
.
url
)
url
=
'{}
://{}
/login?code={}'
.
format
(
up
.
scheme
,
up
.
netloc
,
user
.
security_code
)
url
=
'{}/login?code={}'
.
format
(
settings
[
'base_url'
]
,
user
.
security_code
)
minutes
=
int
(
time_remain
.
seconds
/
60
)
data
=
dict
(
url
=
url
,
minutes
=
minutes
)
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
...
...
web_imgw/views/message.py
View file @
cf403e6
...
...
@@ -206,14 +206,20 @@ def view_list(request):
def
form_validator
(
form
,
value
):
t
=
value
[
'pengirim'
]
.
split
()
jalur_id
=
int
(
t
[
0
])
if
jalur_id
!=
1
:
return
if
'penerima'
not
in
value
:
if
not
t
[
1
:]:
# USSD tapi tidak ada pengirim ?
if
jalur_id
==
1
:
pengirim
=
t
[
1
:]
and
t
[
1
]
msisdn_validator
(
form
,
value
,
pengirim
)
elif
jalur_id
==
6
:
email_validator
(
form
,
value
)
def
msisdn_validator
(
form
,
value
,
pengirim
):
if
'penerima'
not
in
value
:
# USSD
if
not
pengirim
or
not
get_msisdn
(
pengirim
):
raise
colander
.
Invalid
(
form
,
_
(
'missing-ussd-sender'
,
default
=
'Pesan USSD harus
ada
pengirimnya.'
))
default
=
'Pesan USSD harus
ditetapkan nomor
pengirimnya.'
))
return
msisdn
=
value
[
'penerima'
]
if
msisdn
[
0
]
in
[
'0'
,
'+'
]:
...
...
@@ -234,6 +240,11 @@ def form_validator(form, value):
default
=
'Nomor penerima tidak benar.'
))
def
email_validator
(
form
,
value
):
validator
=
colander
.
Email
()
validator
(
form
.
children
[
1
],
value
[
'penerima'
])
@colander.deferred
def
pengirim_widget
(
node
,
kw
):
values
=
kw
.
get
(
'pengirim_list'
)
...
...
@@ -285,7 +296,7 @@ def get_pengirim_list():
agent_id
=
row
.
id
key
=
'{} {}'
.
format
(
row
.
jalur
,
agent_id
)
if
row
.
status
==
0
:
if
row
.
jalur
==
1
:
if
row
.
modem
:
status
=
'{}
%
'
.
format
(
row
.
modem
.
signal
)
else
:
status
=
'ON'
...
...
web_imgw/views/templates/agent/delete.pt
View file @
cf403e6
<html
metal:use-macro=
"load: ../../../templates/base.pt"
>
<div
metal:fill-slot=
"content"
>
<div
class=
"panel panel-danger"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Perhatian
</h3>
<div metal:use-macro="load: ../layout-menu.pt">
<div metal:fill-slot="content" i18n:domain="user">
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Perhatian</h3>
</div>
<div class="panel-body">
Hapus ${agent.jalur_ref.nama}
<span tal:condition="agent.modem">${agent.modem.msisdn}</span>
<span tal:condition="not agent.modem">${agent.id}</span> ?
</div>
</div>
<div tal:content="structure form"/>
</div>
<div
class=
"panel-body"
>
Hapus ${row.jalur_ref.nama}
<span
tal:condition=
"row.modem"
>
${row.modem.msisdn}
</span>
<span
tal:condition=
"not row.modem"
>
${row.id}
</span>
?
</div>
</div>
<div
tal:content=
"structure form"
/>
</div>
</html>
web_imgw/views/templates/change-password-done.pt
View file @
cf403e6
...
...
@@ -5,5 +5,7 @@
Your password has been changed
</p>
<p>Silakan ke <a href="/message">menu utama</a></p>
</div>
</div>
web_imgw/views/templates/home.pt
View file @
cf403e6
...
...
@@ -5,17 +5,23 @@
<h1><span class="font-semi-bold">Web</span> <span
class="smaller">Instant Messaging Gateway</span></h1>
<p
i18n:translate="welcome"
class="lead">Welcome to <span
class="font-normal">Instant Messaging Gateway</span>
, a Pyramid
application generated by<br><span class="font-normal">Cookiecutter</span>.
</p>
<p class="lead">Welcome to <span
class="font-normal">Instant Messaging Gateway</span>
</p>
<p tal:condition="not request.user">
<a href="/login" i18n:translate="login-link">Login please</a>
</p>
<p i18n:translate="you-are-logged-in" tal:condition="request.user">You are logged in as
<span tal:replace="request.user.user_name" i18n:name="username" />. Click <a href="/logout">here</a> to
logout.</p>
<div tal:condition="request.user">
<p>
Silakan <a class="font-normal" href="/message">ke menu utama</a>.
</p>
<p i18n:translate="you-are-logged-in">
You are logged in as <span tal:replace="request.user.user_name" i18n:name="username" />.
Click <a href="/logout">here</a> to logout.
</p>
</div>
</div>
...
...
web_imgw/views/templates/layout.pt
View file @
cf403e6
...
...
@@ -8,15 +8,15 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"description"
content=
"pyramid web application"
>
<meta
name=
"author"
content=
"Pylons Project"
>
<link
rel=
"shortcut icon"
href=
"
${request.static_url('web_imgw:static/pyramid-16x16.png')}
"
>
<link
rel=
"shortcut icon"
href=
"
/static/pyramid-16x16.png
"
>
<title>
Web IMGW -
<span
tal:replace=
"title"
/></title>
<!-- Bootstrap core CSS -->
<link
href=
"/
/oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css
/bootstrap.min.css"
rel=
"stylesheet"
>
<link
href=
"/
static
/bootstrap.min.css"
rel=
"stylesheet"
>
<!-- Custom styles for this scaffold -->
<link
href=
"
${request.static_url('web_imgw:static/theme.css')}
"
rel=
"stylesheet"
>
<link
href=
"
/static/theme.css
"
rel=
"stylesheet"
>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
...
...
@@ -32,24 +32,15 @@
<div
class=
"row"
>
<div
class=
"col-md-2"
>
<img
class=
"logo img-responsive"
src=
"
${request.static_url('web_imgw:static/pyramid.png')}
"
alt=
"pyramid web framework"
>
src=
"
/static/pyramid.png
"
alt=
"pyramid web framework"
>
</div>
<div
class=
"col-md-10"
>
<div
metal:define-slot=
"content"
>
No content
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"links"
>
<ul>
<li><i
class=
"glyphicon glyphicon-cog icon-muted"
></i><a
href=
"https://github.com/Pylons/pyramid"
>
Github Project
</a></li>
<li><i
class=
"glyphicon glyphicon-globe icon-muted"
></i><a
href=
"https://webchat.freenode.net/?channels=pyramid"
>
IRC Channel
</a></li>
<li><i
class=
"glyphicon glyphicon-home icon-muted"
></i><a
href=
"https://pylonsproject.org"
>
Pylons Project
</a></li>
</ul>
</div>
</div>
<div
class=
"row"
>
<div
class=
"copyright"
i18n:translate=
"copyright"
>
Copyright
©
Pylons Project
<div
class=
"copyright"
>
Hak cipta
©
OpenSIPKD
</div>
</div>
</div>
...
...
@@ -59,7 +50,7 @@
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script
src=
"/
/oss.maxcdn.com/libs/jquery/1.10.2
/jquery.min.js"
integrity=
"sha384-aBL3Lzi6c9LNDGvpHkZrrm3ZVsIwohDD7CDozL0pk8FwCrfmV7H9w8j3L7ikEv6h"
crossorigin=
"anonymous"
></script>
<script
src=
"/
/oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js
/bootstrap.min.js"
integrity=
"sha384-s1ITto93iSMDxlp/79qhWHi+LsIi9Gx6yL+cOKDuymvihkfol83TYbLbOw+W/wv4"
crossorigin=
"anonymous"
></script>
<script
src=
"/
static
/jquery.min.js"
integrity=
"sha384-aBL3Lzi6c9LNDGvpHkZrrm3ZVsIwohDD7CDozL0pk8FwCrfmV7H9w8j3L7ikEv6h"
crossorigin=
"anonymous"
></script>
<script
src=
"/
static
/bootstrap.min.js"
integrity=
"sha384-s1ITto93iSMDxlp/79qhWHi+LsIi9Gx6yL+cOKDuymvihkfol83TYbLbOw+W/wv4"
crossorigin=
"anonymous"
></script>
</body>
</html>
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