Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/d38863e21ada
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:21:14 2012
Кодировка:

Поисковые слова: m 8
allpy: d38863e21ada

allpy

changeset 60:d38863e21ada

move all to subdir for join this hg to allpy
author boris (netbook) <bnagaev@gmail.com>
date Thu, 16 Sep 2010 15:26:33 +0400
parents 091c66dd9bac
children df3181ce15f2
files blocks3d-wt-widget.C blocks3d-wt-widget.h blocks3d-wt.C blocks3d-wt.pro blocks3d/wt/blocks3d-wt-widget.C blocks3d/wt/blocks3d-wt-widget.h blocks3d/wt/blocks3d-wt.C blocks3d/wt/blocks3d-wt.pro blocks3d/wt/compile.sh blocks3d/wt/compile_and_run.sh blocks3d/wt/config.C blocks3d/wt/config.h blocks3d/wt/debug.sh blocks3d/wt/files/css/1.css blocks3d/wt/files/js/jquery.countdown.pack.js blocks3d/wt/run.sh blocks3d/wt/salt.C blocks3d/wt/salt.h blocks3d/wt/work-time.C blocks3d/wt/work-time.h compile.sh compile_and_run.sh config.C config.h debug.sh files/css/1.css files/js/jquery.countdown.pack.js run.sh salt.C salt.h work-time.C work-time.h
diffstat 32 files changed, 625 insertions(+), 625 deletions(-) [+]
line diff
     1.1 --- a/blocks3d-wt-widget.C	Thu Sep 16 01:51:04 2010 +0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,298 +0,0 @@
     1.4 -
     1.5 -#include "config.h"
     1.6 -#include "blocks3d-wt-widget.h"
     1.7 -#include "salt.h"
     1.8 -
     1.9 -#include <Wt/WText>
    1.10 -#include <Wt/WBreak>
    1.11 -#include <Wt/WTable>
    1.12 -#include <Wt/WLabel>
    1.13 -#include <Wt/WDoubleValidator>
    1.14 -#include <Wt/WIntValidator>
    1.15 -#include <Wt/WMessageBox>
    1.16 -#include <Wt/WAnchor>
    1.17 -#include <Wt/WFileResource>
    1.18 -
    1.19 -#include <fstream>
    1.20 -#include <iostream>
    1.21 -#include <boost/format.hpp>
    1.22 -#include <stdlib.h>
    1.23 -
    1.24 -Blocks3DWidget::Blocks3DWidget(Wt::WContainerWidget *parent) :
    1.25 -	Wt::WContainerWidget(parent)
    1.26 -{
    1.27 -	Wt::WText* head = new Wt::WText("Blocks3D", this); 
    1.28 -	head->setStyleClass("header");
    1.29 -	
    1.30 -	alignment_upload = new Wt::WFileUpload();
    1.31 -	alignment_textarea = new Wt::WTextArea();
    1.32 -	alignment_textarea->setColumns(60);
    1.33 -	alignment_textarea->setRows(20);
    1.34 -	conformity_upload = new Wt::WFileUpload();
    1.35 -	conformity_textarea = new Wt::WTextArea();
    1.36 -	conformity_textarea->setColumns(40);
    1.37 -	conformity_textarea->setRows(20);
    1.38 -	
    1.39 -	Wt::WLabel *alignment_label = new Wt::WLabel("Alignment:");
    1.40 -	alignment_label->setBuddy(alignment_textarea);
    1.41 -	
    1.42 -	Wt::WLabel *conformity_label = new Wt::WLabel("Confiomity file:");
    1.43 -	conformity_label->setBuddy(alignment_textarea);
    1.44 -	 
    1.45 -	new Wt::WBreak(this);
    1.46 -	Wt::WTable *table = new Wt::WTable(this);
    1.47 -	
    1.48 -	table->elementAt(0, 0)->addWidget(alignment_label);
    1.49 -	table->elementAt(1, 0)->addWidget(alignment_textarea);
    1.50 -	table->elementAt(2, 0)->addWidget(alignment_upload);
    1.51 -	
    1.52 -	table->elementAt(0, 1)->addWidget(conformity_label);
    1.53 -	table->elementAt(1, 1)->addWidget(conformity_textarea);
    1.54 -	table->elementAt(2, 1)->addWidget(conformity_upload);
    1.55 -	
    1.56 -	new Wt::WBreak(this);
    1.57 -	delta_input = new Wt::WLineEdit(Malakite::defaults::delta, this);
    1.58 -	delta_validator = new Wt::WDoubleValidator(0.0, 10.0); // FIXME: not to allow empty
    1.59 -	delta_validator->setMandatory(true);
    1.60 -	delta_input->setValidator(delta_validator);	
    1.61 -	Wt::WLabel *delta_label = new Wt::WLabel("Distance spreading", this);
    1.62 -	delta_label->setBuddy(delta_input);
    1.63 -	
    1.64 -	new Wt::WBreak(this);
    1.65 -	min_block_width_input = new Wt::WLineEdit(Malakite::defaults::min_block_width, this);
    1.66 -	min_block_width_validator = new Wt::WIntValidator(3, 9999);
    1.67 -	min_block_width_validator->setMandatory(true);
    1.68 -	min_block_width_input->setValidator(min_block_width_validator);	
    1.69 -	Wt::WLabel *min_block_width_label = new Wt::WLabel("Min block width", this);
    1.70 -	min_block_width_label->setBuddy(min_block_width_input);
    1.71 -	
    1.72 -	new Wt::WBreak(this);
    1.73 -	timeout_input = new Wt::WLineEdit(Malakite::defaults::timeout, this);
    1.74 -	timeout_validator = new Wt::WIntValidator(-1, 30*24*3600);
    1.75 -	timeout_validator->setMandatory(true);
    1.76 -	timeout_input->setValidator(timeout_validator);	
    1.77 -	Wt::WLabel *timeout_label = new Wt::WLabel(
    1.78 -		"Bron-Kerbosh (couple cores) timeout", this);
    1.79 -	timeout_label->setBuddy(timeout_input);
    1.80 -	
    1.81 -	new Wt::WBreak(this);
    1.82 -	timeout2_input = new Wt::WLineEdit(Malakite::defaults::timeout2, this);
    1.83 -	timeout2_validator = new Wt::WIntValidator(-1, 30*24*3600);
    1.84 -	timeout2_validator->setMandatory(true);
    1.85 -	timeout2_input->setValidator(timeout2_validator);	
    1.86 -	Wt::WLabel *timeout2_label = new Wt::WLabel(
    1.87 -		"Bron-Kerbosh (blocks) timeout", this);
    1.88 -	timeout2_label->setBuddy(timeout2_input);
    1.89 -	
    1.90 -	
    1.91 -	new Wt::WBreak(this);
    1.92 -	Wt::WPushButton *go_button = new Wt::WPushButton("Run", this);
    1.93 -	
    1.94 -	new Wt::WBreak(this);
    1.95 -	results_panel = new Wt::WContainerWidget(this);
    1.96 -	
    1.97 -	go_button->clicked().connect(this, &Blocks3DWidget::go_button_click);
    1.98 -	alignment_upload->uploaded().connect(this, &Blocks3DWidget::alignment_uploaded);
    1.99 -	conformity_upload->uploaded().connect(this, &Blocks3DWidget::conformity_uploaded);
   1.100 -	alignment_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
   1.101 -	conformity_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
   1.102 -	
   1.103 -	alignment_upload->changed().connect(alignment_upload, &Wt::WFileUpload::upload);
   1.104 -	conformity_upload->changed().connect(conformity_upload, &Wt::WFileUpload::upload);
   1.105 -	
   1.106 -	timer = new Wt::WTimer(this);
   1.107 -	timer->timeout().connect(this, &Blocks3DWidget::timeout);
   1.108 -	timer->setInterval(Malakite::refresh_period);
   1.109 -}
   1.110 -
   1.111 -void Blocks3DWidget::go_button_click()
   1.112 -{
   1.113 -	try_to_run();
   1.114 -}
   1.115 -
   1.116 -void Blocks3DWidget::fileTooLarge()
   1.117 -{
   1.118 -	Wt::WMessageBox::show("Error", "File too large", Wt::Ok);		
   1.119 -}
   1.120 -
   1.121 -void Blocks3DWidget::textarea_from_file(Wt::WTextArea* ta, const char* file)
   1.122 -{
   1.123 -	std::string temp("");
   1.124 -	std::string total("");
   1.125 -	std::ifstream uploaded_file;
   1.126 -
   1.127 -	uploaded_file.open(file);
   1.128 -	if (!uploaded_file) 
   1.129 -	{
   1.130 -		return;
   1.131 -	}
   1.132 -	while (uploaded_file >> temp) 
   1.133 -	{
   1.134 -		total += temp + "\n";
   1.135 -	}
   1.136 -	uploaded_file.close();
   1.137 -	
   1.138 -	ta->setText(total);
   1.139 -	
   1.140 -	new Wt::WBreak(results_panel);
   1.141 -	new Wt::WText("Upload finished", results_panel); 
   1.142 -}
   1.143 -
   1.144 -void Blocks3DWidget::alignment_uploaded()
   1.145 -{
   1.146 -	textarea_from_file(alignment_textarea, 
   1.147 -		alignment_upload->spoolFileName().c_str());
   1.148 -}
   1.149 -
   1.150 -void Blocks3DWidget::conformity_uploaded()
   1.151 -{
   1.152 -	textarea_from_file(conformity_textarea, 
   1.153 -		conformity_upload->spoolFileName().c_str());
   1.154 -}
   1.155 -
   1.156 -void Blocks3DWidget::try_to_run()
   1.157 -{
   1.158 -	std::string alignment = alignment_textarea->text().toUTF8();
   1.159 -	std::string conformity = conformity_textarea->text().toUTF8();
   1.160 -	if (alignment.empty())
   1.161 -	{
   1.162 -		new Wt::WBreak(results_panel);
   1.163 -		new Wt::WText("No alignment provided", results_panel); 
   1.164 -		return;
   1.165 -	}
   1.166 -	if (delta_input->validate() != Wt::WValidator::Valid)
   1.167 -	{
   1.168 -		new Wt::WBreak(results_panel);
   1.169 -		new Wt::WText("Enter delta parameter", results_panel); 
   1.170 -		return;
   1.171 -	}
   1.172 -	if (min_block_width_input->validate() != Wt::WValidator::Valid)
   1.173 -	{
   1.174 -		new Wt::WBreak(results_panel);
   1.175 -		new Wt::WText("Enter min block width parameter", results_panel); 
   1.176 -		return;
   1.177 -	}
   1.178 -	if (timeout_input->validate() != Wt::WValidator::Valid)
   1.179 -	{
   1.180 -		new Wt::WBreak(results_panel);
   1.181 -		new Wt::WText("Enter timeout parameter", results_panel); 
   1.182 -		return;
   1.183 -	}
   1.184 -	if (timeout2_input->validate() != Wt::WValidator::Valid)
   1.185 -	{
   1.186 -		new Wt::WBreak(results_panel);
   1.187 -		new Wt::WText("Enter timeout2 parameter", results_panel); 
   1.188 -		return;
   1.189 -	}
   1.190 -	
   1.191 -	std::string r = generateSalt();
   1.192 -	
   1.193 -	tempfile_alignment = 
   1.194 -	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_alignment);
   1.195 -	tempfile_conformity = 
   1.196 -	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_conformity);
   1.197 -	tempfile_html = 
   1.198 -	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_html);
   1.199 -	tempfile_check = 
   1.200 -	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_check);
   1.201 -	tempfile_sh = 
   1.202 -	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_sh);
   1.203 -	
   1.204 -	std::ofstream alignment_file;
   1.205 -	alignment_file.open(tempfile_alignment.c_str());
   1.206 -	alignment_file << alignment;
   1.207 -	alignment_file.close();
   1.208 -	
   1.209 -	if (!conformity.empty())
   1.210 -	{
   1.211 -		std::ofstream conformity_file;
   1.212 -		conformity_file.open(tempfile_conformity.c_str());
   1.213 -		conformity_file << conformity;
   1.214 -		conformity_file.close();
   1.215 -	}
   1.216 -	
   1.217 -	std::string conformity_option = "";
   1.218 -	if (!conformity.empty())
   1.219 -	{
   1.220 -		conformity_option = str(boost::format("-c %s") % tempfile_conformity);
   1.221 -	}
   1.222 -	
   1.223 -	std::string cmd = str(
   1.224 -	boost::format("cd %s ; "
   1.225 -	"%s %s -i %s %s -H %s -d %s -m %s -t %s -T %s; "
   1.226 -	"echo 'f' > %s;") 
   1.227 -	% Malakite::temp_path
   1.228 -	% Malakite::python_path % Malakite::blocks3d_path 
   1.229 -	% tempfile_alignment 
   1.230 -	% conformity_option 
   1.231 -	% tempfile_html 
   1.232 -	% delta_input->text().toUTF8() % min_block_width_input->text().toUTF8()	
   1.233 -	% timeout_input->text().toUTF8() % timeout2_input->text().toUTF8()
   1.234 -	% tempfile_check 
   1.235 -	);	
   1.236 -	
   1.237 -	std::cout << cmd << std::endl;
   1.238 -	
   1.239 -	std::ofstream tempfile_sh_file;
   1.240 -	tempfile_sh_file.open(tempfile_sh.c_str());
   1.241 -	tempfile_sh_file << cmd;
   1.242 -	tempfile_sh_file.close();
   1.243 -	
   1.244 -	// security???
   1.245 -	system(str(boost::format("sh %s &") % tempfile_sh.c_str()).c_str());
   1.246 -	new Wt::WBreak(results_panel);
   1.247 -	new Wt::WText("Task start", results_panel);	
   1.248 -	
   1.249 -	new Wt::WBreak(results_panel);
   1.250 -	new Wt::WText("Time elapsed: ", results_panel);	
   1.251 -	worktime = new Worktime(results_panel);
   1.252 -	
   1.253 -	timer->start();
   1.254 -	
   1.255 -}
   1.256 -
   1.257 -void Blocks3DWidget::timeout()
   1.258 -{
   1.259 -	worktime->render();
   1.260 -	// FIXME: check status of task
   1.261 -	std::ifstream check_file;
   1.262 -	check_file.open(tempfile_check.c_str());
   1.263 -	if (!check_file) 
   1.264 -	{
   1.265 -		return;
   1.266 -	}
   1.267 -	check_file.close();
   1.268 -	
   1.269 -	timer->stop();
   1.270 -	worktime->stop();
   1.271 -	
   1.272 -	std::ifstream tempfile_html_file;
   1.273 -	tempfile_html_file.open(tempfile_html.c_str());
   1.274 -	if (!tempfile_html_file) 
   1.275 -	{
   1.276 -		//~ Wt::WMessageBox::show("Ok", "Ok", Wt::Ok);		
   1.277 -		new Wt::WBreak(results_panel);
   1.278 -		new Wt::WText("Task failed. Please contact developer", results_panel); 
   1.279 -		return; 
   1.280 -	}
   1.281 -	tempfile_html_file.close();
   1.282 -	
   1.283 -	new Wt::WBreak(results_panel);
   1.284 -	new Wt::WText("Task finished", results_panel); 
   1.285 -	
   1.286 -	new Wt::WText(" | ", results_panel); 
   1.287 -	Wt::WFileResource* html_view = 
   1.288 -	new Wt::WFileResource("text/html", tempfile_html, this);	
   1.289 -	Wt::WAnchor* a_view = new Wt::WAnchor(html_view, "View", results_panel);
   1.290 -	a_view->setTarget(Wt::TargetNewWindow);
   1.291 -	
   1.292 -	new Wt::WText(" | ", results_panel); 
   1.293 -	Wt::WFileResource* html_download = 
   1.294 -	new Wt::WFileResource("application/html", tempfile_html, this);	
   1.295 -	new Wt::WAnchor(html_download, "Download", results_panel);
   1.296 -	
   1.297 -	// FIXME Anchor
   1.298 -	
   1.299 -}
   1.300 -
   1.301 -
     2.1 --- a/blocks3d-wt-widget.h	Thu Sep 16 01:51:04 2010 +0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,60 +0,0 @@
     2.4 -#ifndef MALAKITE_BLOCKS3D_WIDGET_H_
     2.5 -#define MALAKITE_BLOCKS3D_WIDGET_H_
     2.6 -
     2.7 -#include "config.h"
     2.8 -#include "work-time.h"
     2.9 -
    2.10 -#include <Wt/WPanel>
    2.11 -#include <Wt/WString>
    2.12 -#include <Wt/WHBoxLayout>
    2.13 -#include <Wt/WVBoxLayout>
    2.14 -#include <Wt/WImage>
    2.15 -
    2.16 -#include <Wt/WContainerWidget>
    2.17 -#include <Wt/WFileUpload>
    2.18 -#include <Wt/WTextArea>
    2.19 -#include <Wt/WPushButton>
    2.20 -#include <Wt/WLineEdit>
    2.21 -#include <Wt/WTimer>
    2.22 -
    2.23 -class Blocks3DWidget : public Wt::WContainerWidget
    2.24 -{
    2.25 -public:
    2.26 -  Blocks3DWidget(Wt::WContainerWidget *parent=0);
    2.27 -private:
    2.28 -  Wt::WFileUpload* alignment_upload;
    2.29 -  Wt::WTextArea* alignment_textarea;
    2.30 -  Wt::WFileUpload* conformity_upload;
    2.31 -  Wt::WTextArea* conformity_textarea;
    2.32 -  
    2.33 -  Wt::WLineEdit* delta_input;
    2.34 -  Wt::WLineEdit* min_block_width_input;
    2.35 -  Wt::WLineEdit* timeout_input;
    2.36 -  Wt::WLineEdit* timeout2_input;
    2.37 -  
    2.38 -  Wt::WDoubleValidator *delta_validator;
    2.39 -  Wt::WIntValidator *min_block_width_validator;
    2.40 -  Wt::WIntValidator *timeout_validator;
    2.41 -  Wt::WIntValidator *timeout2_validator;
    2.42 -  
    2.43 -  Wt::WContainerWidget* results_panel;
    2.44 -  Wt::WTimer* timer;
    2.45 -  Worktime* worktime;
    2.46 -  
    2.47 -  std::string tempfile_alignment;
    2.48 -  std::string tempfile_conformity;
    2.49 -  std::string tempfile_html;
    2.50 -  std::string tempfile_check;
    2.51 -  std::string tempfile_sh;
    2.52 -  
    2.53 -  void textarea_from_file(Wt::WTextArea* ta, const char* file);
    2.54 -  void go_button_click();
    2.55 -  void alignment_uploaded();
    2.56 -  void conformity_uploaded();
    2.57 -  void fileTooLarge();
    2.58 -  void try_to_run();
    2.59 -  void timeout();
    2.60 -  //~ void execute();
    2.61 -};
    2.62 -
    2.63 -#endif // MALAKITE_BLOCKS3D_WIDGET_H_
     3.1 --- a/blocks3d-wt.C	Thu Sep 16 01:51:04 2010 +0400
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,46 +0,0 @@
     3.4 -
     3.5 -#include "config.h"
     3.6 -#include "blocks3d-wt-widget.h"
     3.7 -
     3.8 -#include <Wt/WEnvironment>
     3.9 -#include <Wt/WApplication>
    3.10 -#include <Wt/WServer>
    3.11 -
    3.12 -
    3.13 -class Blocks3DApplication : public Wt::WApplication
    3.14 -{
    3.15 -public:
    3.16 -  Blocks3DApplication(const Wt::WEnvironment& env);
    3.17 -private:
    3.18 -  Blocks3DWidget* blocks3d_widget;
    3.19 -};
    3.20 -
    3.21 -Blocks3DApplication::Blocks3DApplication(const Wt::WEnvironment& env) : 
    3.22 -  Wt::WApplication(env)
    3.23 -{
    3.24 -  useStyleSheet("/files/css/1.css");
    3.25 -  blocks3d_widget = new Blocks3DWidget(root());
    3.26 -}
    3.27 -
    3.28 -
    3.29 -
    3.30 -
    3.31 -Wt::WApplication* createApplication(const Wt::WEnvironment& env)
    3.32 -{
    3.33 -  return new Blocks3DApplication(env);
    3.34 -}
    3.35 -
    3.36 -int main(int argc, char **argv)
    3.37 -{
    3.38 -  Wt::WServer server(argv[0]);
    3.39 -  server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
    3.40 -  
    3.41 -  server.addEntryPoint(Wt::Application, createApplication, Malakite::main_url);
    3.42 -  
    3.43 -  if (server.start()) {
    3.44 -    Wt::WServer::waitForShutdown();
    3.45 -    server.stop();
    3.46 -  }
    3.47 -}
    3.48 -
    3.49 -
     4.1 --- a/blocks3d-wt.pro	Thu Sep 16 01:51:04 2010 +0400
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,15 +0,0 @@
     4.4 -TARGET = blocks3d-wt.exe
     4.5 -
     4.6 -SOURCES += config.C
     4.7 -SOURCES += salt.C
     4.8 -SOURCES += blocks3d-wt.C
     4.9 -SOURCES += blocks3d-wt-widget.C
    4.10 -SOURCES += work-time.C
    4.11 -
    4.12 -CONFIG += debug
    4.13 -CONFIG += precompile_header
    4.14 -
    4.15 -
    4.16 -INCLUDEPATH = /usr/local/include/Wt/
    4.17 -
    4.18 -LIBS += -lwthttp -lwt
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/blocks3d/wt/blocks3d-wt-widget.C	Thu Sep 16 15:26:33 2010 +0400
     5.3 @@ -0,0 +1,298 @@
     5.4 +
     5.5 +#include "config.h"
     5.6 +#include "blocks3d-wt-widget.h"
     5.7 +#include "salt.h"
     5.8 +
     5.9 +#include <Wt/WText>
    5.10 +#include <Wt/WBreak>
    5.11 +#include <Wt/WTable>
    5.12 +#include <Wt/WLabel>
    5.13 +#include <Wt/WDoubleValidator>
    5.14 +#include <Wt/WIntValidator>
    5.15 +#include <Wt/WMessageBox>
    5.16 +#include <Wt/WAnchor>
    5.17 +#include <Wt/WFileResource>
    5.18 +
    5.19 +#include <fstream>
    5.20 +#include <iostream>
    5.21 +#include <boost/format.hpp>
    5.22 +#include <stdlib.h>
    5.23 +
    5.24 +Blocks3DWidget::Blocks3DWidget(Wt::WContainerWidget *parent) :
    5.25 +	Wt::WContainerWidget(parent)
    5.26 +{
    5.27 +	Wt::WText* head = new Wt::WText("Blocks3D", this); 
    5.28 +	head->setStyleClass("header");
    5.29 +	
    5.30 +	alignment_upload = new Wt::WFileUpload();
    5.31 +	alignment_textarea = new Wt::WTextArea();
    5.32 +	alignment_textarea->setColumns(60);
    5.33 +	alignment_textarea->setRows(20);
    5.34 +	conformity_upload = new Wt::WFileUpload();
    5.35 +	conformity_textarea = new Wt::WTextArea();
    5.36 +	conformity_textarea->setColumns(40);
    5.37 +	conformity_textarea->setRows(20);
    5.38 +	
    5.39 +	Wt::WLabel *alignment_label = new Wt::WLabel("Alignment:");
    5.40 +	alignment_label->setBuddy(alignment_textarea);
    5.41 +	
    5.42 +	Wt::WLabel *conformity_label = new Wt::WLabel("Confiomity file:");
    5.43 +	conformity_label->setBuddy(alignment_textarea);
    5.44 +	 
    5.45 +	new Wt::WBreak(this);
    5.46 +	Wt::WTable *table = new Wt::WTable(this);
    5.47 +	
    5.48 +	table->elementAt(0, 0)->addWidget(alignment_label);
    5.49 +	table->elementAt(1, 0)->addWidget(alignment_textarea);
    5.50 +	table->elementAt(2, 0)->addWidget(alignment_upload);
    5.51 +	
    5.52 +	table->elementAt(0, 1)->addWidget(conformity_label);
    5.53 +	table->elementAt(1, 1)->addWidget(conformity_textarea);
    5.54 +	table->elementAt(2, 1)->addWidget(conformity_upload);
    5.55 +	
    5.56 +	new Wt::WBreak(this);
    5.57 +	delta_input = new Wt::WLineEdit(Malakite::defaults::delta, this);
    5.58 +	delta_validator = new Wt::WDoubleValidator(0.0, 10.0); // FIXME: not to allow empty
    5.59 +	delta_validator->setMandatory(true);
    5.60 +	delta_input->setValidator(delta_validator);	
    5.61 +	Wt::WLabel *delta_label = new Wt::WLabel("Distance spreading", this);
    5.62 +	delta_label->setBuddy(delta_input);
    5.63 +	
    5.64 +	new Wt::WBreak(this);
    5.65 +	min_block_width_input = new Wt::WLineEdit(Malakite::defaults::min_block_width, this);
    5.66 +	min_block_width_validator = new Wt::WIntValidator(3, 9999);
    5.67 +	min_block_width_validator->setMandatory(true);
    5.68 +	min_block_width_input->setValidator(min_block_width_validator);	
    5.69 +	Wt::WLabel *min_block_width_label = new Wt::WLabel("Min block width", this);
    5.70 +	min_block_width_label->setBuddy(min_block_width_input);
    5.71 +	
    5.72 +	new Wt::WBreak(this);
    5.73 +	timeout_input = new Wt::WLineEdit(Malakite::defaults::timeout, this);
    5.74 +	timeout_validator = new Wt::WIntValidator(-1, 30*24*3600);
    5.75 +	timeout_validator->setMandatory(true);
    5.76 +	timeout_input->setValidator(timeout_validator);	
    5.77 +	Wt::WLabel *timeout_label = new Wt::WLabel(
    5.78 +		"Bron-Kerbosh (couple cores) timeout", this);
    5.79 +	timeout_label->setBuddy(timeout_input);
    5.80 +	
    5.81 +	new Wt::WBreak(this);
    5.82 +	timeout2_input = new Wt::WLineEdit(Malakite::defaults::timeout2, this);
    5.83 +	timeout2_validator = new Wt::WIntValidator(-1, 30*24*3600);
    5.84 +	timeout2_validator->setMandatory(true);
    5.85 +	timeout2_input->setValidator(timeout2_validator);	
    5.86 +	Wt::WLabel *timeout2_label = new Wt::WLabel(
    5.87 +		"Bron-Kerbosh (blocks) timeout", this);
    5.88 +	timeout2_label->setBuddy(timeout2_input);
    5.89 +	
    5.90 +	
    5.91 +	new Wt::WBreak(this);
    5.92 +	Wt::WPushButton *go_button = new Wt::WPushButton("Run", this);
    5.93 +	
    5.94 +	new Wt::WBreak(this);
    5.95 +	results_panel = new Wt::WContainerWidget(this);
    5.96 +	
    5.97 +	go_button->clicked().connect(this, &Blocks3DWidget::go_button_click);
    5.98 +	alignment_upload->uploaded().connect(this, &Blocks3DWidget::alignment_uploaded);
    5.99 +	conformity_upload->uploaded().connect(this, &Blocks3DWidget::conformity_uploaded);
   5.100 +	alignment_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
   5.101 +	conformity_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
   5.102 +	
   5.103 +	alignment_upload->changed().connect(alignment_upload, &Wt::WFileUpload::upload);
   5.104 +	conformity_upload->changed().connect(conformity_upload, &Wt::WFileUpload::upload);
   5.105 +	
   5.106 +	timer = new Wt::WTimer(this);
   5.107 +	timer->timeout().connect(this, &Blocks3DWidget::timeout);
   5.108 +	timer->setInterval(Malakite::refresh_period);
   5.109 +}
   5.110 +
   5.111 +void Blocks3DWidget::go_button_click()
   5.112 +{
   5.113 +	try_to_run();
   5.114 +}
   5.115 +
   5.116 +void Blocks3DWidget::fileTooLarge()
   5.117 +{
   5.118 +	Wt::WMessageBox::show("Error", "File too large", Wt::Ok);		
   5.119 +}
   5.120 +
   5.121 +void Blocks3DWidget::textarea_from_file(Wt::WTextArea* ta, const char* file)
   5.122 +{
   5.123 +	std::string temp("");
   5.124 +	std::string total("");
   5.125 +	std::ifstream uploaded_file;
   5.126 +
   5.127 +	uploaded_file.open(file);
   5.128 +	if (!uploaded_file) 
   5.129 +	{
   5.130 +		return;
   5.131 +	}
   5.132 +	while (uploaded_file >> temp) 
   5.133 +	{
   5.134 +		total += temp + "\n";
   5.135 +	}
   5.136 +	uploaded_file.close();
   5.137 +	
   5.138 +	ta->setText(total);
   5.139 +	
   5.140 +	new Wt::WBreak(results_panel);
   5.141 +	new Wt::WText("Upload finished", results_panel); 
   5.142 +}
   5.143 +
   5.144 +void Blocks3DWidget::alignment_uploaded()
   5.145 +{
   5.146 +	textarea_from_file(alignment_textarea, 
   5.147 +		alignment_upload->spoolFileName().c_str());
   5.148 +}
   5.149 +
   5.150 +void Blocks3DWidget::conformity_uploaded()
   5.151 +{
   5.152 +	textarea_from_file(conformity_textarea, 
   5.153 +		conformity_upload->spoolFileName().c_str());
   5.154 +}
   5.155 +
   5.156 +void Blocks3DWidget::try_to_run()
   5.157 +{
   5.158 +	std::string alignment = alignment_textarea->text().toUTF8();
   5.159 +	std::string conformity = conformity_textarea->text().toUTF8();
   5.160 +	if (alignment.empty())
   5.161 +	{
   5.162 +		new Wt::WBreak(results_panel);
   5.163 +		new Wt::WText("No alignment provided", results_panel); 
   5.164 +		return;
   5.165 +	}
   5.166 +	if (delta_input->validate() != Wt::WValidator::Valid)
   5.167 +	{
   5.168 +		new Wt::WBreak(results_panel);
   5.169 +		new Wt::WText("Enter delta parameter", results_panel); 
   5.170 +		return;
   5.171 +	}
   5.172 +	if (min_block_width_input->validate() != Wt::WValidator::Valid)
   5.173 +	{
   5.174 +		new Wt::WBreak(results_panel);
   5.175 +		new Wt::WText("Enter min block width parameter", results_panel); 
   5.176 +		return;
   5.177 +	}
   5.178 +	if (timeout_input->validate() != Wt::WValidator::Valid)
   5.179 +	{
   5.180 +		new Wt::WBreak(results_panel);
   5.181 +		new Wt::WText("Enter timeout parameter", results_panel); 
   5.182 +		return;
   5.183 +	}
   5.184 +	if (timeout2_input->validate() != Wt::WValidator::Valid)
   5.185 +	{
   5.186 +		new Wt::WBreak(results_panel);
   5.187 +		new Wt::WText("Enter timeout2 parameter", results_panel); 
   5.188 +		return;
   5.189 +	}
   5.190 +	
   5.191 +	std::string r = generateSalt();
   5.192 +	
   5.193 +	tempfile_alignment = 
   5.194 +	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_alignment);
   5.195 +	tempfile_conformity = 
   5.196 +	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_conformity);
   5.197 +	tempfile_html = 
   5.198 +	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_html);
   5.199 +	tempfile_check = 
   5.200 +	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_check);
   5.201 +	tempfile_sh = 
   5.202 +	str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_sh);
   5.203 +	
   5.204 +	std::ofstream alignment_file;
   5.205 +	alignment_file.open(tempfile_alignment.c_str());
   5.206 +	alignment_file << alignment;
   5.207 +	alignment_file.close();
   5.208 +	
   5.209 +	if (!conformity.empty())
   5.210 +	{
   5.211 +		std::ofstream conformity_file;
   5.212 +		conformity_file.open(tempfile_conformity.c_str());
   5.213 +		conformity_file << conformity;
   5.214 +		conformity_file.close();
   5.215 +	}
   5.216 +	
   5.217 +	std::string conformity_option = "";
   5.218 +	if (!conformity.empty())
   5.219 +	{
   5.220 +		conformity_option = str(boost::format("-c %s") % tempfile_conformity);
   5.221 +	}
   5.222 +	
   5.223 +	std::string cmd = str(
   5.224 +	boost::format("cd %s ; "
   5.225 +	"%s %s -i %s %s -H %s -d %s -m %s -t %s -T %s; "
   5.226 +	"echo 'f' > %s;") 
   5.227 +	% Malakite::temp_path
   5.228 +	% Malakite::python_path % Malakite::blocks3d_path 
   5.229 +	% tempfile_alignment 
   5.230 +	% conformity_option 
   5.231 +	% tempfile_html 
   5.232 +	% delta_input->text().toUTF8() % min_block_width_input->text().toUTF8()	
   5.233 +	% timeout_input->text().toUTF8() % timeout2_input->text().toUTF8()
   5.234 +	% tempfile_check 
   5.235 +	);	
   5.236 +	
   5.237 +	std::cout << cmd << std::endl;
   5.238 +	
   5.239 +	std::ofstream tempfile_sh_file;
   5.240 +	tempfile_sh_file.open(tempfile_sh.c_str());
   5.241 +	tempfile_sh_file << cmd;
   5.242 +	tempfile_sh_file.close();
   5.243 +	
   5.244 +	// security???
   5.245 +	system(str(boost::format("sh %s &") % tempfile_sh.c_str()).c_str());
   5.246 +	new Wt::WBreak(results_panel);
   5.247 +	new Wt::WText("Task start", results_panel);	
   5.248 +	
   5.249 +	new Wt::WBreak(results_panel);
   5.250 +	new Wt::WText("Time elapsed: ", results_panel);	
   5.251 +	worktime = new Worktime(results_panel);
   5.252 +	
   5.253 +	timer->start();
   5.254 +	
   5.255 +}
   5.256 +
   5.257 +void Blocks3DWidget::timeout()
   5.258 +{
   5.259 +	worktime->render();
   5.260 +	// FIXME: check status of task
   5.261 +	std::ifstream check_file;
   5.262 +	check_file.open(tempfile_check.c_str());
   5.263 +	if (!check_file) 
   5.264 +	{
   5.265 +		return;
   5.266 +	}
   5.267 +	check_file.close();
   5.268 +	
   5.269 +	timer->stop();
   5.270 +	worktime->stop();
   5.271 +	
   5.272 +	std::ifstream tempfile_html_file;
   5.273 +	tempfile_html_file.open(tempfile_html.c_str());
   5.274 +	if (!tempfile_html_file) 
   5.275 +	{
   5.276 +		//~ Wt::WMessageBox::show("Ok", "Ok", Wt::Ok);		
   5.277 +		new Wt::WBreak(results_panel);
   5.278 +		new Wt::WText("Task failed. Please contact developer", results_panel); 
   5.279 +		return; 
   5.280 +	}
   5.281 +	tempfile_html_file.close();
   5.282 +	
   5.283 +	new Wt::WBreak(results_panel);
   5.284 +	new Wt::WText("Task finished", results_panel); 
   5.285 +	
   5.286 +	new Wt::WText(" | ", results_panel); 
   5.287 +	Wt::WFileResource* html_view = 
   5.288 +	new Wt::WFileResource("text/html", tempfile_html, this);	
   5.289 +	Wt::WAnchor* a_view = new Wt::WAnchor(html_view, "View", results_panel);
   5.290 +	a_view->setTarget(Wt::TargetNewWindow);
   5.291 +	
   5.292 +	new Wt::WText(" | ", results_panel); 
   5.293 +	Wt::WFileResource* html_download = 
   5.294 +	new Wt::WFileResource("application/html", tempfile_html, this);	
   5.295 +	new Wt::WAnchor(html_download, "Download", results_panel);
   5.296 +	
   5.297 +	// FIXME Anchor
   5.298 +	
   5.299 +}
   5.300 +
   5.301 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/blocks3d/wt/blocks3d-wt-widget.h	Thu Sep 16 15:26:33 2010 +0400
     6.3 @@ -0,0 +1,60 @@
     6.4 +#ifndef MALAKITE_BLOCKS3D_WIDGET_H_
     6.5 +#define MALAKITE_BLOCKS3D_WIDGET_H_
     6.6 +
     6.7 +#include "config.h"
     6.8 +#include "work-time.h"
     6.9 +
    6.10 +#include <Wt/WPanel>
    6.11 +#include <Wt/WString>
    6.12 +#include <Wt/WHBoxLayout>
    6.13 +#include <Wt/WVBoxLayout>
    6.14 +#include <Wt/WImage>
    6.15 +
    6.16 +#include <Wt/WContainerWidget>
    6.17 +#include <Wt/WFileUpload>
    6.18 +#include <Wt/WTextArea>
    6.19 +#include <Wt/WPushButton>
    6.20 +#include <Wt/WLineEdit>
    6.21 +#include <Wt/WTimer>
    6.22 +
    6.23 +class Blocks3DWidget : public Wt::WContainerWidget
    6.24 +{
    6.25 +public:
    6.26 +  Blocks3DWidget(Wt::WContainerWidget *parent=0);
    6.27 +private:
    6.28 +  Wt::WFileUpload* alignment_upload;
    6.29 +  Wt::WTextArea* alignment_textarea;
    6.30 +  Wt::WFileUpload* conformity_upload;
    6.31 +  Wt::WTextArea* conformity_textarea;
    6.32 +  
    6.33 +  Wt::WLineEdit* delta_input;
    6.34 +  Wt::WLineEdit* min_block_width_input;
    6.35 +  Wt::WLineEdit* timeout_input;
    6.36 +  Wt::WLineEdit* timeout2_input;
    6.37 +  
    6.38 +  Wt::WDoubleValidator *delta_validator;
    6.39 +  Wt::WIntValidator *min_block_width_validator;
    6.40 +  Wt::WIntValidator *timeout_validator;
    6.41 +  Wt::WIntValidator *timeout2_validator;
    6.42 +  
    6.43 +  Wt::WContainerWidget* results_panel;
    6.44 +  Wt::WTimer* timer;
    6.45 +  Worktime* worktime;
    6.46 +  
    6.47 +  std::string tempfile_alignment;
    6.48 +  std::string tempfile_conformity;
    6.49 +  std::string tempfile_html;
    6.50 +  std::string tempfile_check;
    6.51 +  std::string tempfile_sh;
    6.52 +  
    6.53 +  void textarea_from_file(Wt::WTextArea* ta, const char* file);
    6.54 +  void go_button_click();
    6.55 +  void alignment_uploaded();
    6.56 +  void conformity_uploaded();
    6.57 +  void fileTooLarge();
    6.58 +  void try_to_run();
    6.59 +  void timeout();
    6.60 +  //~ void execute();
    6.61 +};
    6.62 +
    6.63 +#endif // MALAKITE_BLOCKS3D_WIDGET_H_
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/blocks3d/wt/blocks3d-wt.C	Thu Sep 16 15:26:33 2010 +0400
     7.3 @@ -0,0 +1,46 @@
     7.4 +
     7.5 +#include "config.h"
     7.6 +#include "blocks3d-wt-widget.h"
     7.7 +
     7.8 +#include <Wt/WEnvironment>
     7.9 +#include <Wt/WApplication>
    7.10 +#include <Wt/WServer>
    7.11 +
    7.12 +
    7.13 +class Blocks3DApplication : public Wt::WApplication
    7.14 +{
    7.15 +public:
    7.16 +  Blocks3DApplication(const Wt::WEnvironment& env);
    7.17 +private:
    7.18 +  Blocks3DWidget* blocks3d_widget;
    7.19 +};
    7.20 +
    7.21 +Blocks3DApplication::Blocks3DApplication(const Wt::WEnvironment& env) : 
    7.22 +  Wt::WApplication(env)
    7.23 +{
    7.24 +  useStyleSheet("/files/css/1.css");
    7.25 +  blocks3d_widget = new Blocks3DWidget(root());
    7.26 +}
    7.27 +
    7.28 +
    7.29 +
    7.30 +
    7.31 +Wt::WApplication* createApplication(const Wt::WEnvironment& env)
    7.32 +{
    7.33 +  return new Blocks3DApplication(env);
    7.34 +}
    7.35 +
    7.36 +int main(int argc, char **argv)
    7.37 +{
    7.38 +  Wt::WServer server(argv[0]);
    7.39 +  server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
    7.40 +  
    7.41 +  server.addEntryPoint(Wt::Application, createApplication, Malakite::main_url);
    7.42 +  
    7.43 +  if (server.start()) {
    7.44 +    Wt::WServer::waitForShutdown();
    7.45 +    server.stop();
    7.46 +  }
    7.47 +}
    7.48 +
    7.49 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/blocks3d/wt/blocks3d-wt.pro	Thu Sep 16 15:26:33 2010 +0400
     8.3 @@ -0,0 +1,15 @@
     8.4 +TARGET = blocks3d-wt.exe
     8.5 +
     8.6 +SOURCES += config.C
     8.7 +SOURCES += salt.C
     8.8 +SOURCES += blocks3d-wt.C
     8.9 +SOURCES += blocks3d-wt-widget.C
    8.10 +SOURCES += work-time.C
    8.11 +
    8.12 +CONFIG += debug
    8.13 +CONFIG += precompile_header
    8.14 +
    8.15 +
    8.16 +INCLUDEPATH = /usr/local/include/Wt/
    8.17 +
    8.18 +LIBS += -lwthttp -lwt
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/blocks3d/wt/compile.sh	Thu Sep 16 15:26:33 2010 +0400
     9.3 @@ -0,0 +1,5 @@
     9.4 +cd build;
     9.5 +qmake ../blocks3d-wt.pro && make VERBOSE=0
     9.6 +#~ cmake .. && make VERBOSE=1
     9.7 +
     9.8 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/blocks3d/wt/compile_and_run.sh	Thu Sep 16 15:26:33 2010 +0400
    10.3 @@ -0,0 +1,1 @@
    10.4 +./compile.sh && ./run.sh
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/blocks3d/wt/config.C	Thu Sep 16 15:26:33 2010 +0400
    11.3 @@ -0,0 +1,35 @@
    11.4 +
    11.5 +#include "config.h"
    11.6 +#include <boost/format.hpp>
    11.7 +#include <string>
    11.8 +
    11.9 +
   11.10 +namespace Malakite
   11.11 +{
   11.12 +
   11.13 +const char* python_path = "python";
   11.14 +const char* blocks3d_path = "/home/boris/my-code/Blocks3D/Blocks3D_v5/Blocks3D.py";
   11.15 +const char* temp_path = "/tmp";
   11.16 +
   11.17 +const char* main_url = "/";
   11.18 +
   11.19 +const char* tempfile_alignment = "in_aln.fasta";
   11.20 +const char* tempfile_conformity = "in_conf.fasta";
   11.21 +const char* tempfile_html = "out.html";
   11.22 +const char* tempfile_check = "check.lock";
   11.23 +const char* tempfile_sh = "run.sh";
   11.24 +
   11.25 +namespace defaults
   11.26 +{
   11.27 +
   11.28 +const char* delta = "2.0";
   11.29 +const char* min_block_width = "3";
   11.30 +const char* timeout = "10";
   11.31 +const char* timeout2 = "10";
   11.32 +
   11.33 +}
   11.34 +
   11.35 +
   11.36 +
   11.37 +}
   11.38 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/blocks3d/wt/config.h	Thu Sep 16 15:26:33 2010 +0400
    12.3 @@ -0,0 +1,34 @@
    12.4 +#ifndef MALAKITE_BLOCKS3D_CONFIG_H_
    12.5 +#define MALAKITE_BLOCKS3D_CONFIG_H_
    12.6 +
    12.7 +namespace Malakite
    12.8 +{
    12.9 +
   12.10 +const int refresh_period = 5*1000;
   12.11 +
   12.12 +
   12.13 +extern const char* python_path;
   12.14 +extern const char* blocks3d_path;
   12.15 +extern const char* temp_path;
   12.16 +
   12.17 +extern const char* main_url;
   12.18 +
   12.19 +extern const char* tempfile_alignment;
   12.20 +extern const char* tempfile_conformity;
   12.21 +extern const char* tempfile_html;
   12.22 +extern const char* tempfile_check;
   12.23 +extern const char* tempfile_sh;
   12.24 +
   12.25 +namespace defaults
   12.26 +{
   12.27 +
   12.28 +extern const char* delta;
   12.29 +extern const char* min_block_width;
   12.30 +extern const char* timeout;
   12.31 +extern const char* timeout2;
   12.32 +
   12.33 +}
   12.34 +
   12.35 +}
   12.36 +
   12.37 +#endif // MALAKITE_BLOCKS3D_CONFIG_H_s
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/blocks3d/wt/debug.sh	Thu Sep 16 15:26:33 2010 +0400
    13.3 @@ -0,0 +1,3 @@
    13.4 +cd ./build/; 
    13.5 +gdb --args ./blocks3d-wt.exe  -- run  --docroot . --http-address 0.0.0.0 --http-port 8000
    13.6 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/blocks3d/wt/files/css/1.css	Thu Sep 16 15:26:33 2010 +0400
    14.3 @@ -0,0 +1,5 @@
    14.4 +
    14.5 +.header {
    14.6 +	font-size: 250%;
    14.7 +	font-weight: bold;
    14.8 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/blocks3d/wt/files/js/jquery.countdown.pack.js	Thu Sep 16 15:26:33 2010 +0400
    15.3 @@ -0,0 +1,7 @@
    15.4 +/* http://keith-wood.name/countdown.html
    15.5 +   Countdown for jQuery v1.5.8.
    15.6 +   Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
    15.7 +   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
    15.8 +   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
    15.9 +   Please attribute the author if you use it. */
   15.10 +eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(B($){B 1i(){8.1D=[];8.1D[\'\']={1j:[\'2C\',\'2D\',\'2E\',\'2F\',\'2G\',\'2H\',\'2I\'],2J:[\'2K\',\'2L\',\'2M\',\'2N\',\'2O\',\'2P\',\'2Q\'],1k:[\'y\',\'m\',\'w\',\'d\'],1u:E,1E:\':\',1V:Q};8.1g={1W:E,1X:E,1Y:E,1Z:E,20:\'2R\',1l:\'\',21:Q,1v:0,1F:\'\',22:\'\',23:\'\',25:Q,26:E,27:E,28:1};$.1m(8.1g,8.1D[\'\']);8.1n=[]}x w=\'G\';x Y=0;x O=1;x W=2;x D=3;x H=4;x M=5;x S=6;$.1m(1i.29,{1o:\'2S\',2T:2U(B(){$.G.2a()},2V),19:[],2W:B(a){8.1G(8.1g,a);1H(8.1g,a||{})},1I:B(a,b,c,e,f,g,h,i){A(1p b==\'2X\'&&b.2Y==P){i=b.1J();h=b.1K();g=b.1L();f=b.1M();e=b.T();c=b.17();b=b.18()}x d=K P();d.2Z(b);d.2b(1);d.31(c||0);d.2b(e||1);d.33(f||0);d.34((g||0)-(U.35(a)<30?a*1a:a));d.36(h||0);d.37(i||0);F d},2c:B(a){F a[0]*38+a[1]*39+a[2]*2d+a[3]*2e+a[4]*2f+a[5]*1a+a[6]},3a:B(a,b){A(!b){F $.G.1g}x c=$.X(a,w);F(b==\'3b\'?c.Z:c.Z[b])},2g:B(a,b){x c=$(a);A(c.2h(8.1o)){F}c.3c(8.1o);x d={Z:$.1m({},b),z:[0,0,0,0,0,0,0]};$.X(a,w,d);8.2i(a)},1N:B(a){A(!8.1O(a)){8.19.2j(a)}},1O:B(a){F($.3d(a,8.19)>-1)},1w:B(b){8.19=$.3e(8.19,B(a){F(a==b?E:a)})},2a:B(){V(x i=8.19.1x-1;i>=0;i--){8.1q(8.19[i])}},1q:B(a,b){x c=$(a);b=b||$.X(a,w);A(!b){F}c.3f(8.2k(b));c[(8.C(b,\'1V\')?\'3g\':\'3h\')+\'3i\'](\'3j\');x d=8.C(b,\'27\');A(d){x e=b.R!=\'2l\'?b.z:8.1y(b,b.11,8.C(b,\'1v\'),K P());x f=8.C(b,\'28\');A(f==1||8.2c(e)%f==0){d.1r(a,[e])}}x g=b.R!=\'1s\'&&(b.I?b.1b.L()<b.I.L():b.1b.L()>=b.13.L());A(g&&!b.1P){b.1P=1Q;A(8.1O(a)||8.C(b,\'25\')){8.1w(a);x h=8.C(b,\'26\');A(h){h.1r(a,[])}x i=8.C(b,\'23\');A(i){x j=8.C(b,\'1l\');b.Z.1l=i;8.1q(a,b);b.Z.1l=j}x k=8.C(b,\'22\');A(k){3k.3l=k}}b.1P=Q}1c A(b.R==\'1s\'){8.1w(a)}$.X(a,w,b)},2i:B(a,b,c){b=b||{};A(1p b==\'1R\'){x d=b;b={};b[d]=c}x e=$.X(a,w);A(e){8.1G(e.Z,b);1H(e.Z,b);8.2m(a,e);$.X(a,w,e);x f=K P();A((e.I&&e.I<f)||(e.13&&e.13>f)){8.1N(a)}8.1q(a,e)}},1G:B(a,b){x c=Q;V(x n 1S b){A(n!=\'1u\'&&n.N(/[2n]2o/)){c=1Q;14}}A(c){V(x n 1S a){A(n.N(/[2n]2o[0-9]/)){a[n]=E}}}},2m:B(a,b){x c;x d=8.C(b,\'1Z\');x e=0;x f=E;V(x i=0;i<8.1n.1x;i++){A(8.1n[i][0]==d){f=8.1n[i][1];14}}A(f!=E){e=(d?f:0);c=K P()}1c{x g=(d?d.1r(a,[]):E);c=K P();e=(g?c.L()-g.L():0);8.1n.2j([d,e])}x h=8.C(b,\'1Y\');h=(h==E?-c.3m():h);b.I=8.C(b,\'1X\');A(b.I!=E){b.I=8.1I(h,8.1z(b.I,E));A(b.I&&e){b.I.1A(b.I.1J()+e)}}b.13=8.1I(h,8.1z(8.C(b,\'1W\'),c));A(e){b.13.1A(b.13.1J()+e)}b.11=8.2p(b)},3n:B(a){x b=$(a);A(!b.2h(8.1o)){F}8.1w(a);b.3o(8.1o).3p();$.3q(a,w)},3r:B(a){8.R(a,\'1s\')},3s:B(a){8.R(a,\'2l\')},3t:B(a){8.R(a,E)},R:B(a,b){x c=$.X(a,w);A(c){A(c.R==\'1s\'&&!b){c.z=c.2q;x d=(c.I?\'-\':\'+\');c[c.I?\'I\':\'13\']=8.1z(d+c.z[0]+\'y\'+d+c.z[1]+\'o\'+d+c.z[2]+\'w\'+d+c.z[3]+\'d\'+d+c.z[4]+\'h\'+d+c.z[5]+\'m\'+d+c.z[6]+\'s\');8.1N(a)}c.R=b;c.2q=(b==\'1s\'?c.z:E);$.X(a,w,c);8.1q(a,c)}},3u:B(a){x b=$.X(a,w);F(!b?E:(!b.R?b.z:8.1y(b,b.11,8.C(b,\'1v\'),K P())))},C:B(a,b){F(a.Z[b]!=E?a.Z[b]:$.G.1g[b])},1z:B(k,l){x m=B(a){x b=K P();b.2r(b.L()+a*15);F b};x n=B(a){a=a.3v();x b=K P();x c=b.18();x d=b.17();x e=b.T();x f=b.1M();x g=b.1L();x h=b.1K();x i=/([+-]?[0-9]+)\\s*(s|m|h|d|w|o|y)?/g;x j=i.2s(a);3w(j){3x(j[2]||\'s\'){1d\'s\':h+=1e(j[1],10);14;1d\'m\':g+=1e(j[1],10);14;1d\'h\':f+=1e(j[1],10);14;1d\'d\':e+=1e(j[1],10);14;1d\'w\':e+=1e(j[1],10)*7;14;1d\'o\':d+=1e(j[1],10);e=U.1B(e,$.G.1h(c,d));14;1d\'y\':c+=1e(j[1],10);e=U.1B(e,$.G.1h(c,d));14}j=i.2s(a)}F K P(c,d,e,f,g,h,0)};x o=(k==E?l:(1p k==\'1R\'?n(k):(1p k==\'3y\'?m(k):k)));A(o)o.1A(0);F o},1h:B(a,b){F 32-K P(a,b,32).T()},1T:B(a){F a},2k:B(c){x d=8.C(c,\'1v\');c.z=(c.R?c.z:8.1y(c,c.11,d,K P()));x e=Q;x f=0;x g=d;x h=$.1m({},c.11);V(x i=Y;i<=S;i++){e|=(c.11[i]==\'?\'&&c.z[i]>0);h[i]=(c.11[i]==\'?\'&&!e?E:c.11[i]);f+=(h[i]?1:0);g-=(c.z[i]>0?1:0)}x j=[Q,Q,Q,Q,Q,Q,Q];V(x i=S;i>=Y;i--){A(c.11[i]){A(c.z[i]){j[i]=1Q}1c{j[i]=g>0;g--}}}x k=8.C(c,\'21\');x l=8.C(c,\'1l\');x m=(k?8.C(c,\'1k\'):8.C(c,\'1j\'));x n=8.C(c,\'1u\')||8.1T;x o=8.C(c,\'1E\');x p=8.C(c,\'1F\')||\'\';x q=B(a){x b=$.G.C(c,\'1k\'+n(c.z[a]));F(h[a]?c.z[a]+(b?b[a]:m[a])+\' \':\'\')};x r=B(a){x b=$.G.C(c,\'1j\'+n(c.z[a]));F((!d&&h[a])||(d&&j[a])?\'<16 1t="3z"><16 1t="2t">\'+c.z[a]+\'</16><3A/>\'+(b?b[a]:m[a])+\'</16>\':\'\')};F(l?8.2u(c,h,l,k,d,j):((k?\'<16 1t="1U 2t\'+(c.R?\' 2v\':\'\')+\'">\'+q(Y)+q(O)+q(W)+q(D)+(h[H]?8.J(c.z[H],2):\'\')+(h[M]?(h[H]?o:\'\')+8.J(c.z[M],2):\'\')+(h[S]?(h[H]||h[M]?o:\'\')+8.J(c.z[S],2):\'\'):\'<16 1t="1U 3B\'+(d||f)+(c.R?\' 2v\':\'\')+\'">\'+r(Y)+r(O)+r(W)+r(D)+r(H)+r(M)+r(S))+\'</16>\'+(p?\'<16 1t="1U 3C">\'+p+\'</16>\':\'\')))},2u:B(c,d,e,f,g,h){x j=8.C(c,(f?\'1k\':\'1j\'));x k=8.C(c,\'1u\')||8.1T;x l=B(a){F($.G.C(c,(f?\'1k\':\'1j\')+k(c.z[a]))||j)[a]};x m=B(a,b){F U.1C(a/b)%10};x o={3D:8.C(c,\'1F\'),3E:8.C(c,\'1E\'),3F:l(Y),3G:c.z[Y],3H:8.J(c.z[Y],2),3I:8.J(c.z[Y],3),3J:m(c.z[Y],1),3K:m(c.z[Y],10),3L:m(c.z[Y],1f),3M:m(c.z[Y],15),3N:l(O),3O:c.z[O],3P:8.J(c.z[O],2),3Q:8.J(c.z[O],3),3R:m(c.z[O],1),3S:m(c.z[O],10),3T:m(c.z[O],1f),3U:m(c.z[O],15),3V:l(W),3W:c.z[W],3X:8.J(c.z[W],2),3Y:8.J(c.z[W],3),3Z:m(c.z[W],1),40:m(c.z[W],10),41:m(c.z[W],1f),42:m(c.z[W],15),43:l(D),44:c.z[D],45:8.J(c.z[D],2),46:8.J(c.z[D],3),47:m(c.z[D],1),48:m(c.z[D],10),49:m(c.z[D],1f),4a:m(c.z[D],15),4b:l(H),4c:c.z[H],4d:8.J(c.z[H],2),4e:8.J(c.z[H],3),4f:m(c.z[H],1),4g:m(c.z[H],10),4h:m(c.z[H],1f),4i:m(c.z[H],15),4j:l(M),4k:c.z[M],4l:8.J(c.z[M],2),4m:8.J(c.z[M],3),4n:m(c.z[M],1),4o:m(c.z[M],10),4p:m(c.z[M],1f),4q:m(c.z[M],15),4r:l(S),4s:c.z[S],4t:8.J(c.z[S],2),4u:8.J(c.z[S],3),4v:m(c.z[S],1),4w:m(c.z[S],10),4x:m(c.z[S],1f),4y:m(c.z[S],15)};x p=e;V(x i=Y;i<=S;i++){x q=\'4z\'.4A(i);x r=K 2w(\'\\\\{\'+q+\'<\\\\}(.*)\\\\{\'+q+\'>\\\\}\',\'g\');p=p.2x(r,((!g&&d[i])||(g&&h[i])?\'$1\':\'\'))}$.2y(o,B(n,v){x a=K 2w(\'\\\\{\'+n+\'\\\\}\',\'g\');p=p.2x(a,v)});F p},J:B(a,b){a=\'\'+a;A(a.1x>=b){F a}a=\'4B\'+a;F a.4C(a.1x-b)},2p:B(a){x b=8.C(a,\'20\');x c=[];c[Y]=(b.N(\'y\')?\'?\':(b.N(\'Y\')?\'!\':E));c[O]=(b.N(\'o\')?\'?\':(b.N(\'O\')?\'!\':E));c[W]=(b.N(\'w\')?\'?\':(b.N(\'W\')?\'!\':E));c[D]=(b.N(\'d\')?\'?\':(b.N(\'D\')?\'!\':E));c[H]=(b.N(\'h\')?\'?\':(b.N(\'H\')?\'!\':E));c[M]=(b.N(\'m\')?\'?\':(b.N(\'M\')?\'!\':E));c[S]=(b.N(\'s\')?\'?\':(b.N(\'S\')?\'!\':E));F c},1y:B(c,d,e,f){c.1b=f;c.1b.1A(0);x g=K P(c.1b.L());A(c.I){A(f.L()<c.I.L()){c.1b=f=g}1c{f=c.I}}1c{g.2r(c.13.L());A(f.L()>c.13.L()){c.1b=f=g}}x h=[0,0,0,0,0,0,0];A(d[Y]||d[O]){x i=$.G.1h(f.18(),f.17());x j=$.G.1h(g.18(),g.17());x k=(g.T()==f.T()||(g.T()>=U.1B(i,j)&&f.T()>=U.1B(i,j)));x l=B(a){F(a.1M()*1a+a.1L())*1a+a.1K()};x m=U.4D(0,(g.18()-f.18())*12+g.17()-f.17()+((g.T()<f.T()&&!k)||(k&&l(g)<l(f))?-1:0));h[Y]=(d[Y]?U.1C(m/12):0);h[O]=(d[O]?m-h[Y]*12:0);f=K P(f.L());x n=(f.T()==i);x o=$.G.1h(f.18()+h[Y],f.17()+h[O]);A(f.T()>o){f.2z(o)}f.4E(f.18()+h[Y]);f.4F(f.17()+h[O]);A(n){f.2z(o)}}x p=U.1C((g.L()-f.L())/15);x q=B(a,b){h[a]=(d[a]?U.1C(p/b):0);p-=h[a]*b};q(W,2d);q(D,2e);q(H,2f);q(M,1a);q(S,1);A(p>0&&!c.I){x r=[1,12,4.4G,7,24,1a,1a];x s=S;x t=1;V(x u=S;u>=Y;u--){A(d[u]){A(h[s]>=t){h[s]=0;p=1}A(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}A(e){V(x u=Y;u<=S;u++){A(e&&h[u]){e--}1c A(!e){h[u]=0}}}F h}});B 1H(a,b){$.1m(a,b);V(x c 1S b){A(b[c]==E){a[c]=E}}F a}$.4H.G=B(a){x b=4I.29.4J.4K(4L,1);A(a==\'4M\'||a==\'4N\'){F $.G[\'2A\'+a+\'1i\'].1r($.G,[8[0]].2B(b))}F 8.2y(B(){A(1p a==\'1R\'){$.G[\'2A\'+a+\'1i\'].1r($.G,[8].2B(b))}1c{$.G.2g(8,a)}})};$.G=K 1i()})(4O);',62,299,'||||||||this|||||||||||||||||||||||||var||_periods|if|function|_get||null|return|countdown||_since|_minDigits|new|getTime||match||Date|false|_hold||getDate|Math|for||data||options||_show||_until|break|1000|span|getMonth|getFullYear|_timerTargets|60|_now|else|case|parseInt|100|_defaults|_getDaysInMonth|Countdown|labels|compactLabels|layout|extend|_serverSyncs|markerClassName|typeof|_updateCountdown|apply|pause|class|whichLabels|significant|_removeTarget|length|_calculatePeriods|_determineTime|setMilliseconds|min|floor|regional|timeSeparator|description|_resetExtraLabels|extendRemove|UTCDate|getMilliseconds|getSeconds|getMinutes|getHours|_addTarget|_hasTarget|_expiring|true|string|in|_normalLabels|countdown_row|isRTL|until|since|timezone|serverSync|format|compact|expiryUrl|expiryText||alwaysExpire|onExpiry|onTick|tickInterval|prototype|_updateTargets|setUTCDate|periodsToSeconds|604800|86400|3600|_attachCountdown|hasClass|_changeCountdown|push|_generateHTML|lap|_adjustSettings|Ll|abels|_determineShow|_savePeriods|setTime|exec|countdown_amount|_buildLayout|countdown_holding|RegExp|replace|each|setDate|_|concat|Years|Months|Weeks|Days|Hours|Minutes|Seconds|labels1|Year|Month|Week|Day|Hour|Minute|Second|dHMS|hasCountdown|_timer|setInterval|980|setDefaults|object|constructor|setUTCFullYear||setUTCMonth||setUTCHours|setUTCMinutes|abs|setUTCSeconds|setUTCMilliseconds|31557600|2629800|_settingsCountdown|all|addClass|inArray|map|html|add|remove|Class|countdown_rtl|window|location|getTimezoneOffset|_destroyCountdown|removeClass|empty|removeData|_pauseCountdown|_lapCountdown|_resumeCountdown|_getTimesCountdown|toLowerCase|while|switch|number|countdown_section|br|countdown_show|countdown_descr|desc|sep|yl|yn|ynn|ynnn|y1|y10|y100|y1000|ol|on|onn|onnn|o1|o10|o100|o1000|wl|wn|wnn|wnnn|w1|w10|w100|w1000|dl|dn|dnn|dnnn|d1|d10|d100|d1000|hl|hn|hnn|hnnn|h1|h10|h100|h1000|ml|mn|mnn|mnnn|m1|m10|m100|m1000|sl|sn|snn|snnn|s1|s10|s100|s1000|yowdhms|charAt|0000000000|substr|max|setFullYear|setMonth|3482|fn|Array|slice|call|arguments|getTimes|settings|jQuery'.split('|'),0,{}))
   15.11 \ No newline at end of file
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/blocks3d/wt/run.sh	Thu Sep 16 15:26:33 2010 +0400
    16.3 @@ -0,0 +1,2 @@
    16.4 +cd ./build/; 
    16.5 +./blocks3d-wt.exe  --docroot . --http-address 0.0.0.0 --http-port 8000
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/blocks3d/wt/salt.C	Thu Sep 16 15:26:33 2010 +0400
    17.3 @@ -0,0 +1,21 @@
    17.4 +
    17.5 +#include "salt.h"
    17.6 +
    17.7 +std::string generateSalt() {
    17.8 +	/* Salt generation from glibc manual */
    17.9 +	unsigned long seed[2];
   17.10 +	char salt[] = "_1_........";
   17.11 +	const char *const seedchars =
   17.12 +		"./0123456789ABCDEFGHIJKLMNOPQRST"
   17.13 +		"UVWXYZabcdefghijklmnopqrstuvwxyz";
   17.14 +	 
   17.15 +	/* Generate a (not very) random seed. */
   17.16 +	seed[0] = time(NULL);
   17.17 +	seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000);
   17.18 +	 
   17.19 +	/* Turn it into printable characters from `seedchars'. */
   17.20 +	for (int i = 0; i < 8; i++)
   17.21 +		salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f];
   17.22 +
   17.23 +	return salt;
   17.24 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/blocks3d/wt/salt.h	Thu Sep 16 15:26:33 2010 +0400
    18.3 @@ -0,0 +1,8 @@
    18.4 +#ifndef SALT_H_
    18.5 +#define SALT_H_
    18.6 +
    18.7 +#include <string>
    18.8 +
    18.9 +std::string generateSalt();
   18.10 +
   18.11 +#endif // SALT_H_
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/blocks3d/wt/work-time.C	Thu Sep 16 15:26:33 2010 +0400
    19.3 @@ -0,0 +1,58 @@
    19.4 +
    19.5 +#include "work-time.h"
    19.6 +#include <boost/lexical_cast.hpp>
    19.7 +#include <Wt/WApplication>
    19.8 +
    19.9 +
   19.10 +Worktime::Worktime(Wt::WContainerWidget *parent) : 
   19.11 +	WText(parent), stoped(false)
   19.12 +{
   19.13 +	wApp->require("/files/js/jquery.countdown.pack.js");
   19.14 +	start_at = now();	
   19.15 +	stop_at = now(); // ??	
   19.16 +	render();
   19.17 +}
   19.18 +
   19.19 +std::string Worktime::int2time(posix::time_duration secs)
   19.20 +{
   19.21 +	posix::seconds secs1(secs.total_seconds());
   19.22 +	return to_simple_string(secs1);
   19.23 +}
   19.24 +
   19.25 +void Worktime::stop()
   19.26 +{
   19.27 +	stoped = true;
   19.28 +	stop_at = now();
   19.29 +	//~ setId(generateSalt()); // switch off countdown
   19.30 +	render();
   19.31 +}
   19.32 +
   19.33 +void Worktime::render()
   19.34 +{
   19.35 +	if (!stoped)
   19.36 +	{
   19.37 +		doJavaScript("$('#" + id() + "').countdown({"
   19.38 +		"since: -" + boost::lexical_cast<std::string>(
   19.39 +			spent().total_milliseconds()) + " / 1000,"
   19.40 +		"compact: true"
   19.41 +		"});");
   19.42 +	}
   19.43 +	else
   19.44 +	{
   19.45 +		doJavaScript("$('#" + id() + "').countdown('pause');");
   19.46 +	}
   19.47 +	
   19.48 +	setText(int2time(spent()));
   19.49 +};
   19.50 +
   19.51 +posix::time_duration Worktime::spent()
   19.52 +{
   19.53 +	if (stoped)
   19.54 +	{
   19.55 +		return stop_at - start_at;
   19.56 +	}
   19.57 +	else
   19.58 +	{
   19.59 +		return now() - start_at;
   19.60 +	}
   19.61 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/blocks3d/wt/work-time.h	Thu Sep 16 15:26:33 2010 +0400
    20.3 @@ -0,0 +1,27 @@
    20.4 +
    20.5 +#ifndef WORKTIME_H_
    20.6 +#define WORKTIME_H_
    20.7 +
    20.8 +#include <Wt/WContainerWidget>
    20.9 +#include <Wt/WText>
   20.10 +
   20.11 +#include <boost/date_time/posix_time/posix_time.hpp>
   20.12 +namespace posix = boost::posix_time;
   20.13 +
   20.14 +class Worktime : public Wt::WText
   20.15 +{
   20.16 +public:
   20.17 +	Worktime(Wt::WContainerWidget *parent=0);
   20.18 +	void render();
   20.19 +	void stop();
   20.20 +	inline posix::ptime now() { return posix::microsec_clock::universal_time(); }
   20.21 +	inline posix::time_duration spent(); 
   20.22 +private:
   20.23 +	posix::ptime start_at;
   20.24 +	posix::ptime stop_at;
   20.25 +	bool stoped;
   20.26 +	std::string int2time(posix::time_duration secs);
   20.27 +};
   20.28 +
   20.29 +
   20.30 +#endif // WORKTIME_H_
    21.1 --- a/compile.sh	Thu Sep 16 01:51:04 2010 +0400
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,5 +0,0 @@
    21.4 -cd build;
    21.5 -qmake ../blocks3d-wt.pro && make VERBOSE=0
    21.6 -#~ cmake .. && make VERBOSE=1
    21.7 -
    21.8 -
    22.1 --- a/compile_and_run.sh	Thu Sep 16 01:51:04 2010 +0400
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,1 +0,0 @@
    22.4 -./compile.sh && ./run.sh
    23.1 --- a/config.C	Thu Sep 16 01:51:04 2010 +0400
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,35 +0,0 @@
    23.4 -
    23.5 -#include "config.h"
    23.6 -#include <boost/format.hpp>
    23.7 -#include <string>
    23.8 -
    23.9 -
   23.10 -namespace Malakite
   23.11 -{
   23.12 -
   23.13 -const char* python_path = "python";
   23.14 -const char* blocks3d_path = "/home/boris/my-code/Blocks3D/Blocks3D_v5/Blocks3D.py";
   23.15 -const char* temp_path = "/tmp";
   23.16 -
   23.17 -const char* main_url = "/";
   23.18 -
   23.19 -const char* tempfile_alignment = "in_aln.fasta";
   23.20 -const char* tempfile_conformity = "in_conf.fasta";
   23.21 -const char* tempfile_html = "out.html";
   23.22 -const char* tempfile_check = "check.lock";
   23.23 -const char* tempfile_sh = "run.sh";
   23.24 -
   23.25 -namespace defaults
   23.26 -{
   23.27 -
   23.28 -const char* delta = "2.0";
   23.29 -const char* min_block_width = "3";
   23.30 -const char* timeout = "10";
   23.31 -const char* timeout2 = "10";
   23.32 -
   23.33 -}
   23.34 -
   23.35 -
   23.36 -
   23.37 -}
   23.38 -
    24.1 --- a/config.h	Thu Sep 16 01:51:04 2010 +0400
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,34 +0,0 @@
    24.4 -#ifndef MALAKITE_BLOCKS3D_CONFIG_H_
    24.5 -#define MALAKITE_BLOCKS3D_CONFIG_H_
    24.6 -
    24.7 -namespace Malakite
    24.8 -{
    24.9 -
   24.10 -const int refresh_period = 5*1000;
   24.11 -
   24.12 -
   24.13 -extern const char* python_path;
   24.14 -extern const char* blocks3d_path;
   24.15 -extern const char* temp_path;
   24.16 -
   24.17 -extern const char* main_url;
   24.18 -
   24.19 -extern const char* tempfile_alignment;
   24.20 -extern const char* tempfile_conformity;
   24.21 -extern const char* tempfile_html;
   24.22 -extern const char* tempfile_check;
   24.23 -extern const char* tempfile_sh;
   24.24 -
   24.25 -namespace defaults
   24.26 -{
   24.27 -
   24.28 -extern const char* delta;
   24.29 -extern const char* min_block_width;
   24.30 -extern const char* timeout;
   24.31 -extern const char* timeout2;
   24.32 -
   24.33 -}
   24.34 -
   24.35 -}
   24.36 -
   24.37 -#endif // MALAKITE_BLOCKS3D_CONFIG_H_s
    25.1 --- a/debug.sh	Thu Sep 16 01:51:04 2010 +0400
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,3 +0,0 @@
    25.4 -cd ./build/; 
    25.5 -gdb --args ./blocks3d-wt.exe  -- run  --docroot . --http-address 0.0.0.0 --http-port 8000
    25.6 -
    26.1 --- a/files/css/1.css	Thu Sep 16 01:51:04 2010 +0400
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,5 +0,0 @@
    26.4 -
    26.5 -.header {
    26.6 -	font-size: 250%;
    26.7 -	font-weight: bold;
    26.8 -}
    27.1 --- a/files/js/jquery.countdown.pack.js	Thu Sep 16 01:51:04 2010 +0400
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,7 +0,0 @@
    27.4 -/* http://keith-wood.name/countdown.html
    27.5 -   Countdown for jQuery v1.5.8.
    27.6 -   Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
    27.7 -   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
    27.8 -   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
    27.9 -   Please attribute the author if you use it. */
   27.10 -eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(B($){B 1i(){8.1D=[];8.1D[\'\']={1j:[\'2C\',\'2D\',\'2E\',\'2F\',\'2G\',\'2H\',\'2I\'],2J:[\'2K\',\'2L\',\'2M\',\'2N\',\'2O\',\'2P\',\'2Q\'],1k:[\'y\',\'m\',\'w\',\'d\'],1u:E,1E:\':\',1V:Q};8.1g={1W:E,1X:E,1Y:E,1Z:E,20:\'2R\',1l:\'\',21:Q,1v:0,1F:\'\',22:\'\',23:\'\',25:Q,26:E,27:E,28:1};$.1m(8.1g,8.1D[\'\']);8.1n=[]}x w=\'G\';x Y=0;x O=1;x W=2;x D=3;x H=4;x M=5;x S=6;$.1m(1i.29,{1o:\'2S\',2T:2U(B(){$.G.2a()},2V),19:[],2W:B(a){8.1G(8.1g,a);1H(8.1g,a||{})},1I:B(a,b,c,e,f,g,h,i){A(1p b==\'2X\'&&b.2Y==P){i=b.1J();h=b.1K();g=b.1L();f=b.1M();e=b.T();c=b.17();b=b.18()}x d=K P();d.2Z(b);d.2b(1);d.31(c||0);d.2b(e||1);d.33(f||0);d.34((g||0)-(U.35(a)<30?a*1a:a));d.36(h||0);d.37(i||0);F d},2c:B(a){F a[0]*38+a[1]*39+a[2]*2d+a[3]*2e+a[4]*2f+a[5]*1a+a[6]},3a:B(a,b){A(!b){F $.G.1g}x c=$.X(a,w);F(b==\'3b\'?c.Z:c.Z[b])},2g:B(a,b){x c=$(a);A(c.2h(8.1o)){F}c.3c(8.1o);x d={Z:$.1m({},b),z:[0,0,0,0,0,0,0]};$.X(a,w,d);8.2i(a)},1N:B(a){A(!8.1O(a)){8.19.2j(a)}},1O:B(a){F($.3d(a,8.19)>-1)},1w:B(b){8.19=$.3e(8.19,B(a){F(a==b?E:a)})},2a:B(){V(x i=8.19.1x-1;i>=0;i--){8.1q(8.19[i])}},1q:B(a,b){x c=$(a);b=b||$.X(a,w);A(!b){F}c.3f(8.2k(b));c[(8.C(b,\'1V\')?\'3g\':\'3h\')+\'3i\'](\'3j\');x d=8.C(b,\'27\');A(d){x e=b.R!=\'2l\'?b.z:8.1y(b,b.11,8.C(b,\'1v\'),K P());x f=8.C(b,\'28\');A(f==1||8.2c(e)%f==0){d.1r(a,[e])}}x g=b.R!=\'1s\'&&(b.I?b.1b.L()<b.I.L():b.1b.L()>=b.13.L());A(g&&!b.1P){b.1P=1Q;A(8.1O(a)||8.C(b,\'25\')){8.1w(a);x h=8.C(b,\'26\');A(h){h.1r(a,[])}x i=8.C(b,\'23\');A(i){x j=8.C(b,\'1l\');b.Z.1l=i;8.1q(a,b);b.Z.1l=j}x k=8.C(b,\'22\');A(k){3k.3l=k}}b.1P=Q}1c A(b.R==\'1s\'){8.1w(a)}$.X(a,w,b)},2i:B(a,b,c){b=b||{};A(1p b==\'1R\'){x d=b;b={};b[d]=c}x e=$.X(a,w);A(e){8.1G(e.Z,b);1H(e.Z,b);8.2m(a,e);$.X(a,w,e);x f=K P();A((e.I&&e.I<f)||(e.13&&e.13>f)){8.1N(a)}8.1q(a,e)}},1G:B(a,b){x c=Q;V(x n 1S b){A(n!=\'1u\'&&n.N(/[2n]2o/)){c=1Q;14}}A(c){V(x n 1S a){A(n.N(/[2n]2o[0-9]/)){a[n]=E}}}},2m:B(a,b){x c;x d=8.C(b,\'1Z\');x e=0;x f=E;V(x i=0;i<8.1n.1x;i++){A(8.1n[i][0]==d){f=8.1n[i][1];14}}A(f!=E){e=(d?f:0);c=K P()}1c{x g=(d?d.1r(a,[]):E);c=K P();e=(g?c.L()-g.L():0);8.1n.2j([d,e])}x h=8.C(b,\'1Y\');h=(h==E?-c.3m():h);b.I=8.C(b,\'1X\');A(b.I!=E){b.I=8.1I(h,8.1z(b.I,E));A(b.I&&e){b.I.1A(b.I.1J()+e)}}b.13=8.1I(h,8.1z(8.C(b,\'1W\'),c));A(e){b.13.1A(b.13.1J()+e)}b.11=8.2p(b)},3n:B(a){x b=$(a);A(!b.2h(8.1o)){F}8.1w(a);b.3o(8.1o).3p();$.3q(a,w)},3r:B(a){8.R(a,\'1s\')},3s:B(a){8.R(a,\'2l\')},3t:B(a){8.R(a,E)},R:B(a,b){x c=$.X(a,w);A(c){A(c.R==\'1s\'&&!b){c.z=c.2q;x d=(c.I?\'-\':\'+\');c[c.I?\'I\':\'13\']=8.1z(d+c.z[0]+\'y\'+d+c.z[1]+\'o\'+d+c.z[2]+\'w\'+d+c.z[3]+\'d\'+d+c.z[4]+\'h\'+d+c.z[5]+\'m\'+d+c.z[6]+\'s\');8.1N(a)}c.R=b;c.2q=(b==\'1s\'?c.z:E);$.X(a,w,c);8.1q(a,c)}},3u:B(a){x b=$.X(a,w);F(!b?E:(!b.R?b.z:8.1y(b,b.11,8.C(b,\'1v\'),K P())))},C:B(a,b){F(a.Z[b]!=E?a.Z[b]:$.G.1g[b])},1z:B(k,l){x m=B(a){x b=K P();b.2r(b.L()+a*15);F b};x n=B(a){a=a.3v();x b=K P();x c=b.18();x d=b.17();x e=b.T();x f=b.1M();x g=b.1L();x h=b.1K();x i=/([+-]?[0-9]+)\\s*(s|m|h|d|w|o|y)?/g;x j=i.2s(a);3w(j){3x(j[2]||\'s\'){1d\'s\':h+=1e(j[1],10);14;1d\'m\':g+=1e(j[1],10);14;1d\'h\':f+=1e(j[1],10);14;1d\'d\':e+=1e(j[1],10);14;1d\'w\':e+=1e(j[1],10)*7;14;1d\'o\':d+=1e(j[1],10);e=U.1B(e,$.G.1h(c,d));14;1d\'y\':c+=1e(j[1],10);e=U.1B(e,$.G.1h(c,d));14}j=i.2s(a)}F K P(c,d,e,f,g,h,0)};x o=(k==E?l:(1p k==\'1R\'?n(k):(1p k==\'3y\'?m(k):k)));A(o)o.1A(0);F o},1h:B(a,b){F 32-K P(a,b,32).T()},1T:B(a){F a},2k:B(c){x d=8.C(c,\'1v\');c.z=(c.R?c.z:8.1y(c,c.11,d,K P()));x e=Q;x f=0;x g=d;x h=$.1m({},c.11);V(x i=Y;i<=S;i++){e|=(c.11[i]==\'?\'&&c.z[i]>0);h[i]=(c.11[i]==\'?\'&&!e?E:c.11[i]);f+=(h[i]?1:0);g-=(c.z[i]>0?1:0)}x j=[Q,Q,Q,Q,Q,Q,Q];V(x i=S;i>=Y;i--){A(c.11[i]){A(c.z[i]){j[i]=1Q}1c{j[i]=g>0;g--}}}x k=8.C(c,\'21\');x l=8.C(c,\'1l\');x m=(k?8.C(c,\'1k\'):8.C(c,\'1j\'));x n=8.C(c,\'1u\')||8.1T;x o=8.C(c,\'1E\');x p=8.C(c,\'1F\')||\'\';x q=B(a){x b=$.G.C(c,\'1k\'+n(c.z[a]));F(h[a]?c.z[a]+(b?b[a]:m[a])+\' \':\'\')};x r=B(a){x b=$.G.C(c,\'1j\'+n(c.z[a]));F((!d&&h[a])||(d&&j[a])?\'<16 1t="3z"><16 1t="2t">\'+c.z[a]+\'</16><3A/>\'+(b?b[a]:m[a])+\'</16>\':\'\')};F(l?8.2u(c,h,l,k,d,j):((k?\'<16 1t="1U 2t\'+(c.R?\' 2v\':\'\')+\'">\'+q(Y)+q(O)+q(W)+q(D)+(h[H]?8.J(c.z[H],2):\'\')+(h[M]?(h[H]?o:\'\')+8.J(c.z[M],2):\'\')+(h[S]?(h[H]||h[M]?o:\'\')+8.J(c.z[S],2):\'\'):\'<16 1t="1U 3B\'+(d||f)+(c.R?\' 2v\':\'\')+\'">\'+r(Y)+r(O)+r(W)+r(D)+r(H)+r(M)+r(S))+\'</16>\'+(p?\'<16 1t="1U 3C">\'+p+\'</16>\':\'\')))},2u:B(c,d,e,f,g,h){x j=8.C(c,(f?\'1k\':\'1j\'));x k=8.C(c,\'1u\')||8.1T;x l=B(a){F($.G.C(c,(f?\'1k\':\'1j\')+k(c.z[a]))||j)[a]};x m=B(a,b){F U.1C(a/b)%10};x o={3D:8.C(c,\'1F\'),3E:8.C(c,\'1E\'),3F:l(Y),3G:c.z[Y],3H:8.J(c.z[Y],2),3I:8.J(c.z[Y],3),3J:m(c.z[Y],1),3K:m(c.z[Y],10),3L:m(c.z[Y],1f),3M:m(c.z[Y],15),3N:l(O),3O:c.z[O],3P:8.J(c.z[O],2),3Q:8.J(c.z[O],3),3R:m(c.z[O],1),3S:m(c.z[O],10),3T:m(c.z[O],1f),3U:m(c.z[O],15),3V:l(W),3W:c.z[W],3X:8.J(c.z[W],2),3Y:8.J(c.z[W],3),3Z:m(c.z[W],1),40:m(c.z[W],10),41:m(c.z[W],1f),42:m(c.z[W],15),43:l(D),44:c.z[D],45:8.J(c.z[D],2),46:8.J(c.z[D],3),47:m(c.z[D],1),48:m(c.z[D],10),49:m(c.z[D],1f),4a:m(c.z[D],15),4b:l(H),4c:c.z[H],4d:8.J(c.z[H],2),4e:8.J(c.z[H],3),4f:m(c.z[H],1),4g:m(c.z[H],10),4h:m(c.z[H],1f),4i:m(c.z[H],15),4j:l(M),4k:c.z[M],4l:8.J(c.z[M],2),4m:8.J(c.z[M],3),4n:m(c.z[M],1),4o:m(c.z[M],10),4p:m(c.z[M],1f),4q:m(c.z[M],15),4r:l(S),4s:c.z[S],4t:8.J(c.z[S],2),4u:8.J(c.z[S],3),4v:m(c.z[S],1),4w:m(c.z[S],10),4x:m(c.z[S],1f),4y:m(c.z[S],15)};x p=e;V(x i=Y;i<=S;i++){x q=\'4z\'.4A(i);x r=K 2w(\'\\\\{\'+q+\'<\\\\}(.*)\\\\{\'+q+\'>\\\\}\',\'g\');p=p.2x(r,((!g&&d[i])||(g&&h[i])?\'$1\':\'\'))}$.2y(o,B(n,v){x a=K 2w(\'\\\\{\'+n+\'\\\\}\',\'g\');p=p.2x(a,v)});F p},J:B(a,b){a=\'\'+a;A(a.1x>=b){F a}a=\'4B\'+a;F a.4C(a.1x-b)},2p:B(a){x b=8.C(a,\'20\');x c=[];c[Y]=(b.N(\'y\')?\'?\':(b.N(\'Y\')?\'!\':E));c[O]=(b.N(\'o\')?\'?\':(b.N(\'O\')?\'!\':E));c[W]=(b.N(\'w\')?\'?\':(b.N(\'W\')?\'!\':E));c[D]=(b.N(\'d\')?\'?\':(b.N(\'D\')?\'!\':E));c[H]=(b.N(\'h\')?\'?\':(b.N(\'H\')?\'!\':E));c[M]=(b.N(\'m\')?\'?\':(b.N(\'M\')?\'!\':E));c[S]=(b.N(\'s\')?\'?\':(b.N(\'S\')?\'!\':E));F c},1y:B(c,d,e,f){c.1b=f;c.1b.1A(0);x g=K P(c.1b.L());A(c.I){A(f.L()<c.I.L()){c.1b=f=g}1c{f=c.I}}1c{g.2r(c.13.L());A(f.L()>c.13.L()){c.1b=f=g}}x h=[0,0,0,0,0,0,0];A(d[Y]||d[O]){x i=$.G.1h(f.18(),f.17());x j=$.G.1h(g.18(),g.17());x k=(g.T()==f.T()||(g.T()>=U.1B(i,j)&&f.T()>=U.1B(i,j)));x l=B(a){F(a.1M()*1a+a.1L())*1a+a.1K()};x m=U.4D(0,(g.18()-f.18())*12+g.17()-f.17()+((g.T()<f.T()&&!k)||(k&&l(g)<l(f))?-1:0));h[Y]=(d[Y]?U.1C(m/12):0);h[O]=(d[O]?m-h[Y]*12:0);f=K P(f.L());x n=(f.T()==i);x o=$.G.1h(f.18()+h[Y],f.17()+h[O]);A(f.T()>o){f.2z(o)}f.4E(f.18()+h[Y]);f.4F(f.17()+h[O]);A(n){f.2z(o)}}x p=U.1C((g.L()-f.L())/15);x q=B(a,b){h[a]=(d[a]?U.1C(p/b):0);p-=h[a]*b};q(W,2d);q(D,2e);q(H,2f);q(M,1a);q(S,1);A(p>0&&!c.I){x r=[1,12,4.4G,7,24,1a,1a];x s=S;x t=1;V(x u=S;u>=Y;u--){A(d[u]){A(h[s]>=t){h[s]=0;p=1}A(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}A(e){V(x u=Y;u<=S;u++){A(e&&h[u]){e--}1c A(!e){h[u]=0}}}F h}});B 1H(a,b){$.1m(a,b);V(x c 1S b){A(b[c]==E){a[c]=E}}F a}$.4H.G=B(a){x b=4I.29.4J.4K(4L,1);A(a==\'4M\'||a==\'4N\'){F $.G[\'2A\'+a+\'1i\'].1r($.G,[8[0]].2B(b))}F 8.2y(B(){A(1p a==\'1R\'){$.G[\'2A\'+a+\'1i\'].1r($.G,[8].2B(b))}1c{$.G.2g(8,a)}})};$.G=K 1i()})(4O);',62,299,'||||||||this|||||||||||||||||||||||||var||_periods|if|function|_get||null|return|countdown||_since|_minDigits|new|getTime||match||Date|false|_hold||getDate|Math|for||data||options||_show||_until|break|1000|span|getMonth|getFullYear|_timerTargets|60|_now|else|case|parseInt|100|_defaults|_getDaysInMonth|Countdown|labels|compactLabels|layout|extend|_serverSyncs|markerClassName|typeof|_updateCountdown|apply|pause|class|whichLabels|significant|_removeTarget|length|_calculatePeriods|_determineTime|setMilliseconds|min|floor|regional|timeSeparator|description|_resetExtraLabels|extendRemove|UTCDate|getMilliseconds|getSeconds|getMinutes|getHours|_addTarget|_hasTarget|_expiring|true|string|in|_normalLabels|countdown_row|isRTL|until|since|timezone|serverSync|format|compact|expiryUrl|expiryText||alwaysExpire|onExpiry|onTick|tickInterval|prototype|_updateTargets|setUTCDate|periodsToSeconds|604800|86400|3600|_attachCountdown|hasClass|_changeCountdown|push|_generateHTML|lap|_adjustSettings|Ll|abels|_determineShow|_savePeriods|setTime|exec|countdown_amount|_buildLayout|countdown_holding|RegExp|replace|each|setDate|_|concat|Years|Months|Weeks|Days|Hours|Minutes|Seconds|labels1|Year|Month|Week|Day|Hour|Minute|Second|dHMS|hasCountdown|_timer|setInterval|980|setDefaults|object|constructor|setUTCFullYear||setUTCMonth||setUTCHours|setUTCMinutes|abs|setUTCSeconds|setUTCMilliseconds|31557600|2629800|_settingsCountdown|all|addClass|inArray|map|html|add|remove|Class|countdown_rtl|window|location|getTimezoneOffset|_destroyCountdown|removeClass|empty|removeData|_pauseCountdown|_lapCountdown|_resumeCountdown|_getTimesCountdown|toLowerCase|while|switch|number|countdown_section|br|countdown_show|countdown_descr|desc|sep|yl|yn|ynn|ynnn|y1|y10|y100|y1000|ol|on|onn|onnn|o1|o10|o100|o1000|wl|wn|wnn|wnnn|w1|w10|w100|w1000|dl|dn|dnn|dnnn|d1|d10|d100|d1000|hl|hn|hnn|hnnn|h1|h10|h100|h1000|ml|mn|mnn|mnnn|m1|m10|m100|m1000|sl|sn|snn|snnn|s1|s10|s100|s1000|yowdhms|charAt|0000000000|substr|max|setFullYear|setMonth|3482|fn|Array|slice|call|arguments|getTimes|settings|jQuery'.split('|'),0,{}))
   27.11 \ No newline at end of file
    28.1 --- a/run.sh	Thu Sep 16 01:51:04 2010 +0400
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,2 +0,0 @@
    28.4 -cd ./build/; 
    28.5 -./blocks3d-wt.exe  --docroot . --http-address 0.0.0.0 --http-port 8000
    29.1 --- a/salt.C	Thu Sep 16 01:51:04 2010 +0400
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,21 +0,0 @@
    29.4 -
    29.5 -#include "salt.h"
    29.6 -
    29.7 -std::string generateSalt() {
    29.8 -	/* Salt generation from glibc manual */
    29.9 -	unsigned long seed[2];
   29.10 -	char salt[] = "_1_........";
   29.11 -	const char *const seedchars =
   29.12 -		"./0123456789ABCDEFGHIJKLMNOPQRST"
   29.13 -		"UVWXYZabcdefghijklmnopqrstuvwxyz";
   29.14 -	 
   29.15 -	/* Generate a (not very) random seed. */
   29.16 -	seed[0] = time(NULL);
   29.17 -	seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000);
   29.18 -	 
   29.19 -	/* Turn it into printable characters from `seedchars'. */
   29.20 -	for (int i = 0; i < 8; i++)
   29.21 -		salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f];
   29.22 -
   29.23 -	return salt;
   29.24 -}
    30.1 --- a/salt.h	Thu Sep 16 01:51:04 2010 +0400
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,8 +0,0 @@
    30.4 -#ifndef SALT_H_
    30.5 -#define SALT_H_
    30.6 -
    30.7 -#include <string>
    30.8 -
    30.9 -std::string generateSalt();
   30.10 -
   30.11 -#endif // SALT_H_
    31.1 --- a/work-time.C	Thu Sep 16 01:51:04 2010 +0400
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,58 +0,0 @@
    31.4 -
    31.5 -#include "work-time.h"
    31.6 -#include <boost/lexical_cast.hpp>
    31.7 -#include <Wt/WApplication>
    31.8 -
    31.9 -
   31.10 -Worktime::Worktime(Wt::WContainerWidget *parent) : 
   31.11 -	WText(parent), stoped(false)
   31.12 -{
   31.13 -	wApp->require("/files/js/jquery.countdown.pack.js");
   31.14 -	start_at = now();	
   31.15 -	stop_at = now(); // ??	
   31.16 -	render();
   31.17 -}
   31.18 -
   31.19 -std::string Worktime::int2time(posix::time_duration secs)
   31.20 -{
   31.21 -	posix::seconds secs1(secs.total_seconds());
   31.22 -	return to_simple_string(secs1);
   31.23 -}
   31.24 -
   31.25 -void Worktime::stop()
   31.26 -{
   31.27 -	stoped = true;
   31.28 -	stop_at = now();
   31.29 -	//~ setId(generateSalt()); // switch off countdown
   31.30 -	render();
   31.31 -}
   31.32 -
   31.33 -void Worktime::render()
   31.34 -{
   31.35 -	if (!stoped)
   31.36 -	{
   31.37 -		doJavaScript("$('#" + id() + "').countdown({"
   31.38 -		"since: -" + boost::lexical_cast<std::string>(
   31.39 -			spent().total_milliseconds()) + " / 1000,"
   31.40 -		"compact: true"
   31.41 -		"});");
   31.42 -	}
   31.43 -	else
   31.44 -	{
   31.45 -		doJavaScript("$('#" + id() + "').countdown('pause');");
   31.46 -	}
   31.47 -	
   31.48 -	setText(int2time(spent()));
   31.49 -};
   31.50 -
   31.51 -posix::time_duration Worktime::spent()
   31.52 -{
   31.53 -	if (stoped)
   31.54 -	{
   31.55 -		return stop_at - start_at;
   31.56 -	}
   31.57 -	else
   31.58 -	{
   31.59 -		return now() - start_at;
   31.60 -	}
   31.61 -}
    32.1 --- a/work-time.h	Thu Sep 16 01:51:04 2010 +0400
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,27 +0,0 @@
    32.4 -
    32.5 -#ifndef WORKTIME_H_
    32.6 -#define WORKTIME_H_
    32.7 -
    32.8 -#include <Wt/WContainerWidget>
    32.9 -#include <Wt/WText>
   32.10 -
   32.11 -#include <boost/date_time/posix_time/posix_time.hpp>
   32.12 -namespace posix = boost::posix_time;
   32.13 -
   32.14 -class Worktime : public Wt::WText
   32.15 -{
   32.16 -public:
   32.17 -	Worktime(Wt::WContainerWidget *parent=0);
   32.18 -	void render();
   32.19 -	void stop();
   32.20 -	inline posix::ptime now() { return posix::microsec_clock::universal_time(); }
   32.21 -	inline posix::time_duration spent(); 
   32.22 -private:
   32.23 -	posix::ptime start_at;
   32.24 -	posix::ptime stop_at;
   32.25 -	bool stoped;
   32.26 -	std::string int2time(posix::time_duration secs);
   32.27 -};
   32.28 -
   32.29 -
   32.30 -#endif // WORKTIME_H_