Uživatelské nástroje

Nástroje pro tento web


progs:mobis

MOBIS

(aktualizace v obis-v5.0/user.obis-demo/)

Změny menu, rozhraní

phpserver.ini

  • lze vytvořit soubor $OBISROOT/html/etc/jmeno.ini (pro mobis/jmeno.php)
  • DesktopMode zapína explicitní chování jako v browseru na PC (záložky, detail atd)
  • Landscape - explicitně zobrazení naležato/nastojato (grid jako tabulka)
[javascript]
DesktopMode=1
Landscape=0

obis5/uzivatele/Admin/mobis_menu.xml

LuaConsole+Uzivatele+Skupiny pro Admin: na web serveru soubor

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Menu SYSTEM "startmenu.dtd">
<Menu>
  <MenuItem Name="uzivatele">
    <Caption>Uživatelé</Caption>
    <CmdString>@cf.ShowForm("UZIVATELE")</CmdString>
    <ImageIndex>67</ImageIndex>
  </MenuItem>
  <MenuItem Name="skupiny">
    <Caption>Skupiny</Caption>
    <CmdString>@cf.ShowForm("SKUPINY")</CmdString>
    <ImageIndex>78</ImageIndex>
  </MenuItem>
  <MenuItem Name="about">
    <Caption>O programu</Caption>
    <CmdString>@LuaForm.MainLoop("AboutForm")</CmdString>
    <ImageIndex>61</ImageIndex>
  </MenuItem>
  <MenuItem Name="ShowPathsForm">
    <Caption>Zobrazení adresářů systému</Caption>
    <CmdString>@LuaForm.MainLoop("ShowPathsForm", nil, nil, nil, nil)</CmdString>
    <ImageIndex>66</ImageIndex>
  </MenuItem>
  <MenuItem Name="LuaConsole">
    <Caption>LuaConsole</Caption>
    <CmdString>@cf.ShowForm("LuaConsoleForm")</CmdString>
    <ImageIndex>21</ImageIndex>
  </MenuItem>
</Menu>

rename-mobilemenu.sh

#!/bin/sh
for FILEN in `find uzivatele -name mobilemenu.xml` `find user -name mobilemenu.xml`; do
  DIRN=`dirname $FILEN`
  echo rename $DIRN/mobilemenu.xml to $DIRN/mobis_menu.xml
  mv $DIRN/mobilemenu.xml $DIRN/mobis_menu.xml
done

Příkazy XMLRPCSERVER

  • telnet localhost serviceport
  • LIST
  • DUMP
  • QUIT

XMLRPC, OBISCSERVER

Windows: virtualbox pro windows + (0vypalit/linux/distros/terminaly-obis/virtualbox-server-debian-obis.ova) - importovat applianci + run virtualbox as service nebo po spusteni: VBoxManage.exe startvm "obis" (Nefunkční VirtualBox viz. windows faq)

Debian/Ubuntu

apt-get install lighttpd php5-cgi php5-intl php5-xmlrpc

CentOS 6.* (neobsahuje lighttpd http://www.cyberciti.biz/faq/centos-install-lighttpd-web-server-with-yum-command/)

wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install lighttpd php-cgi php-intl php-xmlrpc lighttpd-fastcgi
vim /etc/php5/cgi/php.ini : cgi.fix_pathinfo = 1
echo 'obiscserver_uri = "tcp://localhost:9401"' > etc/phpserver.ini #port kde posloucha xmlrpc
  • pro mobis je nutny firebird alespon 2.1.5 (pouziti asci_char v list)
  • je nutne PHP 5.3 (squeezy)
  • rozbalit obis4-utils.tar.gz (soubory v bin, html, http)
  • otestovat pomoci: BINDIR=bin64; cd $BINDIR; IPV6=0 BASE_PORT=9400 ./obisxmlrpcserver.sh start; cd ..; HTTP_PORT=8080 http/lighttpd.sh start; w3m http://localhost:8080/mobis.php

XMLRPCSERVER

  • predpokladem je uzivatel obis a xinetd

Nastavení pro následující skripty

export OBISHOME=/home/obis/obis5
export BINDIR=bin64

SystemD

mkdir $OBISHOME/service
cat << EOF > $OBISHOME/service/xmlrpcserver.service
[Unit]
Description=Obis XMLRPC server
#az po zamontovani z fstabu
After=remote-fs.target
 
[Service]
Type=simple
User=obis
#pri ukonceni service je log smazan
RuntimeDirectory=xmlrpcserver
ExecStart=$OBISHOME/$BINDIR/xmlrpcserver.bin -listenport 9401 -serviceport 9402 -serverport 9400 -debug 3 -log %t/xmlrpcserver/log -readycon 2 -maxttl 86400 -maxcon 20 -noconsolelog
Restart=always
 
[Install]
WantedBy=multi-user.target
EOF
 
sudo cp $OBISHOME/service/xmlrpcserver.service /etc/systemd/system
sudo systemctl enable xmlrpcserver.service
sudo systemctl start xmlrpcserver.service

DaemonTools

Debian/Ubuntu

sudo apt-get install daemontools daemontools-run

CentOS http://www.lowfatgeek.com/linux/how-to-install-daemontools-on-centos-6-4/335/

yum install gcc
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xzvf daemontools-0.76.tar.gz
rm daemontools-0.76.tar.gz
cd /package/admin/daemontools-0.76
echo gcc -O2 -include /usr/include/errno.h > src/conf-cc
./package/install
echo "start on runlevel [12345]" > /etc/init/svscan.conf
echo "respawn" >> /etc/init/svscan.conf
echo "exec /command/svscanboot" >> /etc/init/svscan.conf
initctl reload-configuration
initctl start svscan
mkdir service
mkdir service/xmlrpcserver
mkdir service/xmlrpcserver/supervise
mkfifo service/xmlrpcserver/supervise/control
mkfifo service/xmlrpcserver/supervise/ok
 
cat << EOF > service/xmlrpcserver/run
#!/bin/sh
cd $OBISHOME
export LANG=cs_CZ.utf8
TMP_DIR=/tmp/obis
mkdir -p \$TMP_DIR -m 777
LOG_DIR=\$TMP_DIR/log
mkdir -p \$LOG_DIR -m 777
exec setuidgid obis ./$BINDIR/xmlrpcserver.bin -listenport 9401 -serviceport 9402 -serverport 9400 \\
  -savepid \$LOG_DIR/../xmlrpcserver.pid -debug 3 -log \$LOG_DIR/xmlrpcserver.log \\
  -readycon 1 \\
  -maxttl 86400 2>/dev/null
EOF
chmod +x service/xmlrpcserver/run
sudo ln -s $OBISHOME/service/xmlrpcserver /etc/service/
nohup /usr/bin/svscanboot &

OBISCSERVER

SystemD

obis5/service/obiscserver-mobis.socket

[Unit]
Description=Obis %j server socket

[Socket]
ListenStream=9400
Accept=yes

[Install]
WantedBy=sockets.target

obis5/service/obiscserver-mobis@.service

[Unit]
Description=Obis %j server spousteny pres socket

[Service]
User=obis
Environment=LOG_DIR=/tmp/obis5/log
ExecStartPre=mkdir -p $LOG_DIR -m 777
UMask=002
ExecStartPre=/bin/bash -c 'sleep $((RANDOM%%2)).$((RANDOM%%100))'
ExecStart=/home/common/obis5/bin64/obiscserver.bin -stdin -noconsolelog -notrigger -jsonrpc \
  -dofile system/lua/server/web/obis.lua \
  -documentdir /home/common/data/obisdoc/ \
  -log ${LOG_DIR}/log-%j.%i -sqllog ${LOG_DIR}/log-%j.%i -sqlplan \
  -debug 3 -warninglevel 2
StandardInput=socket
StandardError=journal
cd /etc/systemd/system
ln -s /home/common/obis5/service/obiscserver-mobis.socket
ln -s /home/common/obis5/service/obiscserver-mobis@.service
systemctl enable obiscserver-mobis.socket
systemctl start obiscserver-mobis.socket

pres xinetd

mkdir service/obiscserver
 
cat << EOF > service/obiscserver/run
#!/bin/bash
cd $OBISHOME
export LD_LIBRARY_PATH=./$BINDIR/lib
export LANG="cs_CZ.utf8"
TMP_DIR=/tmp/obis
mkdir -p \$TMP_DIR -m 777
LOG_DIR=\$TMP_DIR/log
mkdir -p \$LOG_DIR -m 777
#Port 9400 pres xinetd
exec ./$BINDIR/obiscserver -stdin -notrigger \\
  -log \$LOG_DIR/log.\$$ -sqllog \$LOG_DIR/sql.\$$ -sqlplan \\
  -dofile ./system/lua/server/web/obis.lua \\
  -debug 3 2>/dev/null 
EOF
chmod +x service/obiscserver/run
 
sudo cat << EOF > /etc/xinetd.d/mobiscserver
service mobiscserver
{
  type      = UNLISTED
  port      = 9400
  flags     = REUSE KEEPALIVE
  socket_type   = stream
  wait      = no
  user      = obis
  server    = $OBISHOME/service/obiscserver/run
  disable   = no
}
EOF
 
sudo service xinetd restart

fonty

APACHE2

  • testovano na debian 8
apt-get install apache2
apt-get install libapache2-mod-php7.0 php7.0-intl php7.0-xmlrpc php7.0-xml
a2enmod ssl
a2enmod auth_digest
a2enmod expires
#hlaska: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
a2dismod mpm_event; a2dismod mpm_worker; a2enmod mpm_prefork
apache2ctl configtest
apache2ctl -S #kontrola virtualhosts settings
apache2ctl -M #musi byt mpm_prefork_module

/etc/apache2/sites-enabled/mobis

  • htdigest -c .passwd obis loginname
  • na MIS vygenerovat a podepsat certifikat, nahrat na server do /etc/ssl
<VirtualHost *:443>

	ServerAdmin root

	DocumentRoot /home/mobis/html
	ErrorLog /home/mobis/log/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /home/mobis/log/access.log combined
	SSLEngine on
	SSLCertificateFile    /etc/ssl/certs/mobis.domain.cz.pem
	SSLCertificateKeyFile /etc/ssl/private/mobis.domain.cz.key

  <Location />
    AuthType Digest
    AuthName "obis"
    AuthDigestDomain / 
    AuthDigestProvider file
    AuthUserFile "/home/mobis/.passwd"
    Require valid-user
  </Location>

</VirtualHost>

ExpiresActive On
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"

/etc/apache2/sites-enabled/shop

<VirtualHost *:80>

	ServerAdmin root

	DocumentRoot /home/obis/html
	ErrorLog /home/obis/log/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /home/obis/log/access.log combined

</VirtualHost>

ExpiresActive On
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"

init.d launchtool metoda

/etc/init.d/xmlrpcserver

#!/bin/sh
 
# Source function library.
#. /etc/rc.d/init.d/functions
 
NAME="xmlrpcserver"
RUNAS="epos"
LAUNCHTOOL=/usr/bin/launchtool
ROOTDIR=/home/obis/obis4
LOG_DIR=/tmp/obis4/log
LISTENPORT=19400
SERVICEPORT=19450
SERVERPORT=19300
READYCON=5
#DEBUGLAUNCH="--verbose --debug"
#DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME.log"
 
start() {
  echo -n $"Starting $NAME: "
  export LANG=cs_CZ.utf8
  mkdir -p $LOG_DIR -m 777
  chown $RUNAS $LOG_DIR/..
  $LAUNCHTOOL -t $NAME -d $DEBUG --user=$RUNAS --wait-times=1,1,1,3,3,3,10,10,10 \
    --chdir=$ROOTDIR --no-restrict-environment \
    --forwarded-signals=1,9,15 \
    --log-launchtool-errors=syslog:$NAME,LOG_DAEMON,LOG_ERR  \
    --log-launchtool-output=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    --log-child-output=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    --log-child-errors=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    "./bin/xmlrpcserver.bin -listenport $LISTENPORT -serviceport $SERVICEPORT -serverport $SERVERPORT \
    -savepid $LOG_DIR/../$NAME.pid $DEBUGOBIS \
    -readycon $READYCON  maxttl 86400"
  echo
}
 
stop() {
  echo -n $"Shutting down $NAME: "
  kill `cat $LOG_DIR/../$NAME.pid`
  #$LAUNCHTOOL -t $NAME --kill=15
  echo
}
 
status() (
  $LAUNCHTOOL -t $NAME --check
)
 
# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  status)
	status
	;;
  restart|reload)
	stop
        echo sleep 5
        sleep 5
	start
	;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac
 
exit 0

user/scripts/obiscserver-webshop.sh

#!/bin/sh
NAME=obiscserver-webshop
ROOTDIR=/mnt/raid/obis/obis4
LOG_DIR=/tmp/obis4/log
#DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME-$$.log -sqllog $LOG_DIR/$NAME-$$"
cd $ROOTDIR
export LANG=cs_CZ.utf8
export LC_ALL=cs_CZ.utf8
export LD_LIBRARY_PATH=bin/lib
exec ./bin/obiscserver.bin -stdin $DEBUGOBIS \
  -model model-webshop -dofile ./system/lua/server/web/shop.lua -user webshop -pass "" -data data \
  -notrigger -documentdir $ROOTDIR/obisdoc/ 2>/dev/null

user/scripts/obiscserver-mobis.sh

#!/bin/sh
NAME=obiscserver-mobis
ROOTDIR=/home/obis/obis4
LOG_DIR=/tmp/obis4/log
DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME-$$.log -sqllog $LOG_DIR/$NAME-$$"
cd $ROOTDIR
export LANG=cs_CZ.utf8
export LC_ALL=cs_CZ.utf8
export LD_LIBRARY_PATH=bin/lib
exec ./bin/obiscserver.bin -stdin $DEBUGOBIS \
  -dofile ./system/lua/server/web/obis.lua \
  -notrigger -documentdir $ROOTDIR/obisdoc/ 2>/dev/null

/etc/xinetd.d/obiscserver-webshop

  • pokud hlasi chybu libwrap je treba povolit v /etc/hosts.allow
service obiscserver-webshop
{
  type      = UNLISTED
  port      = 19300
  flags     = REUSE KEEPALIVE 
  socket_type   = stream
  wait      = no
  user      = epos
  server    = /mnt/obis/obis4/user/scripts/obiscserver-webshop.sh
  disable   = no
}

service obiscserver-mobis
{
  type      = UNLISTED
  port      = 19301
  flags     = REUSE KEEPALIVE
  socket_type   = stream
  wait      = no
  user      = epos
  server    = /mnt/obis/obis4/user/scripts/obiscserver-mobis.sh
  disable   = no
}

Kontrola kódování češtiny v helpu

Spustit v LuaConsoli common_help.CheckHelpEncoding() nebo následující skript. Musí končit hláškou "OK kontrola v poradku" (error v obiscserver není vidět).

#!/bin/bash
cat <<EOF | ./bin64/obiscserver -notrigger -noxmlrpc -stdin | tee /tmp/test.log
Login Admin "" data-kaja
<EOF/>
Program "common_help.CheckHelpEncoding()"
<EOF/>
Exit
<EOF/>
EOF

Firefox

Telefonovani z desktopoveho prohlizece - protokol tel:

about:config
network.protocol-handler.expose.tel = false

po clicku na tel: odkaz lze zvolit aplikaci na telefonovani

  • autoreload plugin pro automatické načtení kalendáře vygenerovaném na serveru v HTML po změně souboru

Chrome app

  • C:\Users…\AppData\Local\Google\Chrome\User Data\Default\Preferences - nastavit ReadOnly (jinak chrome po takkill zobrazuje okno Obnovit stranky)
  • xmlrpcserver -maxttl 36000 (10hod)
  • v planovaci spustet v 5:00 skript:
taskkill /F /IM chrome.exe /T
timeout 10
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --start-fullscreen --app="http://mobis.epos.cz/mobis/start.php?Data=data&User=username&Password="
progs/mobis.txt · Poslední úprava: 2024/01/18 14:23 autor: Karel Petrů