SUBDIRS += text
SUBDIRS += xml
SUBDIRS += meta
+SUBDIRS += service
#unix:SUBDIRS += te
--- /dev/null
+/****************************************************************************
+** $Id: aextguid.cpp,v 1.2 2007/09/19 06:32:06 app Exp $
+**
+** Code file of the Report Result Object of Ananas
+** Designer and Engine applications
+**
+** Created : 20070819
+**
+** Copyright (C) 2005-2007 Grigory Panov <grigory.panov at gmail.com>, Moscow.
+** Copyright (C) 2005-2007 Ananas Project.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <quuid.h>
+#include "aextguid.h"
+
+aExtGUID::aExtGUID()
+ : AExtension("GUID")
+{
+}
+
+aExtGUID::~aExtGUID()
+{
+}
+
+
+/**
+ * \en
+ * Class for generate GUID strings from Ananas Script. Linux only !!!
+ * \_en
+ * \ru
+ * Генерирует строку GUID (глобально-уникального идентификатора, Globally Unique IDentifier).
+ * Только в Linux версиях. В Windows возвращает 00000000-0000-... (Для Qt3.2)
+ *
+ * GUID представляет собой 128-битное значение, уникальное для всех практических целей.
+ * \brief Генерирует строку GUID в верхнем регистре.
+ *
+ * Пример использования функции Generate()
+ * \code
+ * var newGUID = (new GUID).Generate();
+ * sysMessage (0, newGUID);
+ * возвращает строку вида {FC98E407-B3F7-4914-A2B1-36B4C2A93228}
+ *
+ * Для преобразования в нижний регистр необходимо использовать
+ * newGUID.toLowerCase();
+ * \endcode
+ *
+ * \_ru
+ */
+QString aExtGUID::Generate() const
+{
+
+#ifdef Q_OS_WIN32
+ return QUuid().toString();
+#else
+ return QUuid::createUuid().toString().upper();
+#endif
+}
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<aExtGUID> aExtGUIDPlugin;
+A_EXPORT_PLUGIN( aExtGUIDPlugin )
--- /dev/null
+/****************************************************************************
+** $Id: aextguid.h,v 1.2 2007/09/19 06:32:06 app Exp $
+**
+** Header file of the Report Result Object of Ananas
+** Designer and Engine applications
+**
+** Created : 20070819
+**
+** Copyright (C) 2005-2007 Grigory Panov <grigory.panov at gmail.com>, Moscow.
+** Copyright (C) 2005-2007 Ananas Project.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AEXTGUID_H
+#define AEXTGUID_H
+
+#include "aextension.h"
+#include "aobject.h"
+
+/**
+ * \en
+ * Class for generate GUID strings from Ananas Script.
+ * \_en
+ * \ru
+ * \brief Генерирует строку GUID в верхенм регистре.
+ *
+ *
+ * \_ru
+ */
+
+class ANANAS_EXPORT aExtGUID: public AExtension
+{
+ Q_OBJECT
+public:
+ aExtGUID();
+ ~aExtGUID();
+
+
+public slots:
+ QString Generate() const;
+};
+
+#endif
--- /dev/null
+#include "aservice.h"
+#include "aextservice.h"
+#include "adatabase.h"
+#include "alog.h"
+
+#include <quuid.h>
+
+aExtSERVICE::aExtSERVICE()
+ : AExtension("Service")
+{
+}
+
+aExtSERVICE::~aExtSERVICE()
+{
+}
+
+
+/**
+ * \en
+ * Defines what office (Microsoft Office или Open office) it is used by default for creation of reports
+ * \_en
+ * \ru
+ * определяет какой офис(Microsoft Office или Open office) используется по-умолчанию для создания отчетов
+ * \code
+ * var defOffice = (new Service).GetOffice();
+ * sysMessage (0, defOffice);
+ * возвращает строку:
+ * "MSO" - Microsoft Office
+ * "OOO" - Open Office
+ * \endcode
+ * \_ru
+ */
+QString aExtSERVICE::GetOffice() const
+{
+#ifdef Q_OS_WIN32
+ bool ok;
+ QString office = aService::readConfigVariable("defaultOffice", &ok);
+ if (ok)
+ return office;
+ else
+ return "";
+#else
+ return "";
+#endif
+}
+
+
+/**
+ * \en
+ * Class for generate GUID strings from Ananas Script. Linux only !!!
+ * \_en
+ * \ru
+ * Генерирует строку GUID (глобально-уникального идентификатора, Globally Unique IDentifier).
+ * Только в Linux версиях. В Windows возвращает 00000000-0000-... (Для Qt3.2)
+ *
+ * GUID представляет собой 128-битное значение, уникальное для всех практических целей.
+ * \brief Генерирует строку GUID в верхнем регистре.
+ *
+ * Пример использования функции Generate()
+ * \code
+ * var newGUID = (new Service).Generate();
+ * sysMessage (0, newGUID);
+ * возвращает строку вида {FC98E407-B3F7-4914-A2B1-36B4C2A93228}
+ *
+ * Для преобразования в нижний регистр необходимо использовать
+ * newGUID.toLowerCase();
+ * \endcode
+ *
+ * \_ru
+ */
+QString aExtSERVICE::Generate() const
+{
+
+#ifdef Q_OS_WIN32
+ return QUuid().toString();
+#else
+ return QUuid::createUuid().toString().upper();
+#endif
+}
+
+/**
+ * \ru
+ * \brief Возвращает имя используемого rc файла с полным путем.
+ *
+ * Враппер. Вызывает аналогичный метод класса aCfgRc.
+ * \see aCfgRc.getRcFileName()
+ *
+ * Пример использования
+ * \code
+ * service = new Service();
+ * sys.Message(0,"Name of used rc file is '"+service.GetRcFileName() + "'");
+ * \endcode
+ *
+ * \_ru
+ */
+QString
+aExtSERVICE::GetRcFileName() const
+{
+ return db->cfg.rc.getRcFileName();
+};
+
+/**
+ * \ru
+ * \brief Возвращает значение указанного параметра, хранящегося в rc файле.
+ *
+ * \param paramName - имя параметра, значение которого требуется получить из файла ресурсов.
+ * \return значение параметра в случае успеха; пустую строку в случае неудачи. Пишет в лог сообщения о возникающих ошибках.
+ *
+ * Пример использования
+ * \code
+ * service = new Service();
+ * sys.Message(0,"File of business-scheme is '"+service.GetRcValue('configfile') + "'");
+ * \endcode
+ *
+ * \_ru
+ */
+QString
+aExtSERVICE::GetRcValue( QString paramName ) const
+{
+ if ( !paramName || paramName.isNull() )
+ {
+ aLog::print(aLog::MT_ERROR, tr("Empty rc file parameter name. Can't read such parameter from rc file."));
+ return "";
+ }
+ QString paramValue = db->cfg.rc.value( paramName );
+ if ( !paramValue || paramValue.isEmpty() )
+ {
+ aLog::print(aLog::MT_ERROR,tr("rc file parameter '%1' not found or empty.").arg(paramName));
+ return "";
+ }
+ return paramValue;
+}
+
+
+
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<aExtSERVICE> aExtSERVICEPlugin;
+A_EXPORT_PLUGIN( aExtSERVICEPlugin )
--- /dev/null
+#ifndef AEXTSERVICE_H
+#define AEXTSERVICE_H
+
+#include "aextension.h"
+#include "aobject.h"
+
+/**
+ * \ru
+ * \brief Сервисные функции для доступа из Скрипта.
+ *
+ * \_ru
+ */
+class ANANAS_EXPORT aExtSERVICE: public AExtension
+{
+ Q_OBJECT
+public:
+ aExtSERVICE();
+ ~aExtSERVICE();
+
+
+public slots:
+ QString GetOffice() const;
+ QString Generate() const;
+
+ QString GetRcFileName() const;
+ QString GetRcValue( QString paramName ) const;
+};
+
+#endif
--- /dev/null
+TARGET = aextservice
+
+SOURCES += aextservice.cpp
+HEADERS += aextservice.h
+
+include ( ../../ananas.pri )
+
+shared {
+win32:DEFINES+= ANANAS_DLL
+} else {
+win32:DEFINES += ANANAS_NO_DLL
+}
+
+TEMPLATE =lib
+CONFIG += plugin
+
+INCLUDEPATH += ../../lib
+LIBS += -L../../lib -lananas
+
+LANGUAGE = C++
+win32:DESTDIR = ..
+
+unix{
+ libext.path = $(LIBDIR)/ananas
+ libext.files = libaextservice.so
+ INSTALLS += libext
+}
+